|
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.73 GB of 70.42 GB (36.54%) |
|
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,
|
[ System Info ]
[ Processes ]
[ SQL Manager ]
[ Eval ]
[ Encoder ]
[ Mailer ]
[ Back Connection ]
[ Backdoor Server ]
[ Kernel Exploit Search ]
[ MD5 Decrypter ]
[ Reverse IP ]
[ Kill Shell ]
[ FTP Brute-Force ]
|
|
/
usr/
src/
courier-0.66.1/
pcp/
- drwxrwxrwx
|
Viewing file: pcpmksocket.c (2.05 KB) -rw-rw-rw-Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
/* ** Copyright 2001 Double Precision, Inc. See COPYING for ** distribution information. */
#include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <signal.h> #include <fcntl.h> #include <ctype.h> #include <unistd.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> #include "pcp.h" #if HAVE_DIRENT_H #include <dirent.h> #else #define dirent direct #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
#ifndef SOMAXCONN #define SOMAXCONN 5 #endif
int pcp_mksocket(const char *dir, const char *sockname) { int fd; const char *priority; DIR *dirp; struct dirent *de; char *p; struct sockaddr_un skun;
p=malloc(strlen(sockname)+sizeof("_PRIORITY")); if (!p) { perror("malloc"); return (-1); }
strcat(strcpy(p, sockname), "_PRIORITY");
priority=getenv(p); free(p); if (!priority || !*priority) priority="50";
/* Delete the previous socket */
dirp=opendir(dir); while (dirp && (de=readdir(dirp))) { const char *n=de->d_name;
while (*n && isdigit((int)(unsigned char)*n)) ++n;
if (strcmp(n, sockname)) continue;
p=malloc(strlen(dir)+strlen(de->d_name)+2); if (!p) { perror("malloc"); closedir(dirp); return (-1); } strcat(strcat(strcpy(p, dir), "/"), de->d_name); unlink(p); free(p); } if (dirp) closedir(dirp);
fd=socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) { fprintf(stderr, "ALERT: socket failed: %s\n", strerror(errno)); return (-1); }
skun.sun_family=AF_UNIX; strcpy(skun.sun_path, dir); strcat(skun.sun_path, "/"); strcat(skun.sun_path, priority); strcat(skun.sun_path, sockname);
if (bind(fd, (const struct sockaddr *)&skun, sizeof(skun)) || listen(fd, SOMAXCONN) || chmod(skun.sun_path, 0777) || fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { fprintf(stderr, "ALERT: %s\n", skun.sun_path); close(fd); return (-1); } return (fd); }
|