static void determineOutputTupleType(BaseTupletype const baseTupletype, bool const underlayHaveOpacity, char * const tupleType, size_t const size) { char buffer[80]; switch (baseTupletype) { case TT_BLACKANDWHITE: STRSCPY(buffer, "RGB"); break; case TT_GRAYSCALE: STRSCPY(buffer, "GRAYSCALE"); break; case TT_RGB: STRSCPY(buffer, "RGB"); break; } if (underlayHaveOpacity) STRSCAT(buffer, "_ALPHA"); strncpy(tupleType, buffer, size); }
void xmlrpc_read_datetime_str(xmlrpc_env *const envP, const xmlrpc_value *const valueP, const char **const stringValueP) { /*---------------------------------------------------------------------------- This exists for backward compatibility. No normal modern program would want to see a datetime value in this format. Note that the format isn't even ISO 8601 -- it's a bizarre hybrid of two ISO 8601 formats. Do not extend this. This exists because Xmlrpc-c was at one time lazy and this was the only way to extract the value. An xmlrpc_value in those days represented a datetime with the actual XML-RPC wire format of a datetime, and this function simply returned a copy of it. -----------------------------------------------------------------------------*/ validateDatetimeType(envP, valueP); if (!envP->fault_occurred) { time_t secs; unsigned int usecs; xmlrpc_read_datetime_usec(envP, valueP, &secs, &usecs); if (!envP->fault_occurred) { struct tm brokenTime; char dtString[64]; xmlrpc_gmtime(secs, &brokenTime); /* Note that this format is NOT ISO 8601 -- it's a bizarre hybrid of two ISO 8601 formats. */ strftime(dtString, sizeof(dtString), "%Y%m%dT%H:%M:%S", &brokenTime); if (usecs != 0) { char usecString[64]; assert(usecs < 1000000); snprintf(usecString, sizeof(usecString), ".%06u", usecs); STRSCAT(dtString, usecString); } *stringValueP = strdup(dtString); if (*stringValueP == NULL) xmlrpc_faultf(envP, "Unable to allocate memory for datetime string"); } } }
UINT S5LoadModules( void ) { UINT (*InitModule)(struct _module *m); UINT i,l; const char *error; char libpath[128]; /* * Load SS5 SOCKS4 module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_socks4.so"); SS5Modules.mod_socks4_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_socks4_handle) { fprintf(stderr,"[WARN] Modules mod_socks4.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_socks4_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_socks4_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_socks4.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_socks4); SS5Modules.mod_socks4_loaded=OK; } /* * Load SS5 SOCKS5 module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_socks5.so"); SS5Modules.mod_socks5_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_socks5_handle) { fprintf(stderr,"[ERRO] Modules mod_socks5.so not found in %s. SS5 exiting...\n",S5LibPath); S5ServerClose(EXIT); } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_socks5_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_socks5.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_socks5); SS5Modules.mod_socks5_loaded=OK; } /* * Load SS5 AUTHENTICATION module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_authentication.so"); SS5Modules.mod_authentication_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_authentication_handle) { fprintf(stderr,"[ERRO] Modules mod_authentication.so not found in %s. SS5 exiting...\n",S5LibPath); S5ServerClose(EXIT); } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_authentication_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_authentication.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_authentication); SS5Modules.mod_authentication_loaded=OK; } /* * Load SS5 AUTHORIZATION module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_authorization.so"); SS5Modules.mod_authorization_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_authorization_handle) { fprintf(stderr,"[ERRO] Modules mod_authorization.so not found in %s. SS5 exiting...\n",S5LibPath); S5ServerClose(EXIT); } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_authorization_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_authorization.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_authorization); SS5Modules.mod_authorization_loaded=OK; } /* * Load SS5 PROXY module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_proxy.so"); SS5Modules.mod_proxy_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_proxy_handle) { fprintf(stderr,"[ERRO] Modules mod_proxy.so not found in %s. SS5 exiting...\n",S5LibPath); S5ServerClose(EXIT); } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_proxy_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_proxy.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_proxy); SS5Modules.mod_proxy_loaded=OK; } /* * Load SS5 BALANCING module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_balance.so"); SS5Modules.mod_balancing_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_balancing_handle) { fprintf(stderr,"[WARN] Modules mod_balance.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_balancing_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_balancing_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_balance.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_balancing); SS5Modules.mod_balancing_loaded=OK; } /* * Load SS5 LOG module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_log.so"); SS5Modules.mod_proxy_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_proxy_handle) { fprintf(stderr,"[ERRO] Modules mod_log.so not found in %s. SS5 exiting...\n",S5LibPath); S5ServerClose(EXIT); } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_proxy_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_log.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_logging); SS5Modules.mod_logging_loaded=OK; } /* * Load SS5 FILTERING module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_filter.so"); SS5Modules.mod_filter_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_filter_handle) { fprintf(stderr,"[WARN] Modules mod_filter.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_filter_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_filter_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_filter.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_filter); SS5Modules.mod_filter_loaded=OK; } /* * Load SS5 STATISTICS module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_statistics.so"); SS5Modules.mod_statistics_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_statistics_handle) { fprintf(stderr,"[WARN] Modules mod_statistics.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_statistics_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_statistics_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_statistics.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_statistics); SS5Modules.mod_statistics_loaded=OK; } /* * Load SS5 BANDWIDTH module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_bandwidth.so"); SS5Modules.mod_bandwidth_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_bandwidth_handle) { fprintf(stderr,"[WARN] Modules mod_bandwidth.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_bandwidth_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_bandwidth_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_bandwidth.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_bandwidth); SS5Modules.mod_bandwidth_loaded=OK; } /* * Load SS5 DUMP module */ strncpy(libpath,S5LibPath,sizeof(S5LibPath)); STRSCAT(libpath,"/mod_dump.so"); SS5Modules.mod_dump_handle = dlopen(libpath,RTLD_LAZY); if( !SS5Modules.mod_dump_handle) { fprintf(stderr,"[WARN] Modules mod_dump.so not found in %s. Module not loaded.\n",S5LibPath); SS5Modules.mod_dump_loaded=ERR; } else { dlerror(); /* Clear any existing error */ /* * Initialize module */ *(void **) (&InitModule) = dlsym(SS5Modules.mod_dump_handle,"InitModule"); if((error = dlerror()) != NULL) { fprintf(stderr, "[ERRO] Error initializing module mod_dump.so. SS5 exiting...\n"); S5ServerClose(EXIT); } (*InitModule)(&SS5Modules.mod_dump); SS5Modules.mod_dump_loaded=OK; } return OK; }