|
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.04 GB of 70.42 GB (34.14%) |
|
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/
courier/
- drwxrwxrwx
|
Viewing file: cmlmarchive.C (1.8 KB) -rw-rw-rw-Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
/* ** Copyright 2000-2007 Double Precision, Inc. ** See COPYING for distribution information. */
#include "config.h" #include "cmlm.h" #include "cmlmarchive.h" #include "numlib/numlib.h" #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <fcntl.h> #include <errno.h> #include <sysexits.h>
#include <sstream>
Archive::Archive(): ExclusiveLock(MSGLOCKFILE) { }
Archive::~Archive() { }
int Archive::get_seq_no(unsigned long &nextseqno) { int seqnofd; char buf[100];
nextseqno=0;
if ( (seqnofd=open(SEQNO, O_RDWR)) < 0) { if (errno != ENOENT) { perror(SEQNO); return (EX_TEMPFAIL); } } else { int n;
n=read(seqnofd, buf, sizeof(buf)-1); if (n < 0) n=0; buf[n]=0; close(seqnofd); nextseqno=atol(buf); } seq_no=++nextseqno; return (0); }
int Archive::save_seq_no() { char buf[NUMBUFSIZE+1]; const char *p=strcat(libmail_str_off_t(seq_no, buf), "\n"); unsigned n=strlen(p); int seqnofd;
if ( (seqnofd=open(NEXTSEQNO, O_WRONLY|O_CREAT, 0644)) < 0) { perror(NEXTSEQNO); return (EX_TEMPFAIL); }
while (n) { int i=write(seqnofd, p, n);
if (i <= 0) { close(seqnofd); perror(NEXTSEQNO); return (EX_TEMPFAIL); } p += i; n -= i; } close(seqnofd); return (0); }
std::string Archive::filename(unsigned long n) { std::ostringstream o;
o << ARCHIVE "/" << n;
return o.str(); }
ArchiveList::ArchiveList():SharedLock(MSGLOCKFILE), dirp(opendir(ARCHIVE)) { }
ArchiveList::~ArchiveList() { if (dirp) closedir(dirp); }
int ArchiveList::Next(unsigned long &n) { struct dirent *de;
while (dirp && (de=readdir(dirp)) != 0) { if (de->d_name[0] == '.') continue; n=atol(de->d_name); return (0); } return (-1); }
std::string ArchiveList::Next() { std::string s; unsigned long n;
if ( Next(n) == 0) s= Archive::filename(n); return (s); }
|