diff options
Diffstat (limited to 'gnu/usr.sbin/sendmail/libmilter/main.c')
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/main.c | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c index cf0bbcd2831..873eddafeff 100644 --- a/gnu/usr.sbin/sendmail/libmilter/main.c +++ b/gnu/usr.sbin/sendmail/libmilter/main.c @@ -9,7 +9,7 @@ */ #ifndef lint -static char id[] = "@(#)$Sendmail: main.c,v 8.34 2000/02/11 02:43:45 gshapiro Exp $"; +static char id[] = "@(#)$Sendmail: main.c,v 8.34.4.9 2000/09/09 02:23:03 gshapiro Exp $"; #endif /* ! lint */ #if _FFR_MILTER @@ -18,6 +18,7 @@ static char id[] = "@(#)$Sendmail: main.c,v 8.34 2000/02/11 02:43:45 gshapiro Ex #include <fcntl.h> #include <sys/stat.h> + static smfiDesc_ptr smfi = NULL; /* @@ -42,7 +43,7 @@ smfi_register(smfilter) if (smfi == NULL) return MI_FAILURE; } - (void)memcpy(smfi, &smfilter, sizeof *smfi); + (void) memcpy(smfi, &smfilter, sizeof *smfi); if (smfilter.xxfi_name == NULL) smfilter.xxfi_name = "Unknown"; @@ -51,12 +52,42 @@ smfi_register(smfilter) if (smfi->xxfi_name == NULL) return MI_FAILURE; (void) strlcpy(smfi->xxfi_name, smfilter.xxfi_name, len); + + /* compare milter version with hard coded version */ + if (smfi->xxfi_version != SMFI_VERSION) + { + /* hard failure for now! */ + smi_log(SMI_LOG_ERR, + "%s: smfi_register: version mismatch application: %d != milter: %d", + smfi->xxfi_name, smfi->xxfi_version, + (int) SMFI_VERSION); + return MI_FAILURE; + } + + return MI_SUCCESS; +} + +/* +** SMFI_STOP -- stop milter +** +** Parameters: +** none. +** +** Returns: +** success. +*/ + +int +smfi_stop() +{ + mi_stop_milters(MILTER_STOP); return MI_SUCCESS; } static int dbg = 0; static char *conn = NULL; static int timeout = MI_TIMEOUT; +static int backlog= MI_SOMAXCONN; int smfi_setdbg(odbg) @@ -91,6 +122,16 @@ smfi_setconn(oconn) } int +smfi_setbacklog(obacklog) + int obacklog; +{ + if (obacklog <= 0) + return MI_FAILURE; + backlog = obacklog; + return MI_SUCCESS; +} + +int smfi_main() { signal(SIGPIPE, SIG_IGN); @@ -98,7 +139,7 @@ smfi_main() { smi_log(SMI_LOG_FATAL, "%s: missing connection information", smfi->xxfi_name); - exit(EX_DATAERR); + return MI_FAILURE; } (void) atexit(mi_clean_signals); @@ -107,13 +148,13 @@ smfi_main() smi_log(SMI_LOG_FATAL, "%s: Couldn't start signal thread", smfi->xxfi_name); - exit(EX_OSERR); + return MI_FAILURE; } /* Startup the listener */ - if (mi_listener(conn, dbg, smfi, timeout) != MI_SUCCESS) - return(MI_FAILURE); + if (mi_listener(conn, dbg, smfi, timeout, backlog) != MI_SUCCESS) + return MI_FAILURE; - return(MI_SUCCESS); + return MI_SUCCESS; } #endif /* _FFR_MILTER */ |