diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-01-01 19:59:25 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-01-01 19:59:25 +0000 |
commit | ca99f1ac04361a3826ef7aa2d09eff30344e9b15 (patch) | |
tree | 037fd2f9239003a4df00dbf76d8f53671ce45b78 /gnu/usr.sbin/sendmail/libmilter | |
parent | e60a23b69678e8ea276e2e2f3e17ecc02b87d3cb (diff) |
update to sendmail 8.12.7
Diffstat (limited to 'gnu/usr.sbin/sendmail/libmilter')
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/README | 4 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/comm.c | 16 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/docs/smfi_settimeout.html | 7 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/engine.c | 42 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/handler.c | 6 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/libmilter.h | 6 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/listener.c | 33 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/main.c | 14 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/signal.c | 5 |
9 files changed, 69 insertions, 64 deletions
diff --git a/gnu/usr.sbin/sendmail/libmilter/README b/gnu/usr.sbin/sendmail/libmilter/README index 39049a4c0fe..6b971890094 100644 --- a/gnu/usr.sbin/sendmail/libmilter/README +++ b/gnu/usr.sbin/sendmail/libmilter/README @@ -39,7 +39,7 @@ The following command presumes that the sample code from the end of this README is saved to a file named 'sample.c' and built in the local platform- specific build subdirectory (SRCDIR/obj.*/libmilter). - cc -I../../sendmail -I../../include -o sample sample.c libmilter.a ../libsm/libsm.a -pthread + cc -I../../include -o sample sample.c libmilter.a ../libsm/libsm.a -pthread It is recommended that you build your filters in a location outside of the sendmail source tree. Modify the compiler include references (-I) @@ -457,4 +457,4 @@ main(argc, argv) /* eof */ -$Revision: 1.9 $, Last updated $Date: 2002/01/14 03:21:40 $ +$Revision: 1.10 $, Last updated $Date: 2003/01/01 19:59:21 $ diff --git a/gnu/usr.sbin/sendmail/libmilter/comm.c b/gnu/usr.sbin/sendmail/libmilter/comm.c index 6f1cb64792d..d73541e91ec 100644 --- a/gnu/usr.sbin/sendmail/libmilter/comm.c +++ b/gnu/usr.sbin/sendmail/libmilter/comm.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: comm.c,v 8.54.2.2 2002/08/16 17:09:13 ca Exp $") +SM_RCSID("@(#)$Sendmail: comm.c,v 8.54.2.4 2002/12/03 17:32:45 ca Exp $") #include "libmilter.h" #include <sm/errstring.h> @@ -55,14 +55,6 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) *cmd = '\0'; *rlen = 0; - if (sd >= FD_SETSIZE) - { - smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d", - name, sd, FD_SETSIZE); - *cmd = SMFIC_SELECT; - return NULL; - } - i = 0; for (;;) { @@ -87,7 +79,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) { smi_log(SMI_LOG_ERR, "%s, mi_rd_cmd: read returned %d: %s", - name, len, sm_errstring(errno)); + name, (int) len, sm_errstring(errno)); *cmd = SMFIC_RECVERR; return NULL; } @@ -160,7 +152,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) { smi_log(SMI_LOG_ERR, "%s: mi_rd_cmd: read returned %d: %s", - name, len, sm_errstring(errno)); + name, (int) len, sm_errstring(errno)); ret = -1; break; } @@ -224,7 +216,7 @@ mi_rd_cmd(sd, timeout, cmd, rlen, name) /* ** we don't care much about the timeout here, it's very long anyway -** FD_SETSIZE is only checked in mi_rd_cmd. +** FD_SETSIZE is checked when socket is created. ** XXX l == 0 ? */ diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_settimeout.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_settimeout.html index a9e870a6a7e..6fee16621d7 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_settimeout.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_settimeout.html @@ -24,7 +24,10 @@ Set the filter's connection timeout value. </tr> <tr align="left" valign=top> <th width="80">Effects</th> -<td>Sets the number of seconds libmilter will wait for an MTA connection before timing out a socket. If smfi_settimeout is not called, a default timeout of 1800 seconds is used.</td> +<td>Sets the number of seconds libmilter will wait for an MTA connection before +timing out a socket. +If smfi_settimeout is not called, a default timeout of 7210 seconds is used. +</td> </tr> </table> @@ -50,7 +53,7 @@ no wait, <b>not</b> "wait forever". <hr size="1"> <font size="-1"> -Copyright (c) 2000 Sendmail, Inc. and its suppliers. +Copyright (c) 2000, 2002 Sendmail, Inc. and its suppliers. All rights reserved. <br> By using this file, you agree to the terms and conditions set diff --git a/gnu/usr.sbin/sendmail/libmilter/engine.c b/gnu/usr.sbin/sendmail/libmilter/engine.c index 91b894bc9bf..1076205c327 100644 --- a/gnu/usr.sbin/sendmail/libmilter/engine.c +++ b/gnu/usr.sbin/sendmail/libmilter/engine.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: engine.c,v 8.109.2.1 2002/07/29 16:40:47 ca Exp $") +SM_RCSID("@(#)$Sendmail: engine.c,v 8.109.2.4 2002/12/03 17:27:32 ca Exp $") #include "libmilter.h" @@ -116,22 +116,22 @@ static int dec_arg2 __P((char *, size_t, char **, char **)); ** this function is coded in trans_ok(), see below. */ -#define MASK(x) (0x0001 << (x)) /* generate a bit "mask" for a state */ -#define NX_INIT (MASK(ST_OPTS)) -#define NX_OPTS (MASK(ST_CONN)) -#define NX_CONN (MASK(ST_HELO) | MASK(ST_MAIL)) -#define NX_HELO (MASK(ST_HELO) | MASK(ST_MAIL)) -#define NX_MAIL (MASK(ST_RCPT) | MASK(ST_ABRT)) -#define NX_RCPT (MASK(ST_HDRS) | MASK(ST_EOHS) | \ - MASK(ST_BODY) | MASK(ST_ENDM) | \ - MASK(ST_RCPT) | MASK(ST_ABRT)) -#define NX_HDRS (MASK(ST_EOHS) | MASK(ST_HDRS) | MASK(ST_ABRT)) -#define NX_EOHS (MASK(ST_BODY) | MASK(ST_ENDM) | MASK(ST_ABRT)) -#define NX_BODY (MASK(ST_ENDM) | MASK(ST_BODY) | MASK(ST_ABRT)) -#define NX_ENDM (MASK(ST_QUIT) | MASK(ST_MAIL)) +#define MI_MASK(x) (0x0001 << (x)) /* generate a bit "mask" for a state */ +#define NX_INIT (MI_MASK(ST_OPTS)) +#define NX_OPTS (MI_MASK(ST_CONN)) +#define NX_CONN (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL)) +#define NX_HELO (MI_MASK(ST_HELO) | MI_MASK(ST_MAIL)) +#define NX_MAIL (MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT)) +#define NX_RCPT (MI_MASK(ST_HDRS) | MI_MASK(ST_EOHS) | \ + MI_MASK(ST_BODY) | MI_MASK(ST_ENDM) | \ + MI_MASK(ST_RCPT) | MI_MASK(ST_ABRT)) +#define NX_HDRS (MI_MASK(ST_EOHS) | MI_MASK(ST_HDRS) | MI_MASK(ST_ABRT)) +#define NX_EOHS (MI_MASK(ST_BODY) | MI_MASK(ST_ENDM) | MI_MASK(ST_ABRT)) +#define NX_BODY (MI_MASK(ST_ENDM) | MI_MASK(ST_BODY) | MI_MASK(ST_ABRT)) +#define NX_ENDM (MI_MASK(ST_QUIT) | MI_MASK(ST_MAIL)) #define NX_QUIT 0 #define NX_ABRT 0 -#define NX_SKIP MASK(ST_SKIP) +#define NX_SKIP MI_MASK(ST_SKIP) static int next_states[] = { @@ -255,7 +255,7 @@ mi_engine(ctx) } if (ctx->ctx_dbg > 4) sm_dprintf("[%d] got cmd '%c' len %d\n", - (int) ctx->ctx_id, cmd, len); + (int) ctx->ctx_id, cmd, (int) len); for (i = 0; i < ncmds; i++) { if (cmd == cmds[i].cm_cmd) @@ -292,8 +292,8 @@ mi_engine(ctx) if (ctx->ctx_dbg > 1) sm_dprintf("[%d] abort: cur %d (%x) new %d (%x) next %x\n", (int) ctx->ctx_id, - curstate, MASK(curstate), - newstate, MASK(newstate), + curstate, MI_MASK(curstate), + newstate, MI_MASK(newstate), next_states[curstate]); /* call abort only if in a mail transaction */ @@ -511,7 +511,7 @@ st_optionneg(g) smi_log(SMI_LOG_ERR, "%s: st_optionneg[%d]: len too short %d < %d", g->a_ctx->ctx_smfi->xxfi_name, - (int) g->a_ctx->ctx_id, g->a_len, + (int) g->a_ctx->ctx_id, (int) g->a_len, MILTER_OPTLEN); return _SMFIS_ABORT; } @@ -615,7 +615,7 @@ st_connectinfo(g) smi_log(SMI_LOG_ERR, "%s: connect[%d]: wrong len %d >= %d", g->a_ctx->ctx_smfi->xxfi_name, - (int) g->a_ctx->ctx_id, i, l); + (int) g->a_ctx->ctx_id, (int) i, (int) l); return _SMFIS_ABORT; } @@ -990,7 +990,7 @@ trans_ok(old, new) do { /* is this state transition allowed? */ - if ((MASK(new) & next_states[s]) != 0) + if ((MI_MASK(new) & next_states[s]) != 0) return true; /* diff --git a/gnu/usr.sbin/sendmail/libmilter/handler.c b/gnu/usr.sbin/sendmail/libmilter/handler.c index ba3c5f1211b..edb666603d4 100644 --- a/gnu/usr.sbin/sendmail/libmilter/handler.c +++ b/gnu/usr.sbin/sendmail/libmilter/handler.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: handler.c,v 8.30 2002/04/29 15:06:48 ca Exp $") +SM_RCSID("@(#)$Sendmail: handler.c,v 8.30.2.2 2002/12/18 23:15:35 ca Exp $") #include "libmilter.h" @@ -35,8 +35,8 @@ mi_handle_session(ctx) ctx->ctx_id = (sthread_t) sthread_get_id(); /* - ** detach so resources are free when the thread returns - ** if we ever "wait" for threads, this call must be removed + ** Detach so resources are free when the thread returns. + ** If we ever "wait" for threads, this call must be removed. */ if (pthread_detach(ctx->ctx_id) != 0) diff --git a/gnu/usr.sbin/sendmail/libmilter/libmilter.h b/gnu/usr.sbin/sendmail/libmilter/libmilter.h index 3c6931c79d8..4696d0e56e1 100644 --- a/gnu/usr.sbin/sendmail/libmilter/libmilter.h +++ b/gnu/usr.sbin/sendmail/libmilter/libmilter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -19,7 +19,7 @@ #ifdef _DEFINE # define EXTERN # define INIT(x) = x -SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.33 2002/04/30 23:52:24 msk Exp $") +SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.33.2.7 2002/12/18 23:15:35 ca Exp $") #else /* _DEFINE */ # define EXTERN extern # define INIT(x) @@ -118,4 +118,4 @@ extern int mi_wr_cmd __P((socket_t, struct timeval *, int, char *, size_t)); extern bool mi_sendok __P((SMFICTX_PTR, int)); -#endif /* !_LIBMILTER_H */ +#endif /* ! _LIBMILTER_H */ diff --git a/gnu/usr.sbin/sendmail/libmilter/listener.c b/gnu/usr.sbin/sendmail/libmilter/listener.c index 06a4c4071a9..587148593e9 100644 --- a/gnu/usr.sbin/sendmail/libmilter/listener.c +++ b/gnu/usr.sbin/sendmail/libmilter/listener.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.1 2002/08/09 22:13:36 gshapiro Exp $") +SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.7 2002/12/10 04:02:25 ca Exp $") /* ** listener.c -- threaded network listener @@ -17,6 +17,7 @@ SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.1 2002/08/09 22:13:36 gshapiro Exp #include "libmilter.h" #include <sm/errstring.h> +#include <sm/fdset.h> # if NETINET || NETINET6 @@ -73,7 +74,13 @@ mi_opensocket(conn, backlog, dbg, smfi) (void) smutex_unlock(&L_Mutex); return MI_FAILURE; } - + if (!SM_FD_OK_SELECT(listenfd)) + { + smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d", + smfi->xxfi_name, listenfd, FD_SETSIZE); + (void) smutex_unlock(&L_Mutex); + return MI_FAILURE; + } return MI_SUCCESS; } @@ -482,7 +489,7 @@ mi_milteropen(conn, backlog, name) { smi_log(SMI_LOG_ERR, "%s: can't malloc(%d) for sockpath: %s", - name, len, sm_errstring(errno)); + name, (int) len, sm_errstring(errno)); (void) closesocket(sock); return INVALID_SOCKET; } @@ -630,9 +637,10 @@ mi_closener() if (rs != 0) \ { \ smi_log(SMI_LOG_ERR, \ - "MI_SLEEP(): select() returned non-zero result %d, errno = %d", \ + "MI_SLEEP(): select() returned non-zero result %d, errno = %d", \ rs, errno); \ } \ + break; \ } \ } \ } @@ -668,16 +676,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) return MI_FAILURE; clilen = L_socksize; - - if (listenfd >= FD_SETSIZE) - { - smi_log(SMI_LOG_ERR, "%s: fd %d is larger than FD_SETSIZE %d", - smfi->xxfi_name, listenfd, FD_SETSIZE); - (void) smutex_unlock(&L_Mutex); - return MI_FAILURE; - } (void) smutex_unlock(&L_Mutex); - while (mi_stop() == MILTER_CONT) { (void) smutex_lock(&L_Mutex); @@ -755,6 +754,14 @@ mi_listener(conn, dbg, smfi, timeout, backlog) save_errno = EINVAL; } + /* check if acceptable for select() */ + if (ValidSocket(connfd) && !SM_FD_OK_SELECT(connfd)) + { + (void) closesocket(connfd); + connfd = INVALID_SOCKET; + save_errno = ERANGE; + } + if (!ValidSocket(connfd)) { if (save_errno == EINTR) diff --git a/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c index 49e36e7a5b9..3b2d7285c1c 100644 --- a/gnu/usr.sbin/sendmail/libmilter/main.c +++ b/gnu/usr.sbin/sendmail/libmilter/main.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: main.c,v 8.64 2002/06/04 02:32:32 geir Exp $") +SM_RCSID("@(#)$Sendmail: main.c,v 8.64.2.8 2002/12/18 23:13:45 ca Exp $") #define _DEFINE 1 #include "libmilter.h" @@ -98,13 +98,13 @@ static int backlog = MI_SOMAXCONN; #if _FFR_SMFI_OPENSOCKET /* ** SMFI_OPENSOCKET -- try the socket setup to make sure we'll be -** able to start up +** able to start up ** -** Parameters: -** None. +** Parameters: +** None. ** -** Return: -** MI_SUCCESS/MI_FAILURE +** Return: +** MI_SUCCESS/MI_FAILURE */ int @@ -236,6 +236,6 @@ smfi_main() /* Startup the listener */ if (mi_listener(conn, dbg, smfi, timeout, backlog) != MI_SUCCESS) r = MI_FAILURE; - return r; } + diff --git a/gnu/usr.sbin/sendmail/libmilter/signal.c b/gnu/usr.sbin/sendmail/libmilter/signal.c index a8774bc6317..a319cdf3a81 100644 --- a/gnu/usr.sbin/sendmail/libmilter/signal.c +++ b/gnu/usr.sbin/sendmail/libmilter/signal.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Sendmail: signal.c,v 8.37 2002/03/23 00:55:19 ca Exp $") +SM_RCSID("@(#)$Sendmail: signal.c,v 8.37.2.2 2002/10/23 16:52:00 ca Exp $") #include "libmilter.h" @@ -107,6 +107,9 @@ mi_signal_thread(name) if (sigwait(&set, &sig) != 0) #endif /* defined(SOLARIS) || defined(__svr5__) */ { + /* this can happen on OSF/1 (at least) */ + if (errno == EINTR) + continue; smi_log(SMI_LOG_ERR, "%s: sigwait returned error: %d", (char *)name, errno); |