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:25.74 GB of 70.42 GB (36.55%)
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/ numlib/ - drwxrwxrwx

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

#if    HAVE_CONFIG_H
#include    "config.h"
#endif
#include    <sys/types.h>
#if    HAVE_UNISTD_H
#include    <unistd.h>
#endif
#include    <stdio.h>
#include    <stdlib.h>
#include    <string.h>
#include    <grp.h>
#include    <pwd.h>
#include    <errno.h>

#include    "numlib.h"


void libmail_changegroup(gid_t gid)
{
    if ( setgid(gid))
    {
        perror("setgid");
        exit(1);
    }

#if HAVE_SETGROUPS
    if ( getuid() == 0 && setgroups(1, &gid) )
    {
        perror("setgroups");
        exit(1);
    }
#endif
}

void libmail_changeuidgid(uid_t uid, gid_t gid)
{
    libmail_changegroup(gid);
    if ( setuid(uid))
    {
        perror("setuid");
        exit(1);
    }
}

void libmail_changeusername(const char *uname, const gid_t *forcegrp)
{
struct passwd *pw;
uid_t    changeuid;
gid_t    changegid;

/* uname might be a pointer returned from a previous called to getpw(),
** and libc has a problem getting it back.
*/
char    *p=malloc(strlen(uname)+1);

    if (!p)
    {
        perror("malloc");
        exit(1);
    }
    strcpy(p, uname);

    errno=ENOENT;
    if ((pw=getpwnam(p)) == 0)
    {
        free(p);
        perror("getpwnam");
        exit(1);
    }
    free(p);

    changeuid=pw->pw_uid;

    if ( !forcegrp )    forcegrp= &pw->pw_gid;

    changegid= *forcegrp;

    if ( setgid( changegid ))
    {
        perror("setgid");
        exit(1);
    }

#if HAVE_INITGROUPS
    if ( getuid() == 0 && initgroups(pw->pw_name, changegid) )
    {
        perror("initgroups");
        exit(1);
    }
#else
#if HAVE_SETGROUPS
    if ( getuid() == 0 && setgroups(1, &changegid) )
    {
        perror("setgroups");
        exit(1);
    }
#endif
#endif

    if (setuid(changeuid))
    {
        perror("setuid");
        exit(1);
    }
}
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.3185 seconds