Пример #1
0
int url_check_init_service(ci_service_xdata_t * srv_xdata,
                           struct ci_server_conf *server_conf)
{
     unsigned int xops;
     struct lookup_db *int_db;
     ci_debug_printf(2, "Initialization of url_check module......\n");
     ci_service_set_preview(srv_xdata, 0);
     xops = CI_XCLIENTIP | CI_XSERVERIP;
     xops |= CI_XAUTHENTICATEDUSER | CI_XAUTHENTICATEDGROUPS;
     ci_service_set_xopts(srv_xdata, xops);

     /*initialize mempools          */
     URL_CHECK_DATA_POOL = ci_object_pool_register("url_check_data", 
						   sizeof(struct url_check_data));

     if (URL_CHECK_DATA_POOL < 0)
	 return CI_ERROR;
     /*Add internal database lookups*/
     int_db = new_lookup_db("ALL", DB_INTERNAL, CHECK_HOST, NULL,
			    all_lookup_db,
			    NULL);
     if(int_db)
       return add_lookup_db(int_db);

     return CI_OK;
}
Пример #2
0
int cfg_srv_preview_size(char *directive, char **argv, void *setdata)
{
    int preview;
    char *end;
    struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata;
    if (argv == NULL || argv[0] == NULL) {
	ci_debug_printf(1, "Missing arguments in directive %s \n", directive);
	return 0;
    }
    errno = 0;
    preview = strtoll(argv[0], &end, 10);
    if (errno != 0 || preview < 0) {
	ci_debug_printf(1, "Invalid argument in directive %s \n", directive);
	return 0;
    }
    ci_debug_printf(1, "Setting parameter :%s=%d\n", directive, preview);
    ci_service_set_preview(srv_xdata, preview);
    return 1;
}
Пример #3
0
int srvclamav_init_service(ci_service_xdata_t * srv_xdata,
                           struct ci_server_conf *server_conf)
{
     int ret, i;
     magic_db = server_conf->MAGIC_DB;
     scantypes = (int *) malloc(ci_magic_types_num(magic_db) * sizeof(int));
     scangroups = (int *) malloc(ci_magic_groups_num(magic_db) * sizeof(int));

     for (i = 0; i < ci_magic_types_num(magic_db); i++)
          scantypes[i] = 0;
     for (i = 0; i < ci_magic_groups_num(magic_db); i++)
          scangroups[i] = 0;


     ci_debug_printf(10, "Going to initialize srvclamav\n");
     ret = init_virusdb();
     if (!ret)
          return 0;
     srv_clamav_xdata = srv_xdata;      /*Needed by db_reload command */
     set_istag(srv_clamav_xdata);
     ci_service_set_preview(srv_xdata, 1024);
     ci_service_enable_204(srv_xdata);
     ci_service_set_transfer_preview(srv_xdata, "*");
 

     /*Initialize object pools*/
     AVREQDATA_POOL = ci_object_pool_register("av_req_data_t", sizeof(av_req_data_t));

     if(AVREQDATA_POOL < 0) {
	 ci_debug_printf(1, " srvclamav_init_service: error registering object_pool av_req_data_t\n");
	 return 0;
     }
     /*initialize service commands */
     register_command("srv_clamav:dbreload", MONITOR_PROC_CMD | CHILDS_PROC_CMD,
                      dbreload_command);

     return 1;
}
/* This function will be called when the service loaded  */
int search_record_init_service(ci_service_xdata_t * srv_xdata,
                      struct ci_server_conf *server_conf)
{
     ci_debug_printf(5, "Initialization of Search Record module......\n");
     
     /*Tell to the icap clients that we can support up to 1024 size of preview data*/
     ci_service_set_preview(srv_xdata, 128);

     /*Tell to the icap clients that we support 204 responses*/
     ci_service_enable_204(srv_xdata);

     /*Tell to the icap clients to send preview data for all files*/
     ci_service_set_transfer_preview(srv_xdata, "*");

     /*Tell to the icap clients that we want the X-Authenticated-User and X-Authenticated-Groups headers
       which contains the username and the groups in which belongs.  */
     /*ci_service_set_xopts(srv_xdata,  CI_XAUTHENTICATEDUSER|CI_XAUTHENTICATEDGROUPS);*/
     
	 initPairs(&search_engine);
	 addNewPair(&search_engine,baidu_matchurl,baidu_wordlist,baidu_site);
	 addNewPair(&search_engine,google_matchurl,google_wordlist,google_site);
     return CI_OK;
}
Пример #5
0
/**
 * Called after load_java_module(char * service_file) .<br>
 * initialize service OPTIONS parameter.<br>
 * prev = load_java_module(const char * service_file)<br>
 * next = post_init_java_handler(struct ci_server_conf * server_conf)<br>
 *
 * @param srv_xdata a pointer holds service parameter.
 * @param server_conf a pointer of server config.
 * @return CI_SERVICE_OK
 */
int java_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf * server_conf) {
    ci_service_set_preview(srv_xdata, 1024);
    ci_service_enable_204(srv_xdata);
    ci_service_set_transfer_preview(srv_xdata, "*");
    return CI_SERVICE_OK;
}