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.43 GB of 70.42 GB (34.69%)
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/ webmail/ - drwxrwxrwx

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


/*
*/
#include    "sqwebmail.h"
#include    "sqconfig.h"
#include    <stdio.h>
#include    <stdlib.h>
#include    <string.h>
#if    HAVE_UNISTD_H
#include    <unistd.h>
#endif
#include    <sys/types.h>
#include    <sys/stat.h>
#include    "maildir/maildircreate.h"

/* Assume all configuration data fits in 256 char buffer. */

static char linebuf[256];

const char *read_sqconfig(const char *dir, const char *configfile, time_t *mtime)
{
char *p=malloc(strlen(dir) + strlen(configfile) + 2);
struct stat stat_buf;
FILE    *f;

    if (!p)    enomem();
    strcat(strcat(strcpy(p, dir), "/"), configfile);
    f=fopen(p, "r");
    free(p);
    if (!f)    return (0);
    if (fstat(fileno(f), &stat_buf) != 0 ||
        !fgets(linebuf, sizeof(linebuf), f))
    {
        fclose(f);
        return (0);
    }
    fclose(f);
    if (mtime)    *mtime=stat_buf.st_mtime;

    linebuf[sizeof(linebuf)-1]=0;
    if ((p=strchr(linebuf, '\n')) != 0)    *p=0;
    return (linebuf);
}

void write_sqconfig(const char *dir, const char *configfile, const char *val)
{
    char *p=malloc(strlen(dir) + strlen(configfile) + 2);

    struct maildir_tmpcreate_info createInfo;
    FILE *fp;

    if (!p)    enomem();

    strcat(strcat(strcpy(p, dir), "/"), configfile);
    if (!val)
    {
        unlink(p);
        free(p);
        return;
    }

    maildir_tmpcreate_init(&createInfo);

    createInfo.maildir=dir;
    createInfo.uniq="config";
    createInfo.doordie=1;

    fp=maildir_tmpcreate_fp(&createInfo);

    if (!fp)
        enomem();


    free(createInfo.newname);
    createInfo.newname=p;

    fprintf(fp, "%s\n", val);
    fflush(fp);
    if (ferror(fp))    eio("Error after write:",p);
    fclose(fp);

    /* Note - umask should already turn off the 077 bits, but
    ** just in case someone screwed up previously, I'll fix it
    ** myself */

    chmod(createInfo.tmpname, 0600);
    rename(createInfo.tmpname, createInfo.newname);
    maildir_tmpcreate_free(&createInfo);
}
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.2643 seconds