Пример #1
0
MODULE signal_connection_failed (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    sendfmt (&operq, "ERROR", "smtftpd: could not connect to %s:%d",
        sock_ntoa (htonl (tcb-> data_host)),
                          tcb-> data_port);

    SEND (&tcb-> reply_to, "FTPD_ERROR", "");
}
Пример #2
0
void
die_log(int err, char *arg_info, char *log_info, char *user_comment)
{
    if (err & ERRNO) err = errno;

    sendfmt(f_fatal, arg_info, log_info, err ? strerror(err) : 0);
    if (user_comment)
        (void) lx_gdputs(gd_out, user_comment);

    lx_gdflush(gd_out);
    _exit(1);
}
Пример #3
0
MODULE load_ddns_services_list (THREAD *thread)
{
    char
        *filename;

    filename = CONFIG ("ddns:filename");
    services = NULL;

    switch (xml_load_file (&services, "PATH", filename, FALSE))
      {
        case XML_FILEERROR:
            sendfmt (&operq, "ERROR",
                "xiddns: cannot read '%s': %s", filename, xml_error ());
            raise_exception (exception_event);
            break;
        case XML_LOADERROR:
            sendfmt (&operq, "ERROR",
                "xiddns: error in '%s': %s", filename, xml_error ());
            raise_exception (exception_event);
            break;
      }
}
Пример #4
0
MODULE get_next_ddns_profile (THREAD *thread)
{
    char
        ddns_prefix [10];               /*  "ddns.." config table prefix     */
    XML_ATTR
        *attr;                          /*  XML attribute                    */

    /*  If we have a symbol with the name ddns... then we can assume that
     *  this is the start of a DDNS entry.
     */
    sprintf (ddns_prefix, "ddns%.0d", ddns_index++);
    ddns_service = ini_dyn_value (config, ddns_prefix, "service", NULL);

    if (ddns_service)
      {
        the_next_event = ok_event;
        ddns_username = ini_dyn_value (config, ddns_prefix, "username", "");
        ddns_password = ini_dyn_value (config, ddns_prefix, "password", "");
        ddns_domain   = ini_dyn_value (config, ddns_prefix, "domain",   "");

        /*  Now find service properties                                      */
        FORCHILDREN (service_item, xml_first_child (services))
          {
            attr = xml_attr (service_item, "NAME");
            if (attr == NULL)
                sendfmt (&operq, "ERROR",
                         "xiddns: syntax error in definition file - no NAME");
            else
            if (streq (ddns_service, xml_attr_value (attr)))
                break;
           }
        if (service_item == NULL)
          {
            sendfmt (&operq, "ERROR",
                     "xiddns: service '%s' not defined", ddns_service);
            the_next_event = error_event;
          }
      }
Пример #5
0
void
log_debug(int level, char *arg_info, char *log_info)
{
    if (!(level & OPT_DEBUG)) return;
    sendfmt(f_debug, arg_info, log_info, 0);
}
Пример #6
0
void
die_html(int hterr, char *arg_info,
        char *log_info, char *user_comment)
{
    /* ignore all user-supplied data on error, including user-supplied req.
     * XXX: breaks spec?
     */
    struct reqinfo req = {
        {0}, {0}, 1, 0
    };

    lx_s body = {0},
         data = {0};

    int err = (hterr & ERRNO) ? errno : 0;
    int hterridx = hterr & (~ERRNO);

    sendfmt(f_fatal, arg_info, log_info, err ? strerror(err) : 0);

    if (stage & SENT_PREFIX) {
        /* oh, well.  Prefix already sent; may as well not supply user info
         * now, since we'd just corrupt the data already given.
         */
        goto JUSTDIE;
    }

    header_reinit(&blob_header_send);
    header_set_default(hterridx);

    /* RFC-compliance means that we gather this regardless of whether we
     * send the data.  I guess i care.
     */
    if (lx_stradd(&body,
                "<html>\r\n"
                "  <head>\r\n"
                "    <title>")) die_nomem();
    if (lx_stradd(&body, user_comment)) die_nomem();
    if (lx_stradd(&body, "</title>\r\n"
                "  </head>\r\n"
                "  <body>")) die_nomem();
    if (lx_stradd(&body, user_comment)) die_nomem();
    if (lx_stradd(&body, "</body>\r\n"
                "</html>\r\n")) die_nomem();

    if (lx_strset(&data, "text/html")) die_nomem();
    header_setstr(blob_header_send, "Content-Type", data.s, data.len);

    data.len = 0;
    if (lx_straddulong(&data, body.len, 10)) die_nomem();
    header_setstr(blob_header_send, "Content-Length", data.s, data.len);

    resp_sendprefix(&req, hterridx);
    resp_sendheaders(&req, blob_header_send);

    if (!global_flags.header_only)
        (void) lx_gdstrput(gd_out, &body);

JUSTDIE:
    (void) lx_gdflush(gd_out);

    _exit(1);
}
Пример #7
0
void
log_warning(int err, char *arg_info, char *log_info)
{
    if (err & ERRNO) err = errno;
    sendfmt(f_warning, arg_info, log_info, err ? strerror(err) : 0);
}