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.38 GB of 70.42 GB (34.63%)
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/ maildir/ - drwxrwxrwx

Directory:
Viewing file:     maildirfilename.c (2.63 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
** Copyright 2000-2002 Double Precision, Inc.
** See COPYING for distribution information.
*/

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#define NAMLEN(dirent) strlen((dirent)->d_name)
#else
#define dirent direct
#define NAMLEN(dirent) (dirent)->d_namlen
#if HAVE_SYS_NDIR_H
#include <sys/ndir.h>
#endif
#if HAVE_SYS_DIR_H
#include <sys/dir.h>
#endif
#if HAVE_NDIR_H
#include <ndir.h>
#endif
#endif
#include    <sys/types.h>
#include    <sys/stat.h>
#include    <string.h>
#include    <stdlib.h>
#include    <time.h>
#if    HAVE_UNISTD_H
#include    <unistd.h>
#endif
#include    <stdio.h>
#include    <ctype.h>
#include    <errno.h>

#include    "maildirmisc.h"


/*
** char *maildir_filename(const char *maildir, const char *folder,
**   const char *filename)
**    - find a message in a maildir
**
** Return the full path to the indicated message.  If the message flags
** in filename have changed, we search the maildir for this message.
*/

char *maildir_filename(const char *maildir,
    const char *folder, const char *filename)
{
struct stat stat_buf;
char    *p, *q;
DIR *dirp;
struct dirent *de;
char    *dir;

    if (strchr(filename, '/') || *filename == '.')
    {
        errno=ENOENT;
        return (0);
    }

    dir=maildir_folderdir(maildir, folder);

    if (!dir)    return (0);

    p=malloc(strlen(dir)+strlen(filename)+sizeof("/cur/"));

    if (!p)
    {
        free(dir);
        return (0);
    }

    strcat(strcat(strcpy(p, dir), "/cur/"), filename);

    if (stat(p, &stat_buf) == 0)
    {
        free(dir);
        return (p);
    }

    /* Oh, a wise guy... */

    q=strrchr(p, '/');
    *q=0;
    dirp=opendir(p);
    *q='/';

    if ( dirp == NULL)
    {
        free(dir);
        return p;
    }

    /* Compare filenames, ignore filename size if set by maildirquota */

    while ((de=readdir(dirp)) != NULL)
    {
    const char *a=filename;
    const char *b=de->d_name;

        for (;;)
        {
            if ( a[0] == ',' && a[1] == 'S' && a[2] == '=')
            {
                /* File size - quota shortcut - skip */
                a += 3;
                while (*a && isdigit((int)(unsigned char)*a))
                    ++a;
            }

            if ( b[0] == ',' && b[1] == 'S' && b[2] == '=')
            {
                /* File size - quota shortcut - skip */
                b += 3;
                while (*b && isdigit((int)(unsigned char)*b))
                    ++b;
            }

            if ( (*a == 0 || *a == MDIRSEP[0]) && (*b == 0 || *b == MDIRSEP[0]))
            {
                free(p);
                p=malloc(strlen(dir)+strlen(de->d_name)+
                    sizeof("/cur/"));
                if (!p)
                {
                    closedir(dirp);
                    free(dir);
                    return (0);
                }

                strcat(strcat(strcpy(p, dir), "/cur/"),
                    de->d_name);
                closedir(dirp);
                free(dir);
                return (p);
            }
            if ( *a == 0 || *a == MDIRSEP[0] || *b == 0 || *b == MDIRSEP[0] ||
                *a != *b)
                break;

            ++a;
            ++b;
        }
    }
    closedir(dirp);
    free(dir);
    return (p);
}
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.1613 seconds