Lines Matching +full:mbox +full:- +full:name
2 * Copyright (c) 2008-2014, Simon Schubert <2@0x2c.org>.
18 * 3. Neither the name of The DragonFly Project nor the names of its
55 create_mbox(const char *name) in create_mbox() argument
63 int r = -1; in create_mbox()
79 if (maxfd == -1) in create_mbox()
85 execl(LIBEXEC_PATH "/dma-mbox-create", "dma-mbox-create", name, (char *)NULL); in create_mbox()
86 syslog(LOG_ERR, "cannot execute "LIBEXEC_PATH"/dma-mbox-create: %m"); in create_mbox()
97 if (waitchild == -1 && e == EINTR) { in create_mbox()
98 syslog(LOG_ERR, "hung child while creating mbox `%s': %m", name); in create_mbox()
102 if (waitchild == -1) { in create_mbox()
103 syslog(LOG_ERR, "child disappeared while creating mbox `%s': %m", name); in create_mbox()
108 syslog(LOG_ERR, "error creating mbox `%s'", name); in create_mbox()
116 case -1: in create_mbox()
118 syslog(LOG_ERR, "error creating mbox"); in create_mbox()
136 int mbox; in deliver_local() local
142 error = snprintf(fn, sizeof(fn), "%s/%s", _PATH_MAILDIR, it->addr); in deliver_local()
153 mbox = open_locked(fn, O_WRONLY|O_APPEND); in deliver_local()
154 if (mbox < 0) { in deliver_local()
164 * Call dma-mbox-create to create it and fix permissions. in deliver_local()
166 if (tries > 0 || create_mbox(it->addr) != 0) { in deliver_local()
185 mboxlen = lseek(mbox, 0, SEEK_END); in deliver_local()
187 /* New mails start with \nFrom ...., unless we're at the beginning of the mbox */ in deliver_local()
191 /* If we're bouncing a message, claim it comes from MAILER-DAEMON */ in deliver_local()
192 sender = it->sender; in deliver_local()
194 sender = "MAILER-DAEMON"; in deliver_local()
196 if (fseek(it->mailf, 0, SEEK_SET) != 0) { in deliver_local()
206 if (write(mbox, line, error) != error) in deliver_local()
209 while (!feof(it->mailf)) { in deliver_local()
210 if (fgets(line, sizeof(line), it->mailf) == NULL) in deliver_local()
213 if (linelen == 0 || line[linelen - 1] != '\n') { in deliver_local()
216 error = -1; in deliver_local()
222 * - escape lines that start with "From " with a > sign. in deliver_local()
223 * - be reversible by escaping lines that contain an arbitrary in deliver_local()
225 * - strict mbox processing only requires escaping after empty lines, in deliver_local()
233 if (write(mbox, gt, 1) != 1) in deliver_local()
241 if ((size_t)write(mbox, line, linelen) != linelen) in deliver_local()
244 close(mbox); in deliver_local()
251 if (ftruncate(mbox, mboxlen) != 0) in deliver_local()
252 syslog(LOG_WARNING, "error recovering mbox `%s': %m", fn); in deliver_local()
254 close(mbox); in deliver_local()