|
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.4 GB of 70.42 GB (34.65%) |
|
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/
maildir/
- drwxrwxrwx
|
Viewing file: maildirpurgetmp.c (2.13 KB) -rw-rw-rw-Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
/* ** Copyright 2000-2003 Double Precision, Inc. ** See COPYING for distribution information. */
#if HAVE_CONFIG_H #include "config.h" #endif #include "maildirquota.h"
#include <sys/types.h> #if HAVE_DIRENT_H #include <dirent.h> #define NAMLEN(dirent) strlen((dirent)->d_name) #else #define dirent direct #define NAMLEN(dirent) (dirent)->d_namlen #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 #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <stdlib.h> #include <time.h> #if HAVE_UNISTD_H #include <unistd.h> #endif
#include "maildirmisc.h"
static void dopurge(const char *m, unsigned nage, int *nfiles, long *nbytes) { time_t current_time; DIR *dirp; struct dirent *de;
time (¤t_time); dirp=opendir(m); *nfiles=0; *nbytes=0;
while (dirp && (de=readdir(dirp)) != 0) { char *z; struct stat stat_buf;
if (de->d_name[0] == '.') continue; z=malloc(strlen(m)+strlen(de->d_name)+2); if (!z) continue;
strcat(strcat(strcpy(z, m), "/"), de->d_name);
if (stat(z, &stat_buf) == 0 && stat_buf.st_ctime < current_time - nage) { if (maildirquota_countfile(de->d_name)) { ++ *nfiles; *nbytes += stat_buf.st_size; } unlink(z); } free(z); } if (dirp) closedir(dirp); }
void maildir_purgetmp(const char *maildir) { char *m=malloc(strlen(maildir)+sizeof("/tmp")); int nfiles; long nbytes;
if (!m) return; strcat(strcpy(m, maildir), "/tmp"); dopurge(m, 60 * 60 * 36, &nfiles, &nbytes); free(m); }
void maildir_purge(const char *maildir, unsigned nage) { char *m=malloc(strlen(maildir)+sizeof("/cur")); char *p; int adjustquota; int nfiles; long nbytes;
int nfiles2; long nbytes2;
p=strrchr(maildir, '/'); if (p) ++p; else p=".";
adjustquota=maildirquota_countfolder(p);
if (!m) return; strcat(strcpy(m, maildir), "/cur"); dopurge(m, nage, &nfiles, &nbytes); strcat(strcpy(m, maildir), "/new"); dopurge(m, nage, &nfiles2, &nbytes2); free(m);
nfiles += nfiles2; nbytes += nbytes2;
if (adjustquota && nfiles > 0) maildir_quota_deleted(maildir, -nbytes, -nfiles); }
|