Branch: Tag:

2000-08-11

2000-08-11 19:30:54 by Andreas Lange <andreas@lange.cx>

Added ids

Rev: server/base_server/configuration.pike:1.332
Rev: server/base_server/roxen.pike:1.517
Rev: server/config_interface/standard/settings.html:1.11

4:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.      // ABS and suicide systems contributed freely by Francesco Chemolli - constant cvs_version="$Id: roxen.pike,v 1.516 2000/08/10 23:30:32 per Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.517 2000/08/11 19:30:27 lange Exp $";      // Used when running threaded to find out which thread is the backend thread,   // for debug purposes only.
185: Inside #if defined(HAVE_EFFECTIVE_USER)
   }       if(LOGP) -  report_notice(LOC_M("", "Change to %s(%d):%d privs wanted (%s), from %s"), +  report_notice(LOC_M(1, "Change to %s(%d):%d privs wanted (%s), from %s"),    (string)u[0], (int)uid, (int)gid,    (string)reason,    (string)dbt(backtrace()[-2]));
199: Inside #if defined(HAVE_EFFECTIVE_USER)
   gid = gid || getgid();    int err = (int)setegid(new_gid = gid);    if (err < 0) { -  report_warning(LOC_M("", "Privs: WARNING: Failed to set the " +  report_warning(LOC_M(2, "Privs: WARNING: Failed to set the "    "effective group id to %d!\n"    "Check that your password database is correct "    "for user %s(%d),\n and that your group "
275: Inside #if defined(HAVE_EFFECTIVE_USER)
   catch {    array bt = backtrace();    if (sizeof(bt) >= 2) { -  report_notice(LOC_M("","Change back to uid#%d gid#%d, from %s\n"), +  report_notice(LOC_M(3,"Change back to uid#%d gid#%d, from %s\n"),    saved_uid, saved_gid, dbt(bt[-2]));    } else { -  report_notice(LOC_M("","Change back to uid#%d gid#%d, " +  report_notice(LOC_M(4,"Change back to uid#%d gid#%d, "    "from backend\n"), saved_uid, saved_gid);    }    };
495: Inside #if defined(THREADS)
   "Client will not get any response from Roxen.\n"),*/    describe_backtrace(q));    if (q = catch {h = 0;}) { -  report_error(LOC_M("", "Uncaught error in handler thread: %s" +  report_error(LOC_M(5, "Uncaught error in handler thread: %s"    "Client will not get any response from Roxen.\n"),    describe_backtrace(q));    }
528: Inside #if defined(THREADS)
   } else {    report_notice (LOC_S(2, "Starting %d threads to handle requests.\n"),    QUERY(numthreads) ); -  +     }    array(object) new_threads = ({});    for(; number_of_threads < QUERY(numthreads); number_of_threads++)
804:    ::create();    if(!bind( port, got_connection, ip ))    { -  report_error(LOC_M("", "Failed to bind %s://%s:%d/ (%s)\n"), +  report_error(LOC_M(6, "Failed to bind %s://%s:%d/ (%s)\n"),    (string)name, (ip||"*"), (int)port, strerror( errno() ));    }    }       static string _sprintf( )    { -  return LOC_M("","Protocol")+"("+name+"://"+ip+":"+port+")"; +  return LOC_M(7,"Protocol")+"("+name+"://"+ip+":"+port+")";    }   }   
883: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
      if( catch{ f = lopen(query_option("ssl_cert_file"), "r")->read(); } )    { -  report_error(LOC_M("","SSL3: Reading cert-file failed!\n")); +  report_error(LOC_M(8,"SSL3: Reading cert-file failed!\n"));    destruct();    return;    }
891: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
   if( strlen(query_option("ssl_key_file")) &&    catch{ f2 = lopen(query_option("ssl_key_file"),"r")->read(); } )    { -  report_error(LOC_M("", "SSL3: Reading key-file failed!\n")); +  report_error(LOC_M(9, "SSL3: Reading key-file failed!\n"));    destruct();    return;    }
905: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
      if (!part || !(cert = part->decoded_body()))    { -  report_error(LOC_M("", "ssl3: No certificate found.\n")); +  report_error(LOC_M(10, "SSL3: No certificate found.\n"));    destruct();    return;    }
923: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
      if (!(key = part->decoded_body()))    { -  report_error(LOC_M("","SSL3: Private rsa key not valid (PEM).\n")); +  report_error(LOC_M(11,"SSL3: Private rsa key not valid (PEM).\n"));    destruct();    return;    }
931: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
   object rsa = Standards.PKCS.RSA.parse_private_key(key);    if (!rsa)    { -  report_error(LOC_M("", "SSL3: Private rsa key not valid (DER).\n")); +  report_error(LOC_M(12, "SSL3: Private rsa key not valid (DER).\n"));    destruct();    return;    }
952: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
   object tbs = Tools.X509.decode_certificate (cert);    if (!tbs)    { -  report_error(LOC_M("","SSL3: Certificate not valid (DER).\n")); +  report_error(LOC_M(13,"SSL3: Certificate not valid (DER).\n"));    destruct();    return;    }    if (!tbs->public_key->rsa->public_key_equal (rsa))    { -  report_error(LOC_M("", "SSL3: Certificate and private key do not match.\n")); +  report_error(LOC_M(14, "SSL3: Certificate and private key do not match.\n"));    destruct();    return;    }
969: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
      if (!(key = part->decoded_body()))    { -  report_error(LOC_M("","SSL3: Private dsa key not valid (PEM).\n")); +  report_error(LOC_M(15,"SSL3: Private dsa key not valid (PEM).\n"));    destruct();    return;    }
977: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
   object dsa = Standards.PKCS.DSA.parse_private_key(key);    if (!dsa)    { -  report_error(LOC_M("","SSL3: Private dsa key not valid (DER).\n")); +  report_error(LOC_M(16,"SSL3: Private dsa key not valid (DER).\n"));    destruct();    return;    }
995: Inside #if constant(Crypto) && constant(Crypto.rsa) && constant(Standards) && constant(Standards.PKCS.RSA) && constant(SSL) && constant(SSL.sslfile)
   }    else    { -  report_error(LOC_M("","SSL3: No private key found.\n")); +  report_error(LOC_M(17,"SSL3: No private key found.\n"));    destruct();    return;    }
1011:   #else /* !constant(SSL.sslfile) */    void create(int pn, string i)    { -  report_error(LOC_M("","No SSL support available\n")); +  report_error(LOC_M(18,"No SSL support available\n"));    destruct();    }   #endif /* constant(SSL.sslfile) */
1216:    portobj = Stdio.Port(); /* No way to use ::create easily */    if( !portobj->bind( port, 0, ip ) )    { -  report_error(LOC_M("","Failed to bind %s://%s:%d/ (%s)\n"), +  report_error(LOC_M(6,"Failed to bind %s://%s:%d/ (%s)\n"),    name,ip||"*",(int)port, strerror(errno()));    destruct(portobj);    destruct();
1589:    sscanf( url, "%[^:]://%[^/]%s", protocol, host, path );    if (!host || !stringp(host))    { -  report_error(LOC_M("","Bad URL '%s' for server `%s'\n"), +  report_error(LOC_M(19,"Bad URL '%s' for server `%s'\n"),    url, conf->query_name());    return 1;    }
1610:    {    if( urls[ url ]->conf != conf )    { -  report_error(LOC_M("", "Cannot register URL %s, " +  report_error(LOC_M(20, "Cannot register URL %s, "    "already registered by %s!\n"),    url, urls[ url ]->conf->name);    return 0;
1623:       if( !( prot = protocols[ protocol ] ) )    { -  report_error(LOC_M("", "Cannot register URL %s, " +  report_error(LOC_M(21, "Cannot register URL %s, "    "cannot find the protocol %s!\n"),    url, protocol);    return 0;
1695:    m_delete( m[ required_host ], port );    failures++;    if (required_host) { -  report_warning(LOC_M("", "Binding the port on IP %s " +  report_warning(LOC_M(22, "Binding the port on IP %s "    "failed\n for URL %s!\n"),    url, required_host);    }
1706:    }    if (failures == sizeof(required_hosts)) {    m_delete( urls, url ); -  report_error(LOC_M("", "Cannot register URL %s!\n"), url); +  report_error(LOC_M(23, "Cannot register URL %s!\n"), url);    sort_urls();    return 0;    }
2871: Inside #if undefined(__NT__)
   {    if(getuid())    { -  report_error(LOC_M("", "It is only possible to change uid and gid " +  report_error(LOC_M(24, "It is only possible to change uid and gid "    "if the server is running as root.\n"));    } else {    if (g) {
2923: Inside #if constant(setuid) and #if constant(setgid)
  # if constant(setgid)    setgid(gid);    if (getgid() != gid) { -  report_error(LOC_M("", "Failed to set gid.\n")); +  report_error(LOC_M(25, "Failed to set gid.\n"));    g = 0;    }   # else -  report_warning(LOC_M("", "Setting gid not supported on this system.\n")); +  report_warning(LOC_M(26, "Setting gid not supported on this system.\n"));    g = 0;   # endif    }    setuid(uid);    if (getuid() != uid) { -  report_error(LOC_M("", "Failed to set uid.\n")); +  report_error(LOC_M(27, "Failed to set uid.\n"));    u = 0;    }    if (u) report_notice(CALL_M("setting_uid_gid_permanently", "eng")    (uid, gid, u, g));   #else -  report_warning(LOC_M("", "Setting uid not supported on this system.\n")); +  report_warning(LOC_M(28, "Setting uid not supported on this system.\n"));    u = g = 0;   #endif    }
2949: Inside #if constant(seteuid) and #if constant(setegid)
  # if constant(setegid)    setegid(gid);    if (getegid() != gid) { -  report_error(LOC_M("", "Failed to set effective gid.\n")); +  report_error(LOC_M(29, "Failed to set effective gid.\n"));    g = 0;    }   # else -  report_warning(LOC_M("", "Setting effective gid not supported on this system.\n")); +  report_warning(LOC_M(30, "Setting effective gid not supported on this system.\n"));    g = 0;   # endif    }    seteuid(uid);    if (geteuid() != uid) { -  report_error(LOC_M("", "Failed to set effective uid.\n")); +  report_error(LOC_M(31, "Failed to set effective uid.\n"));    u = 0;    }    if (u) report_notice(CALL_M("setting_uid_gid", "eng")(uid, gid, u, g));   #else -  report_warning(LOC_M("", "Setting effective uid not supported on " +  report_warning(LOC_M(32, "Setting effective uid not supported on "    "this system.\n"));    u = g = 0;   #endif
3010:    conf = enable_configuration(config);    }) {    string bt=describe_backtrace(err); -  report_error(LOC_M("", "Error while enabling configuration %s%s"), +  report_error(LOC_M(33, "Error while enabling configuration %s%s"),    config, (bt ? ":\n"+bt : "\n"));    continue;    }
3021:    conf->enable_all_modules();    }) {    string bt=describe_backtrace(err); -  report_error(LOC_M("", "Error while enabling configuration %s%s"), +  report_error(LOC_M(33, "Error while enabling configuration %s%s"),    config, (bt ? ":\n"+bt : "\n" ));    continue;    }
3031:    foreach(configurations - new_confs, conf)    {    modified = 1; -  report_notice(LOC_M("", "Disabling old configuration %s\n"), conf->name); +  report_notice(LOC_M(34, "Disabling old configuration %s\n"), conf->name);    // Array.map(values(conf->server_ports), lambda(object o) { destruct(o); });    conf->stop();    destruct(conf);
3089:    int t = gethrtime();    report_debug("\nEnabling the configuration %s ...\n", config);    if(err=catch( enable_configuration(config)->start() )) -  report_error(LOC_M("", "\nError while loading configuration %s:\n%s\n"), +  report_error(LOC_M(35, "\nError while loading configuration %s:\n%s\n"),    config, describe_backtrace(err));    report_debug("Enabled %s in %.1fms\n", config, (gethrtime()-t)/1000.0 );    }
3101:    if( all_modules_loaded++ ) return;    foreach(configurations, object config)    if(mixed err=catch( config->enable_all_modules() )) -  report_error(LOC_M("", "Error while loading modules in " +  report_error(LOC_M(36, "Error while loading modules in "    "configuration %s:\n%s\n"),    config->name, describe_backtrace(err));   }