7 /* recipient localpart address splitter
9 /* #include <split_addr.h>
11 /* char *split_addr(localpart, delimiter)
15 /* split_addr() null-terminates \fIlocalpart\fR at the first
16 /* occurrence of the \fIdelimiter\fR character found, and
17 /* returns a pointer to the remainder.
19 /* Reserved addresses are not split: postmaster, mailer-daemon,
20 /* double-bounce. Addresses that begin with owner-, or addresses
21 /* that end in -request are not split when the owner_request_special
26 /* The Secure Mailer license must be distributed with this software.
29 /* IBM T.J. Watson Research
31 /* Yorktown Heights, NY 10598, USA
39 #ifdef STRCASECMP_IN_STRINGS_H
43 /* Utility library. */
49 #include <mail_params.h>
50 #include <mail_addr.h>
51 #include <split_addr.h>
53 /* split_addr - split address with extreme prejudice */
55 char *split_addr(char *localpart
, int delimiter
)
60 * Don't split these, regardless of what the delimiter is.
62 if (strcasecmp(localpart
, MAIL_ADDR_POSTMASTER
) == 0)
64 if (strcasecmp(localpart
, MAIL_ADDR_MAIL_DAEMON
) == 0)
66 if (strcasecmp(localpart
, var_double_bounce_sender
) == 0)
70 * Backwards compatibility: don't split owner-foo or foo-request.
72 if (delimiter
== '-' && var_ownreq_special
!= 0) {
73 if (strncasecmp(localpart
, "owner-", 6) == 0)
75 if ((len
= strlen(localpart
) - 8) > 0
76 && strcasecmp(localpart
+ len
, "-request") == 0)
81 * Safe to split this address. Do not split the address if the result
82 * would have a null localpart.
84 return (delimiter
== *localpart
? 0 : split_at(localpart
, delimiter
));