10 date 95.12.07.00.01.25; author jromine; state Exp;
15 date 93.08.25.17.28.16; author jromine; state Exp;
20 date 92.12.15.00.20.22; author jromine; state Exp;
25 date 92.12.11.19.00.32; author jromine; state Exp;
30 date 92.12.11.18.26.10; author jromine; state Exp;
35 date 92.11.25.04.20.30; author jromine; state Exp;
40 date 92.11.11.23.10.37; author jromine; state Exp;
45 date 92.11.04.01.03.18; author jromine; state Exp;
50 date 92.10.27.16.43.48; author jromine; state Exp;
55 date 92.10.26.16.47.04; author jromine; state Exp;
60 date 92.02.15.00.53.47; author jromine; state Exp;
65 date 92.02.12.17.18.19; author jromine; state Exp;
70 date 92.02.03.18.12.31; author jromine; state Exp;
75 date 92.02.03.17.57.22; author jromine; state Exp;
80 date 92.01.31.22.27.43; author jromine; state Exp;
85 date 92.01.30.00.06.00; author jromine; state Exp;
90 date 91.01.10.14.39.00; author mh; state Exp;
95 date 90.04.05.14.58.46; author sources; state Exp;
100 date 90.03.21.16.22.43; author sources; state Exp;
105 date 90.03.19.15.41.29; author sources; state Exp;
110 date 90.03.19.15.37.13; author sources; state Exp;
115 date 90.02.06.13.31.25; author sources; state Exp;
120 date 90.02.05.15.02.49; author sources; state Exp;
125 date 89.11.17.16.13.22; author sources; state Exp;
130 date 89.11.17.16.10.30; author sources; state Exp;
144 @/* slocal.c - MH style mailer to write to a local user's mailbox */
146 static char ident[] = "@@(#)$Id: slocal.c,v 1.24 1993/08/25 17:28:16 jromine Exp jromine $";
149 /* This program implements mail delivery in the MH/MMDF style.
151 Under SendMail, users should add the line
153 "| /usr/local/lib/mh/slocal"
155 to their $HOME/.forward file.
157 Under MMDF-I, users should (symbolically) link /usr/local/lib/mh/slocal
158 to $HOME/bin/rcvmail.
160 Under stand-alone MH, post will automatically run this during local
163 This program should be used ONLY if you have "mts sendmail" or "mts mh"
164 or "mts mmdf1" set in your MH configuration.
170 #include "../h/dropsbr.h"
171 #include "../h/rcvmail.h"
172 #include "../zotnet/tws.h"
173 #include "../zotnet/mts.h"
178 #include <sys/ioctl.h>
179 #endif /* NOIOCTLH */
181 #include <sys/stat.h>
190 #undef DBM /* used by ndbm.h */
193 #include <sys/types.h>
194 #include <sys/file.h>
201 #if defined(LOCKF) && !defined(F_ULOCK)
202 #include <sys/fcntl.h>
212 static struct swit switches[] = {
224 "home directory", -4,
229 "maildelivery file", 0,
247 static int debug = 0;
248 static int globbed = 0;
249 static int parsed = 0;
250 static int utmped = 0;
251 static int verbose = 0;
253 static char *addr = NULLCP;
254 static char *user = NULLCP;
255 static char *info = NULLCP;
256 static char *file = NULLCP;
257 static char *sender = NULLCP;
258 static char *unixfrom = NULLCP;
259 static char *mbox = NULLCP;
260 static char *home = NULLCP;
263 static struct passwd *pw;
266 static char ddate[BUFSIZ];
271 static jmp_buf myctx;
286 static struct pair *lookup ();
289 static struct pair hdrs[NVEC + 1] = {
290 "source", NULL, P_HID,
293 "Return-Path", NULL, P_ADR,
294 "Reply-To", NULL, P_ADR,
296 "Sender", NULL, P_ADR,
299 "Resent-Reply-To", NULL, P_ADR,
300 "Resent-From", NULL, P_ADR,
301 "Resent-Sender", NULL, P_ADR,
302 "Resent-To", NULL, P_ADR,
303 "Resent-cc", NULL, P_ADR,
309 static struct pair vars[] = {
310 "sender", NULL, P_NIL,
311 "address", NULL, P_NIL,
313 "reply-to", NULL, P_CHK,
321 extern char **environ;
323 static void adorn ();
324 static TYPESIG alrmser ();
330 struct passwd *getpwnam ();
333 static int localmail(), usr_delivery(), split(), parse(), logged_in();
334 static int timely(), usr_file(), usr_pipe(), copyfile();
335 static expand(), glob(), copyinfo();
341 main (argc, argv, envp)
357 setlocale(LC_ALL, "");
359 invo_name = r1bindex (*argv, '/');
361 mts_init (invo_name);
365 while (cp = *argp++) {
367 switch (smatch (++cp, switches)) {
369 ambigsw (cp, switches);
372 adios (NULLCP, "-%s unknown", cp);
374 (void) sprintf (buf, "%s [switches] [address info sender]",
376 help (buf, switches);
380 if (!(addr = *argp++))/* allow -xyz arguments */
381 adios (NULLCP, "missing argument to %s", argp[-2]);
384 if (!(info = *argp++))/* allow -xyz arguments */
385 adios (NULLCP, "missing argument to %s", argp[-2]);
388 if (!(user = *argp++))/* allow -xyz arguments */
389 adios (NULLCP, "missing argument to %s", argp[-2]);
392 if (!(file = *argp++) || *file == '-')
393 adios (NULLCP, "missing argument to %s", argp[-2]);
396 if (!(sender = *argp++))/* allow -xyz arguments */
397 adios (NULLCP, "missing argument to %s", argp[-2]);
400 if (!(mbox = *argp++) || *mbox == '-')
401 adios (NULLCP, "missing argument to %s", argp[-2]);
404 if (!(home = *argp++) || *home == '-')
405 adios (NULLCP, "missing argument to %s", argp[-2]);
409 if (!(cp = *argp++) || *cp == '-')
410 adios (NULLCP, "missing argument to %s", argp[-2]);
412 adios (NULLCP, "only one maildelivery file at a time!");
428 switch (argp - (argv + 1)) {
448 user = (cp = index (addr, '.')) ? ++cp : addr;
449 if ((pw = getpwnam (user)) == NULL)
450 adios (NULLCP, "no such local user as %s", user);
452 if (chdir (pw -> pw_dir) == NOTOK)
456 if (geteuid () == 0) {
458 (void) inigrp (pw -> pw_name, pw -> pw_gid);
460 (void) setgid (pw -> pw_gid);
462 (void) initgroups (pw -> pw_name, pw -> pw_gid);
464 (void) setuid (pw -> pw_uid);
470 setbuf (stdin, NULLCP);
473 if ((fd = copyfile (fileno (stdin), file = tmpfil, 1)) == NOTOK)
474 adios (NULLCP, "unable to create temporary file");
476 fprintf (stderr, "temporary file \"%s\" selected\n", tmpfil);
478 (void) unlink (tmpfil);
479 if ((fp = fdopen (fd, "r+")) == NULL)
480 adios (NULLCP, "unable to access temporary file");
491 (void) sprintf (mailbox, "%s/%s",
492 mmdfldir[0] ? mmdfldir : pw -> pw_dir,
493 mmdflfil[0] ? mmdflfil : pw -> pw_name);
499 if ((now = dtwstime ()) == NULL)
500 adios (NULLCP, "unable to ascertain local time");
501 (void) sprintf (ddate, "Delivery-Date: %s\n", dtimenow ());
504 fprintf (stderr, "addr=\"%s\" user=\"%s\" info=\"%s\" file=\"%s\"\n",
505 addr, user, info, file);
506 fprintf (stderr, "sender=\"%s\" mbox=\"%s\" home=\"%s\" from=\"%s\"\n",
507 sender, mbox, home, from);
508 fprintf (stderr, "ddate=\"%s\" now=%02d:%02d\n",
509 ddate, now -> tw_hour, now -> tw_min);
512 done (localmail (fd, from, mdlvr) != NOTOK ? RCV_MOK : RCV_MBX);
517 static int localmail (fd, from, mdlvr)
525 if (stat (".maildelivery.pag", &st) != NOTOK
526 && check_msgid (fd, ".maildelivery") == DONE)
530 if (usr_delivery (fd, mdlvr ? mdlvr : ".maildelivery", 0, from) != NOTOK)
533 if (usr_delivery (fd, maildelivery, 1, from) != NOTOK)
538 printf ("(invoking hook)\n");
539 if (usr_hook (fd, mbox) != NOTOK)
544 printf ("(trying normal delivery)\n");
545 return usr_file (fd, mbox, from);
550 #define matches(a,b) (stringdex (b, a) >= 0)
552 static int usr_delivery (fd, delivery, su, from)
573 register struct pair *p;
576 if ((fp = fopen (delivery, "r")) == NULL)
578 if (fstat (fileno (fp), &st) == NOTOK
579 || (st.st_uid != 0 && (su || st.st_uid != pw -> pw_uid))
580 || st.st_mode & 0022) {
582 printf ("%s: ownership/modes bad (%d, %d,%d,0%o)\n",
583 delivery, su, pw -> pw_uid, st.st_uid, st.st_mode);
584 (void) fflush (stdout);
591 while (fgets (buffer, sizeof buffer, fp) != NULL) {
594 if (cp = index (buffer, '\n'))
596 if ((vecp = split (buffer, vec)) < 5)
599 for (i = 0; vec[i]; i++)
600 fprintf (stderr, "vec[%d]: \"%s\"\n", i, vec[i]);
610 continue; /* if previous condition failed, don't
611 do this - else fall through */
615 continue; /* else fall */
631 if (uleq (vec[5], "select")) {
632 if (logged_in () != NOTOK)
634 if (vecp > 7 && timely (vec[6], vec[7]) == NOTOK)
644 if (uleq (field, "default")) {
651 if (!parsed && parse (fd) == NOTOK) {
655 if ((p = lookup (hdrs, field)) == NULL
656 || (p->p_value == NULL) /* XXX */
657 || !matches (p -> p_value, pattern)) {
668 if (!uleq (action, "qpipe"))
669 continue; /* else fall */
671 expand (tmpbuf, string, fd);
672 if (split (tmpbuf, vec) < 1)
674 status = usr_pipe (fd, tmpbuf, vec[0], vec);
678 if (!uleq (action, "pipe"))
679 continue; /* else fall */
683 expand (tmpbuf, string, fd);
686 status = usr_pipe (fd, tmpbuf, "/bin/sh", vec + 2);
690 if (!uleq (action, "file"))
691 continue; /* else fall */
694 status = usr_file (fd, string, from); /* UUCP format? */
696 status = usr_file (fd, string, NULLCP);
701 if (!uleq (action, "mbox"))
703 status = usr_file (fd, string, NULLCP);
707 if (!uleq (action, "destroy"))
713 if (accept && status == OK)
718 return (won ? OK : NOTOK);
725 static int split (cp, vec)
732 for (i = 0, s = cp; i <= NVEC;) {
734 while (isspace (*s) || *s == ',')
740 for (vec[i++] = ++s; *s != 0 && *s != '"'; s++)
743 (void) strcpy (s - 1, s);
750 if (*s == QUOTE && *++s != '"')
754 while (*s != 0 && !isspace (*s) && *s != ',')
764 static int parse (fd)
775 register struct pair *p,
782 if ((fd1 = dup (fd)) == NOTOK)
784 if ((in = fdopen (fd1, "r")) == NULL) {
790 if (p = lookup (hdrs, "source"))
791 p -> p_value = getcpy (sender);
792 if (p = lookup (hdrs, "addr"))
793 p -> p_value = getcpy (addr);
795 for (i = 0, state = FLD;;) {
796 switch (state = m_getfld (state, name, field, sizeof field, in)) {
800 lp = add (field, NULLCP);
801 while (state == FLDPLUS) {
802 state = m_getfld (state, name, field, sizeof field, in);
803 lp = add (field, lp);
805 for (p = hdrs; p -> p_name; p++)
806 if (uleq (p -> p_name, name)) {
807 if (!(p -> p_flags & P_HID)) {
808 if (cp = p -> p_value)
809 if (p -> p_flags & P_ADR) {
810 dp = cp + strlen (cp) - 1;
813 cp = add (",\n\t", cp);
817 p -> p_value = add (lp, cp);
822 if (p -> p_name == NULL && i < NVEC) {
823 p -> p_name = getcpy (name);
825 p -> p_flags = P_NIL;
840 advise (NULLCP, "format error in message");
844 advise (NULLCP, "internal error");
852 if (p = lookup (vars, "reply-to")) {
853 if ((q = lookup (hdrs, "reply-to")) == NULL || q -> p_value == NULL)
854 q = lookup (hdrs, "from");
855 p -> p_value = getcpy (q ? q -> p_value : "");
856 p -> p_flags &= ~P_CHK;
858 fprintf (stderr, "vars[%d]: name=\"%s\" value=\"%s\"\n",
859 p - vars, p -> p_name, p -> p_value);
861 #define empty(s) ((s) ? (s) : "")
863 for (p = hdrs; p -> p_name; p++)
864 fprintf (stderr, "hdrs[%d]: name=\"%s\" value=\"%s\"\n",
865 p - hdrs, p -> p_name, empty(p -> p_value));
876 static expand (s1, s2, fd)
883 register struct pair *p;
889 if (c != '$' || *s2 != LPAREN)
892 for (cp = ++s2; *s2 && *s2 != RPAREN; s2++)
899 if (p = lookup (vars, cp)) {
900 if (!parsed && (p -> p_flags & P_CHK))
903 (void) strcpy (s1, p -> p_value);
917 register struct pair *p;
922 if (p = lookup (vars, "sender"))
923 p -> p_value = getcpy (sender);
924 if (p = lookup (vars, "address"))
925 p -> p_value = getcpy (addr);
926 if (p = lookup (vars, "size")) {
927 (void) sprintf (buffer, "%d",
928 fstat (fd, &st) != NOTOK ? (int) st.st_size : 0);
929 p -> p_value = getcpy (buffer);
931 if (p = lookup (vars, "info"))
932 p -> p_value = getcpy (info);
935 for (p = vars; p -> p_name; p++)
936 fprintf (stderr, "vars[%d]: name=\"%s\" value=\"%s\"\n",
937 p - vars, p -> p_name, p -> p_value);
942 static struct pair *lookup (pairs, key)
943 register struct pair *pairs;
948 for (; cp = pairs -> p_name; pairs++)
957 static int logged_in () {
964 if ((uf = fopen ("/etc/utmp", "r")) == NULL)
967 while (fread ((char *) &ut, sizeof ut, 1, uf) == 1)
968 if (ut.ut_name[0] != 0
969 && strncmp (user, ut.ut_name, sizeof ut.ut_name) == 0) {
973 return (utmped = DONE);
977 return (utmped = NOTOK);
981 static int timely (t1, t2)
985 #define check(t,a,b) if (t < a || t > b) return NOTOK
986 #define cmpar(h1,m1,h2,m2) if (h1 < h2 || (h1 == h2 && m1 < m2)) return OK
993 if (sscanf (t1, "%d:%d", &t1hours, &t1mins) != 2)
995 check (t1hours, 0, 23);
996 check (t1mins, 0, 59);
998 if (sscanf (t2, "%d:%d", &t2hours, &t2mins) != 2)
1000 check (t2hours, 0, 23);
1001 check (t2mins, 0, 59);
1003 cmpar (now -> tw_hour, now -> tw_min, t1hours, t1mins);
1004 cmpar (t2hours, t2mins, now -> tw_hour, now -> tw_min);
1011 static int usr_file (fd, mailbox, from)
1019 char buffer[BUFSIZ];
1022 printf ("\tdelivering to file \"%s\"", mailbox);
1023 if (from && *from) {
1026 printf (" (uucp style)");
1027 (void) sprintf (buffer, "%s%s", from, ddate);
1036 (void) fflush (stdout);
1038 if ((md = mbx_open (mailbox, pw -> pw_uid, pw -> pw_gid, m_gmprot ()))
1040 adorn ("", "unable to open:");
1044 (void) lseek (fd, (off_t)0, 0);
1045 if (mbx_copy (mailbox, md, fd, mapping, bp, verbose) == NOTOK) {
1046 adorn ("", "error writing to:");
1050 (void) mbx_close (mailbox, md);
1052 printf (", done.\n");
1053 (void) fflush (stdout);
1061 static int usr_hook (fd, mailbox)
1067 char receive[BUFSIZ],
1071 if ((fd = copyfile (fd, tmpfil, 0)) == NOTOK) {
1073 adorn ("unable to copy message; skipping hook\n");
1076 (void) chown (tmpfil, pw -> pw_uid, pw -> pw_gid);
1079 (void) sprintf (receive, "%s/.mh_receive", pw -> pw_dir);
1080 switch (access (receive, 01)) {
1082 (void) sprintf (receive, "%s/bin/rcvmail", pw -> pw_dir);
1083 if (access (receive, 01) == NOTOK) {
1084 (void) unlink (tmpfil);
1086 printf ("\tnot present\n");
1087 (void) fflush (stdout);
1092 vec[vecp++] = tmpfil;
1093 vec[vecp++] = sender;
1097 vec[vecp++] = tmpfil;
1098 vec[vecp++] = mailbox;
1101 vec[vecp++] = sender;
1104 vec[0] = r1bindex (receive, '/');
1107 i = usr_pipe (fd, "rcvmail", receive, vec);
1108 (void) unlink (tmpfil);
1116 static int usr_pipe (fd, cmd, pgm, vec)
1129 printf ("\tdelivering to pipe \"%s\"", cmd);
1130 (void) fflush (stdout);
1132 (void) lseek (fd, (off_t)0, 0);
1134 for (i = 0; (child_id = fork ()) == NOTOK && i < 5; i++)
1138 adorn ("fork", "unable to");
1143 (void) dup2 (fd, 0);
1144 (void) freopen ("/dev/null", "w", stdout);
1145 (void) freopen ("/dev/null", "w", stderr);
1147 (void) dup2 (fd, 3);
1150 if ((fd = open ("/dev/tty", 2)) != NOTOK) {
1151 (void) ioctl (fd, TIOCNOTTY, NULLCP);
1154 #endif /* TIOCNOTTY */
1156 (void) setpgrp (0, getpid ());
1160 (void) m_putenv ("USER", pw -> pw_name);
1161 (void) m_putenv ("HOME", pw -> pw_dir);
1162 (void) m_putenv ("SHELL", pw -> pw_shell);
1168 switch (setjmp (myctx)) {
1170 (void) signal (SIGALRM, alrmser);
1171 bytes = fstat (fd, &st) != NOTOK ? (int) st.st_size : 100;
1174 (void) alarm ((unsigned) (bytes * 60 + 300));
1176 status = pidwait (child_id, OK);
1180 if (status == RP_MOK || status == RP_OK)
1185 printf (", wins.\n");
1187 if ((status & 0xff00) == 0xff00)
1188 printf (", system error\n");
1190 (void) pidstatus (status, stdout, ", loses");
1191 (void) fflush (stdout);
1193 return (status == 0 ? OK : NOTOK);
1197 (void) kill (child_id, SIGKILL);
1199 (void) killpg (child_id, SIGKILL);
1202 printf (", timed-out; terminated\n");
1203 (void) fflush (stdout);
1214 static TYPESIG alrmser (i)
1217 longjmp (myctx, DONE);
1222 static copyinfo (fp, from)
1228 static char buffer[BUFSIZ];
1230 if (unixfrom) /* interface from copyfile */
1231 strcpy (from, unixfrom);
1232 else if (fgets (from, BUFSIZ, fp) == NULL)
1233 adios (NULLCP, "no message");
1235 if (strncmp (from, "From ", i = strlen ("From "))) {
1241 (void) strcpy (buffer, from + i);
1242 if (cp = index (buffer, '\n')) {
1252 for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--)
1263 static int copyfile (qd, tmpfil, fold)
1266 register char *tmpfil;
1272 char buffer[BUFSIZ];
1276 (void) strcpy (tmpfil, m_tmpfil (invo_name));
1277 if ((fd1 = creat (tmpfil, 0600)) == NOTOK)
1280 if ((fd1 = open (tmpfil, 2)) == NOTOK)
1284 while ((i = read (qd, buffer, sizeof buffer)) > 0)
1285 if (write (fd1, buffer, i) != i) {
1288 (void) unlink (tmpfil);
1293 (void) lseek (fd1, (off_t)0, 0);
1297 if ((fd2 = dup (qd)) == NOTOK) {
1301 if ((qfp = fdopen (fd2, "r")) == NULL) {
1307 if ((fd2 = dup (fd1)) == NOTOK) {
1309 (void) fclose (qfp);
1312 if ((ffp = fdopen (fd2, "r+")) == NULL) {
1315 (void) fclose (qfp);
1319 i = strlen ("From ");
1320 while (fgets (buffer, sizeof buffer, qfp)) {
1321 if (!strncmp (buffer, "From ", i))
1324 register char *fp, *cp, *hp, *ep;
1326 unixfrom = getcpy (buffer); /* save for later */
1328 continue; /* but don't put in file */
1330 hp = cp = index (fp = unixfrom + i, ' ');
1331 while (hp = index (++hp, 'r'))
1332 if (uprf (hp, "remote from")) {
1333 hp = rindex (hp, ' ');
1337 ep = rindex (++hp, '\n');
1338 sprintf (buffer, "Return-Path: %.*s!%.*s\n",
1343 sprintf (buffer, "Return-Path: %.*s\n",
1347 #ifdef notdef /* mbx_copy does this */
1352 fputs (buffer, ffp);
1355 (void) fclose (ffp);
1356 (void) fclose (qfp);
1361 (void) fclose (ffp);
1364 (void) fclose (qfp);
1367 (void) fclose (qfp);
1369 (void) lseek (fd1, (off_t)0, 0);
1378 static void adorn (what, fmt, a, b, c, d, e, f)
1388 char *cp = invo_name;
1395 advise (what, fmt, a, b, c, d, e, f);
1403 static int check_msgid (fd, file)
1417 if ((fd1 = dup (fd)) == NOTOK)
1419 if ((in = fdopen (fd1, "r")) == NULL) {
1425 for (state = FLD;;) {
1426 switch (state = m_getfld (state, name, buf, sizeof buf, in)) {
1430 if (!uleq (name, "Message-ID")) {
1431 while (state == FLDPLUS)
1432 state = m_getfld (state, name, buf, sizeof buf, in);
1436 cp = add (buf, NULLCP);
1437 while (state == FLDPLUS) {
1438 state = m_getfld (state, name, buf, sizeof buf, in);
1441 key.dsize = strlen (key.dptr = trimcpy (cp)) + 1;
1445 if ((db = dbm_open (file, O_RDWR | O_CREAT, 0600)) == NULL) {
1446 advise (file, "unable to perform dbm_open on");
1456 fl.l_type = F_WRLCK;
1460 if (fcntl (dbm_pagfno (db), F_SETLK, &fl) == -1) {
1461 advise (file, "unable to perform flock on");
1467 if (lockf (dbm_pagfno (db), F_LOCK) == NOTOK) {
1468 advise (file, "unable to perform lockf on");
1472 if (flock (dbm_pagfno (db), LOCK_EX) == NOTOK) {
1473 advise (file, "unable to perform flock on");
1479 value = dbm_fetch (db, key);
1480 if (value.dptr != NULL) {
1483 "Message-ID: %s already received on\n\tDate: %s",
1490 value.dsize = strlen (value.dptr =
1491 ddate + sizeof "Delivery-Date:") + 1;
1493 if (dbm_store (db, key, value, DBM_INSERT))
1494 advise (file, "possibly corrupt file");
1524 @off_t fixes for BSD44
1529 static char ident[] = "@@(#)$Id: slocal.c,v 1.23 1992/12/15 00:20:22 jromine Exp jromine $";
1533 p - hdrs, p -> p_name, p -> p_value);
1544 static char ident[] = "@@(#)$Id: slocal.c,v 1.22 1992/12/11 19:00:32 jromine Exp jromine $";
1550 (void) lseek (fd, 0L, 0);
1553 (void) lseek (fd, 0L, 0);
1556 (void) lseek (fd1, 0L, 0);
1559 (void) lseek (fd1, 0L, 0);
1565 @include sys/fcntl.h under LOCKF
1570 static char ident[] = "@@(#)$Id: slocal.c,v 1.21 1992/12/11 18:26:10 jromine Exp jromine $";
1611 @LOCKF (may not work on all systems)
1616 static char ident[] = "@@(#)$Id: slocal.c,v 1.20 1992/11/25 04:20:30 jromine Exp jromine $";
1623 @fixes from Stephen Gildea
1628 static char ident[] = "@@(#)$Id: slocal.c,v 1.19 1992/11/11 23:10:37 jromine Exp jromine $";
1637 @attempt to use FCNTL locking for MSGID under SVR4
1642 static char ident[] = "@@(#)$Id: slocal.c,v 1.18 1992/11/04 01:03:18 jromine Exp jromine $";
1645 #undef DBM /* used by ndbm.h */
1648 #include <sys/types.h>
1649 #include <sys/file.h>
1657 #if defined(SVR4) && defined(FCNTL)
1670 static char ident[] = "@@(#)$Id: slocal.c,v 1.17 1992/10/27 16:43:48 jromine Exp jromine $";
1683 static char ident[] = "@@(#)$Id: slocal.c,v 1.16 1992/10/26 16:47:04 jromine Exp jromine $";
1687 static int alrmser ();
1691 (void) putenv ("USER", pw -> pw_name);
1692 (void) putenv ("HOME", pw -> pw_dir);
1693 (void) putenv ("SHELL", pw -> pw_shell);
1696 static int alrmser (i)
1707 static char ident[] = "@@(#)$Id: slocal.c,v 1.15 1992/02/15 00:53:47 jromine Exp jromine $";
1710 static struct pair {
1712 #include <sys/stat.h>
1718 @fix for "From " lines
1723 static char ident[] = "@@(#)$Id: slocal.c,v 1.14 1992/02/12 17:18:19 jromine Exp jromine $";
1732 make -home invisible
1737 static char ident[] = "@@(#)$Id: slocal.c,v 1.13 1992/02/03 18:12:31 jromine Exp jromine $";
1750 static char ident[] = "@@(#)$Id: slocal.c,v 1.12 1992/02/03 17:57:22 jromine Exp jromine $";
1753 "home directory", 0,
1780 static char ident[] = "@@(#)$Id: slocal.c,v 1.11 1992/01/31 22:27:43 jromine Exp jromine $";
1795 static char ident[] = "@@(#)$Id: slocal.c,v 1.10 1992/01/30 00:06:00 jromine Exp jromine $";
1805 @fix from MTR re: slocal & SendMail
1810 static char ident[] = "@@(#)$Id: slocal.c,v 1.9 1991/01/10 14:39:00 mh Exp jromine $";
1826 for (vec[i++] = ++s; *s != NULL && *s != '"'; s++)
1832 while (*s != NULL && !isspace (*s) && *s != ',')
1844 if (ut.ut_name[0] != NULL
1862 @fix logic error in "?"/"A" result code
1867 static char ident[] = "@@(#)$Id: slocal.c,v 1.8 90/04/05 14:58:46 sources Exp Locker: mh $";
1880 static char ident[] = "@@(#)$Id:$";
1884 if (status == NOTOK) {
1895 @use "From_" format in usr_file if appropriate
1896 new "N" condition -- do this if prev condition succeeded
1910 if (usr_delivery (fd, mdlvr ? mdlvr : ".maildelivery", 0) != NOTOK)
1913 if (usr_delivery (fd, maildelivery, 1) != NOTOK)
1916 static int usr_delivery (fd, delivery, su)
1927 || !matches (p -> p_value, pattern))
1931 status = usr_file (fd, string, NULLCP);
1937 @do some Return-Path stuff
1946 char *fp, *cp, *hp, *ep;
1958 if (fgets (from, BUFSIZ, fp) == NULL)
1968 @*** empty log message ***
1973 struct pair *lookup ();