Linux sagir-us1.hostever.us 5.14.0-570.51.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 8 09:41:34 EDT 2025 x86_64
LiteSpeed
Server IP : 104.247.108.91 & Your IP : 216.73.216.105
Domains : 74 Domain
User : georgeto
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
local /
apps /
lib /
imap /
lib /
Delete
Unzip
Name
Size
Permission
Date
Action
auth_ext.c
2.88
KB
-rw-r--r--
2023-01-11 06:22
auth_gss.c
14.25
KB
-rw-r--r--
2023-01-11 06:22
auth_log.c
3.42
KB
-rw-r--r--
2023-01-11 06:22
auth_md5.c
16.71
KB
-rw-r--r--
2023-01-11 06:22
auth_pla.c
4.32
KB
-rw-r--r--
2023-01-11 06:22
auths.c
88
B
-rw-r--r--
2023-01-11 06:22
big5.c
111.09
KB
-rw-r--r--
2023-01-11 06:22
ckp_1st.c
1.48
KB
-rw-r--r--
2023-01-11 06:22
ckp_2nd.c
888
B
-rw-r--r--
2023-01-11 06:22
ckp_3rd.c
816
B
-rw-r--r--
2023-01-11 06:22
ckp_a41.c
1.41
KB
-rw-r--r--
2023-01-11 06:22
ckp_afs.c
1.84
KB
-rw-r--r--
2023-01-11 06:22
ckp_bsi.c
1.38
KB
-rw-r--r--
2023-01-11 06:22
ckp_cyg.c
1.75
KB
-rw-r--r--
2023-01-11 06:22
ckp_dce.c
2.56
KB
-rw-r--r--
2023-01-11 06:22
ckp_gss.c
3.01
KB
-rw-r--r--
2023-01-11 06:22
ckp_nul.c
1.04
KB
-rw-r--r--
2023-01-11 06:22
ckp_os4.c
2.11
KB
-rw-r--r--
2023-01-11 06:22
ckp_pam.c
3.99
KB
-rw-r--r--
2023-01-11 06:22
ckp_pmb.c
3.82
KB
-rw-r--r--
2023-01-11 06:22
ckp_psx.c
3.6
KB
-rw-r--r--
2023-01-11 06:22
ckp_sce.c
1.58
KB
-rw-r--r--
2023-01-11 06:22
ckp_sec.c
1.54
KB
-rw-r--r--
2023-01-11 06:22
ckp_ssn.c
1.58
KB
-rw-r--r--
2023-01-11 06:22
ckp_std.c
1.16
KB
-rw-r--r--
2023-01-11 06:22
ckp_sv4.c
3.17
KB
-rw-r--r--
2023-01-11 06:22
ckp_svo.c
3.11
KB
-rw-r--r--
2023-01-11 06:22
ckp_ult.c
1.07
KB
-rw-r--r--
2023-01-11 06:22
cns11643.c
505.24
KB
-rw-r--r--
2023-01-11 06:22
crexcl.c
2.44
KB
-rw-r--r--
2023-01-11 06:22
crx_nfs.c
2.44
KB
-rw-r--r--
2023-01-11 06:22
crx_std.c
1.21
KB
-rw-r--r--
2023-01-11 06:22
decomtab.c
163.37
KB
-rw-r--r--
2023-01-11 06:22
dummy.c
24.66
KB
-rw-r--r--
2023-01-11 06:22
env_unix.c
61.15
KB
-rw-r--r--
2023-01-11 06:22
fdstring.c
2.76
KB
-rw-r--r--
2023-01-11 06:22
flockcyg.c
2.99
KB
-rw-r--r--
2023-01-11 06:22
flocklnx.c
2.27
KB
-rw-r--r--
2023-01-11 06:22
flocksim.c
28.21
KB
-rw-r--r--
2023-01-11 06:22
flstring.c
2.37
KB
-rw-r--r--
2023-01-11 06:22
fs_unix.c
1.84
KB
-rw-r--r--
2023-01-11 06:22
fsync.c
910
B
-rw-r--r--
2023-01-11 06:22
ftl_unix.c
1002
B
-rw-r--r--
2023-01-11 06:22
gb_12345.c
64.81
KB
-rw-r--r--
2023-01-11 06:22
gb_2312.c
179.47
KB
-rw-r--r--
2023-01-11 06:22
gethstid.c
975
B
-rw-r--r--
2023-01-11 06:22
getspnam.c
1.55
KB
-rw-r--r--
2023-01-11 06:22
gr_wait.c
1.27
KB
-rw-r--r--
2023-01-11 06:22
gr_wait4.c
1.06
KB
-rw-r--r--
2023-01-11 06:22
gr_waitp.c
1.06
KB
-rw-r--r--
2023-01-11 06:22
ibm.c
16.66
KB
-rw-r--r--
2023-01-11 06:22
imap4r1.c
193.18
KB
-rw-r--r--
2023-01-11 06:22
ip4_unix.c
5.13
KB
-rw-r--r--
2023-01-11 06:22
ip6_unix.c
8.54
KB
-rw-r--r--
2023-01-11 06:22
ip_unix.c
5.13
KB
-rw-r--r--
2023-01-11 06:22
ipo_unix.c
5.04
KB
-rw-r--r--
2023-01-11 06:22
iso_8859.c
13.88
KB
-rw-r--r--
2023-01-11 06:22
jis_0208.c
62.77
KB
-rw-r--r--
2023-01-11 06:22
jis_0212.c
55.8
KB
-rw-r--r--
2023-01-11 06:22
kerb_mit.c
3
KB
-rw-r--r--
2023-01-11 06:22
koi8_r.c
1.76
KB
-rw-r--r--
2023-01-11 06:22
koi8_u.c
1.77
KB
-rw-r--r--
2023-01-11 06:22
ksc_5601.c
178.16
KB
-rw-r--r--
2023-01-11 06:22
libc-client.a
3.91
MB
-rw-r--r--
2023-01-11 06:22
linkage.c
1.2
KB
-rw-r--r--
2023-01-11 06:22
log_bsi.c
1.54
KB
-rw-r--r--
2023-01-11 06:22
log_cyg.c
1.24
KB
-rw-r--r--
2023-01-11 06:22
log_old.c
1.01
KB
-rw-r--r--
2023-01-11 06:22
log_os4.c
1.62
KB
-rw-r--r--
2023-01-11 06:22
log_sec.c
1.14
KB
-rw-r--r--
2023-01-11 06:22
log_std.c
1.12
KB
-rw-r--r--
2023-01-11 06:22
log_sv4.c
1.1
KB
-rw-r--r--
2023-01-11 06:22
mail.c
201.99
KB
-rw-r--r--
2023-01-11 06:22
mbx.c
61.93
KB
-rw-r--r--
2023-01-11 06:22
memmove.c
993
B
-rw-r--r--
2023-01-11 06:22
memmove2.c
1.32
KB
-rw-r--r--
2023-01-11 06:22
memset.c
1010
B
-rw-r--r--
2023-01-11 06:22
mh.c
39.67
KB
-rw-r--r--
2023-01-11 06:22
misc.c
13.34
KB
-rw-r--r--
2023-01-11 06:22
mix.c
92.52
KB
-rw-r--r--
2023-01-11 06:22
mmdf.c
89.34
KB
-rw-r--r--
2023-01-11 06:22
mtx.c
45.09
KB
-rw-r--r--
2023-01-11 06:22
mx.c
39.05
KB
-rw-r--r--
2023-01-11 06:22
netmsg.c
2.88
KB
-rw-r--r--
2023-01-11 06:22
news.c
21.78
KB
-rw-r--r--
2023-01-11 06:22
newsrc.c
16.67
KB
-rw-r--r--
2023-01-11 06:22
nl_unix.c
2.56
KB
-rw-r--r--
2023-01-11 06:22
nntp.c
74.66
KB
-rw-r--r--
2023-01-11 06:22
opendir.c
1.94
KB
-rw-r--r--
2023-01-11 06:22
os_a32.c
1.44
KB
-rw-r--r--
2023-01-11 06:22
os_a41.c
1.53
KB
-rw-r--r--
2023-01-11 06:22
os_a52.c
1.57
KB
-rw-r--r--
2023-01-11 06:22
os_aix.c
1.5
KB
-rw-r--r--
2023-01-11 06:22
os_aos.c
1.5
KB
-rw-r--r--
2023-01-11 06:22
os_art.c
2.13
KB
-rw-r--r--
2023-01-11 06:22
os_asv.c
1.7
KB
-rw-r--r--
2023-01-11 06:22
os_aux.c
1.51
KB
-rw-r--r--
2023-01-11 06:22
os_bsd.c
1.5
KB
-rw-r--r--
2023-01-11 06:22
os_bsf.c
1.33
KB
-rw-r--r--
2023-01-11 06:22
os_bsi.c
1.33
KB
-rw-r--r--
2023-01-11 06:22
os_cvx.c
1.38
KB
-rw-r--r--
2023-01-11 06:22
os_cyg.c
1.61
KB
-rw-r--r--
2023-01-11 06:22
os_d-g.c
1.32
KB
-rw-r--r--
2023-01-11 06:22
os_do4.c
1.4
KB
-rw-r--r--
2023-01-11 06:22
os_drs.c
1.39
KB
-rw-r--r--
2023-01-11 06:22
os_dyn.c
1.53
KB
-rw-r--r--
2023-01-11 06:22
os_hpp.c
1.89
KB
-rw-r--r--
2023-01-11 06:22
os_isc.c
1.65
KB
-rw-r--r--
2023-01-11 06:22
os_lnx.c
1.35
KB
-rw-r--r--
2023-01-11 06:22
os_lyn.c
1.32
KB
-rw-r--r--
2023-01-11 06:22
os_mct.c
1.29
KB
-rw-r--r--
2023-01-11 06:22
os_mnt.c
1.3
KB
-rw-r--r--
2023-01-11 06:22
os_nto.c
1.84
KB
-rw-r--r--
2023-01-11 06:22
os_nxt.c
1.32
KB
-rw-r--r--
2023-01-11 06:22
os_os4.c
1.38
KB
-rw-r--r--
2023-01-11 06:22
os_osf.c
1.35
KB
-rw-r--r--
2023-01-11 06:22
os_osx.c
1.33
KB
-rw-r--r--
2023-01-11 06:22
os_ptx.c
2.88
KB
-rw-r--r--
2023-01-11 06:22
os_pyr.c
1.49
KB
-rw-r--r--
2023-01-11 06:22
os_qnx.c
1.87
KB
-rw-r--r--
2023-01-11 06:22
os_s40.c
1.58
KB
-rw-r--r--
2023-01-11 06:22
os_sc5.c
1.56
KB
-rw-r--r--
2023-01-11 06:22
os_sco.c
1.62
KB
-rw-r--r--
2023-01-11 06:22
os_sgi.c
1.38
KB
-rw-r--r--
2023-01-11 06:22
os_shp.c
1.94
KB
-rw-r--r--
2023-01-11 06:22
os_slx.c
1.43
KB
-rw-r--r--
2023-01-11 06:22
os_sol.c
1.67
KB
-rw-r--r--
2023-01-11 06:22
os_sos.c
1.39
KB
-rw-r--r--
2023-01-11 06:22
os_sua.c
1.33
KB
-rw-r--r--
2023-01-11 06:22
os_sun.c
1.58
KB
-rw-r--r--
2023-01-11 06:22
os_sv2.c
2.82
KB
-rw-r--r--
2023-01-11 06:22
os_sv4.c
1.6
KB
-rw-r--r--
2023-01-11 06:22
os_ult.c
1.27
KB
-rw-r--r--
2023-01-11 06:22
os_vu2.c
2.01
KB
-rw-r--r--
2023-01-11 06:22
osdep.c
32.49
KB
-rw-r--r--
2023-01-11 06:22
osdepbas.c
1.43
KB
-rw-r--r--
2023-01-11 06:22
osdepckp.c
3.6
KB
-rw-r--r--
2023-01-11 06:22
osdeplog.c
1.12
KB
-rw-r--r--
2023-01-11 06:22
osdepssl.c
26.33
KB
-rw-r--r--
2023-01-11 06:22
phile.c
16.28
KB
-rw-r--r--
2023-01-11 06:22
pmatch.c
2.77
KB
-rw-r--r--
2023-01-11 06:22
pop3.c
34.08
KB
-rw-r--r--
2023-01-11 06:22
pseudo.c
1.24
KB
-rw-r--r--
2023-01-11 06:22
rename.c
1.12
KB
-rw-r--r--
2023-01-11 06:22
rfc822.c
78.98
KB
-rw-r--r--
2023-01-11 06:22
scandir.c
2.61
KB
-rw-r--r--
2023-01-11 06:22
setpgrp.c
946
B
-rw-r--r--
2023-01-11 06:22
sig_bsd.c
954
B
-rw-r--r--
2023-01-11 06:22
sig_psx.c
1.3
KB
-rw-r--r--
2023-01-11 06:22
sig_sv4.c
955
B
-rw-r--r--
2023-01-11 06:22
siglocal.c
1.3
KB
-rw-r--r--
2023-01-11 06:22
smanager.c
3.54
KB
-rw-r--r--
2023-01-11 06:22
smtp.c
26.33
KB
-rw-r--r--
2023-01-11 06:22
ssl_none.c
2.57
KB
-rw-r--r--
2023-01-11 06:22
ssl_unix.c
26.33
KB
-rw-r--r--
2023-01-11 06:22
sslstdio.c
4.15
KB
-rw-r--r--
2023-01-11 06:22
strerror.c
981
B
-rw-r--r--
2023-01-11 06:22
strpbrk.c
1.1
KB
-rw-r--r--
2023-01-11 06:22
strstr.c
1.27
KB
-rw-r--r--
2023-01-11 06:22
strtok.c
2.02
KB
-rw-r--r--
2023-01-11 06:22
strtoul.c
2.33
KB
-rw-r--r--
2023-01-11 06:22
tcp_unix.c
31.52
KB
-rw-r--r--
2023-01-11 06:22
tenex.c
48.69
KB
-rw-r--r--
2023-01-11 06:22
tis_620.c
1.91
KB
-rw-r--r--
2023-01-11 06:22
tmap.c
84.45
KB
-rw-r--r--
2023-01-11 06:22
truncate.c
1.06
KB
-rw-r--r--
2023-01-11 06:22
tz_bsd.c
989
B
-rw-r--r--
2023-01-11 06:22
tz_nul.c
887
B
-rw-r--r--
2023-01-11 06:22
tz_sv4.c
1.02
KB
-rw-r--r--
2023-01-11 06:22
unix.c
92.97
KB
-rw-r--r--
2023-01-11 06:22
utf8.c
84
KB
-rw-r--r--
2023-01-11 06:22
utf8aux.c
14.12
KB
-rw-r--r--
2023-01-11 06:22
utime.c
1.22
KB
-rw-r--r--
2023-01-11 06:22
viscii.c
2.8
KB
-rw-r--r--
2023-01-11 06:22
widths.c
265.05
KB
-rw-r--r--
2023-01-11 06:22
windows.c
10.77
KB
-rw-r--r--
2023-01-11 06:22
write.c
1.74
KB
-rw-r--r--
2023-01-11 06:22
Save
Rename
/* ======================================================================== * Copyright 1988-2006 University of Washington * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * * ======================================================================== */ /* * Program: File routines * * Author: Mark Crispin * Networks and Distributed Computing * Computing & Communications * University of Washington * Administration Building, AG-44 * Seattle, WA 98195 * Internet: MRC@CAC.Washington.EDU * * Date: 25 August 1993 * Last Edited: 9 May 2006 */ #include <stdio.h> #include <ctype.h> #include <errno.h> extern int errno; /* just in case */ #include <signal.h> #include "mail.h" #include "osdep.h" #include <pwd.h> #include <sys/stat.h> #include <sys/time.h> #include "rfc822.h" #include "misc.h" #include "dummy.h" /* Types returned from phile_type() */ #define PTYPEBINARY 0 /* binary data */ #define PTYPETEXT 1 /* textual data */ #define PTYPECRTEXT 2 /* textual data with CR */ #define PTYPE8 4 /* textual 8bit data */ #define PTYPEISO2022JP 8 /* textual Japanese */ #define PTYPEISO2022KR 16 /* textual Korean */ #define PTYPEISO2022CN 32 /* textual Chinese */ /* PHILE I/O stream local data */ typedef struct phile_local { ENVELOPE *env; /* file envelope */ BODY *body; /* file body */ char tmp[MAILTMPLEN]; /* temporary buffer */ } PHILELOCAL; /* Convenient access to local data */ #define LOCAL ((PHILELOCAL *) stream->local) /* Function prototypes */ DRIVER *phile_valid (char *name); int phile_isvalid (char *name,char *tmp); void *phile_parameters (long function,void *value); void phile_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents); void phile_list (MAILSTREAM *stream,char *ref,char *pat); void phile_lsub (MAILSTREAM *stream,char *ref,char *pat); long phile_create (MAILSTREAM *stream,char *mailbox); long phile_delete (MAILSTREAM *stream,char *mailbox); long phile_rename (MAILSTREAM *stream,char *old,char *newname); long phile_status (MAILSTREAM *stream,char *mbx,long flags); MAILSTREAM *phile_open (MAILSTREAM *stream); int phile_type (unsigned char *s,unsigned long i,unsigned long *j); void phile_close (MAILSTREAM *stream,long options); ENVELOPE *phile_structure (MAILSTREAM *stream,unsigned long msgno,BODY **body, long flags); char *phile_header (MAILSTREAM *stream,unsigned long msgno, unsigned long *length,long flags); long phile_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs,long flags); long phile_ping (MAILSTREAM *stream); void phile_check (MAILSTREAM *stream); long phile_expunge (MAILSTREAM *stream,char *sequence,long options); long phile_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options); long phile_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data); /* File routines */ /* Driver dispatch used by MAIL */ DRIVER philedriver = { "phile", /* driver name */ /* driver flags */ DR_LOCAL|DR_READONLY|DR_NOSTICKY, (DRIVER *) NIL, /* next driver */ phile_valid, /* mailbox is valid for us */ phile_parameters, /* manipulate parameters */ phile_scan, /* scan mailboxes */ phile_list, /* list mailboxes */ phile_lsub, /* list subscribed mailboxes */ NIL, /* subscribe to mailbox */ NIL, /* unsubscribe from mailbox */ dummy_create, /* create mailbox */ dummy_delete, /* delete mailbox */ dummy_rename, /* rename mailbox */ phile_status, /* status of mailbox */ phile_open, /* open mailbox */ phile_close, /* close mailbox */ NIL, /* fetch message "fast" attributes */ NIL, /* fetch message flags */ NIL, /* fetch overview */ phile_structure, /* fetch message envelopes */ phile_header, /* fetch message header only */ phile_text, /* fetch message body only */ NIL, /* fetch partial message text */ NIL, /* unique identifier */ NIL, /* message number */ NIL, /* modify flags */ NIL, /* per-message modify flags */ NIL, /* search for message based on criteria */ NIL, /* sort messages */ NIL, /* thread messages */ phile_ping, /* ping mailbox to see if still alive */ phile_check, /* check for new messages */ phile_expunge, /* expunge deleted messages */ phile_copy, /* copy messages to another mailbox */ phile_append, /* append string message to mailbox */ NIL /* garbage collect stream */ }; /* prototype stream */ MAILSTREAM phileproto = {&philedriver}; /* File validate mailbox * Accepts: mailbox name * Returns: our driver if name is valid, NIL otherwise */ DRIVER *phile_valid (char *name) { char tmp[MAILTMPLEN]; return phile_isvalid (name,tmp) ? &philedriver : NIL; } /* File test for valid mailbox * Accepts: mailbox name * Returns: T if valid, NIL otherwise */ int phile_isvalid (char *name,char *tmp) { struct stat sbuf; char *s; /* INBOX never accepted, any other name is */ return ((s = mailboxfile (tmp,name)) && *s && !stat (s,&sbuf) && !(sbuf.st_mode & S_IFDIR) && /* only allow empty files if no empty proto or if #ftp */ (sbuf.st_size || !default_proto (T) || ((*name == '#') && ((name[1] == 'f') || (name[1] == 'F')) && ((name[2] == 't') || (name[2] == 'T')) && ((name[3] == 'p') || (name[3] == 'P')) && (name[4] == '/')))); } /* File manipulate driver parameters * Accepts: function code * function-dependent value * Returns: function-dependent return value */ void *phile_parameters (long function,void *value) { return NIL; } /* File mail scan mailboxes * Accepts: mail stream * reference * pattern to search * string to scan */ void phile_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents) { if (stream) dummy_scan (NIL,ref,pat,contents); } /* File list mailboxes * Accepts: mail stream * reference * pattern to search */ void phile_list (MAILSTREAM *stream,char *ref,char *pat) { if (stream) dummy_list (NIL,ref,pat); } /* File list subscribed mailboxes * Accepts: mail stream * reference * pattern to search */ void phile_lsub (MAILSTREAM *stream,char *ref,char *pat) { if (stream) dummy_lsub (NIL,ref,pat); } /* File status * Accepts: mail stream * mailbox name * status flags * Returns: T on success, NIL on failure */ long phile_status (MAILSTREAM *stream,char *mbx,long flags) { char *s,tmp[MAILTMPLEN]; MAILSTATUS status; struct stat sbuf; long ret = NIL; if ((s = mailboxfile (tmp,mbx)) && *s && !stat (s,&sbuf)) { status.flags = flags; /* return status values */ status.unseen = (stream && mail_elt (stream,1)->seen) ? 0 : 1; status.messages = status.recent = status.uidnext = 1; status.uidvalidity = sbuf.st_mtime; /* pass status to main program */ mm_status (stream,mbx,&status); ret = LONGT; /* success */ } return ret; } /* File open * Accepts: Stream to open * Returns: Stream on success, NIL on failure */ MAILSTREAM *phile_open (MAILSTREAM *stream) { int i,k,fd; unsigned long j,m; char *s,tmp[MAILTMPLEN]; struct passwd *pw; struct stat sbuf; struct tm *t; MESSAGECACHE *elt; SIZEDTEXT *buf; /* return prototype for OP_PROTOTYPE call */ if (!stream) return &phileproto; if (stream->local) fatal ("phile recycle stream"); /* open associated file */ if (!mailboxfile (tmp,stream->mailbox) || !tmp[0] || stat (tmp,&sbuf) || (fd = open (tmp,O_RDONLY,NIL)) < 0) { sprintf (tmp,"Unable to open file %s",stream->mailbox); mm_log (tmp,ERROR); return NIL; } fs_give ((void **) &stream->mailbox); stream->mailbox = cpystr (tmp); stream->local = fs_get (sizeof (PHILELOCAL)); mail_exists (stream,1); /* make sure upper level knows */ mail_recent (stream,1); elt = mail_elt (stream,1); /* instantiate cache element */ elt->valid = elt->recent = T; /* mark valid flags */ stream->sequence++; /* bump sequence number */ stream->rdonly = T; /* make sure upper level knows readonly */ /* instantiate a new envelope and body */ LOCAL->env = mail_newenvelope (); LOCAL->body = mail_newbody (); t = gmtime (&sbuf.st_mtime); /* get UTC time and Julian day */ i = t->tm_hour * 60 + t->tm_min; k = t->tm_yday; t = localtime(&sbuf.st_mtime);/* get local time */ /* calculate time delta */ i = t->tm_hour * 60 + t->tm_min - i; if (k = t->tm_yday - k) i += ((k < 0) == (abs (k) == 1)) ? -24*60 : 24*60; k = abs (i); /* time from UTC either way */ elt->hours = t->tm_hour; elt->minutes = t->tm_min; elt->seconds = t->tm_sec; elt->day = t->tm_mday; elt->month = t->tm_mon + 1; elt->year = t->tm_year - (BASEYEAR - 1900); elt->zoccident = (k == i) ? 0 : 1; elt->zhours = k/60; elt->zminutes = k % 60; sprintf (tmp,"%s, %d %s %d %02d:%02d:%02d %c%02d%02d", days[t->tm_wday],t->tm_mday,months[t->tm_mon],t->tm_year+1900, t->tm_hour,t->tm_min,t->tm_sec,elt->zoccident ? '-' : '+', elt->zhours,elt->zminutes); /* set up Date field */ LOCAL->env->date = cpystr (tmp); /* fill in From field from file owner */ LOCAL->env->from = mail_newaddr (); if (pw = getpwuid (sbuf.st_uid)) strcpy (tmp,pw->pw_name); else sprintf (tmp,"User-Number-%ld",(long) sbuf.st_uid); LOCAL->env->from->mailbox = cpystr (tmp); LOCAL->env->from->host = cpystr (mylocalhost ()); /* set subject to be mailbox name */ LOCAL->env->subject = cpystr (stream->mailbox); /* slurp the data */ (buf = &elt->private.special.text)->size = sbuf.st_size; read (fd,buf->data = (unsigned char *) fs_get (buf->size + 1),buf->size); buf->data[buf->size] = '\0'; close (fd); /* close the file */ /* analyze data type */ if (i = phile_type (buf->data,buf->size,&j)) { LOCAL->body->type = TYPETEXT; LOCAL->body->subtype = cpystr ("PLAIN"); if (!(i & PTYPECRTEXT)) { /* change Internet newline format as needed */ s = (char *) buf->data; /* make copy of UNIX-format string */ buf->data = NIL; /* zap the buffer */ buf->size = strcrlfcpy (&buf->data,&m,s,buf->size); fs_give ((void **) &s); /* flush original UNIX-format string */ } LOCAL->body->parameter = mail_newbody_parameter (); LOCAL->body->parameter->attribute = cpystr ("charset"); LOCAL->body->parameter->value = cpystr ((i & PTYPEISO2022JP) ? "ISO-2022-JP" : (i & PTYPEISO2022KR) ? "ISO-2022-KR" : (i & PTYPEISO2022CN) ? "ISO-2022-CN" : (i & PTYPE8) ? "X-UNKNOWN" : "US-ASCII"); LOCAL->body->encoding = (i & PTYPE8) ? ENC8BIT : ENC7BIT; LOCAL->body->size.lines = j; } else { /* binary data */ LOCAL->body->type = TYPEAPPLICATION; LOCAL->body->subtype = cpystr ("OCTET-STREAM"); LOCAL->body->parameter = mail_newbody_parameter (); LOCAL->body->parameter->attribute = cpystr ("name"); LOCAL->body->parameter->value = cpystr ((s = (strrchr (stream->mailbox,'/'))) ? s+1 : stream->mailbox); LOCAL->body->encoding = ENCBASE64; buf->data = rfc822_binary (s = (char *) buf->data,buf->size,&buf->size); fs_give ((void **) &s); /* flush originary binary contents */ } phile_header (stream,1,&j,NIL); LOCAL->body->size.bytes = LOCAL->body->contents.text.size = buf->size; elt->rfc822_size = j + buf->size; /* only one message ever... */ stream->uid_validity = sbuf.st_mtime; stream->uid_last = elt->private.uid = 1; return stream; /* return stream alive to caller */ } /* File determine data type * Accepts: data to examine * size of data * pointer to line count return * Returns: PTYPE mask of data type */ int phile_type (unsigned char *s,unsigned long i,unsigned long *j) { int ret = PTYPETEXT; char *charvec = "bbbbbbbaaalaacaabbbbbbbbbbbebbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; *j = 0; /* no lines */ /* check type of every character */ while (i--) switch (charvec[*s++]) { case 'A': ret |= PTYPE8; /* 8bit character */ break; case 'a': break; /* ASCII character */ case 'b': return PTYPEBINARY; /* binary byte seen, stop immediately */ case 'c': ret |= PTYPECRTEXT; /* CR indicates Internet text */ break; case 'e': /* ESC */ if (*s == '$') { /* ISO-2022 sequence? */ switch (s[1]) { case 'B': case '@': ret |= PTYPEISO2022JP; break; case ')': switch (s[2]) { case 'A': case 'E': case 'G': ret |= PTYPEISO2022CN; break; case 'C': ret |= PTYPEISO2022KR; break; } case '*': switch (s[2]) { case 'H': ret |= PTYPEISO2022CN; break; } case '+': switch (s[2]) { case 'I': case 'J': case 'K': case 'L': case 'M': ret |= PTYPEISO2022CN; break; } } } break; case 'l': /* newline */ (*j)++; break; } return ret; /* return type of data */ } /* File close * Accepts: MAIL stream * close options */ void phile_close (MAILSTREAM *stream,long options) { if (LOCAL) { /* only if a file is open */ fs_give ((void **) &mail_elt (stream,1)->private.special.text.data); /* nuke the local data */ fs_give ((void **) &stream->local); stream->dtb = NIL; /* log out the DTB */ } } /* File fetch structure * Accepts: MAIL stream * message # to fetch * pointer to return body * option flags * Returns: envelope of this message, body returned in body value * * Fetches the "fast" information as well */ ENVELOPE *phile_structure (MAILSTREAM *stream,unsigned long msgno,BODY **body, long flags) { if (body) *body = LOCAL->body; return LOCAL->env; /* return the envelope */ } /* File fetch message header * Accepts: MAIL stream * message # to fetch * pointer to returned header text length * option flags * Returns: message header in RFC822 format */ char *phile_header (MAILSTREAM *stream,unsigned long msgno, unsigned long *length,long flags) { rfc822_header (LOCAL->tmp,LOCAL->env,LOCAL->body); *length = strlen (LOCAL->tmp); return LOCAL->tmp; } /* File fetch message text (body only) * Accepts: MAIL stream * message # to fetch * pointer to returned stringstruct * option flags * Returns: T, always */ long phile_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs,long flags) { SIZEDTEXT *buf = &mail_elt (stream,msgno)->private.special.text; if (!(flags &FT_PEEK)) { /* mark message as seen */ mail_elt (stream,msgno)->seen = T; mm_flags (stream,msgno); } INIT (bs,mail_string,buf->data,buf->size); return T; } /* File ping mailbox * Accepts: MAIL stream * Returns: T if stream alive, else NIL * No-op for readonly files, since read/writer can expunge it from under us! */ long phile_ping (MAILSTREAM *stream) { return T; } /* File check mailbox * Accepts: MAIL stream * No-op for readonly files, since read/writer can expunge it from under us! */ void phile_check (MAILSTREAM *stream) { mm_log ("Check completed",NIL); } /* File expunge mailbox * Accepts: MAIL stream * sequence to expunge if non-NIL * expunge options * Returns: T if success, NIL if failure */ long phile_expunge (MAILSTREAM *stream,char *sequence,long options) { if (!stream->silent) mm_log ("Expunge ignored on readonly mailbox",NIL); return LONGT; } /* File copy message(s) * Accepts: MAIL stream * sequence * destination mailbox * copy options * Returns: T if copy successful, else NIL */ long phile_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options) { char tmp[MAILTMPLEN]; mailproxycopy_t pc = (mailproxycopy_t) mail_parameters (stream,GET_MAILPROXYCOPY,NIL); if (pc) return (*pc) (stream,sequence,mailbox,options); sprintf (tmp,"Can't copy - file \"%s\" is not in valid mailbox format", stream->mailbox); mm_log (tmp,ERROR); return NIL; } /* File append message from stringstruct * Accepts: MAIL stream * destination mailbox * append callback function * data for callback * Returns: T if append successful, else NIL */ long phile_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data) { char tmp[MAILTMPLEN],file[MAILTMPLEN]; char *s = mailboxfile (file,mailbox); if (s && *s) sprintf (tmp,"Can't append - not in valid mailbox format: %.80s",s); else sprintf (tmp,"Can't append - invalid name: %.80s",mailbox); mm_log (tmp,ERROR); return NIL; }