/*
* Copyright (c) 2005 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.
*/
#include "sm/generic.h"
SM_RCSID("@(#)$Id: pmilter_getrcpt_idx.c,v 1.2 2006/10/05 04:27:38 ca Exp $")
#include "sm/error.h"
#include "sm/assert.h"
#include "pmilter.h"
#include "sm/pmfdef.h"
#include "sm/pmfapi.h"
#if MTA_USE_PMILTER
/*
** SM_PMFI_GETRCPT_IDX -- Get recipient index for current RCPT command
**
** Parameters:
** pmse_ctx -- pmilter/SMTP server session context
** prcpt_idx -- (pointer to) recipient index (output)
**
** Returns:
** usual sm_error code
*/
sm_ret_T
sm_pmfi_getrcpt_idx(pmse_ctx_P pmse_ctx, rcpt_idx_T *prcpt_idx)
{
SM_IS_PMSE_CTX(pmse_ctx);
if (prcpt_idx == NULL)
return EINVAL;
if (pmse_ctx->pmse_state != PMSE_ST_RCPT)
return sm_error_perm(SM_EM_PMILTER, SM_E_PR_ERR);
*prcpt_idx = pmse_ctx->pmse_rcpt_idx;
return SM_SUCCESS;
}
#endif /* MTA_USE_PMILTER */
syntax highlighted by Code2HTML, v. 0.9.1