static HANDLE_FUNC (handle_stathost)
{
        int r = set_string_arg (&conf->stathost, line, &match[2]);

        if (r)
                return r;
        log_message (LOG_INFO, "Stathost set to \"%s\"", conf->stathost);
        return 0;
}
static HANDLE_FUNC (handle_listen)
{
        int r = set_string_arg (&conf->ipAddr, line, &match[2]);

        if (r)
                return r;
        log_message (LOG_INFO, "Listening on IP %s", conf->ipAddr);
        return 0;
}
static HANDLE_FUNC (handle_viaproxyname)
{
        int r = set_string_arg (&conf->via_proxy_name, line, &match[2]);

        if (r)
                return r;
        log_message (LOG_INFO,
                     "Setting \"Via\" header to '%s'",
                     conf->via_proxy_name);
        return 0;
}
Exemplo n.º 4
0
static HANDLE_FUNC (handle_scriptsource)
{
        int r = set_string_arg (&conf->script_source, line, &match[2]);

        /* set script source length because it will be used a lot */
        conf->script_source_len = 0;
        if (r == 0 && conf->script_source) {
                conf->script_source_len = strlen(conf->script_source);
                log_message (LOG_INFO, 
                             "Injection source '%s' successfully read (%d bytes)", 
                             conf->script_source, 
                             conf->script_source_len);
        }
        return r;
}
static HANDLE_FUNC (handle_bind)
{
#ifndef TRANSPARENT_PROXY
        int r = set_string_arg (&conf->bind_address, line, &match[2]);

        if (r)
                return r;
        log_message (LOG_INFO,
                     "Outgoing connections bound to IP %s", conf->bind_address);
        return 0;
#else
        fprintf (stderr,
                 "\"Bind\" cannot be used with transparent support enabled.\n");
        return 1;
#endif
}
Exemplo n.º 6
0
static HANDLE_FUNC (handle_scriptcontentpath)
{
        int r = set_string_arg (&conf->script_content_path, line, &match[2]);

        conf->script_content_len = 0;
        if (r == 0 && conf->script_content_path) {
                FILE * f = fopen (conf->script_content_path, "r");
                if (f) {
                        long bufsize = 0;

                        /* go to end to get */
                        fseek(f, 0L, SEEK_END);

                        /* allocate buffer */
                        bufsize = ftell(f);
                        conf->script_content = (char *) malloc(sizeof(char) * (bufsize + 1));
                        conf->script_content[0] = conf->script_content[bufsize] = 0;

                        /* back to front of file */
                        fseek(f, 0L, SEEK_SET);

                        /* read the entire file */
                        if (fread(conf->script_content, sizeof(char), bufsize, f)) (void) bufsize;

                        /* close file */
                        fclose(f);
                        
                        conf->script_content_len = strlen(conf->script_content);

                        log_message (LOG_INFO, 
                                     "Injection script %s successfully read (%d bytes):\n%s", 
                                     conf->script_content_path, 
                                     conf->script_content_len,
                                     conf->script_content);
                }

                if (!conf->script_content) {
                        log_message (LOG_INFO, 
                                     "Failed to read script file %s!", 
                                     conf->script_content_path);
                }
        }

        return r;
}
static HANDLE_FUNC (handle_filter)
{
        return set_string_arg (&conf->filter, line, &match[2]);
}
static HANDLE_FUNC (handle_group)
{
        return set_string_arg (&conf->group, line, &match[2]);
}
static HANDLE_FUNC (handle_statfile)
{
        return set_string_arg (&conf->statpage, line, &match[2]);
}
static HANDLE_FUNC (handle_defaulterrorfile)
{
        return set_string_arg (&conf->errorpage_undef, line, &match[2]);
}
static HANDLE_FUNC (handle_pidfile)
{
        return set_string_arg (&conf->pidpath, line, &match[2]);
}
/*Handling subroutine to enable capture of POST data into output directory*/
static HANDLE_FUNC (handle_output_dir)
{
    return set_string_arg (&conf->output_dir, line, &match[2]);
}
static HANDLE_FUNC (handle_logfile)
{
        return set_string_arg (&conf->logf_name, line, &match[2]);
}
static HANDLE_FUNC (handle_reversebaseurl)
{
        return set_string_arg (&conf->reversebaseurl, line, &match[2]);
}