ShellBanner
System:Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686
Software:Apache. PHP/5.3.6-13ubuntu3.10
ID:uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Safe Mode:OFF
Open_Basedir:OFF
Freespace:24.9 GB of 70.42 GB (35.36%)
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

/ usr/ src/ courier-0.66.1/ imap/ - drwxrwxrwx

Directory:
Viewing file:     mainloop.c (2.88 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
** Copyright 1998 - 2006 Double Precision, Inc.
** See COPYING for distribution information.
*/

#if    HAVE_CONFIG_H
#include    "config.h"
#endif
#include    <stdio.h>
#include    <stdlib.h>
#include    <string.h>
#include    <errno.h>
#include    <ctype.h>
#include    <fcntl.h>
#include    <signal.h>
#include    <unistd.h>
#include    "imaptoken.h"
#include    "imapwrite.h"
#include    "numlib/numlib.h"


extern int do_imap_command(const char *);

extern unsigned long header_count, body_count;
extern unsigned long bytes_received_count, bytes_sent_count;
extern time_t start_time;

static RETSIGTYPE sigexit(int n)
{
    static char byemsg[]="* BYE Courier-IMAP server shut down by signal.\r\n";
    const char *a=getenv("AUTHENTICATED");
    char buf[NUMBUFSIZE];
    char msg[1024];
    int l = 0;
    const char *tls=getenv("IMAP_TLS");
    const char *ip=getenv("TCPREMOTEIP");

    if (write(1, byemsg, sizeof(byemsg)-1) < 0)
        exit(1);

    bytes_sent_count += sizeof(byemsg);

    libmail_str_time_t(time(NULL)-start_time, buf);

    if (tls && atoi(tls))
        tls=", starttls=1";
    else
        tls="";

    if (a && *a)
        l = snprintf(msg, sizeof(msg) - 1, "NOTICE: Disconnected during shutdown by signal, user=%s, "
            "ip=[%s], headers=%lu, body=%lu, rcvd=%lu, sent=%lu, time=%s%s\n",
            a, ip, header_count, body_count, bytes_received_count, bytes_sent_count,
            buf, tls);
    else
        l = snprintf(msg, sizeof(msg) - 1, "NOTICE: Disconnected during shutdown by signal, ip=[%s], time=%s%s\n",
            getenv("TCPREMOTEIP"),
            buf, tls);

    if (l > 0 && write(2, msg, l))
        ; /* Suppress gcc warning */

    exit(0);
#if    RETSIGTYPE != void
    return (0);
#endif
}


void cmdfail(const char *tag, const char *msg)
{
#if SMAP
    const char *p=getenv("PROTOCOL");

    if (p && strcmp(p, "SMAP1") == 0)
        writes("-ERR ");
    else
#endif
    {
        writes(tag);
        writes(" NO ");
    }
    writes(msg);
}

void cmdsuccess(const char *tag, const char *msg)
{
#if SMAP
    const char *p=getenv("PROTOCOL");

    if (p && strcmp(p, "SMAP1") == 0)
        writes("+OK ");
    else
#endif
    {
        writes(tag);
        writes(" OK ");
    }
    writes(msg);
}

void mainloop(void)
{
    int noerril = 0;

    signal(SIGTERM, sigexit);
    signal(SIGHUP, sigexit);
    signal(SIGINT, sigexit);

    for (;;)
    {
    char    tag[IT_MAX_ATOM_SIZE+1];
    struct    imaptoken *curtoken;

        read_timeout(30 * 60);
        curtoken=nexttoken_nouc();
        tag[0]=0;
        if (curtoken->tokentype == IT_ATOM ||
            curtoken->tokentype == IT_NUMBER)
        {
        int    rc;

            if (strlen(tag)+strlen(curtoken->tokenbuf) > IT_MAX_ATOM_SIZE)
                write_error_exit("max atom size too small");
                  
            strncat(tag, curtoken->tokenbuf, IT_MAX_ATOM_SIZE);
            rc=do_imap_command(tag);

            if (rc == 0)
            {
                noerril = 0;
                writeflush();
                read_eol();
                continue;
            }
            if (rc == -2)
                continue;
        }

        noerril++;
        if (noerril > 9)
        {
            errno = 0;
            write_error_exit("TOO MANY CONSECUTIVE PROTOCOL VIOLATIONS");
        }
        read_eol();
        cmdfail(tag[0] ? tag:"*",
            "Error in IMAP command received by server.\r\n");
        writeflush();
    }
}
Command:
Quick Commands:
Upload:
[OK] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [OK]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.2266 seconds