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.61 GB of 70.42 GB (34.95%)
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/ courier/ - drwxrwxrwx

Directory:
Viewing file:     webmlmddirs.C (3.92 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
**
** Copyright 2007 Double Precision, Inc.
** See COPYING for distribution information.
*/
#include    "webmlmd.H"
#include    "webmlmddirs.H"
#include    "numlib/numlib.h"
#include    <stdio.h>
#include    <errno.h>
#include    <stdlib.h>
#if    HAVE_UNISTD_H
#include    <unistd.h>
#endif
#include    <sys/types.h>
#include    <sys/stat.h>

#include    <iostream>
#include    <algorithm>

// Helper class -- order by last component in a filename path.

class webmlmd::dirs::OrderByLastComponent {

public:
    OrderByLastComponent();
    ~OrderByLastComponent();

    bool operator()(std::string, std::string) const;
};

webmlmd::dirs::OrderByLastComponent::OrderByLastComponent()
{
}

webmlmd::dirs::OrderByLastComponent::~OrderByLastComponent()
{
}

bool webmlmd::dirs::OrderByLastComponent::operator()(std::string a,
                             std::string b) const
{
    std::string::iterator ab=a.begin(), ae=a.end(),
        bb=b.begin(), be=b.end();

    while (ab != ae && bb != be)
    {
        if (*--ae != *--be)
            return *ae < *ab;

        if (*ae == '/')
            return false;
    }
    return ab == ae && bb != be;
}

// Helper class -- order list directories by the name of the mailing list.

class webmlmd::dirs::OrderByListName {

public:
    OrderByListName();
    ~OrderByListName();

    bool operator()(std::string, std::string) const;
};

webmlmd::dirs::OrderByListName::OrderByListName()
{
}

webmlmd::dirs::OrderByListName::~OrderByListName()
{
}

std::string getlistname(std::string dir, std::string dirbasename);

bool webmlmd::dirs::OrderByListName::operator()(std::string a,
                        std::string b) const
{
    return getlistname(a, webmlmd::basename(a))
        < getlistname(b, webmlmd::basename(b));
}

// Helper class -- compare last components of two file paths

class webmlmd::dirs::EqualLastComponent {

public:
    EqualLastComponent();
    ~EqualLastComponent();

    bool operator()(std::string, std::string) const;
};

webmlmd::dirs::EqualLastComponent::EqualLastComponent()
{
}

webmlmd::dirs::EqualLastComponent::~EqualLastComponent()
{
}

bool webmlmd::dirs::EqualLastComponent::operator()(std::string a, std::string b) const
{
    std::string::iterator ab=a.begin(), ae=a.end(),
        bb=b.begin(), be=b.end();

    while (ab != ae && bb != be)
    {
        if (*--ae != *--be)
            return false;

        if (*ae == '/')
            return true;
    }

    return true;
}


webmlmd::dirs::dirs()
{
}

webmlmd::dirs::~dirs()
{
}


bool webmlmd::dirs::initialize(std::string colonpath)
{
    // Split the path into an array, first

    std::string::iterator b=colonpath.begin(), e=colonpath.end();
    std::string::iterator q=b;

    while(1)
    {
        if (b == e || *b == ':')
        {
            std::string dirname=std::string(q, b);

            if (dirname.size() > 0)
                push_back(dirname);

            if (b == e)
                break;

            q=++b;
            continue;
        }

        ++b;
    }

    if (size() == 0)
    {
        std::cerr << "Missing LISTS setting" << std::endl;
        return false;
    }

    // Check if two directories carry same last component

    std::sort(begin(), end(), webmlmd::dirs::OrderByLastComponent());

    std::vector<std::string>::iterator bb=begin(), ee=end();

    bb=std::adjacent_find(bb, ee, webmlmd::dirs::EqualLastComponent());

    if (bb != ee)
    {
        std::cerr <<
            "Two directories cannot have the same last component:"
              << std::endl
              << "  " << *bb << std::endl
              << "  " << bb[1] << std::endl;
        return false;
    }

    // Verify that all directories exist, and owned by same uid and gid
    // If I'm root, drop root

    std::sort(begin(), end(), webmlmd::dirs::OrderByListName());
    // Final order -- by list name

    bb=begin();

    while (bb != ee)
    {
        struct stat stat_buf;

        if (stat(bb->c_str(), &stat_buf) < 0)
        {
            perror(bb->c_str());
            return false;
        }

        if (stat_buf.st_uid == 0)
        {
            std::cerr << *bb << ": is owned by root!"
                  << std::endl;
            return false;
        }

        if (geteuid() == 0)
            libmail_changeuidgid(stat_buf.st_uid,
                         stat_buf.st_gid);

        if (geteuid() != stat_buf.st_uid ||
            getegid() != stat_buf.st_gid)
        {
            std::cerr << "My uid/gid does not match "
                  << *b << "'s"
                  << std::endl;
            return false;
        }
        ++bb;
    }
    return true;
}
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.1757 seconds