2008-08-15
2008-08-15 12:33:55 by Martin Stjernholm <mast@lysator.liu.se>
-
fc4039bf3f265ac71ff9df16b347b8fabed8b350
(253 lines)
(+121/-132)
[
Show
| Annotate
]
Branch: 5.2
Moving to pike 7.8 and dropping compatibility with earlier pikes.
Rev: server/arg_cache_plugins/replicate.pike:1.27
Rev: server/base_server/__default.pmod:1.2
Rev: server/base_server/cache.pike:1.90
Rev: server/base_server/config_userdb.pike:1.53
Rev: server/base_server/configuration.pike:1.653
Rev: server/base_server/emit_object.pike:1.7
Rev: server/base_server/fonts.pike:1.87
Rev: server/base_server/global_variables.pike:1.110
Rev: server/base_server/javamodule.pike:1.7
Rev: server/base_server/language.pike:1.43
Rev: server/base_server/module.pike:1.231
Rev: server/base_server/module_support.pike:1.135
Rev: server/base_server/prototypes.pike:1.219
Rev: server/base_server/roxen.pike:1.981
Rev: server/base_server/roxenlib.pike:1.224
Rev: server/base_server/roxenloader.pike:1.397
Rev: server/base_server/rxmlhelp.pike:1.65
Rev: server/base_server/smtprelay.pike:3.2
Rev: server/base_server/snmpagent.pike:1.24
Rev: server/bin/buildenv.pike:1.10
Rev: server/bin/create_testcert.pike:1.2
Rev: server/bin/functions:1.19
Rev: server/bin/garbagecollector.pike:1.23
Rev: server/bin/setup_nsr.pike:1.4
Rev: server/bin/sqlhelper.pike:1.4
Rev: server/config_interface/actions/change_version.pike:1.15
Rev: server/config_interface/actions/debug_info.pike:1.40
Rev: server/config_interface/actions/feature_list.pike:1.14
Rev: server/config_interface/actions/ftpstatus.pike:1.4
Rev: server/config_interface/actions/generate_rsa.pike:1.7
Rev: server/config_interface/actions/make_rsa_csr.pike:1.11
Rev: server/config_interface/actions/make_selfsigned_dsa.pike:1.11
Rev: server/config_interface/actions/make_selfsigned_rsa.pike:1.10
Rev: server/config_interface/actions/ssl_common.pike:1.8
Rev: server/config_interface/actions/tablist.pike:1.10
Rev: server/config_interface/actions/threads.pike:1.8
Rev: server/etc/env.d/java.pike:1.19
Rev: server/etc/include/variables.h:1.18
Rev: server/etc/modules/DBManager.pmod:1.76
Rev: server/etc/modules/ExtSQL.pmod:1.4
Rev: server/etc/modules/ExtScript.pmod:1.22
Rev: server/etc/modules/GText.pmod:1.20
Rev: server/etc/modules/HTML.pmod:1.8
Rev: server/etc/modules/JavaModule.pmod:1.25
Rev: server/etc/modules/LazyImage.pmod/CoordinateSystem.pike:1.4
Rev: server/etc/modules/LazyImage.pmod/Legend.pike:1.5
Rev: server/etc/modules/LazyImage.pmod/module.pmod:1.19
Rev: server/etc/modules/License.pmod:1.27
Rev: server/etc/modules/Map.pmod:1.7
Rev: server/etc/modules/PropertySet.pike:1.12
Rev: server/etc/modules/RXML.pmod/PEnt.pike:1.24
Rev: server/etc/modules/RXML.pmod/PXml.pike:1.65
Rev: server/etc/modules/RXML.pmod/module.pmod:1.367
Rev: server/etc/modules/Roxen.pmod:1.246
Rev: server/etc/modules/RoxenDebug.pmod:1.12
Rev: server/etc/modules/RoxenRPC.pmod/HTTP.pmod/Client.pike:1.10
Rev: server/etc/modules/RoxenRPC.pmod/HTTP.pmod/Server.pike:1.6
Rev: server/etc/modules/RoxenSSLFile.pike:1.27(DEAD)
Rev: server/etc/modules/SNMP.pmod:1.10
Rev: server/etc/modules/Servlet.pmod:1.31
Rev: server/etc/modules/SloppyDOM.pmod:1.16
Rev: server/etc/modules/StateHandler.pmod:1.13
Rev: server/etc/modules/VFS.pmod:1.7
Rev: server/etc/modules/Variable.pmod/Date.pike:1.9
Rev: server/etc/modules/Variable.pmod/Email.pike:1.15
Rev: server/etc/modules/Variable.pmod/Image.pike:1.5
Rev: server/etc/modules/Variable.pmod/Language.pike:1.2
Rev: server/etc/modules/Variable.pmod/MapLocation.pike:1.6
Rev: server/etc/modules/Variable.pmod/Mapping.pike:1.9
Rev: server/etc/modules/Variable.pmod/Upload.pike:1.5
Rev: server/etc/modules/Variable.pmod/module.pmod:1.108
Rev: server/etc/modules/_NewLDAP.pmod/client.pike:1.11(DEAD)
Rev: server/etc/modules/_NewLDAP.pmod/ldap_globals.h:1.1(DEAD)
Rev: server/etc/modules/_NewLDAP.pmod/ldap_privates.pmod:1.1(DEAD)
Rev: server/etc/modules/_NewLDAP.pmod/module.pmod:1.4(DEAD)
Rev: server/etc/modules/_NewLDAP.pmod/protocol.pike:1.1(DEAD)
Rev: server/etc/roxen_master.pike:1.150
Rev: server/etc/test/tests/ftp/ftp_test.pike:1.4
Rev: server/font_handlers/freetype.pike:1.30
Rev: server/font_handlers/imagedir.pike:1.15
Rev: server/font_handlers/imagetar.pike:1.10
Rev: server/font_handlers/ttf.pike:1.18
Rev: server/languages/catala.pike:1.11
Rev: server/languages/chinese.pike:1.2
Rev: server/languages/croatian.pike:1.11
Rev: server/languages/czech.pike:1.18
Rev: server/languages/dutch.pike:1.11
Rev: server/languages/finnish.pike:1.10
Rev: server/languages/french.pike:1.13
Rev: server/languages/german.pike:1.11
Rev: server/languages/hungarian.pike:1.7
Rev: server/languages/italian.pike:1.13
Rev: server/languages/japanese.pike:1.22
Rev: server/languages/maori.pike:1.9
Rev: server/languages/norwegian.pike:1.12
Rev: server/languages/polish.pike:1.8
Rev: server/languages/portuguese.pike:1.11
Rev: server/languages/russian.pike:1.10
Rev: server/languages/serbian.pike:1.10
Rev: server/languages/slovenian.pike:1.17
Rev: server/languages/spanish.pike:1.12
Rev: server/languages/swedish.pike:1.20
Rev: server/modules/configuration/config_tags.pike:1.197
Rev: server/modules/configuration/roxen_test.pike:1.68
Rev: server/modules/configuration/update.pike:1.40
Rev: server/modules/examples/userdb_ex.pike:1.8
Rev: server/modules/filesystems/filesystem.pike:1.157
Rev: server/modules/filesystems/incoming.pike:1.19
Rev: server/modules/filesystems/restrictedfs.pike:1.24
Rev: server/modules/filesystems/sqlfs.pike:1.9
Rev: server/modules/filesystems/userfs.pike:1.71
Rev: server/modules/filters/tableborder.pike:1.13
Rev: server/modules/filters/whitespace_remover.pike:1.4
Rev: server/modules/graphics/business.pike:1.152
Rev: server/modules/graphics/gxml.pike:1.38
Rev: server/modules/graphics/pimage.pike:1.31
Rev: server/modules/graphics/rimage/rimage.pike:1.23
Rev: server/modules/icecast/icecast.pike:1.12
Rev: server/modules/icecast/pl_common.pike:1.9
Rev: server/modules/js-support/javascript_support.pike:1.68
Rev: server/modules/ldap/ldaptag.pike:2.38
Rev: server/modules/ldap/userdb_ldap.pike:1.14
Rev: server/modules/logging/home_logger.pike:1.35
Rev: server/modules/misc/preferred_language.pike:1.32
Rev: server/modules/misc/randomtext.pike:1.10
Rev: server/modules/misc/wapadapter.pike:1.13
Rev: server/modules/misc/webdav.pike:1.38
Rev: server/modules/proxies/connect.pike:1.20
Rev: server/modules/proxies/proxy.pike:1.57
Rev: server/modules/proxies/wais.pike:1.28
Rev: server/modules/scripting/cgi.pike:2.65
Rev: server/modules/scripting/fastcgi.pike:2.13
Rev: server/modules/scripting/perl.pike:2.26
Rev: server/modules/scripting/php.pike:2.5
Rev: server/modules/scripting/piketag.pike:2.38
Rev: server/modules/scripting/servlet.pike:2.24
Rev: server/modules/scripting/webapp.pike:2.32
Rev: server/modules/security/auth_httpbasic.pike:1.12
Rev: server/modules/security/auth_httpcookie.pike:1.12
Rev: server/modules/security/htaccess.pike:1.106
Rev: server/modules/security/userdb_sql.pike:1.10
Rev: server/modules/security/userdb_system.pike:1.12
Rev: server/modules/tags/accessed.pike:1.57
Rev: server/modules/tags/email.pike:1.43
Rev: server/modules/tags/emit_exec.pike:1.4
Rev: server/modules/tags/emit_timerange.pike:1.29
Rev: server/modules/tags/insert_cached_href.pike:1.22
Rev: server/modules/tags/obox.pike:1.41
Rev: server/modules/tags/rxmltags.pike:1.553
Rev: server/modules/tags/wizz.pike:1.10
Rev: server/modules/tags/writefile.pike:1.20
Rev: server/modules/throttling/throttling_byaddress.pike:1.6
Rev: server/modules/throttling/throttling_bytime.pike:1.8
Rev: server/ntroxenloader.pike:1.9
Rev: server/protocols/ftp.pike:2.125
Rev: server/protocols/http.pike:1.561
Rev: server/protocols/prot_hilfe.pike:2.15
Rev: server/protocols/prot_snmp.pike:2.8
Rev: server/sbin/roxen-create-server:1.5
Rev: server/tools/ntroxen/startdll/cmdline.cpp:1.21
6:
// 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.980 2008/08/08 15:04:22 mast Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.981 2008/08/15 12:33:54 mast Exp $";
//! @appears roxen
//!
76:
#endif
#define DDUMP(X) sol( combine_path( __FILE__, "../../" + X ), dump )
- static function sol = master()->set_on_load;
+ protected function sol = master()->set_on_load;
#ifdef TEST_EUID_CHANGE
int test_euid_change;
84:
string md5( string what )
{
- return Gmp.mpz(Crypto.md5()->update( what )->digest(),256)
+ return Gmp.mpz(Crypto.MD5()->update( what )->digest(),256)
->digits(32);
}
104:
return fname-(getcwd()+"/");
}
- static int once_mode;
+ protected int once_mode;
// Note that 2.5 is a nonexisting version. It's only used for the
// cache static optimization for tags such as <if> and <emit> inside
141:
*/
int privs_level;
- static class Privs
+ protected class Privs
{
#if efun(seteuid)
157:
#define HAVE_EFFECTIVE_USER
#endif
- static private string _getcwd()
+ private string _getcwd()
{
if (catch{return(getcwd());}) {
return("Unknown directory (no x-bit on current directory?)");
}
}
- static private string dbt(array t)
+ private string dbt(array t)
{
if(!arrayp(t) || (sizeof(t)<2)) return "";
return (((t[0]||"Unknown program")-(_getcwd()+"/"))-"base_server/")+":"+t[1]+"\n";
}
#ifdef THREADS
- static mixed mutex_key; // Only one thread may modify the euid/egid at a time.
- static object threads_disabled;
+ protected mixed mutex_key; // Only one thread may modify the euid/egid at a time.
+ protected object threads_disabled;
#endif /* THREADS */
int p_level;
393:
/* Used by read_config.pike, since there seems to be problems with
* overloading otherwise.
*/
- static Privs PRIVS(string r, int|string|void u, int|string|void g)
+ protected Privs PRIVS(string r, int|string|void u, int|string|void g)
{
return Privs(r, u, g);
}
620: Inside #if defined(THREADS)
// thread_create( f, @args );
// };
// }
- local static Queue handle_queue = Queue();
+ local protected Queue handle_queue = Queue();
//! Queue of things to handle.
//! An entry consists of an array(function fp, array args)
- local static int thread_reap_cnt;
+ local protected int thread_reap_cnt;
//! Number of handler threads in the process of being stopped.
- static int threads_on_hold;
+ protected int threads_on_hold;
//! Number of handler threads on hold.
- local static void handler_thread(int id)
+ local protected void handler_thread(int id)
//! The actual handling function. This functions read function and
//! parameters from the queue, calls it, then reads another one. There
//! is a lot of error handling to ensure that nothing serious happens if
733: Inside #if defined(THREADS)
int busy_threads;
//! The number of currently busy threads.
- static array(object) handler_threads = ({});
+ protected array(object) handler_threads = ({});
//! The handler threads, the list is kept for debug reasons.
void start_handler_threads()
753: Inside #if defined(THREADS)
handler_threads += new_threads;
}
- static int num_hold_messages;
- static Thread.Condition hold_wakeup_cond = Thread.Condition();
+ protected int num_hold_messages;
+ protected Thread.Condition hold_wakeup_cond = Thread.Condition();
// Note: There are races in the use of this condition variable, but
// the only effect of that is that some handler thread might be
// considered hung when it's actually waiting on hold_wakeup_cond, and
834: Inside #if defined(THREADS)
}
}
- static Thread.MutexKey backend_block_lock;
+ protected Thread.MutexKey backend_block_lock;
void stop_handler_threads()
//! Stop all the handler threads and the backend, but give up if it
901:
{
class SignalAsyncVerifier( function f )
{
- static int async_called;
+ protected int async_called;
void really_call( array args )
{
970:
}
#ifdef THREADS
- static Thread.Queue bg_queue = Thread.Queue();
- static int bg_process_running;
+ protected Thread.Queue bg_queue = Thread.Queue();
+ protected int bg_process_running;
// Use a time buffer to strike a balance if the server is busy and
// always have at least one busy thread: The maximum waiting time in
979: Inside #if defined(THREADS)
// bg_time_buffer_max. If there are only short periods of time between
// the queue runs, the max waiting time will shrink towards the
// minimum.
- static constant bg_time_buffer_max = 30;
- static constant bg_time_buffer_min = 0;
- static int bg_last_busy = 0;
+ protected constant bg_time_buffer_max = 30;
+ protected constant bg_time_buffer_min = 0;
+ protected int bg_last_busy = 0;
- static void bg_process_queue()
+ protected void bg_process_queue()
{
if (bg_process_running) return;
// Relying on the interpreter lock here.
1142:
int|float period;
int stopping = 0;
- static void repeat (function func, mixed args)
+ protected void repeat (function func, mixed args)
{
// Got a minimum of four refs to this:
// o One in the task array in bg_process_queue.
1179:
period = period_;
}
- //! @decl static void create (int|float period, function func, mixed... args);
+ //! @decl protected void create (int|float period, function func, mixed... args);
//!
//! The function @[func] will be called with the following arguments
//! after approximately @[period] seconds, and then kept being
1187:
//!
//! The repetition will stop if @[stop] is called, or if @[func]
//! throws an error.
- static void create (int|float period_, function func, mixed... args)
+ protected void create (int|float period_, function func, mixed... args)
{
period = period_;
background_run (period, repeat, func, args);
1226:
#define URL2CONF_MSG(X...)
#endif
- static mapping(string:int(0..1)) host_is_local_cache = ([]);
+ protected mapping(string:int(0..1)) host_is_local_cache = ([]);
//! Check if @[hostname] is local to this machine.
int(0..1) host_is_local(string hostname)
1351:
return set_path( raw_url );
}
- static string _sprintf()
+ protected string _sprintf()
{
return sprintf("RequestID(conf=%O; not_query=%O)", conf, not_query );
}
- static void create()
+ protected void create()
{
client = ({ "Roxen" });
prot = "INTERNAL";
1388:
//! Implements reference handling, finding Configuration objects
//! for URLs, and the bind/accept handling.
{
- static Stdio.Port port_obj;
+ protected Stdio.Port port_obj;
inherit "basic_defvar";
int bound;
1526:
mapping mu;
string rrhf;
- static void got_connection()
+ protected void got_connection()
{
Stdio.File q;
while( q = accept() )
1691:
set( kv[0], kv[1] );
}
- static int retries;
- static void bind (void|int ignore_eaddrinuse)
+ protected int retries;
+ protected void bind (void|int ignore_eaddrinuse)
{
if (bound) return;
if (!port_obj) port_obj = Stdio.Port();
1739:
}
}
- static array(int) get_ipv6_sequence(string partition)
+ protected array(int) get_ipv6_sequence(string partition)
{
array(int) segments = ({});
foreach(partition/":", string part) {
1847:
}
}
- static void setup (int pn, string i)
+ protected void setup (int pn, string i)
{
port = pn;
ip = canonical_ip(i);
1869:
retries = 0;
}
- static void create( int pn, string i, void|int ignore_eaddrinuse )
+ protected void create( int pn, string i, void|int ignore_eaddrinuse )
//! Constructor. Bind to the port 'pn' ip 'i'
{
setup (pn, i);
bind (ignore_eaddrinuse);
}
- static string _sprintf( )
+ protected string _sprintf( )
{
return "Protocol(" + get_url() + ")";
}
1893: Inside #if constant(SSL.sslfile)
int cert_failure;
- static void cert_err_unbind()
+ protected void cert_err_unbind()
{
if (bound) {
port_obj->close();
1921:
return; \
} while (0)
- void certificates_changed(Variable|void ignored,
+ void certificates_changed(Variable.Variable|void ignored,
void|int ignore_eaddrinuse)
{
int old_cert_failure = cert_failure;
1929:
string raw_keydata;
array(string) certificates = ({});
array(object) decoded_certs = ({});
- Variable Certificates = getvar("ssl_cert_file");
+ Variable.Variable Certificates = getvar("ssl_cert_file");
object privs = Privs("Reading cert file");
1981:
return;
}
- Variable KeyFile = getvar("ssl_key_file");
+ Variable.Variable KeyFile = getvar("ssl_key_file");
if( strlen(KeyFile->query())) {
SSL3_WERR (sprintf ("Reading key file %O", KeyFile->query()));
2023:
if (rsa->rsa_size() > 512)
{
/* Too large for export */
- #if constant(Crypto.RSA)
+
ctx->short_rsa = Crypto.RSA()->generate_key(512, ctx->random);
- #else
- ctx->short_rsa = Crypto.rsa()->generate_key(512, ctx->random);
- #endif
+
- // ctx->long_rsa = Crypto.rsa()->generate_key(rsa->rsa_size(), ctx->random);
+ // ctx->long_rsa = Crypto.RSA()->generate_key(rsa->rsa_size(), ctx->random);
}
ctx->rsa_mode();
2127:
}
}
- RoxenSSLFile accept()
+ SSL.sslfile accept()
{
Stdio.File q = ::accept();
if (q)
- return RoxenSSLFile (q, ctx);
+ return SSL.sslfile (q, ctx);
return 0;
}
- static void bind (void|int ignore_eaddrinuse)
+ protected void bind (void|int ignore_eaddrinuse)
{
// Don't bind if we don't have correct certs.
if (!ctx->certificates) return;
2144:
void create(int pn, string i, void|int ignore_eaddrinuse)
{
- #if constant(Crypto.Random.random_string)
+
ctx->random = Crypto.Random.random_string;
- #else
- ctx->random = Crypto.randomness.reasonably_random()->read;
- #endif
+
set_up_ssl_variables( this_object() );
2182: Inside #if undefined(DEBUG)
class lazy_load( string prog, string name )
{
program real;
- static void realize()
+ protected void realize()
{
if( catch {
DDUMP( prog );
2609:
return 0;
}
- static int last_hrtime = gethrtime(1)/100;
- static int clock_sequence = random(0x4000);
- static string hex_mac_address =
- Crypto.string_to_hex(Crypto.randomness.reasonably_random()->read(6)|
+ protected int last_hrtime = gethrtime(1)/100;
+ protected int clock_sequence = random(0x4000);
+ protected string hex_mac_address =
+ String.string2hex(Crypto.Random.random_string (6)|
"\1\0\0\0\0\0"); // Multicast bit.
// Generate an uuid string.
string new_uuid_string()
2765:
private int unique_id_counter;
string create_unique_id()
{
- object md5 = Crypto.md5();
+ Crypto.MD5 md5 = Crypto.MD5();
md5->update(query("server_salt") + start_time + "|" +
(unique_id_counter++) + "|" + time(1));
- return Crypto.string_to_hex(md5->digest());
+ return String.string2hex(md5->digest());
}
#ifndef __NT__
- static int abs_started;
- static int handlers_alive;
+ protected int abs_started;
+ protected int handlers_alive;
- static void low_engage_abs()
+ protected void low_engage_abs()
{
report_debug("**** %s: ABS exiting roxen!\n\n",
ctime(time()) - "\n");
2783: Inside #if undefined(__NT__)
// locked up
}
- static void engage_abs(int n)
+ protected void engage_abs(int n)
{
if (!query("abs_engage")) {
abs_started = 0;
2883:
return replace(doc, "###", tag_n_args);
}
- static mapping meta_cache_insert( string i, mapping what )
+ protected mapping meta_cache_insert( string i, mapping what )
{
#ifdef ARG_CACHE_DEBUG
werror("MD insert for %O: %O\n", i, what );
2899:
return 0;
}
- static mixed frommapp( mapping what )
+ protected mixed frommapp( mapping what )
{
if( !what )
error( "Got invalid argcache-entry\n" );
2907:
return what;
}
- static void|mapping draw( string name, RequestID id )
+ protected void|mapping draw( string name, RequestID id )
{
#ifdef ARG_CACHE_DEBUG
werror("draw %O\n", name );
3424:
#endif
}
- static void store_data( string id, string data, mapping meta )
+ protected void store_data( string id, string data, mapping meta )
{
if(!stringp(data)) return;
#ifdef ARG_CACHE_DEBUG
3459:
#endif
}
- static mapping restore_meta( string id, RequestID rid )
+ protected mapping restore_meta( string id, RequestID rid )
{
if( array item = meta_cache[ id ] )
{
3489:
return meta_cache_insert( id, m );
}
- static void sync_meta()
+ protected void sync_meta()
{
// Sync cached atimes.
foreach(meta_cache; string id; array value) {
3585:
return ({ imgs, size, aged });
}
- static mapping(string:mapping) rst_cache = ([ ]);
- static mapping(string:string) uid_cache = ([ ]);
+ protected mapping(string:mapping) rst_cache = ([ ]);
+ protected mapping(string:string) uid_cache = ([ ]);
- static mapping restore( string id, RequestID rid )
+ protected mapping restore( string id, RequestID rid )
{
array q;
string uid;
3836:
draw_function = to;
}
- static void setup_tables()
+ protected void setup_tables()
{
if(catch(QUERY("SELECT data FROM "+name+" WHERE id=''")))
{
3868:
return dbm_cached_get("local");
}
- static void init_db( )
+ protected void init_db( )
{
catch(sync_meta());
setup_tables();
3946:
#define dwerror(ARGS...) 0
#endif
- static mapping(string|int:mixed) cache = ([ ]);
+ protected mapping(string|int:mixed) cache = ([ ]);
- static void setup_table()
+ protected void setup_table()
{
// New style argument2 table.
if(catch(QUERY("SELECT id FROM "+name+"2 LIMIT 0")))
3985:
};
}
- static void init_db()
+ protected void init_db()
{
// Delay DBManager resolving to before the 'roxen' object is
// compiled.
3994:
setup_table( );
}
- static void create( string _name )
+ protected void create( string _name )
{
name = _name;
init_db();
4004:
get_plugins();
}
- static string read_encoded_args( string id, int dont_update_atime )
+ protected string read_encoded_args( string id, int dont_update_atime )
{
LOCK();
array res = QUERY("SELECT contents FROM "+name+"2 "
4018:
return res[0]->contents;
}
- static void create_key( string id, string encoded_args )
+ protected void create_key( string id, string encoded_args )
{
LOCK();
array(mapping) rows =
4048:
(plugins->create_key-({0}))( id, encoded_args );
}
- static array plugins;
- static void get_plugins()
+ protected array plugins;
+ protected void get_plugins()
{
plugins = ({});
foreach( ({ "../local/arg_cache_plugins", "arg_cache_plugins" }), string d)
4062:
}
}
- static mapping plugins_read_encoded_args( string id )
+ protected mapping plugins_read_encoded_args( string id )
{
mapping args;
foreach( (plugins->read_encoded_args - ({0})), function(string:mapping) f )
4077:
//! data later.
{
string encoded_args = encode_value_canonic( args );
- string id = Gmp.mpz(Crypto.sha()->update(encoded_args)->digest(), 256)->digits(36);
+ string id = Gmp.mpz(Crypto.SHA1()->update(encoded_args)->digest(), 256)->digits(36);
if( cache[ id ] )
return id;
create_key(id, encoded_args);
4304:
// for module encoding stuff
- #if constant (Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS)
+
// Pike 7.7 or later - we use the native LDAP module and link the
// migration alias NewLDAP to it.
add_constant ("NewLDAP", Protocols.LDAP);
- #else
- // Older pike - use our own LDAP protocol as NewLDAP.
- add_constant ("NewLDAP", _NewLDAP);
- #endif
+
add_constant( "CFUserDBModule",config_userdb_module );
4722:
config->name+":\n", describe_backtrace(err)+"\n");
}
- mapping low_decode_image(string data, void|mixed tocolor)
+ mapping low_decode_image(string data)
{
- mapping w = Image._decode( data, tocolor );
+ mapping w = Image._decode( data );
if( w->image ) return w;
return 0;
}
4974:
cdt_thread = 0;
}
- void cdt_changed (Variable v)
+ void cdt_changed (Variable.Variable v)
{
if (cdt_directory && v->query() && !cdt_thread)
cdt_thread = Thread.thread_create (cdt_poll_file);
5026:
class GCTimestamp
{
array self_ref;
- static void create() {self_ref = ({this_object()});}
- static void destroy() {
+ protected void create() {self_ref = ({this_object()});}
+ protected void destroy() {
werror ("GC runs at %s", ctime(time()));
GCTimestamp();
}
5327:
}
#ifdef ROXEN_DEBUG_MEMORY_TRACE
- static object roxen_debug_info_obj;
+ protected object roxen_debug_info_obj;
void restart_roxen_debug_memory_trace()
{
remove_call_out(restart_roxen_debug_memory_trace);
5398:
(sizeof(s/":") > 1)); // IPv6
}
- static string _sprintf( )
+ protected string _sprintf( )
{
return "roxen";
}
5406:
// Logging
- class LogFormat // Note: Dumping won't work if static.
+ class LogFormat // Note: Dumping won't work if protected.
{
- static string url_encode (string str)
+ protected string url_encode (string str)
{
// Somewhat like Roxen.http_encode_url, but only encode enough
// chars to avoid ambiguity in typical log formats. Notably, UTF-8
5438:
}));
}
- static int rusage_time;
- static array(int) rusage_data;
- static void update_rusage()
+ protected int rusage_time;
+ protected mapping(string:int) rusage_data;
+ protected void update_rusage()
{
if(!rusage_data || time(1) != rusage_time)
{
- rusage_data = rusage();
+ rusage_data = (["utime": 1, "stime": 1]) & System.getrusage();
rusage_time = time(1);
}
}
- static int server_cputime()
+ protected int server_cputime()
{
update_rusage();
- if(rusage_data && sizeof(rusage_data) >= 2)
- return rusage_data[0] + rusage_data[1];
+ if(rusage_data)
+ return rusage_data->utime + rusage_data->stime;
return 0;
}
- static int server_usertime()
+ protected int server_usertime()
{
update_rusage();
- if(rusage_data && sizeof(rusage_data) >= 1)
- return rusage_data[0];
+ if(rusage_data)
+ return rusage_data->utime;
return 0;
}
- static int server_systime()
+ protected int server_systime()
{
update_rusage();
- if(rusage_data && sizeof(rusage_data) >= 2)
- return rusage_data[1];
+ if(rusage_data)
+ return rusage_data->stime;
return 0;
}
- static string std_date(mapping(string:int) ct) {
+ protected string std_date(mapping(string:int) ct) {
return(sprintf("%04d-%02d-%02d",
1900+ct->year,ct->mon+1, ct->mday));
}
- static string std_time(mapping(string:int) ct) {
+ protected string std_time(mapping(string:int) ct) {
return(sprintf("%02d:%02d:%02d",
ct->hour, ct->min, ct->sec));
}
// CERN date formatter. Note similar code in Roxen.pmod.
- static constant months = ({ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ protected constant months = ({ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" });
- static int chd_lt;
- static string chd_lf;
+ protected int chd_lt;
+ protected string chd_lf;
- static string cern_http_date(int t, mapping(string:int) ct)
+ protected string cern_http_date(int t, mapping(string:int) ct)
{
if( t == chd_lt )
// Interpreter lock assumed here.
5517:
return c;
}
- static string host_ip_to_int(string s)
+ protected string host_ip_to_int(string s)
{
int a, b, c, d;
sscanf(s, "%d.%d.%d.%d", a, b, c, d);
return sprintf("%c%c%c%c",a, b, c, d);
}
- static string extract_user(string from)
+ protected string extract_user(string from)
{
array tmp;
if (!from || sizeof(tmp = from/":")<2)
5537:
void log_event (function do_write, string facility, string action,
string resource, mapping(string:mixed) info);
- static void do_async_write( string host, string data, string ip, function c )
+ protected void do_async_write( string host, string data,
+ string ip, function c )
{
if( c )
c( replace( data, "\4711", (host||ip) ) );
}
}
- static mapping(string:function) compiled_log_access = ([ ]);
- static mapping(string:function) compiled_log_event = ([ ]);
+ protected mapping(string:function) compiled_log_access = ([ ]);
+ protected mapping(string:function) compiled_log_event = ([ ]);
#define LOG_ASYNC_HOST 1
#define LOG_NEED_COOKIES 2
5565:
// arr[3]: Code for the corresponding sprintf argument of arr[2].
// arr[4]: Flags.
- static constant formats = ([
+ protected constant formats = ([
// Used for both access and event logging
"date": ({"%s", "std_date (ltime)", 0, 0, LOG_NEED_LTIME}),
5717:
resource, info);
}
- static LogFormat compile_log_format( string fmt )
+ protected LogFormat compile_log_format( string fmt )
{
add_constant( "___LogFormat", LogFormat );
6446:
}
- static string cached_hostname = gethostname();
+ protected string cached_hostname = gethostname();
class LogFile(string fname, string|void compressor_program)
{
6458:
// "$LOGDIR/test/Log.%y-%m-%d", not "$LOGDIR/test/%y/Log.%m-%d").
Process.Process compressor_process;
int last_compressor_scan_time;
- static void compress_logs(string fname, string active_log)
+ protected void compress_logs(string fname, string active_log)
{
if(!compressor_program || !sizeof(compressor_program))
// No compressor program specified...
6547:
}
array(string) write_buf = ({});
- static void do_the_write( )
+ protected void do_the_write( )
{
if( !opened ) do_open();
if( !opened ) return 0;