diff options
author | gshapiro <gshapiro@FreeBSD.org> | 2000-08-12 21:55:49 +0000 |
---|---|---|
committer | gshapiro <gshapiro@FreeBSD.org> | 2000-08-12 21:55:49 +0000 |
commit | c3cd75415d60bc002b20182ffd3383ea9e901a80 (patch) | |
tree | 211dfd0f771f89d6abe14fa94cab53985a9d0116 /contrib/sendmail/libmilter/handler.c | |
parent | 231592eb7942ebd4becae24ea8e018acea3742a9 (diff) | |
parent | 4332139a9a11f773ffe5109bed871561e3c290a1 (diff) | |
download | FreeBSD-src-c3cd75415d60bc002b20182ffd3383ea9e901a80.zip FreeBSD-src-c3cd75415d60bc002b20182ffd3383ea9e901a80.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r64562,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/sendmail/libmilter/handler.c')
-rw-r--r-- | contrib/sendmail/libmilter/handler.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/contrib/sendmail/libmilter/handler.c b/contrib/sendmail/libmilter/handler.c new file mode 100644 index 0000000..f6e75e9 --- /dev/null +++ b/contrib/sendmail/libmilter/handler.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. + * All rights reserved. + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the sendmail distribution. + * + */ + +#ifndef lint +static char id[] = "@(#)$Id: handler.c,v 8.19.4.2 2000/07/14 06:16:57 msk Exp $"; +#endif /* ! lint */ + +#if _FFR_MILTER +#include "libmilter.h" + + +/* +** HANDLE_SESSION -- Handle a connected session in its own context +** +** Parameters: +** ctx -- context structure +** +** Returns: +** MI_SUCCESS/MI_FAILURE +*/ + +int +mi_handle_session(ctx) + SMFICTX_PTR ctx; +{ + int ret; + + if (ctx == NULL) + return MI_FAILURE; + 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 + */ + if (pthread_detach(ctx->ctx_id) != 0) + return MI_FAILURE; + ret = mi_engine(ctx); + if (ValidSocket(ctx->ctx_sd)) + (void) close(ctx->ctx_sd); + if (ctx->ctx_reply != NULL) + free(ctx->ctx_reply); + if (ctx->ctx_privdata != NULL) + { + smi_log(SMI_LOG_WARN, + "%s: private data not NULL", + ctx->ctx_smfi->xxfi_name); + } + mi_clr_macros(ctx, 0); + free(ctx); + ctx = NULL; + return ret; +} +#endif /* _FFR_MILTER */ |