Codebase list fdm / aa7e65b
Tweaks, some spacing, bump some limits, kill some XXXs. Nicholas Marriott 17 years ago
8 changed file(s) with 35 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
153153 len--;
154154 hdr++;
155155
156 /* now follows a set of attributes of the form name=value, seperated
157 by semicolons, possibly crossing multiple lines and possibly with
158 the value enclosed in quotes */
156 /*
157 * Now follows a set of attributes of the form name=value, seperated
158 * by semicolons, possibly crossing multiple lines and possibly with
159 * the value enclosed in quotes.
160 */
159161 namelen = strlen(name);
160162 for (;;) {
161163 /* skip spaces and newlines */
167167 int blocked, u_int queued)
168168 {
169169 static int holding; /* holding fetch until queues drop */
170 struct io *rio, *iop[NFDS];
170 struct io *rio, *iop[IO_POLLFDS];
171171 char *cause;
172172 u_int n;
173173 int timeout, error;
6363 return (DELIVER_FAILURE);
6464 }
6565
66 /* XXX needed? */
6766 ARRAY_FREE(&m->wrapped);
6867 m->wrapchar = '\0';
6968 fill_wrapped(m);
5151 }
5252 log_debug2("%s: removing header: %s", a->name, hdr);
5353
54 /* XXX necessary? */
5554 ARRAY_FREE(&m->wrapped);
5655 m->wrapchar = '\0';
5756 fill_wrapped(m);
4141
4242 /* Delivery types. */
4343 enum delivertype {
44 DELIVER_INCHILD, /* do not pass up to parent */
45 DELIVER_ASUSER, /* do pass up to parent to drop privs */
46 DELIVER_WRBACK /* modifies mail: pass up to parent and expect
47 a new mail back */
44 DELIVER_INCHILD,/* don't pass to parent */
45 DELIVER_ASUSER, /* pass to parent to drop privs */
46 DELIVER_WRBACK /* modifies mail: pass to parent and receive new mail */
4847 };
4948
5049 /* Deliver functions. */
7777 #define __packed __attribute__ ((__packed__))
7878 #endif
7979
80 #ifdef DEBUG
8081 #define NFDS 64
8182 #define COUNTFDS(s) do { \
8283 int fd_i, fd_n; \
8788 } \
8889 log_debug2("%s: %d file descriptors in use", s, fd_n); \
8990 } while (0)
91 #endif
9092
9193 /* Convert a file mode. */
9294 #define MODE(m) \
317319
318320 /* Initial string block slots and block size. */
319321 #define STRBENTRIES 64
320 #define STRBBLOCK 512
322 #define STRBBLOCK 1024
321323
322324 /* String block access macros. */
323325 #define STRB_KEY(sb, sbe) (((char *) (sb)) + (sizeof *(sb)) + (sbe)->key)
688690 #define IO_FLUSHSIZE (2 * IO_BLOCKSIZE)
689691
690692 /* Maximum number of pollfds. */
691 #define IO_POLLFDS 64
693 #define IO_POLLFDS 256
692694
693695 /* IO buffer size macros. */
694696 #define IO_ROUND(n) (((n / IO_BLOCKSIZE) + 1) * IO_BLOCKSIZE)
781781 xfree($1);
782782 }
783783
784 /** REPLPATHV: <string> (char *) */
784785 replpathv: strv
786 /** [$1: strv (char *)] */
785787 {
786788 struct replpath rp;
787789
797799
798800 /** INCLUDE */
799801 include: TOKINCLUDE replpathv
800 /** [$2: replstrv (char *)] */
802 /** [$2: replpathv (char *)] */
801803 {
802804 char *path;
803805 struct fileent *top;
932934 conf.lock_types = $3;
933935 }
934936 | TOKSET TOKLOCKFILE replpathv
935 /** [$3: replstrv (char *)] */
937 /** [$3: replpathv (char *)] */
936938 {
937939 if (conf.lock_file != NULL)
938940 xfree(conf.lock_file);
959961 conf.timeout = $3 * 1000;
960962 }
961963 | TOKSET TOKQUEUEHIGH numv
962 /** [$3: time (long long)] */
964 /** [$3: numv (long long)] */
963965 {
964966 if ($3 == 0)
965967 yyerror("zero queue-high");
970972 conf.queue_high = $3;
971973 }
972974 | TOKSET TOKQUEUELOW numv
973 /** [$3: time (long long)] */
975 /** [$3: numv (long long)] */
974976 {
975977 if ($3 > MAXQUEUEVALUE)
976978 yyerror("queue-low too big: %lld", $3);
12301232
12311233 /** MAILDIRSLIST: <strings> (struct strings *) */
12321234 maildirslist: maildirslist replpathv
1233 /** [$1: maildirslist (struct strings *)] [$2: replstrv (char *)] */
1235 /** [$1: maildirslist (struct strings *)] [$2: replpathv (char *)] */
12341236 {
12351237 if (*$2 == '\0')
12361238 yyerror("invalid maildir");
12391241 ARRAY_ADD($$, $2, char *);
12401242 }
12411243 | replpathv
1242 /** [$1: replstrv (char *)] */
1244 /** [$1: replpathv (char *)] */
12431245 {
12441246 if (*$1 == '\0')
12451247 yyerror("invalid maildir");
12511253
12521254 /** MAILDIRS: <strings> (struct strings *) */
12531255 maildirs: TOKMAILDIR replpathv
1254 /** [$2: replstrv (char *)] */
1256 /** [$2: replpathv (char *)] */
12551257 {
12561258 if (*$2 == '\0')
12571259 yyerror("invalid maildir");
24522454 $$ = FETCHPORT_SSL;
24532455 }
24542456
2457 /** USERPASSNETRC: <userpass> (struct { ... } userpass) */
24552458 userpassnetrc: TOKUSER replstrv TOKPASS replstrv
2456 /** [$2: replstrv (char *)] [$4: replstrv (char *)] */
2459 /** [$2: replstrv (char *)] [$4: replstrv (char *)] */
24572460 {
24582461 if (*$2 == '\0')
24592462 yyerror("invalid user");
24732476 $$.pass_netrc = 1;
24742477 }
24752478 | TOKUSER replstrv
2479 /** [$2: replstrv (char *)] */
24762480 {
24772481 if (*$2 == '\0')
24782482 yyerror("invalid user");
24832487 $$.pass_netrc = 1;
24842488 }
24852489 | TOKPASS replstrv
2490 /** [$2: replstrv (char *)] */
24862491 {
24872492 if (*$2 == '\0')
24882493 yyerror("invalid pass");
25192524 /** FETCHTYPE: <fetch> (struct { ... } fetch) */
25202525 fetchtype: poptype server userpassnetrc
25212526 /** [$1: poptype (int)] [$2: server (struct { ... } server)] */
2522 /** [$4: replstrv (char *)] [$6: replstrv (char *)] */
2527 /** [$3: userpassnetrc (struct { ... } userpass)] */
25232528 {
25242529 struct fetch_pop3_data *data;
25252530
25502555 }
25512556 | imaptype server userpassnetrc folder
25522557 /** [$1: imaptype (int)] [$2: server (struct { ... } server)] */
2553 /** [$4: replstrv (char *)] [$6: replstrv (char *)] [$7: folder (char *)] */
2558 /** [$3: userpassnetrc (struct { ... } userpass)] [$4: folder (char *)] */
25542559 {
25552560 struct fetch_imap_data *data;
25562561
26222627 }
26232628 | TOKNNTP server groups TOKCACHE replpathv
26242629 /** [$2: server (struct { ... } server)] */
2625 /** [$3: groups (struct strings *)] [$5: replstrv (char *)] */
2630 /** [$3: groups (struct strings *)] [$5: replpathv (char *)] */
26262631 {
26272632 struct fetch_nntp_data *data;
26282633 char *group;
111111 if (sbep == NULL) {
112112 if (sb->ent_used > sb->ent_max) {
113113 /* allocate some more */
114 if (sb->ent_max > UINT_MAX / 2) /* XXX */
115 fatalx("strb_add: ent_max too large");
116114 n = sb->ent_max;
117115
116 size = STRB_SIZE(sb);
117 if (sb->ent_max > UINT_MAX / 2)
118 fatalx("strb_add: ent_max too large");
118119 sb->ent_max *= 2;
120 if (STRB_SIZE(sb) < size)
121 fatalx("strb_add: size too large");
122
119123 sb = *sbp = xrealloc(sb, 1, STRB_SIZE(sb));
120124
121125 memset(STRB_ENTRY(sb, n), 0, STRB_ENTSIZE(sb) / 2);