diff options
Diffstat (limited to 'gnu/usr.sbin/sendmail/libmilter/main.c')
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/main.c | 72 |
1 files changed, 62 insertions, 10 deletions
diff --git a/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c index 521f149fca1..2fbe35334e3 100644 --- a/gnu/usr.sbin/sendmail/libmilter/main.c +++ b/gnu/usr.sbin/sendmail/libmilter/main.c @@ -8,11 +8,9 @@ * */ -#ifndef lint -static char id[] = "@(#)$Sendmail: main.c,v 8.34.4.11 2001/05/07 22:06:37 gshapiro Exp $"; -#endif /* ! lint */ +#include <sm/gen.h> +SM_RCSID("@(#)$Sendmail: main.c,v 8.49 2001/04/21 01:18:16 ca Exp $") -#if _FFR_MILTER #define _DEFINE 1 #include "libmilter.h" #include <fcntl.h> @@ -51,7 +49,7 @@ smfi_register(smfilter) smfi->xxfi_name = (char *) malloc(len); if (smfi->xxfi_name == NULL) return MI_FAILURE; - (void) strlcpy(smfi->xxfi_name, smfilter.xxfi_name, len); + (void) sm_strlcpy(smfi->xxfi_name, smfilter.xxfi_name, len); /* compare milter version with hard coded version */ if (smfi->xxfi_version != SMFI_VERSION) @@ -61,6 +59,9 @@ smfi_register(smfilter) "%s: smfi_register: version mismatch application: %d != milter: %d", smfi->xxfi_name, smfi->xxfi_version, (int) SMFI_VERSION); + + /* XXX how about smfi? */ + free(smfi->xxfi_name); return MI_FAILURE; } @@ -84,11 +85,26 @@ smfi_stop() return MI_SUCCESS; } +/* +** default values for some variables. +** Most of these can be changed with the functions below. +*/ + static int dbg = 0; static char *conn = NULL; static int timeout = MI_TIMEOUT; static int backlog= MI_SOMAXCONN; +/* +** SMFI_SETDBG -- set debug level. +** +** Parameters: +** odbg -- new debug level. +** +** Returns: +** MI_SUCCESS +*/ + int smfi_setdbg(odbg) int odbg; @@ -97,6 +113,16 @@ smfi_setdbg(odbg) return MI_SUCCESS; } +/* +** SMFI_SETTIMEOUT -- set timeout (for read/write). +** +** Parameters: +** otimeout -- new timeout. +** +** Returns: +** MI_SUCCESS +*/ + int smfi_settimeout(otimeout) int otimeout; @@ -105,6 +131,16 @@ smfi_settimeout(otimeout) return MI_SUCCESS; } +/* +** SMFI_SETCONN -- set connection information (socket description) +** +** Parameters: +** oconn -- new connection information. +** +** Returns: +** MI_SUCCESS/MI_FAILURE +*/ + int smfi_setconn(oconn) char *oconn; @@ -116,11 +152,21 @@ smfi_setconn(oconn) l = strlen(oconn) + 1; if ((conn = (char *) malloc(l)) == NULL) return MI_FAILURE; - if (strlcpy(conn, oconn, l) >= l) + if (sm_strlcpy(conn, oconn, l) >= l) return MI_FAILURE; return MI_SUCCESS; } +/* +** SMFI_SETBACKLOG -- set backlog +** +** Parameters: +** odbg -- new backlog. +** +** Returns: +** MI_SUCCESS/MI_FAILURE +*/ + int smfi_setbacklog(obacklog) int obacklog; @@ -131,12 +177,20 @@ smfi_setbacklog(obacklog) return MI_SUCCESS; } +/* +** SMFI_MAIN -- setup milter connnection and start listener. +** +** Parameters: +** none. +** +** Returns: +** MI_SUCCESS/MI_FAILURE +*/ int smfi_main() { - - signal(SIGPIPE, SIG_IGN); + (void) signal(SIGPIPE, SIG_IGN); if (conn == NULL) { smi_log(SMI_LOG_FATAL, "%s: missing connection information", @@ -153,11 +207,9 @@ smfi_main() return MI_FAILURE; } - /* Startup the listener */ if (mi_listener(conn, dbg, smfi, timeout, backlog) != MI_SUCCESS) return MI_FAILURE; return MI_SUCCESS; } -#endif /* _FFR_MILTER */ |