X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Finc.c;h=72c79b70f9b615d4c410d591f1af4b595b34f0a3;hb=363d8b056113f4a54e84149977eac95505e38d59;hp=1dcba6a57cdbd642e8eb9bf2ce28d7203ab411e8;hpb=a395a8839181b9895fdd0cafdb40be35675ced48;p=mmh diff --git a/uip/inc.c b/uip/inc.c index 1dcba6a..72c79b7 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -30,11 +30,8 @@ #include #include -#ifdef POP -# include -# include -#endif - +#include +#include #include #include #include @@ -43,12 +40,6 @@ #include #include -#ifndef POP -# define POPminc(a) (a) -#else -# define POPminc(a) 0 -#endif - #ifndef CYRUS_SASL # define SASLminc(a) (a) #else @@ -71,15 +62,15 @@ static struct swit switches[] = { #define FMTSW 6 { "format string", 5 }, #define HOSTSW 7 - { "host hostname", POPminc (-4) }, + { "host hostname", 0 }, #define USERSW 8 - { "user username", POPminc (-4) }, + { "user username", 0 }, #define PACKSW 9 - { "pack file", POPminc (-4) }, + { "pack file", 0}, #define NPACKSW 10 - { "nopack", POPminc (-6) }, + { "nopack", 0 }, #define PORTSW 11 - { "port name/number", POPminc (-4) }, + { "port name/number", 0 }, #define SILSW 12 { "silent", 0 }, #define NSILSW 13 @@ -101,7 +92,7 @@ static struct swit switches[] = { #define SASLMECHSW 21 { "saslmech", SASLminc(-8) }, #define PROXYSW 22 - { "proxy command", POPminc(-5) }, + { "proxy command", 0 }, { NULL, 0 } }; @@ -119,7 +110,6 @@ static struct Maildir_entry { static int num_maildir_entries = 0; static int snoop = 0; -#ifdef POP extern char response[]; static int size; @@ -127,7 +117,6 @@ static long pos; static int mbx_style = MMDF_FORMAT; static int pd = NOTOK; -#endif /* POP */ static long start; static long stop; @@ -139,13 +128,9 @@ static FILE *pf = NULL; * privilege ops into macros. * *GROUPPRIVS() is related to handling the setgid MAIL property, * and only applies if MAILGROUP is defined. - * *USERPRIVS() is related to handling the setuid root property, - * and only applies if POP is defined [why does POP => setuid root?] * Basically, SAVEGROUPPRIVS() is called right at the top of main() * to initialise things, and then DROPGROUPPRIVS() and GETGROUPPRIVS() - * do the obvious thing. TRYDROPGROUPPRIVS() has to be safe to call - * before DROPUSERPRIVS() is called [this is needed because setgid() - * sets both effective and real uids if euid is root.] + * do the obvious thing. * * There's probably a better implementation if we're allowed to use * BSD-style setreuid() rather than using POSIX saved-ids. @@ -162,15 +147,7 @@ static FILE *pf = NULL; */ #ifdef MAILGROUP static int return_gid; -#ifndef POP -/* easy case; we're not setuid root, so can drop group privs - * immediately. - */ #define TRYDROPGROUPPRIVS() DROPGROUPPRIVS() -#else /* POP ie we are setuid root */ -#define TRYDROPGROUPPRIVS() \ -if (geteuid() != 0) DROPGROUPPRIVS() -#endif #define DROPGROUPPRIVS() setgid(getgid()) #define GETGROUPPRIVS() setgid(return_gid) #define SAVEGROUPPRIVS() return_gid = getegid() @@ -193,11 +170,9 @@ static FILE *in; char *map_name(char *); static void inc_done(int) NORETURN; -#ifdef POP static int pop_action(char *); static int pop_pack(char *); static int map_count(void); -#endif int maildir_srt(const void *va, const void *vb) @@ -227,14 +202,12 @@ main (int argc, char **argv) struct msgs *mp = NULL; struct stat st, s1; FILE *aud = NULL; - char b[MAXPATHLEN + 1]; + char b[PATH_MAX + 1]; char *maildir_copy = NULL; /* copy of mail directory because the static gets overwritten */ -#ifdef POP int nmsgs, nbytes; char *pass = NULL; char *MAILHOST_env_variable; -#endif done=inc_done; @@ -256,7 +229,6 @@ main (int argc, char **argv) arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; -#ifdef POP /* * Scheme is: * use MAILHOST environment variable if present, @@ -273,10 +245,6 @@ main (int argc, char **argv) if (pophost && *pophost) host = pophost; - if ((cp = getenv ("MHPOPDEBUG")) && *cp) - snoop++; -#endif /* POP */ - while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -289,10 +257,10 @@ main (int argc, char **argv) case HELPSW: snprintf (buf, sizeof(buf), "%s [+folder] [switches]", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case AUDSW: if (!(cp = *argp++) || *cp == '-') @@ -377,18 +345,11 @@ main (int argc, char **argv) continue; case PACKSW: -#ifndef POP - if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); -#else /* POP */ if (!(packfile = *argp++) || *packfile == '-') adios (NULL, "missing argument to %s", argp[-2]); -#endif /* POP */ continue; case NPACKSW: -#ifdef POP packfile = NULL; -#endif /* POP */ continue; case SNOOPSW: @@ -422,10 +383,8 @@ main (int argc, char **argv) /* NOTE: above this point you should use TRYDROPGROUPPRIVS(), * not DROPGROUPPRIVS(). */ -#ifdef POP if (host && !*host) host = NULL; -#endif /* POP */ /* guarantee dropping group priveleges; we might not have done so earlier */ DROPGROUPPRIVS(); @@ -435,14 +394,11 @@ main (int argc, char **argv) */ if (from) inc_type = INC_FILE; -#ifdef POP else if (host) inc_type = INC_POP; -#endif else inc_type = INC_FILE; -#ifdef POP /* * Are we getting the mail from * a POP server? @@ -471,7 +427,6 @@ main (int argc, char **argv) adios (NULL, "no mail to incorporate"); } } -#endif /* POP */ /* * We will get the mail from a file @@ -546,11 +501,9 @@ main (int argc, char **argv) newmail = cp; } -#ifdef POP /* skip the folder setup */ if ((inc_type == INC_POP) && packfile) goto go_to_it; -#endif /* POP */ if (!context_find ("path")) free (path ("./", TFOLDER)); @@ -578,9 +531,7 @@ main (int argc, char **argv) if (!(mp = folder_read (folder))) adios (NULL, "unable to read folder %s", folder); -#ifdef POP go_to_it: -#endif /* POP */ if (inc_type == INC_FILE && Maildir == NULL) { if (access (newmail, W_OK) != NOTOK) { @@ -617,15 +568,10 @@ go_to_it: else if (i == NOTOK) chmod (audfile, m_gmprot ()); -#ifdef POP fprintf (aud, from ? "<> %s -ms %s\n" : host ? "<> %s -host %s -user %s\n" : "<> %s\n", dtimenow (0), from ? from : host, user); -#else /* POP */ - fprintf (aud, from ? "<> %s -ms %s\n" : "<> %s\n", - dtimenow (0), from); -#endif /* POP */ } /* Get new format string */ @@ -636,7 +582,6 @@ go_to_it: fflush (stdout); } -#ifdef POP /* * Get the mail from a POP server */ @@ -765,7 +710,6 @@ go_to_it: pd = NOTOK; } } -#endif /* POP */ /* * Get the mail from file (usually mail spool) @@ -968,10 +912,8 @@ go_to_it: if (noisy) fflush (stdout); -#ifdef POP if ((inc_type == INC_POP) && packfile) done (0); -#endif /* POP */ /* * truncate file we are incorporating from @@ -1064,10 +1006,8 @@ cpymsg (FILE *in, FILE *out) static void inc_done (int status) { -#ifdef POP if (packfile && pd != NOTOK) mbx_close (packfile, pd); -#endif /* POP */ if (locked) { GETGROUPPRIVS(); @@ -1077,7 +1017,6 @@ inc_done (int status) exit (status); } -#ifdef POP static int pop_action (char *s) { @@ -1121,4 +1060,3 @@ map_count (void) close (md); return (d.d_id); } -#endif /* POP */