Deleted Added
full compact
milter.c (64562) milter.c (66494)
1/*
2 * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#ifndef lint
1/*
2 * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#ifndef lint
12static char id[] = "@(#)$Id: milter.c,v 8.50.4.30 2000/07/18 07:24:51 gshapiro Exp $";
12static char id[] = "@(#)$Id: milter.c,v 8.50.4.33 2000/09/19 19:40:15 gshapiro Exp $";
13#endif /* ! lint */
14
15#if _FFR_MILTER
16
17# include <sendmail.h>
18# include <errno.h>
19# include <sys/time.h>
20

--- 182 unchanged lines hidden (view full) ---

203static char *
204milter_sysread(m, buf, sz, to, e)
205 struct milter *m;
206 char *buf;
207 ssize_t sz;
208 time_t to;
209 ENVELOPE *e;
210{
13#endif /* ! lint */
14
15#if _FFR_MILTER
16
17# include <sendmail.h>
18# include <errno.h>
19# include <sys/time.h>
20

--- 182 unchanged lines hidden (view full) ---

203static char *
204milter_sysread(m, buf, sz, to, e)
205 struct milter *m;
206 char *buf;
207 ssize_t sz;
208 time_t to;
209 ENVELOPE *e;
210{
211 time_t readstart;
211 time_t readstart = 0;
212 ssize_t len, curl;
213
214 curl = 0;
215
216 if (to > 0)
217 readstart = curtime();
218
219 for (;;)

--- 63 unchanged lines hidden (view full) ---

283static char *
284milter_read(m, cmd, rlen, to, e)
285 struct milter *m;
286 char *cmd;
287 ssize_t *rlen;
288 time_t to;
289 ENVELOPE *e;
290{
212 ssize_t len, curl;
213
214 curl = 0;
215
216 if (to > 0)
217 readstart = curtime();
218
219 for (;;)

--- 63 unchanged lines hidden (view full) ---

283static char *
284milter_read(m, cmd, rlen, to, e)
285 struct milter *m;
286 char *cmd;
287 ssize_t *rlen;
288 time_t to;
289 ENVELOPE *e;
290{
291 time_t readstart;
291 time_t readstart = 0;
292 ssize_t expl;
293 mi_int32 i;
294 char *buf;
295 char data[MILTER_LEN_BYTES + 1];
296
297 *rlen = 0;
298 *cmd = '\0';
299

--- 634 unchanged lines hidden (view full) ---

934 return -1;
935 }
936
937 if (connect(sock, (struct sockaddr *) &addr, addrlen) >= 0)
938 break;
939
940 /* couldn't connect.... try next address */
941 save_errno = errno;
292 ssize_t expl;
293 mi_int32 i;
294 char *buf;
295 char data[MILTER_LEN_BYTES + 1];
296
297 *rlen = 0;
298 *cmd = '\0';
299

--- 634 unchanged lines hidden (view full) ---

934 return -1;
935 }
936
937 if (connect(sock, (struct sockaddr *) &addr, addrlen) >= 0)
938 break;
939
940 /* couldn't connect.... try next address */
941 save_errno = errno;
942 p = CurHostName;
943 CurHostName = at;
942 if (tTd(64, 5))
943 dprintf("milter_open(%s): %s failed: %s\n",
944 m->mf_name, at, errstring(save_errno));
945 if (LogLevel >= 14)
946 sm_syslog(LOG_INFO, e->e_id,
947 "milter_open(%s): %s failed: %s",
948 m->mf_name, at, errstring(save_errno));
944 if (tTd(64, 5))
945 dprintf("milter_open(%s): %s failed: %s\n",
946 m->mf_name, at, errstring(save_errno));
947 if (LogLevel >= 14)
948 sm_syslog(LOG_INFO, e->e_id,
949 "milter_open(%s): %s failed: %s",
950 m->mf_name, at, errstring(save_errno));
951 CurHostName = p;
949 (void) close(sock);
950
951 /* try next address */
952 if (hp != NULL && hp->h_addr_list[addrno] != NULL)
953 {
954 switch (addr.sa.sa_family)
955 {
956# if NETINET

--- 54 unchanged lines hidden (view full) ---

1011milter_setup(line)
1012 char *line;
1013{
1014 char fcode;
1015 register char *p;
1016 register struct milter *m;
1017 STAB *s;
1018
952 (void) close(sock);
953
954 /* try next address */
955 if (hp != NULL && hp->h_addr_list[addrno] != NULL)
956 {
957 switch (addr.sa.sa_family)
958 {
959# if NETINET

--- 54 unchanged lines hidden (view full) ---

1014milter_setup(line)
1015 char *line;
1016{
1017 char fcode;
1018 register char *p;
1019 register struct milter *m;
1020 STAB *s;
1021
1019 /* collect the mailer name */
1022 /* collect the filter name */
1020 for (p = line;
1021 *p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p));
1022 p++)
1023 continue;
1024 if (*p != '\0')
1025 *p++ = '\0';
1026 if (line[0] == '\0')
1027 {

--- 28 unchanged lines hidden (view full) ---

1056 return;
1057 }
1058 while (isascii(*p) && isspace(*p))
1059 p++;
1060
1061 /* p now points to the field body */
1062 p = munchstring(p, &delimptr, ',');
1063
1023 for (p = line;
1024 *p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p));
1025 p++)
1026 continue;
1027 if (*p != '\0')
1028 *p++ = '\0';
1029 if (line[0] == '\0')
1030 {

--- 28 unchanged lines hidden (view full) ---

1059 return;
1060 }
1061 while (isascii(*p) && isspace(*p))
1062 p++;
1063
1064 /* p now points to the field body */
1065 p = munchstring(p, &delimptr, ',');
1066
1064 /* install the field into the mailer struct */
1067 /* install the field into the filter struct */
1065 switch (fcode)
1066 {
1067 case 'S': /* socket */
1068 if (p == NULL)
1069 m->mf_conn = NULL;
1070 else
1071 m->mf_conn = newstr(p);
1072 break;

--- 16 unchanged lines hidden (view full) ---

1089 break;
1090 }
1091 p = delimptr;
1092 }
1093
1094 /* early check for errors */
1095 (void) milter_open(m, TRUE, CurEnv);
1096
1068 switch (fcode)
1069 {
1070 case 'S': /* socket */
1071 if (p == NULL)
1072 m->mf_conn = NULL;
1073 else
1074 m->mf_conn = newstr(p);
1075 break;

--- 16 unchanged lines hidden (view full) ---

1092 break;
1093 }
1094 p = delimptr;
1095 }
1096
1097 /* early check for errors */
1098 (void) milter_open(m, TRUE, CurEnv);
1099
1097 /* enter the mailer into the symbol table */
1100 /* enter the filter into the symbol table */
1098 s = stab(m->mf_name, ST_MILTER, ST_ENTER);
1099 if (s->s_milter != NULL)
1100 syserr("X%s: duplicate filter definition", m->mf_name);
1101 else
1102 s->s_milter = m;
1103}
1104 /*
1105** MILTER_PARSE_LIST -- parse option list into an array

--- 95 unchanged lines hidden (view full) ---

1201 return;
1202 }
1203 while (isascii(*p) && isspace(*p))
1204 p++;
1205
1206 /* p now points to the field body */
1207 p = munchstring(p, &delimptr, ';');
1208
1101 s = stab(m->mf_name, ST_MILTER, ST_ENTER);
1102 if (s->s_milter != NULL)
1103 syserr("X%s: duplicate filter definition", m->mf_name);
1104 else
1105 s->s_milter = m;
1106}
1107 /*
1108** MILTER_PARSE_LIST -- parse option list into an array

--- 95 unchanged lines hidden (view full) ---

1204 return;
1205 }
1206 while (isascii(*p) && isspace(*p))
1207 p++;
1208
1209 /* p now points to the field body */
1210 p = munchstring(p, &delimptr, ';');
1211
1209 /* install the field into the mailer struct */
1212 /* install the field into the filter struct */
1210 switch (fcode)
1211 {
1212 case 'S':
1213 m->mf_timeout[SMFTO_WRITE] = convtime(p, 's');
1214 if (tTd(64, 5))
1215 printf("X%s: %c=%ld\n",
1216 m->mf_name, fcode,
1217 (u_long) m->mf_timeout[SMFTO_WRITE]);

--- 2185 unchanged lines hidden ---
1213 switch (fcode)
1214 {
1215 case 'S':
1216 m->mf_timeout[SMFTO_WRITE] = convtime(p, 's');
1217 if (tTd(64, 5))
1218 printf("X%s: %c=%ld\n",
1219 m->mf_name, fcode,
1220 (u_long) m->mf_timeout[SMFTO_WRITE]);

--- 2185 unchanged lines hidden ---