Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:6261: Inside #if defined(TIMERS)
   sort( a, b );    reverse(a);    reverse(b);    report_notice("Timers:\n");    for( int i = 0; i<sizeof(b); i++ )    report_notice( " %-30s : %10.1fms\n", b[i], a[i]/1000.0 );    report_notice("\n\n");   }   #endif    + void scan_certs(int|void force) + { +  foreach(query("CertGlobs"), string glob_pattern) { +  glob_pattern = String.trim_all_whites(glob_pattern); +  if (glob_pattern == "") continue; +  if (!has_value(glob_pattern, "*") && !has_value(glob_pattern, "?")) { +  CertDB.register_pem_file(glob_pattern); +  continue; +  } +  string dir = dirname(glob_pattern); +  string base = basename(glob_pattern); +  array(string) dirs = ({}); +  if (has_value(dir, "*") || has_value(dir, "?")) { +  // FIXME: Complicated case; expand the globbed dir. +  dirs = ({ dir }); +  } else { +  dirs = ({ dir }); +  } +  foreach(dirs, dir) { +  array(string) rdirs; +  if (has_prefix(dir, "/")) { +  // Absolute path. +  rdirs = ({ "/" }); +  } else { +  // lopen path +  rdirs = map(roxenloader.package_directories, roxen_path); +  } +  foreach(rdirs, string rdir) { +  foreach(glob(base, get_dir(combine_path(rdir, dir)) || ({})), +  string fname) { +  werror("Found PEM file %O, matching %O.\n", +  Stdio.append_path(dir, fname), glob_pattern); +  CertDB.register_pem_file(Stdio.append_path(dir, fname)); +  } +  } +  } +  } +  CertDB.refresh_all_pem_files(force);    -  +  call_out(scan_certs, 600); // Scan for new certs every 10 minutes. + } +  +    protected class GCTimestamp   {    array self_ref;    protected void create() {self_ref = ({this_object()});}    protected void destroy() {    werror ("GC runs at %s", ctime(time()));    GCTimestamp();    }   }   
Roxen.git/server/base_server/roxen.pike:6576: Inside #if defined(THREADS)
  #ifdef THREADS    name_thread( backend_thread, "Backend" );   #else    report_debug("\n"    "WARNING: Threads not enabled!\n"    "\n");   #endif /* THREADS */       foreach(({ "testca.pem", "demo_certificate.pem" }), string file_name) {    if (!sizeof(roxenloader.package_directories)) break; +  CertDB.register_pem_file(file_name);    string cert;    if (lfile_path(file_name) == file_name) {    file_name = roxen_path (roxenloader.package_directories[0] + "/" +    file_name);    report_notice("Generating a new certificate %s...\n", file_name);    cert = Roxen.generate_self_signed_certificate("*");   #if constant(Standards.X509)    } else {    file_name = roxen_path (lfile_path(file_name));   
Roxen.git/server/base_server/roxen.pike:6672:    report_error("Couldn't create certificate file %s: %s\n", file_name,    strerror (file->errno()));    } else if (file->write(cert) != sizeof(cert)) {    rm(file_name);    report_error("Couldn't write certificate file %s: %s\n", file_name,    strerror (file->errno()));    }    }    }    +  // Update the certificate registry before opening any ports. +  // NB: Force all certificate files to be reread and reparsed. +  scan_certs(1); +     enable_configurations();       string pid_file = Getopt.find_option(argv, "p", "pid-file");    if (pid_file && query("permanent_uid")) rm(pid_file);       set_u_and_gid(); // Running with the right [e]uid:[e]gid from this point on.       create_pid_file(pid_file);       // Done before the modules are dumped.