2000-08-12 21:55:49 +00:00
|
|
|
/*
|
2014-01-26 20:46:55 +00:00
|
|
|
* Copyright (c) 1999-2003, 2006 Proofpoint, Inc. and its suppliers.
|
2000-08-12 21:55:49 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-02-17 21:56:45 +00:00
|
|
|
#include <sm/gen.h>
|
2014-05-22 03:45:17 +00:00
|
|
|
SM_RCSID("@(#)$Id: handler.c,v 8.40 2013-11-22 20:51:36 ca Exp $")
|
2000-08-12 21:55:49 +00:00
|
|
|
|
|
|
|
#include "libmilter.h"
|
|
|
|
|
2007-04-09 01:38:51 +00:00
|
|
|
#if !_FFR_WORKERS_POOL
|
2000-08-12 21:55:49 +00:00
|
|
|
/*
|
2014-12-12 04:10:50 +00:00
|
|
|
** MI_HANDLE_SESSION -- Handle a connected session in its own context
|
2000-08-12 21:55:49 +00:00
|
|
|
**
|
|
|
|
** 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();
|
|
|
|
|
|
|
|
/*
|
2003-02-08 20:31:29 +00:00
|
|
|
** Detach so resources are free when the thread returns.
|
|
|
|
** If we ever "wait" for threads, this call must be removed.
|
2000-08-12 21:55:49 +00:00
|
|
|
*/
|
2002-06-11 21:12:04 +00:00
|
|
|
|
2000-08-12 21:55:49 +00:00
|
|
|
if (pthread_detach(ctx->ctx_id) != 0)
|
2002-06-11 21:12:04 +00:00
|
|
|
ret = MI_FAILURE;
|
|
|
|
else
|
|
|
|
ret = mi_engine(ctx);
|
2010-01-26 04:17:18 +00:00
|
|
|
mi_clr_ctx(ctx);
|
2000-08-12 21:55:49 +00:00
|
|
|
ctx = NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
2007-04-09 01:38:51 +00:00
|
|
|
#endif /* !_FFR_WORKERS_POOL */
|