1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*++
/* NAME
/* split_addr 3
/* SUMMARY
/* recipient localpart address splitter
/* SYNOPSIS
/* #include <split_addr.h>
/*
/* char *split_addr(localpart, delimiter)
/* char *localpart;
/* int delimiter;
/* DESCRIPTION
/* split_addr() null-terminates \fIlocalpart\fR at the first
/* occurrence of the \fIdelimiter\fR character found, and
/* returns a pointer to the remainder.
/*
/* Reserved addresses are not split: postmaster, mailer-daemon,
/* double-bounce. Addresses that begin with owner-, or addresses
/* that end in -request are not split, unless the owner_request_special
/* parameter is set.
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
/* System library. */
#include <sys_defs.h>
#include <string.h>
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
#endif
/* Utility library. */
#include <split_at.h>
/* Global library. */
#include <mail_params.h>
#include <mail_addr.h>
#include <split_addr.h>
/* split_addr - split address with extreme prejudice */
char *split_addr(char *localpart, int delimiter)
{
int len;
/*
* Don't split these, regardless of what the delimiter is.
*/
if (strcasecmp(localpart, MAIL_ADDR_POSTMASTER) == 0)
return (0);
if (strcasecmp(localpart, MAIL_ADDR_MAIL_DAEMON) == 0)
return (0);
if (strcasecmp(localpart, var_double_bounce_sender) == 0)
return (0);
/*
* Backwards compatibility: don't split owner-foo or foo-request.
*/
if (var_ownreq_special != 0) {
if (strncasecmp(localpart, "owner-", 6) == 0)
return (0);
if ((len = strlen(localpart) - 8) > 0
&& strcasecmp(localpart + len, "-request") == 0)
return (0);
}
/*
* Safe to split this address.
*/
return (split_at(localpart, delimiter));
}
|