]>
diplodocus.org Git - nmh/blob - uip/inc.c
3 * inc.c -- incorporate messages from a maildrop into a folder
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
12 * Thu Feb 12 21:00 CST 2015 Marcin Cieslak <saper@saper.info>
13 * Replaced setgid() calls with setegid() so that it works with dot
14 * locking on FreeBSD. setegid() should be supported on modern POSIX
17 * Revised: Sat Apr 14 17:08:17 PDT 1990 (marvit@hplabs)
18 * Added hpux hacks to set and reset gid to be "mail" as needed. The reset
19 * is necessary so inc'ed mail is the group of the inc'er, rather than
20 * "mail". We setgid to egid only when [un]locking the mail file. This
21 * is also a major security precaution which will not be explained here.
23 * Fri Feb 7 16:04:57 PST 1992 John Romine <bug-mh@ics.uci.edu>
24 * NB: I'm not 100% sure that this setgid stuff is secure even now.
26 * See the *GROUPPRIVS() macros later. I'm reasonably happy with the setgid
27 * attribute. Running setuid root is probably not a terribly good idea, though.
28 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 04/1998
30 * Peter Maydell's patch slightly modified for nmh 0.28-pre2.
31 * Ruud de Rooij <ruud@debian.org> Wed, 22 Jul 1998 13:24:22 +0200
38 #include <h/dropsbr.h>
40 #include <h/fmt_scan.h>
41 #include <h/scansbr.h>
42 #include <h/signals.h>
47 # define SASLminc(a) (a)
49 # define SASLminc(a) 0
52 #define INC_SWITCHES \
53 X("audit audit-file", 0, AUDSW) \
54 X("noaudit", 0, NAUDSW) \
55 X("changecur", 0, CHGSW) \
56 X("nochangecur", 0, NCHGSW) \
57 X("file name", 0, FILESW) \
58 X("form formatfile", 0, FORMSW) \
59 X("format string", 5, FMTSW) \
60 X("host hostname", 0, HOSTSW) \
61 X("user username", 0, USERSW) \
62 X("pack file", 0, PACKSW) \
63 X("nopack", 0, NPACKSW) \
64 X("port name/number", 0, PORTSW) \
65 X("silent", 0, SILSW) \
66 X("nosilent", 0, NSILSW) \
67 X("truncate", 0, TRNCSW) \
68 X("notruncate", 0, NTRNCSW) \
69 X("width columns", 0, WIDTHSW) \
70 X("version", 0, VERSIONSW) \
71 X("help", 0, HELPSW) \
72 X("snoop", -5, SNOOPSW) \
73 X("sasl", SASLminc(-4), SASLSW) \
74 X("nosasl", SASLminc(-6), NOSASLSW) \
75 X("saslmech", SASLminc(-8), SASLMECHSW) \
76 X("proxy command", 0, PROXYSW) \
78 #define X(sw, minchars, id) id,
79 DEFINE_SWITCH_ENUM(INC
);
82 #define X(sw, minchars, id) { sw, minchars, id },
83 DEFINE_SWITCH_ARRAY(INC
, switches
);
87 * flags for the mail source
93 static struct Maildir_entry
{
97 static int num_maildir_entries
= 0;
100 extern char response
[];
105 static int mbx_style
= MMDF_FORMAT
;
106 static int pd
= NOTOK
;
111 static char *packfile
= NULL
;
112 static FILE *pf
= NULL
;
114 /* This is an attempt to simplify things by putting all the
115 * privilege ops into macros.
116 * *GROUPPRIVS() is related to handling the setgid MAIL property,
117 * and only applies if MAILGROUP is defined.
118 * Basically, SAVEGROUPPRIVS() is called right at the top of main()
119 * to initialise things, and then DROPGROUPPRIVS() and GETGROUPPRIVS()
120 * do the obvious thing.
122 * There's probably a better implementation if we're allowed to use
123 * BSD-style setreuid() rather than using POSIX saved-ids.
124 * Anyway, if you're euid root it's a bit pointless to drop the group
127 * I'm pretty happy that the security is good provided we aren't setuid root.
128 * The only things we trust with group=mail privilege are lkfopen()
133 * For setting and returning to "mail" gid
136 static gid_t return_gid
;
137 #define TRYDROPGROUPPRIVS() DROPGROUPPRIVS()
138 #define DROPGROUPPRIVS() \
139 if (setegid(getgid()) != 0) { \
140 adios ("setegid", "unable to restore group to %ld", (long) getgid()); \
142 #define GETGROUPPRIVS() \
143 if (setegid(return_gid) != 0) { \
144 adios ("setegid", "unable to set group to %ld", (long) return_gid); \
146 #define SAVEGROUPPRIVS() return_gid = getegid()
148 /* define *GROUPPRIVS() as null; this avoids having lots of "#ifdef MAILGROUP"s */
149 #define TRYDROPGROUPPRIVS()
150 #define DROPGROUPPRIVS()
151 #define GETGROUPPRIVS()
152 #define SAVEGROUPPRIVS()
153 #endif /* not MAILGROUP */
155 /* these variables have to be globals so that done() can correctly clean up the lockfile */
156 static int locked
= 0;
157 static char *newmail
;
163 char *map_name(char *);
165 static void inc_done(int) NORETURN
;
166 static int pop_action(char *);
167 static int pop_pack(char *);
168 static int map_count(void);
171 maildir_srt(const void *va
, const void *vb
)
173 const struct Maildir_entry
*a
= va
, *b
= vb
;
174 if (a
->mtime
> b
->mtime
)
176 else if (a
->mtime
< b
->mtime
)
183 main (int argc
, char **argv
)
185 int chgflag
= 1, trnflag
= 1;
186 int noisy
= 1, width
= -1;
187 int hghnum
= 0, msgnum
= 0;
189 int incerr
= 0; /* <0 if inc hits an error which means it should not truncate mailspool */
190 char *cp
, *maildir
= NULL
, *folder
= NULL
;
191 char *format
= NULL
, *form
= NULL
;
192 char *host
= NULL
, *port
= NULL
, *user
= NULL
, *proxy
= NULL
;
193 char *audfile
= NULL
, *from
= NULL
, *saslmech
= NULL
;
194 char buf
[BUFSIZ
], **argp
, *nfs
, **arguments
;
195 struct msgs
*mp
= NULL
;
198 char b
[PATH_MAX
+ 1];
199 char *maildir_copy
= NULL
; /* copy of mail directory because the static gets overwritten */
202 char *MAILHOST_env_variable
;
206 /* absolutely the first thing we do is save our privileges,
207 * and drop them if we can.
212 if (nmh_init(argv
[0], 1)) { return 1; }
214 mts_init (invo_name
);
215 arguments
= getarguments (invo_name
, argc
, argv
, 1);
220 * use MAILHOST environment variable if present,
222 * If that fails, use the default (if any)
223 * provided by mts.conf in mts_init()
225 if ((MAILHOST_env_variable
= getenv("MAILHOST")) != NULL
)
226 pophost
= MAILHOST_env_variable
;
228 * If there is a valid "pophost" entry in mts.conf,
229 * then use it as the default host.
231 if (pophost
&& *pophost
)
234 while ((cp
= *argp
++)) {
236 switch (smatch (++cp
, switches
)) {
238 ambigsw (cp
, switches
);
241 adios (NULL
, "-%s unknown", cp
);
244 snprintf (buf
, sizeof(buf
), "%s [+folder] [switches]", invo_name
);
245 print_help (buf
, switches
, 1);
248 print_version(invo_name
);
252 if (!(cp
= *argp
++) || *cp
== '-')
253 adios (NULL
, "missing argument to %s", argp
[-2]);
254 audfile
= getcpy (m_maildir (cp
));
268 * The flag `trnflag' has the value:
270 * 2 if -truncate is given
271 * 1 by default (truncating is default)
272 * 0 if -notruncate is given
282 if (!(cp
= *argp
++) || *cp
== '-')
283 adios (NULL
, "missing argument to %s", argp
[-2]);
284 from
= path (cp
, TFILE
);
287 * If the truncate file is in default state,
288 * change to not truncate.
302 if (!(form
= *argp
++) || *form
== '-')
303 adios (NULL
, "missing argument to %s", argp
[-2]);
307 if (!(format
= *argp
++) || *format
== '-')
308 adios (NULL
, "missing argument to %s", argp
[-2]);
313 if (!(cp
= *argp
++) || *cp
== '-')
314 adios (NULL
, "missing argument to %s", argp
[-2]);
319 if (!(host
= *argp
++) || *host
== '-')
320 adios (NULL
, "missing argument to %s", argp
[-2]);
324 if (!(port
= *argp
++) || *port
== '-')
325 adios (NULL
, "missing argument to %s", argp
[-2]);
329 if (!(user
= *argp
++) || *user
== '-')
330 adios (NULL
, "missing argument to %s", argp
[-2]);
334 if (!(packfile
= *argp
++) || *packfile
== '-')
335 adios (NULL
, "missing argument to %s", argp
[-2]);
353 if (!(saslmech
= *argp
++) || *saslmech
== '-')
354 adios (NULL
, "missing argument to %s", argp
[-2]);
357 if (!(proxy
= *argp
++) || *proxy
== '-')
358 adios (NULL
, "missing argument to %s", argp
[-2]);
362 if (*cp
== '+' || *cp
== '@') {
364 adios (NULL
, "only one folder at a time!");
366 folder
= pluspath (cp
);
368 adios (NULL
, "usage: %s [+folder] [switches]", invo_name
);
372 /* NOTE: above this point you should use TRYDROPGROUPPRIVS(),
373 * not DROPGROUPPRIVS().
378 /* guarantee dropping group priveleges; we might not have done so earlier */
382 * Where are we getting the new mail?
392 * Are we getting the mail from
395 if (inc_type
== INC_POP
) {
396 struct nmh_creds creds
= { 0, 0, 0 };
399 * initialize POP connection
401 nmh_get_credentials (host
, user
, sasl
, &creds
);
402 if (pop_init (host
, port
, creds
.user
, creds
.password
, proxy
, snoop
,
403 sasl
, saslmech
) == NOTOK
)
404 adios (NULL
, "%s", response
);
406 /* Check if there are any messages */
407 if (pop_stat (&nmsgs
, &nbytes
) == NOTOK
)
408 adios (NULL
, "%s", response
);
412 adios (NULL
, "no mail to incorporate");
417 * We will get the mail from a file
418 * (typically the standard maildrop)
421 if (inc_type
== INC_FILE
) {
424 else if ((newmail
= getenv ("MAILDROP")) && *newmail
)
425 newmail
= m_mailpath (newmail
);
426 else if ((newmail
= context_find ("maildrop")) && *newmail
)
427 newmail
= m_mailpath (newmail
);
429 newmail
= concat (MAILDIR
, "/", MAILFIL
, NULL
);
431 if (stat (newmail
, &s1
) == NOTOK
|| s1
.st_size
== 0)
432 adios (NULL
, "no mail to incorporate");
433 if (s1
.st_mode
& S_IFDIR
) {
439 cp
= concat (newmail
, "/new", NULL
);
440 if ((md
= opendir(cp
)) == NULL
)
441 adios (NULL
, "unable to open %s", cp
);
442 while ((de
= readdir (md
)) != NULL
) {
443 if (de
->d_name
[0] == '.')
445 if (i
>= num_maildir_entries
) {
446 if ((Maildir
= realloc(Maildir
, sizeof(*Maildir
) * (2*i
+16))) == NULL
)
447 adios(NULL
, "not enough memory for %d messages", 2*i
+16);
448 num_maildir_entries
= 2*i
+16;
450 Maildir
[i
].filename
= concat (cp
, "/", de
->d_name
, NULL
);
451 if (stat(Maildir
[i
].filename
, &ms
) != 0)
452 adios (Maildir
[i
].filename
, "couldn't get delivery time");
453 Maildir
[i
].mtime
= ms
.st_mtime
;
458 cp
= concat (newmail
, "/cur", NULL
);
459 if ((md
= opendir(cp
)) == NULL
)
460 adios (NULL
, "unable to open %s", cp
);
461 while ((de
= readdir (md
)) != NULL
) {
462 if (de
->d_name
[0] == '.')
464 if (i
>= num_maildir_entries
) {
465 if ((Maildir
= realloc(Maildir
, sizeof(*Maildir
) * (2*i
+16))) == NULL
)
466 adios(NULL
, "not enough memory for %d messages", 2*i
+16);
467 num_maildir_entries
= 2*i
+16;
469 Maildir
[i
].filename
= concat (cp
, "/", de
->d_name
, NULL
);
470 if (stat(Maildir
[i
].filename
, &ms
) != 0)
471 adios (Maildir
[i
].filename
, "couldn't get delivery time");
472 Maildir
[i
].mtime
= ms
.st_mtime
;
478 adios (NULL
, "no mail to incorporate");
479 num_maildir_entries
= i
;
480 qsort (Maildir
, num_maildir_entries
, sizeof(*Maildir
), maildir_srt
);
483 if ((cp
= strdup(newmail
)) == (char *)0)
484 adios (NULL
, "error allocating memory to copy newmail");
489 /* skip the folder setup */
490 if ((inc_type
== INC_POP
) && packfile
)
493 if (!context_find ("path"))
494 free (path ("./", TFOLDER
));
496 folder
= getfolder (0);
497 maildir
= m_maildir (folder
);
499 if ((maildir_copy
= strdup(maildir
)) == (char *)0)
500 adios (maildir
, "error allocating memory to copy maildir");
502 if (!folder_exists(maildir
)) {
503 /* If the folder doesn't exist, and we're given the -silent flag,
507 create_folder(maildir
, 0, done
);
512 if (chdir (maildir
) == NOTOK
)
513 adios (maildir
, "unable to change directory to");
515 /* read folder and create message structure */
516 if (!(mp
= folder_read (folder
, 0)))
517 adios (NULL
, "unable to read folder %s", folder
);
521 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
522 if (access (newmail
, W_OK
) != NOTOK
) {
525 SIGNAL (SIGHUP
, SIG_IGN
);
526 SIGNAL (SIGINT
, SIG_IGN
);
527 SIGNAL (SIGQUIT
, SIG_IGN
);
528 SIGNAL (SIGTERM
, SIG_IGN
);
531 GETGROUPPRIVS(); /* Reset gid to lock mail file */
532 in
= lkfopenspool (newmail
, "r");
535 adios (NULL
, "unable to lock and fopen %s", newmail
);
536 fstat (fileno(in
), &s1
);
539 if ((in
= fopen (newmail
, "r")) == NULL
)
540 adios (newmail
, "unable to read");
544 /* This shouldn't be necessary but it can't hurt. */
549 if ((i
= stat (audfile
, &st
)) == NOTOK
)
550 advise (NULL
, "Creating Receive-Audit: %s", audfile
);
551 if ((aud
= fopen (audfile
, "a")) == NULL
)
552 adios (audfile
, "unable to append to");
554 chmod (audfile
, m_gmprot ());
557 fprintf (aud
, "<<inc>> %s -ms %s\n", dtimenow(0), from
);
560 fprintf (aud
, "<<inc>> %s -host %s -user %s\n", dtimenow(0),
563 fprintf (aud
, "<<inc>> %s\n", dtimenow (0));
567 /* Get new format string */
568 nfs
= new_fs (form
, format
, FORMAT
);
571 printf ("Incorporating new mail into %s...\n\n", folder
);
577 * Get the mail from a POP server
579 if (inc_type
== INC_POP
) {
582 packfile
= path (packfile
, TFILE
);
583 if (stat (packfile
, &st
) == NOTOK
) {
585 adios (packfile
, "error on file");
586 cp
= concat ("Create file \"", packfile
, "\"? ", NULL
);
587 if (noisy
&& !read_yes_or_no_if_tty (cp
))
591 msgnum
= map_count ();
592 if ((pd
= mbx_open (packfile
, mbx_style
, getuid(), getgid(), m_gmprot()))
594 adios (packfile
, "unable to open");
595 if ((pf
= fdopen (pd
, "w+")) == NULL
)
596 adios (NULL
, "unable to fdopen %s", packfile
);
598 hghnum
= msgnum
= mp
->hghmsg
;
601 for (i
= 1; i
<= nmsgs
; i
++) {
602 charstring_t scanl
= NULL
;
606 fseek (pf
, 0L, SEEK_CUR
);
609 if (fwrite (mmdlm1
, 1, strlen (mmdlm1
), pf
) < strlen (mmdlm1
)) {
610 advise (mmdlm1
, "fwrite");
614 if (pop_retr (i
, pop_pack
) == NOTOK
)
615 adios (NULL
, "%s", response
);
617 fseek (pf
, 0L, SEEK_CUR
);
620 adios (packfile
, "write error on");
621 fseek (pf
, start
, SEEK_SET
);
623 cp
= getcpy (m_name (msgnum
));
624 if ((pf
= fopen (cp
, "w+")) == NULL
)
625 adios (cp
, "unable to write");
626 chmod (cp
, m_gmprot ());
629 if (pop_retr (i
, pop_action
) == NOTOK
)
630 adios (NULL
, "%s", response
);
633 adios (cp
, "write error on");
634 fseek (pf
, 0L, SEEK_SET
);
636 switch (incerr
= scan (pf
, msgnum
, 0, nfs
, width
,
637 packfile
? 0 : msgnum
== mp
->hghmsg
+ 1 && chgflag
,
638 1, NULL
, stop
- start
, noisy
, &scanl
)) {
640 printf ("%*d empty\n", DMAXFOLDER
, msgnum
);
646 /* advise (cp, "unable to read"); already advised */
657 fputs (charstring_buffer (scanl
), aud
);
662 charstring_free (scanl
);
665 fseek (pf
, stop
, SEEK_SET
);
666 if (fwrite (mmdlm2
, 1, strlen (mmdlm2
), pf
) < strlen (mmdlm1
)) {
667 advise (mmdlm2
, "fwrite");
669 if (fflush (pf
) || ferror (pf
)) {
673 adios (packfile
, "write error on");
675 map_write (packfile
, pd
, 0, 0L, start
, stop
, pos
, size
, noisy
);
677 if (ferror(pf
) || fclose (pf
)) {
679 (void) m_unlink (cp
);
682 adios (cp
, "write error on");
687 if (trnflag
&& pop_dele (i
) == NOTOK
)
688 adios (NULL
, "%s", response
);
693 if (pop_quit () == NOTOK
)
694 adios (NULL
, "%s", response
);
696 mbx_close (packfile
, pd
);
702 * Get the mail from file (usually mail spool)
704 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
705 scan_detect_mbox_style (in
); /* the MAGIC invocation... */
706 hghnum
= msgnum
= mp
->hghmsg
;
708 charstring_t scanl
= NULL
;
710 /* create scanline for new message */
711 switch (incerr
= scan (in
, msgnum
+ 1, msgnum
+ 1, nfs
, width
,
712 msgnum
== hghnum
&& chgflag
, 1, NULL
, 0L, noisy
,
720 fputs ("inc aborted!\n", aud
);
721 advise (NULL
, "aborted!"); /* doesn't clean up locks! */
725 advise (NULL
, "BUG in %s, number out of range", invo_name
);
729 advise (NULL
, "BUG in %s, scan() botch (%d)", invo_name
, incerr
);
735 * Run the external program hook on the message.
738 (void)snprintf(b
, sizeof (b
), "%s/%d", maildir_copy
, msgnum
+ 1);
739 (void)ext_hook("add-hook", b
, (char *)0);
742 fputs (charstring_buffer (scanl
), aud
);
749 charstring_free (scanl
);
751 /* If we get here there was some sort of error from scan(),
752 * so stop processing anything more from the spool.
756 } else if (inc_type
== INC_FILE
) { /* Maildir inbox to process */
761 hghnum
= msgnum
= mp
->hghmsg
;
762 for (i
= 0; i
< num_maildir_entries
; i
++) {
763 charstring_t scanl
= NULL
;
767 sp
= Maildir
[i
].filename
;
768 cp
= getcpy (m_name (msgnum
));
770 if (!trnflag
|| link(sp
, cp
) == -1) {
771 static char buf
[65536];
774 if ((sf
= fopen (sp
, "r")) == NULL
)
775 adios (sp
, "unable to read for copy");
776 if ((pf
= fopen (cp
, "w+")) == NULL
)
777 adios (cp
, "unable to write for copy");
778 while ((nrd
= fread(buf
, 1, sizeof(buf
), sf
)) > 0)
779 if (fwrite(buf
, 1, nrd
, pf
) != nrd
)
781 if (ferror(sf
) || fflush(pf
) || ferror(pf
)) {
783 fclose(pf
); fclose(sf
); (void) m_unlink(cp
);
785 adios(cp
, "copy error %s -> %s", sp
, cp
);
790 if (pf
== NULL
&& (pf
= fopen (cp
, "r")) == NULL
)
791 adios (cp
, "not available");
792 chmod (cp
, m_gmprot ());
794 fseek (pf
, 0L, SEEK_SET
);
795 switch (incerr
= scan (pf
, msgnum
, 0, nfs
, width
,
796 msgnum
== mp
->hghmsg
+ 1 && chgflag
,
797 1, NULL
, stop
- start
, noisy
, &scanl
)) {
799 printf ("%*d empty\n", DMAXFOLDER
, msgnum
);
805 /* advise (cp, "unable to read"); already advised */
816 * Run the external program hook on the message.
819 (void)snprintf(b
, sizeof (b
), "%s/%d", maildir_copy
, msgnum
+ 1);
820 (void)ext_hook("add-hook", b
, (char *)0);
823 fputs (charstring_buffer (scanl
), aud
);
828 charstring_free (scanl
);
830 if (ferror(pf
) || fclose (pf
)) {
832 (void) m_unlink (cp
);
834 adios (cp
, "write error on");
839 if (trnflag
&& m_unlink (sp
) == NOTOK
)
840 adios (sp
, "couldn't unlink");
841 free (sp
); /* Free Maildir[i]->filename */
845 free (Maildir
); /* From now on Maildir is just a flag - don't dref! */
850 if (incerr
< 0) { /* error */
852 GETGROUPPRIVS(); /* Be sure we can unlock mail file */
853 (void) lkfclosespool (in
, newmail
); in
= NULL
;
854 DROPGROUPPRIVS(); /* And then return us to normal privileges */
856 fclose (in
); in
= NULL
;
858 adios (NULL
, "failed");
867 if ((inc_type
== INC_POP
) && packfile
)
871 * truncate file we are incorporating from
873 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
875 if (stat (newmail
, &st
) != NOTOK
&& s1
.st_mtime
!= st
.st_mtime
)
876 advise (NULL
, "new messages have arrived!\007");
879 if ((newfd
= creat (newmail
, 0600)) != NOTOK
)
882 admonish (newmail
, "error zero'ing");
883 (void) m_unlink(map_name(newmail
));
887 printf ("%s not zero'd\n", newmail
);
891 if (msgnum
== hghnum
) {
892 admonish (NULL
, "no messages incorporated");
895 * Lock the sequence file now, and loop to set the right flags
896 * in the folder structure
902 context_replace (pfolder
, folder
); /* update current folder */
904 if ((mp2
= folder_read(folder
, 1)) == NULL
) {
905 admonish(NULL
, "Unable to reread folder %s", folder
);
910 * Shouldn't happen, but just in case ...
913 if (msgnum
>= mp2
->hghoff
914 && !(mp2
= folder_realloc (mp2
, mp2
->lowoff
, msgnum
+ 1))) {
915 advise (NULL
, "unable to reallocate folder storage");
920 mp2
->curmsg
= hghnum
+ 1;
921 mp2
->hghmsg
= msgnum
;
923 if (mp2
->lowmsg
== 0)
925 if (chgflag
) /* sigh... */
926 seq_setcur (mp2
, mp2
->curmsg
);
928 for (i
= hghnum
+ 1; i
<= msgnum
; i
++) {
929 clear_msg_flags (mp2
, i
);
933 mp2
->msgflags
|= SEQMOD
;
934 seq_setunseen(mp2
, 0); /* Set the Unseen-Sequence */
935 seq_save(mp2
); /* Save the sequence file */
941 * unlock the mail spool
943 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
945 GETGROUPPRIVS(); /* Be sure we can unlock mail file */
946 (void) lkfclosespool (in
, newmail
); in
= NULL
;
947 DROPGROUPPRIVS(); /* And then return us to normal privileges */
949 fclose (in
); in
= NULL
;
953 context_save (); /* save the context file */
960 inc_done (int status
)
963 if (packfile
&& pd
!= NOTOK
)
964 mbx_close (packfile
, pd
);
968 lkfclosespool(in
, newmail
);
977 fprintf (pf
, "%s\n", s
);
978 stop
+= strlen (s
) + 1;
979 return 0; /* Is return value used? This was missing before 1999-07-15. */
988 snprintf (buffer
, sizeof(buffer
), "%s\n", s
);
989 for ( ; (j
= stringdex (mmdlm1
, buffer
)) >= 0; buffer
[j
]++)
991 for ( ; (j
= stringdex (mmdlm2
, buffer
)) >= 0; buffer
[j
]++)
994 size
+= strlen (buffer
) + 1;
995 return 0; /* Is return value used? This was missing before 1999-07-15. */
1006 if (stat (packfile
, &st
) == NOTOK
)
1008 if ((md
= open (cp
= map_name (packfile
), O_RDONLY
)) == NOTOK
1009 || map_chk (cp
, md
, &d
, (long) st
.st_size
, 1)) {