/*
* Copyright (c) 1999-2007 Proofpoint, 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 "libmilter.h"
/* for smfi_set{ml}reply, let's be generous. 256/16 should be sufficient */
/*
** SMFI_HEADER -- send a header to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** cmd -- Header modification command
** hdridx -- Header index
** headerf -- Header field name
** headerv -- Header field value
**
** Returns:
*/
static int
int cmd;
int hdridx;
char *headerf;
char *headerv;
{
int r;
mi_int32 v;
char *buf;
return MI_FAILURE;
if (hdridx >= 0)
len += MILTER_LEN_BYTES;
return MI_FAILURE;
offset = 0;
if (hdridx >= 0)
{
}
return r;
}
/*
** SMFI_ADDHEADER -- send a new header to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** headerf -- Header field name
** headerv -- Header field value
**
** Returns:
*/
int
char *headerf;
char *headerv;
{
return MI_FAILURE;
}
/*
** SMFI_INSHEADER -- send a new header to the MTA (to be inserted)
**
** Parameters:
** ctx -- Opaque context structure
** hdridx -- index into header list where insertion should occur
** headerf -- Header field name
** headerv -- Header field value
**
** Returns:
*/
int
int hdridx;
char *headerf;
char *headerv;
{
return MI_FAILURE;
}
/*
** SMFI_CHGHEADER -- send a changed header to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** headerf -- Header field name
** hdridx -- Header index value
** headerv -- Header field value
**
** Returns:
*/
int
char *headerf;
char *headerv;
{
return MI_FAILURE;
headerv = "";
}
#if 0
/*
** BUF_CRT_SEND -- construct buffer to send from arguments
**
** Parameters:
** ctx -- Opaque context structure
** cmd -- command
** arg0 -- first argument
** argv -- list of arguments (NULL terminated)
**
** Returns:
*/
static int
static int
int cmd;
char *arg0;
char **argv;
{
int r;
return MI_FAILURE;
{
}
return MI_FAILURE;
{
}
return r;
}
#endif /* 0 */
/*
** SEND2 -- construct buffer to send from arguments
**
** Parameters:
** ctx -- Opaque context structure
** cmd -- command
** arg0 -- first argument
** argv -- list of arguments (NULL terminated)
**
** Returns:
*/
static int
static int
int cmd;
char *arg0;
char *arg1;
{
int r;
char *buf;
return MI_FAILURE;
{
}
return MI_FAILURE;
{
}
return r;
}
/*
** SMFI_CHGFROM -- change enveloper sender ("from") address
**
** Parameters:
** ctx -- Opaque context structure
** from -- new envelope sender address ("MAIL From")
** args -- ESMTP arguments
**
** Returns:
*/
int
char *from;
char *args;
{
return MI_FAILURE;
return MI_FAILURE;
}
/*
** SMFI_SETSYMLIST -- set list of macros that the MTA should send.
**
** Parameters:
** ctx -- Opaque context structure
** where -- SMTP stage
** macros -- list of macros
**
** Returns:
*/
int
int where;
char *macros;
{
return MI_FAILURE;
return MI_FAILURE;
return MI_FAILURE;
return MI_FAILURE;
return MI_FAILURE;
return MI_SUCCESS;
}
/*
** SMFI_ADDRCPT_PAR -- send an additional recipient to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** rcpt -- recipient address
** args -- ESMTP arguments
**
** Returns:
*/
int
char *rcpt;
char *args;
{
return MI_FAILURE;
return MI_FAILURE;
}
/*
** SMFI_ADDRCPT -- send an additional recipient to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** rcpt -- recipient address
**
** Returns:
*/
int
char *rcpt;
{
return MI_FAILURE;
return MI_FAILURE;
}
/*
** SMFI_DELRCPT -- send a recipient to be removed to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** rcpt -- recipient address
**
** Returns:
*/
int
char *rcpt;
{
return MI_FAILURE;
return MI_FAILURE;
}
/*
** SMFI_REPLACEBODY -- send a body chunk to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** bodyp -- body chunk
** bodylen -- length of body chunk
**
** Returns:
*/
int
unsigned char *bodyp;
int bodylen;
{
if (bodylen < 0 ||
return MI_FAILURE;
return MI_FAILURE;
/* split body chunk if necessary */
off = 0;
do
{
return r;
} while (bodylen > 0);
return MI_SUCCESS;
}
/*
** SMFI_QUARANTINE -- quarantine an envelope
**
** Parameters:
** ctx -- Opaque context structure
** reason -- why?
**
** Returns:
*/
int
char *reason;
{
int r;
char *buf;
return MI_FAILURE;
return MI_FAILURE;
return MI_FAILURE;
return r;
}
/*
** MYISENHSC -- check whether a string contains an enhanced status code
**
** Parameters:
** s -- string with possible enhanced status code.
** delim -- delim for enhanced status code.
**
** Returns:
** 0 -- no enhanced status code.
** >4 -- length of enhanced status code.
**
** Side Effects:
** none.
*/
static int
const char *s;
int delim;
{
int l, h;
if (s == NULL)
return 0;
if (!((*s == '2' || *s == '4' || *s == '5') && s[1] == '.'))
return 0;
h = 0;
l = 2;
++h;
if (h == 0 || s[l + h] != '.')
return 0;
l += h + 1;
h = 0;
++h;
if (h == 0 || s[l + h] != delim)
return 0;
return l + h;
}
/*
** SMFI_SETREPLY -- set the reply code for the next reply to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** rcode -- The three-digit (RFC 821) SMTP reply code.
** xcode -- The extended (RFC 2034) reply code.
** message -- The text part of the SMTP reply.
**
** Returns:
*/
int
char *rcode;
char *xcode;
char *message;
{
char *buf;
return MI_FAILURE;
/* ### <sp> \0 */
if (len != 5)
return MI_FAILURE;
return MI_FAILURE;
{
return MI_FAILURE;
}
{
/* XXX check also for unprintable chars? */
return MI_FAILURE;
if (ml > MAXREPLYLEN)
return MI_FAILURE;
}
return MI_FAILURE; /* oops */
{
}
return MI_SUCCESS;
}
/*
** SMFI_SETMLREPLY -- set multiline reply code for the next reply to the MTA
**
** Parameters:
** ctx -- Opaque context structure
** rcode -- The three-digit (RFC 821) SMTP reply code.
** xcode -- The extended (RFC 2034) reply code.
** txt, ... -- The text part of the SMTP reply,
** MUST be terminated with NULL.
**
** Returns:
*/
int
#if SM_VA_STD
#else /* SM_VA_STD */
const char *rcode;
const char *xcode;
#endif /* SM_VA_STD */
{
int args;
const char *xc;
return MI_FAILURE;
/* ### <sp> */
if (len != 4)
return MI_FAILURE;
return MI_FAILURE;
{
return MI_FAILURE;
}
else
{
if (rcode[0] == '4')
xc = "4.0.0";
else
xc = "5.0.0";
}
/* add trailing space */
args = 0;
{
if (tl > MAXREPLYLEN)
break;
/* this text, reply codes, \r\n */
if (++args > MAXREPLIES)
break;
/* XXX check also for unprintable chars? */
break;
}
return MI_FAILURE;
/* trailing '\0' */
++len;
return MI_FAILURE; /* oops */
xc, " ");
{
{
if (--args <= 1)
}
}
return MI_SUCCESS;
}
/*
** SMFI_SETPRIV -- set private data
**
** Parameters:
** ctx -- Opaque context structure
** privatedata -- pointer to private data
**
** Returns:
*/
int
void *privatedata;
{
return MI_FAILURE;
return MI_SUCCESS;
}
/*
** SMFI_GETPRIV -- get private data
**
** Parameters:
** ctx -- Opaque context structure
**
** Returns:
** pointer to private data
*/
void *
{
return NULL;
return ctx->ctx_privdata;
}
/*
** SMFI_GETSYMVAL -- get the value of a macro
**
** See explanation in mfapi.h about layout of the structures.
**
** Parameters:
** ctx -- Opaque context structure
** symname -- name of macro
**
** Returns:
** value of macro (NULL in case of failure)
*/
char *
char *symname;
{
int i;
char **s;
return NULL;
{
}
else
one[0] = '\0';
{
braces[0] = '{';
}
else
braces[0] = '\0';
/* search backwards through the macro array */
for (i = MAX_MACROS_ENTRIES - 1 ; i >= 0; --i)
{
continue;
{
return *++s;
return *++s;
return *++s;
++s; /* skip over macro value */
++s; /* points to next macro name */
}
}
return NULL;
}
/*
** SMFI_PROGRESS -- send "progress" message to the MTA to prevent premature
** timeouts during long milter-side operations
**
** Parameters:
** ctx -- Opaque context structure
**
** Return value:
*/
int
{
return MI_FAILURE;
}
/*
** SMFI_VERSION -- return (runtime) version of libmilter
**
** Parameters:
** major -- (pointer to) major version
** minor -- (pointer to) minor version
** patchlevel -- (pointer to) patchlevel version
**
** Return value:
** MI_SUCCESS
*/
int
unsigned int *major;
unsigned int *minor;
unsigned int *patchlevel;
{
if (patchlevel != NULL)
return MI_SUCCESS;
}