sendmail 8.12.8
This commit is contained in:
parent
3592333cbb
commit
29b190bd81
|
@ -0,0 +1,34 @@
|
|||
|
||||
SENDMAIL CONFIGURATION FILES INSTALLATION
|
||||
|
||||
This document describes how to install the sendmail configuration files.
|
||||
Please see ../README about the sendmail configuration files themselves.
|
||||
|
||||
By default you need two .mc files: sendmail.mc and submit.mc. The
|
||||
latter is an OS independent configuration file for the mail submission
|
||||
program (MSP). See ../README for details about both files.
|
||||
|
||||
Installation of these two files can be done via:
|
||||
|
||||
make install-cf
|
||||
|
||||
If you use a different name than "sendmail" for your main .mc file"
|
||||
then you should use
|
||||
|
||||
make install-cf CF=config
|
||||
|
||||
where "config" is the name of your main .mc file.
|
||||
|
||||
The default installation directory is /etc/mail and can be changed
|
||||
by specifying
|
||||
|
||||
MAILDIR=/other/dir
|
||||
|
||||
The name of the source file for "submit.cf" can be overridden by
|
||||
|
||||
SUBMIT=msp
|
||||
|
||||
For more details see Makefile.
|
||||
|
||||
|
||||
Revision: 1.2, Last updated Date: 2002/02/22 00:33:54
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001 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.
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# This is a generic configuration file for HP MPE/iX.
|
||||
# It has support for local and SMTP mail only. If you want to
|
||||
# customize it, copy it to a name appropriate for your environment
|
||||
# and do the modifications there.
|
||||
#
|
||||
|
||||
divert(0)dnl
|
||||
VERSIONID(`Id: generic-mpeix.mc,v 8.1 2001/12/13 23:56:37 gshapiro Exp')
|
||||
OSTYPE(mpeix)dnl
|
||||
DOMAIN(generic)dnl
|
||||
define(`confFORWARD_PATH', `$z/.forward')dnl
|
||||
MAILER(local)dnl
|
||||
MAILER(smtp)dnl
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 1998, 1999, 2001 Sendmail, Inc. and its suppliers.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
|
||||
# Copyright (c) 1988, 1993
|
||||
# The Regents of the University of California. 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.
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# This is a generic configuration file for SunOS 5.x (a.k.a. Solaris 2.x
|
||||
# and Solaris 7 through the present version).
|
||||
#
|
||||
# It has support for local and SMTP mail only. If you want to
|
||||
# customize it, copy it to a name appropriate for your environment
|
||||
# and do the modifications there.
|
||||
#
|
||||
|
||||
divert(0)dnl
|
||||
VERSIONID(`Id: generic-solaris.mc,v 8.13 2001/06/27 21:46:30 gshapiro Exp')
|
||||
OSTYPE(solaris2)dnl
|
||||
DOMAIN(generic)dnl
|
||||
MAILER(local)dnl
|
||||
MAILER(smtp)dnl
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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.
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# This is the prototype file for a set-group-ID sm-msp sendmail that
|
||||
# acts as a initial mail submission program.
|
||||
#
|
||||
|
||||
divert(0)dnl
|
||||
VERSIONID(`Id: submit.mc,v 8.6.2.4 2002/12/29 03:54:34 ca Exp')
|
||||
define(`confCF_VERSION', `Submit')dnl
|
||||
define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining
|
||||
define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet
|
||||
define(`confTIME_ZONE', `USE_TZ')dnl
|
||||
define(`confDONT_INIT_GROUPS', `True')dnl
|
||||
dnl
|
||||
dnl If you use IPv6 only, change [127.0.0.1] to [IPv6:::1]
|
||||
FEATURE(`msp', `[127.0.0.1]')dnl
|
|
@ -0,0 +1,22 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000-2001 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: authinfo.m4,v 1.7 2001/03/16 00:51:25 gshapiro Exp')
|
||||
divert(-1)
|
||||
|
||||
define(`_AUTHINFO_TABLE_', `')
|
||||
|
||||
LOCAL_CONFIG
|
||||
# authinfo list database: contains info for authentication as client
|
||||
Kauthinfo ifelse(defn(`_ARG_'), `', DATABASE_MAP_TYPE MAIL_SETTINGS_DIR`authinfo',
|
||||
defn(`_ARG_'), `LDAP', `ldap -1 -v sendmailMTAMapValue -k (&(objectClass=sendmailMTAMapObject)(|(sendmailMTACluster=${sendmailMTACluster})(sendmailMTAHost=$j))(sendmailMTAMapName=authinfo)(sendmailMTAKey=%0))',
|
||||
`_ARG_')
|
|
@ -0,0 +1,33 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000-2002 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.
|
||||
#
|
||||
#
|
||||
divert(0)
|
||||
VERSIONID(`Id: compat_check.m4,v 1.4 2002/02/26 22:15:31 gshapiro Exp')
|
||||
divert(-1)
|
||||
ifdef(`_ACCESS_TABLE_', `',
|
||||
`errprint(`FEATURE(`compat_check') requires FEATURE(`access_db')
|
||||
')')
|
||||
|
||||
LOCAL_RULESETS
|
||||
Scheck_compat
|
||||
# look up the pair of addresses
|
||||
# (we use <@> as the separator. Note this in the map too!)
|
||||
R< $+ > $| $+ $: $1 $| $2
|
||||
R$+ $| < $+ > $: $1 $| $2
|
||||
R$+ $| $+ $: <$(access Compat:$1<@>$2 $:OK $)>
|
||||
R$* $| $* $@ ok
|
||||
# act on the result,
|
||||
# it must be one of the following... anything else will be allowed..
|
||||
dnl for consistency with the other two even though discard does not take a
|
||||
dnl reply code
|
||||
R< DISCARD:$* > $#discard $: $1 " - discarded by check_compat"
|
||||
R< DISCARD $* > $#discard $: $1 " - discarded by check_compat"
|
||||
R< TEMP:$* > $#error $@ TEMPFAIL $: $1 " error from check_compat. Try again later"
|
||||
R< ERROR:$* > $#error $@ UNAVAILABLE $: $1 " error from check_compat"
|
|
@ -0,0 +1,44 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000-2002 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
ifdef(`_EDNSBL_R_',`dnl',`dnl
|
||||
VERSIONID(`Id: enhdnsbl.m4,v 1.9 2002/05/19 21:27:29 gshapiro Exp')
|
||||
LOCAL_CONFIG
|
||||
define(`_EDNSBL_R_',`')dnl
|
||||
# map for enhanced DNS based blacklist lookups
|
||||
Kednsbl dns -R A -a. -T<TMP> -r`'ifdef(`EDNSBL_TO',`EDNSBL_TO',`5')
|
||||
')
|
||||
divert(-1)
|
||||
define(`_EDNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
|
||||
define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_EDNSBL_SRV_`"',`_ARG2_')')dnl
|
||||
define(`_EDNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_EDNSBL_SRV_`"',`_ARG3_')')dnl
|
||||
define(`_EDNSBL_MATCH_', `ifelse(len(X`'_ARG4_),`1',`$`'+',_ARG4_)')dnl
|
||||
divert(8)
|
||||
# DNS based IP address spam list _EDNSBL_SRV_
|
||||
R$* $: $&{client_addr}
|
||||
R$-.$-.$-.$- $: <?> $(ednsbl $4.$3.$2.$1._EDNSBL_SRV_. $: OK $)
|
||||
R<?>OK $: OKSOFAR
|
||||
ifelse(len(X`'_ARG3_),`1',
|
||||
`R<?>$+<TMP> $: TMPOK',
|
||||
`R<?>$+<TMP> $#error $@ 4.7.1 $: _EDNSBL_MSG_TMP_')
|
||||
R<?>_EDNSBL_MATCH_ $#error $@ 5.7.1 $: _EDNSBL_MSG_
|
||||
ifelse(len(X`'_ARG5_),`1',`dnl',
|
||||
`R<?>_ARG5_ $#error $@ 5.7.1 $: _EDNSBL_MSG_')
|
||||
ifelse(len(X`'_ARG6_),`1',`dnl',
|
||||
`R<?>_ARG6_ $#error $@ 5.7.1 $: _EDNSBL_MSG_')
|
||||
ifelse(len(X`'_ARG7_),`1',`dnl',
|
||||
`R<?>_ARG7_ $#error $@ 5.7.1 $: _EDNSBL_MSG_')
|
||||
ifelse(len(X`'_ARG8_),`1',`dnl',
|
||||
`R<?>_ARG8_ $#error $@ 5.7.1 $: _EDNSBL_MSG_')
|
||||
ifelse(len(X`'_ARG9_),`1',`dnl',
|
||||
`R<?>_ARG9_ $#error $@ 5.7.1 $: _EDNSBL_MSG_')
|
||||
divert(-1)
|
|
@ -0,0 +1,18 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000 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.
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: local_no_masquerade.m4,v 1.2 2000/08/03 15:54:59 ca Exp')
|
||||
divert(-1)
|
||||
|
||||
ifdef(`_MAILER_local_',
|
||||
`errprint(`*** MAILER(`local') must appear after FEATURE(`local_no_masquerade')')
|
||||
')dnl
|
||||
define(`_LOCAL_NO_MASQUERADE_', `1')
|
|
@ -0,0 +1,22 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: lookupdotdomain.m4,v 1.1 2000/04/13 22:32:49 ca Exp')
|
||||
divert(-1)
|
||||
|
||||
ifdef(`_ACCESS_TABLE_',
|
||||
`define(`_LOOKUPDOTDOMAIN_')',
|
||||
`errprint(`*** ERROR: FEATURE(`lookupdotdomain') requires FEATURE(`access_db')
|
||||
')')
|
||||
ifdef(`_RELAY_HOSTS_ONLY_',
|
||||
`errprint(`*** WARNING: FEATURE(`lookupdotdomain') does not work well with FEATURE(`relay_hosts_only')
|
||||
')')
|
|
@ -0,0 +1,76 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000-2002 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)dnl
|
||||
VERSIONID(`Id: msp.m4,v 1.32 2002/03/26 22:02:03 ca Exp')
|
||||
divert(-1)
|
||||
undefine(`ALIAS_FILE')
|
||||
define(`confDELIVERY_MODE', `i')
|
||||
define(`confUSE_MSP', `True')
|
||||
define(`confFORWARD_PATH', `')
|
||||
define(`confPRIVACY_FLAGS', `goaway,noetrn,restrictqrun')
|
||||
define(`confDONT_PROBE_INTERFACES', `True')
|
||||
dnl ---------------------------------------------
|
||||
dnl run as this user (even if called by root)
|
||||
ifdef(`confRUN_AS_USER',,`define(`confRUN_AS_USER', `smmsp')')
|
||||
ifdef(`confTRUSTED_USER',,`define(`confTRUSTED_USER', confRUN_AS_USER)')
|
||||
dnl ---------------------------------------------
|
||||
dnl This queue directory must have the same group
|
||||
dnl as sendmail and it must be group-writable.
|
||||
dnl notice: do not test for QUEUE_DIR, it is set in some ostype/*.m4 files
|
||||
ifdef(`MSP_QUEUE_DIR',
|
||||
`define(`QUEUE_DIR', `MSP_QUEUE_DIR')',
|
||||
`define(`QUEUE_DIR', `/var/spool/clientmqueue')')
|
||||
define(`_MTA_HOST_', ifelse(defn(`_ARG_'), `', `[localhost]', `_ARG_'))
|
||||
define(`_MSP_FQHN_',`dnl used to qualify addresses
|
||||
ifdef(`MASQUERADE_NAME', ifdef(`_MASQUERADE_ENVELOPE_', `$M', `$j'), `$j')')
|
||||
ifelse(_ARG2_, `MSA', `define(`RELAY_MAILER_ARGS', `TCP $h 587')')
|
||||
dnl ---------------------------------------------
|
||||
ifdef(`confPID_FILE', `dnl',
|
||||
`define(`confPID_FILE', QUEUE_DIR`/sm-client.pid')')
|
||||
define(`confQUEUE_FILE_MODE', `0660')dnl
|
||||
ifdef(`STATUS_FILE',
|
||||
`define(`_F_',
|
||||
`define(`_b_', index(STATUS_FILE, `sendmail.st'))ifelse(_b_, `-1', `STATUS_FILE', `substr(STATUS_FILE, 0, _b_)sm-client.st')')
|
||||
define(`STATUS_FILE', _F_)
|
||||
undefine(`_b_') undefine(`_F_')',
|
||||
`define(`STATUS_FILE', QUEUE_DIR`/sm-client.st')')
|
||||
FEATURE(`no_default_msa')dnl
|
||||
ifelse(defn(`_DPO_'), `',
|
||||
`DAEMON_OPTIONS(`Name=NoMTA, Addr=127.0.0.1, M=E')dnl')
|
||||
define(`_DEF_LOCAL_MAILER_FLAGS', `')dnl
|
||||
define(`_DEF_LOCAL_SHELL_FLAGS', `')dnl
|
||||
define(`LOCAL_MAILER_PATH', `[IPC]')dnl
|
||||
define(`LOCAL_MAILER_FLAGS', `lmDFMuXkw5')dnl
|
||||
define(`LOCAL_MAILER_ARGS', `TCP $h')dnl
|
||||
define(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE', `SMTP')dnl
|
||||
define(`LOCAL_SHELL_PATH', `[IPC]')dnl
|
||||
define(`LOCAL_SHELL_FLAGS', `lmDFMuXk5')dnl
|
||||
define(`LOCAL_SHELL_ARGS', `TCP $h')dnl
|
||||
MODIFY_MAILER_FLAGS(`SMTP', `+k5')dnl
|
||||
MODIFY_MAILER_FLAGS(`ESMTP', `+k5')dnl
|
||||
MODIFY_MAILER_FLAGS(`DSMTP', `+k5')dnl
|
||||
MODIFY_MAILER_FLAGS(`SMTP8', `+k5')dnl
|
||||
MODIFY_MAILER_FLAGS(`RELAY', `+k')dnl
|
||||
MAILER(`local')dnl
|
||||
MAILER(`smtp')dnl
|
||||
|
||||
LOCAL_CONFIG
|
||||
D{MTAHost}_MTA_HOST_
|
||||
|
||||
LOCAL_RULESETS
|
||||
SLocal_localaddr
|
||||
R$+ $: $>ParseRecipient $1
|
||||
R$* < @ $+ > $* $#relay $@ ${MTAHost} $: $1 < @ $2 > $3
|
||||
ifdef(`_USE_DECNET_SYNTAX_',
|
||||
`# DECnet
|
||||
R$+ :: $+ $#relay $@ ${MTAHost} $: $1 :: $2', `dnl')
|
||||
R$* $#relay $@ ${MTAHost} $: $1 < @ _MSP_FQHN_ >
|
|
@ -0,0 +1,16 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: preserve_local_plus_detail.m4,v 8.1 2000/04/10 05:48:05 gshapiro Exp')
|
||||
divert(-1)
|
||||
|
||||
define(`_PRESERVE_LOCAL_PLUS_DETAIL_', `1')
|
|
@ -0,0 +1,20 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000, 2002 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: preserve_luser_host.m4,v 1.3 2002/04/14 13:22:58 ca Exp')
|
||||
divert(-1)
|
||||
|
||||
ifdef(`LUSER_RELAY', `',
|
||||
`errprint(`*** LUSER_RELAY should be defined before FEATURE(`preserve_luser_host')
|
||||
')')
|
||||
define(`_PRESERVE_LUSER_HOST_', `1')
|
||||
define(`_NEED_MACRO_MAP_', `1')
|
|
@ -0,0 +1,27 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: queuegroup.m4,v 1.4 2001/03/28 00:39:39 ca Exp')
|
||||
divert(-1)
|
||||
|
||||
ifdef(`_ACCESS_TABLE_', `',
|
||||
`errprint(`*** ERROR: FEATURE(`queuegroup') requires FEATURE(`access_db')
|
||||
')')
|
||||
|
||||
LOCAL_RULESETS
|
||||
Squeuegroup
|
||||
R< $+ > $1
|
||||
R $+ @ $+ $: $>SearchList <! qgrp> $| <F:$1@$2> <D:$2> <>
|
||||
ifelse(len(X`'_ARG_),`1',
|
||||
`R<?> $@',
|
||||
`R<?> $# _ARG_')
|
||||
R<$+> $# $1
|
|
@ -0,0 +1,29 @@
|
|||
PUSHDIVERT(-1)
|
||||
#
|
||||
# Copyright (c) 2002 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.
|
||||
#
|
||||
# Contributed by Kenneth Murchison.
|
||||
#
|
||||
|
||||
_DEFIFNOT(`_DEF_CYRUSV2_MAILER_FLAGS', `lsDFMnqXz')
|
||||
_DEFIFNOT(`CYRUSV2_MAILER_FLAGS', `A@/:|m')
|
||||
ifdef(`CYRUSV2_MAILER_ARGS',, `define(`CYRUSV2_MAILER_ARGS', `FILE /var/imap/socket/lmtp')')
|
||||
define(`_CYRUSV2_QGRP', `ifelse(defn(`CYRUSV2_MAILER_QGRP'),`',`', ` Q=CYRUSV2_MAILER_QGRP,')')dnl
|
||||
|
||||
POPDIVERT
|
||||
|
||||
#########################################
|
||||
### Cyrus V2 Mailer specification ###
|
||||
#########################################
|
||||
|
||||
VERSIONID(`Id: cyrusv2.m4,v 1.1 2002/06/01 21:14:57 ca Exp')
|
||||
|
||||
Mcyrusv2, P=[IPC], F=_MODMF_(CONCAT(_DEF_CYRUSV2_MAILER_FLAGS, CYRUSV2_MAILER_FLAGS), `CYRUSV2'),
|
||||
S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL, E=\r\n,
|
||||
_OPTINS(`CYRUSV2_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`CYRUSV2_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`CYRUSV2_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_CYRUSV2_QGRP
|
||||
A=CYRUSV2_MAILER_ARGS
|
|
@ -0,0 +1,21 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 1998, 1999, 2001 Sendmail, Inc. and its suppliers.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
|
||||
# Copyright (c) 1988, 1993
|
||||
# The Regents of the University of California. 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: a-ux.m4,v 8.2 2001/07/23 16:19:36 gshapiro Exp')
|
||||
ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
|
||||
ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
|
||||
_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl
|
||||
ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d -r $f $u')')dnl
|
||||
define(`confEBINDIR', `/usr/lib')dnl
|
|
@ -10,7 +10,7 @@ divert(-1)
|
|||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: aix5.m4,v 1.1.2.1 2000/12/09 03:32:08 ca Exp')
|
||||
VERSIONID(`Id: aix5.m4,v 1.1 2000/12/08 21:53:36 ca Exp')
|
||||
ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl
|
||||
ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl
|
||||
_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2000 Sendmail, Inc. and its suppliers.
|
||||
# Copyright (c) 2000, 2002 Sendmail, Inc. and its suppliers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set
|
||||
|
@ -8,10 +8,11 @@ divert(-1)
|
|||
# the sendmail distribution.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: darwin.m4,v 8.1.2.1 2000/06/15 06:37:04 gshapiro Exp')
|
||||
VERSIONID(`Id: darwin.m4,v 8.3 2002/03/05 01:55:40 ca Exp')
|
||||
ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl
|
||||
dnl turn on S flag for local mailer
|
||||
MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl
|
||||
ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl
|
||||
ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: freebsd5.m4,v 1.1 2001/10/08 22:25:34 gshapiro Exp')
|
||||
ifdef(`STATUS_FILE',, `define(`STATUS_FILE', `/var/log/sendmail.st')')dnl
|
||||
dnl turn on S flag for local mailer
|
||||
MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl
|
||||
ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl
|
||||
ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail $u')')dnl
|
||||
ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', `/usr/local/bin/uux')')dnl
|
||||
ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
|
|
@ -0,0 +1,22 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001 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.
|
||||
#
|
||||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: mpeix.m4,v 1.1 2001/12/13 23:56:40 gshapiro Exp')
|
||||
|
||||
ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/bin/tsmail')')dnl
|
||||
_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mu9')dnl
|
||||
ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `tsmail $u')')dnl
|
||||
ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', `/bin/sh')')dnl
|
||||
ifdef(`confDEF_USER_ID',, `define(`confDEF_USER_ID', `SERVER.SENDMAIL')')dnl
|
||||
ifdef(`confTRUSTED_USER',, `define(`confTRUSTED_USER', `SERVER.SENDMAIL')')dnl
|
||||
define(`confTIME_ZONE', `USE_TZ')dnl
|
||||
define(`confDONT_BLAME_SENDMAIL', `ForwardFileInGroupWritableDirPath')dnl
|
|
@ -15,7 +15,7 @@ divert(-1)
|
|||
#
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: solaris8.m4,v 8.1.2.2 2000/08/23 16:10:01 gshapiro Exp')
|
||||
VERSIONID(`Id: solaris8.m4,v 8.2 2000/08/23 16:10:49 gshapiro Exp')
|
||||
divert(-1)
|
||||
|
||||
ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')')
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
# Copyright (c) 2000-2002 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.
|
||||
#
|
||||
# Id: sendmail.schema,v 8.19.2.1 2002/11/20 23:13:27 gshapiro Exp
|
||||
|
||||
# Note that this schema is experimental at this point as it has had little
|
||||
# public review. Therefore, it may change in future versions. Feedback
|
||||
# via sendmail@sendmail.org is encouraged.
|
||||
|
||||
|
||||
# OID arcs for Sendmail
|
||||
# enterprise: 1.3.6.1.4.1
|
||||
# sendmail: enterprise.6152
|
||||
# sendmail-at: sendmail.3.1
|
||||
# sendmail-oc: sendmail.3.2
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# The Sendmail MTA attributes and objectclass
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# attribute sendmailMTACluster cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.10
|
||||
NAME 'sendmailMTACluster'
|
||||
DESC 'cluster name associated with a set of MTAs'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
# attribute sendmailMTAHost cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.11
|
||||
NAME 'sendmailMTAHost'
|
||||
DESC 'host name associated with a MTA cluster'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
#objectClass sendmailMTA
|
||||
# requires
|
||||
# objectClass
|
||||
# allows
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.10
|
||||
NAME 'sendmailMTA'
|
||||
SUP top STRUCTURAL
|
||||
DESC 'Sendmail MTA definition'
|
||||
MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# The Sendmail MTA shared attributes
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# attribute sendmailMTAKey cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.13
|
||||
NAME 'sendmailMTAKey'
|
||||
DESC 'key (left hand side) of an aliases or map entry'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# The Sendmail MTA Map attributes and objectclasses
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# attribute sendmailMTAMapName cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.14
|
||||
NAME 'sendmailMTAMapName'
|
||||
DESC 'identifier for the particular map'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} SINGLE-VALUE )
|
||||
|
||||
# attribute sendmailMTAMapValue cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.16
|
||||
NAME 'sendmailMTAMapValue'
|
||||
DESC 'value (right hand side) of a map entry'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
||||
|
||||
|
||||
#objectClass sendmailMTAMap
|
||||
# requires
|
||||
# objectClass,
|
||||
# sendmailMTAMapName,
|
||||
# allows
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.11
|
||||
NAME 'sendmailMTAMap'
|
||||
SUP sendmailMTA STRUCTURAL
|
||||
DESC 'Sendmail MTA map definition'
|
||||
MUST sendmailMTAMapName
|
||||
MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
||||
|
||||
#objectClass sendmailMTAObject
|
||||
# requires
|
||||
# objectClass,
|
||||
# sendmailMTAMapName,
|
||||
# sendmailMTAKey,
|
||||
# sendmailMTAMapValue,
|
||||
# allows
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.12
|
||||
NAME 'sendmailMTAMapObject'
|
||||
SUP sendmailMTAMap STRUCTURAL
|
||||
DESC 'Sendmail MTA map object'
|
||||
MUST ( sendmailMTAMapName $ sendmailMTAKey $ sendmailMTAMapValue )
|
||||
MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# The Sendmail MTA Alias attributes and objectclasses
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# attribute sendmailMTAAliasGrouping cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.18
|
||||
NAME 'sendmailMTAAliasGrouping'
|
||||
DESC 'name that identifies a particular aliases grouping'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
# attribute sendmailMTAAliasValue cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.20
|
||||
NAME 'sendmailMTAAliasValue'
|
||||
DESC 'value (right hand side) of an alias'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
|
||||
|
||||
|
||||
#objectClass sendmailMTAAlias
|
||||
# requires
|
||||
# objectClass,
|
||||
# allows
|
||||
# sendmailMTAAliasGrouping,
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.13
|
||||
NAME 'sendmailMTAAlias'
|
||||
SUP sendmailMTA STRUCTURAL
|
||||
DESC 'Sendmail MTA alias definition'
|
||||
MAY ( sendmailMTAAliasGrouping $
|
||||
sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
||||
|
||||
#objectClass sendmailMTAAliasObject
|
||||
# requires
|
||||
# objectClass,
|
||||
# sendmailMTAKey,
|
||||
# sendmailMTAAliasValue,
|
||||
# allows
|
||||
# sendmailMTAAliasGrouping,
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.14
|
||||
NAME 'sendmailMTAAliasObject'
|
||||
SUP sendmailMTAAlias STRUCTURAL
|
||||
DESC 'Sendmail MTA alias object'
|
||||
MUST ( sendmailMTAKey $ sendmailMTAAliasValue )
|
||||
MAY ( sendmailMTAAliasGrouping $
|
||||
sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# The Sendmail MTA Class attributes and objectclass
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# attribute sendmailMTAClassName cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.22
|
||||
NAME 'sendmailMTAClassName'
|
||||
DESC 'identifier for the class'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} SINGLE-VALUE )
|
||||
|
||||
# attribute sendmailMTAClassValue cis
|
||||
attributetype ( 1.3.6.1.4.1.6152.10.3.1.23
|
||||
NAME 'sendmailMTAClassValue'
|
||||
DESC 'member of a class'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
|
||||
|
||||
|
||||
#objectClass sendmailMTAClass
|
||||
# requires
|
||||
# objectClass,
|
||||
# sendmailMTAClassName,
|
||||
# sendmailMTAClassValue,
|
||||
# allows
|
||||
# sendmailMTACluster,
|
||||
# sendmailMTAHost,
|
||||
# Description
|
||||
|
||||
objectclass ( 1.3.6.1.4.1.6152.10.3.2.15
|
||||
NAME 'sendmailMTAClass'
|
||||
SUP sendmailMTA STRUCTURAL
|
||||
DESC 'Sendmail MTA class definition'
|
||||
MUST ( sendmailMTAClassName $ sendmailMTAClassValue )
|
||||
MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) )
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
# v 0.2-very-very-beta
|
||||
# v 0.2-very-beta
|
||||
#
|
||||
# 17 July 2000 Derek J. Balling (dredd@megacity.org)
|
||||
#
|
||||
|
@ -13,10 +13,24 @@
|
|||
# notation. Caveat: the address portion MUST be the start address or your
|
||||
# results will NOT be what what you want.
|
||||
#
|
||||
# If you have two overlapping CIDR blocks with conflicting actions
|
||||
# e.g. 10.2.3.128/25 REJECT and 10.2.3.143 ACCEPT
|
||||
# make sure that the exceptions to the more general block are specified
|
||||
# later in the access_db.
|
||||
#
|
||||
# the -r flag to makemap will make it "do the right thing"
|
||||
#
|
||||
# Modifications
|
||||
# -------------
|
||||
# 5 Nov 2002 Richard Rognlie (richard@sendmail.com)
|
||||
# Added code to deal with the prefix tags that may now be included in
|
||||
# the access_db
|
||||
#
|
||||
# Added clarification in the notes for what to do if you have
|
||||
# exceptions to a larger CIDR block.
|
||||
#
|
||||
# usage:
|
||||
# cidrexpand < /etc/mail/access | makemap hash /etc/mail/access
|
||||
#
|
||||
# cidrexpand < /etc/mail/access | makemap -r hash /etc/mail/access
|
||||
#
|
||||
# Report bugs to: dredd@megacity.org
|
||||
#
|
||||
|
@ -37,20 +51,20 @@ my $SENDMAIL = 1;
|
|||
|
||||
while (<>)
|
||||
{
|
||||
my ($left,$right,$space);
|
||||
my ($prefix,$left,$right,$space);
|
||||
|
||||
if (! /^(\d+\.){3}\d+\/\d\d?$spaceregex.*/ )
|
||||
if (! /^(|\S\S*:)(\d+\.){3}\d+\/\d\d?$spaceregex.*/ )
|
||||
{
|
||||
print;
|
||||
}
|
||||
else
|
||||
{
|
||||
($left,$space,$right) = /^((?:\d+\.){3}\d+\/\d\d?)($spaceregex)(.*)$/;
|
||||
($prefix,$left,$space,$right) = /^(|\S\S*:)((?:\d+\.){3}\d+\/\d\d?)($spaceregex)(.*)$/;
|
||||
|
||||
my @new_lefts = expand_network($left);
|
||||
foreach my $nl (@new_lefts)
|
||||
{
|
||||
print "$nl$space$right\n";
|
||||
print "$prefix$nl$space$right\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,5 +147,13 @@ sub calc_changes
|
|||
$second = 255;
|
||||
$first = 2**($power-24) - 1;
|
||||
}
|
||||
elsif ($mask == 0)
|
||||
{
|
||||
$fourth = 255;
|
||||
$third = 255;
|
||||
$second = 255;
|
||||
$first = 255;
|
||||
}
|
||||
|
||||
return ($first,$second,$third,$fourth);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001-2002 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.
|
||||
#
|
||||
#
|
||||
|
||||
dnl ## This is a modified enhdnsbl, loosely based on the
|
||||
dnl ## original.
|
||||
dnl ##
|
||||
dnl ## Use it as follows
|
||||
dnl ##
|
||||
dnl ## HACK(dnsblaccess, domain, optional-message, tempfail-message, keytag)
|
||||
dnl ##
|
||||
dnl ## The first argument (domain) is required. The other arguments
|
||||
dnl ## are optional and have reasonable defaults. The
|
||||
dnl ## optional-message is the error message given in case of a
|
||||
dnl ## match. The default behavior for a tempfail is to accept the
|
||||
dnl ## email. A tempfail-message value of `t' temporarily rejects
|
||||
dnl ## with a default message. Otherwise the value should be your
|
||||
dnl ## own message. The keytag is used to lookup the access map to
|
||||
dnl ## further refine the result. I recommend a qualified keytag
|
||||
dnl ## (containing a ".") as less likely to accidently conflict with
|
||||
dnl ## other access tags.
|
||||
dnl ##
|
||||
dnl ## This is best illustrated with an example. Please do not use
|
||||
dnl ## the example, as it refers to a bogus lookup list.
|
||||
dnl ##
|
||||
dnl ## Suppose that you use
|
||||
dnl ##
|
||||
dnl ## HACK(dnsblaccess, `rbl.bogus.org',`',`t',bogus.tag)
|
||||
dnl ##
|
||||
dnl ## and suppose that your access map contains the entries
|
||||
dnl ##
|
||||
dnl ## bogus.tag:127.0.0.2 REJECT
|
||||
dnl ## bogus.tag:127.0.0.3 error:dialup mail from %1: listed at %2
|
||||
dnl ## bogus.tag:127.0.0.4 OK
|
||||
dnl ## bogus.tag:127 REJECT
|
||||
dnl ## bogus.tag: OK
|
||||
dnl ##
|
||||
dnl ## If an SMTP connection is received from 123.45.6.7, sendmail
|
||||
dnl ## will lookup the A record for 7.6.45.123.bogus.org. If there
|
||||
dnl ## is a temp failure for the lookup, sendmail will generate a
|
||||
dnl ## temporary failure with a default message. If there is no
|
||||
dnl ## A-record for this lookup, then the mail is treated as if the
|
||||
dnl ## HACK line were not present. If the lookup returns 127.0.0.2,
|
||||
dnl ## then a default message rejects the mail. If it returns
|
||||
dnl ## 127.0.0.3, then the message
|
||||
dnl ## "dialup mail from 123.45.6.7: listed at rbl.bogus.org"
|
||||
dnl ## is used to reject the mail. If it returns 127.0.0.4, the
|
||||
dnl ## mail is processed as if there were no HACK line. If the
|
||||
dnl ## address returned is something else beginning with 127.*, the
|
||||
dnl ## mail is rejected with a default error message. If the
|
||||
dnl ## address returned does not begin 127, then the mail is
|
||||
dnl ## processed as if the HACK line were not present.
|
||||
|
||||
divert(0)
|
||||
VERSIONID(`Id: dnsblaccess.m4,v 1.5 2002/05/19 21:30:06 gshapiro Exp')
|
||||
ifdef(`_ACCESS_TABLE_', `dnl',
|
||||
`errprint(`*** ERROR: dnsblaccess requires FEATURE(`access_db')
|
||||
')')
|
||||
ifdef(`_EDNSBL_R_',`dnl',`dnl
|
||||
define(`_EDNSBL_R_', `1')dnl ## prevent multiple redefines of the map.
|
||||
LOCAL_CONFIG
|
||||
# map for enhanced DNS based blacklist lookups
|
||||
Kednsbl dns -R A -a. -T<TMP> -r`'ifdef(`EDNSBL_TO',`EDNSBL_TO',`5')
|
||||
')
|
||||
divert(-1)
|
||||
define(`_EDNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
|
||||
define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_EDNSBL_SRV_`"',`_ARG2_')')dnl
|
||||
define(`_EDNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_EDNSBL_SRV_`"',`_ARG3_')')dnl
|
||||
define(`_EDNSBL_KEY_', `ifelse(len(X`'_ARG4_),`1',`dnsblaccess',_ARG4_)')dnl
|
||||
divert(8)
|
||||
# DNS based IP address spam list _EDNSBL_SRV_
|
||||
R$* $: $&{client_addr}
|
||||
dnl IPv6?
|
||||
R$-.$-.$-.$- $: <?> $(ednsbl $4.$3.$2.$1._EDNSBL_SRV_. $: OK $) <>$1.$2.$3.$4
|
||||
R<?>OK<>$* $: OKSOFAR
|
||||
R<?>$+<TMP><>$* $: <? <TMPF>>
|
||||
R<?>$* $- .<>$* <$(access _EDNSBL_KEY_`:'$1$2 $@$3 $@`'_EDNSBL_SRV_ $: ? $)> $1 <>$3
|
||||
R<?>$* <>$* $:<$(access _EDNSBL_KEY_`:' $@$2 $@`'_EDNSBL_SRV_ $: ? $)> <>$2
|
||||
ifelse(len(X`'_ARG3_),`1',
|
||||
`R<$*<TMPF>>$* $: TMPOK',
|
||||
`R<$*<TMPF>>$* $#error $@ 4.7.1 $: _EDNSBL_MSG_TMP_')
|
||||
R<$={Accept}>$* $: OKSOFAR
|
||||
R<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4
|
||||
R<ERROR:$+> $* $#error $: $1
|
||||
R<DISCARD> $* $#discard $: discard
|
||||
R<$*> $* $#error $@ 5.7.1 $: _EDNSBL_MSG_
|
||||
divert(-1)
|
|
@ -46,7 +46,7 @@ divert(-1)changequote(<<, >>)<<
|
|||
in the sendmail source tree. For more information, please see the
|
||||
following URL:
|
||||
|
||||
http://www-wsg.cso.uiuc.edu/sendmail/patches/domainmap.html
|
||||
http://www-dev.cso.uiuc.edu/sendmail/domainmap/
|
||||
|
||||
Feedback is welcome.
|
||||
|
||||
|
@ -69,14 +69,16 @@ LOCAL_RULESETS
|
|||
SDomainMapLookup
|
||||
R $=L <@ $=w .> $@ $1 <@ $2 .> weed out local users, in case
|
||||
# Cw contains a mapped domain
|
||||
R $+ <@ $+> $: $1 <@ $2 > <$&{addr_type}> check if sender
|
||||
R $+ <@ $+> <e s> $#smtp $@ $2 $: $1 @ $2 do not process sender
|
||||
ifdef(`DOMAINMAP_NO_REGEX',`dnl
|
||||
R $+ <@ $+> $: $1 <@ $2> <$2> find domain
|
||||
R $+ <@ $+> <$*> $: $1 <@ $2> <$2> find domain
|
||||
R $+ <$+> <$+ . $+> $1 <$2> < $(dequote $3 "_" $4 $) >
|
||||
# change "." to "_"
|
||||
R $+ <$+> <$+ .> $: $1 <$2> < $(dequote "domain_" $3 $) >
|
||||
# prepend "domain_"
|
||||
dnl',`dnl
|
||||
R $+ <@ $+> $: $1 <@ $2> <$2 :NOTDONE:> find domain
|
||||
R $+ <@ $+> <$*> $: $1 <@ $2> <$2 :NOTDONE:> find domain
|
||||
R $+ <$+> <$+ . :NOTDONE:> $1 <$2> < $(domainmap_regex $3 $: $3 $) >
|
||||
# change "." and "-" to "_"
|
||||
R $+ <$+> <$+> $: $1 <$2> < $(dequote "domain_" $3 $) >
|
||||
|
|
|
@ -1,232 +1,225 @@
|
|||
#!/usr/bin/perl
|
||||
# doublebounce.pl
|
||||
# attempt to return a doubly-bounced email to a postmaster
|
||||
# jr@terra.net, 12/4/97
|
||||
#
|
||||
# invoke by creating an mail alias such as:
|
||||
# doublebounce: "|/usr/local/sbin/doublebounce"
|
||||
# then adding this line to your sendmail.cf:
|
||||
# O DoubleBounceAddress=doublebounce
|
||||
# Return a doubly-bounced e-mail to postmaster. Specific to sendmail,
|
||||
# updated to work on sendmail 8.12.6.
|
||||
#
|
||||
# optionally, add a "-d" flag in the aliases file, to send a
|
||||
# debug trace to your own postmaster showing what is going on
|
||||
# Based on the original doublebounce.pl code by jr@terra.net, 12/4/97.
|
||||
# Updated by bicknell@ufp.org, 12/4/2002 to understand new sendmail DSN
|
||||
# bounces. Code cleanup also performed, mainly making things more
|
||||
# robust.
|
||||
#
|
||||
# this allows the "postmaster" address to still go to a human being,
|
||||
# while bounce messages can go to this script, which will bounce them
|
||||
# back to the postmaster at the sending site.
|
||||
#
|
||||
# the algorithm is to scan the double-bounce error report generated
|
||||
# by sendmail on stdin, for the original message (it starts after the
|
||||
# second "Orignal message follows" marker), look for From, Sender, and
|
||||
# Received headers from the point closest to the sender back to the point
|
||||
# closest to us, and try to deliver a double-bounce report back to a
|
||||
# postmaster at one of these sites in the hope that they can
|
||||
# return the message to the original sender, or do something about
|
||||
# the fact that that sender's return address is not valid.
|
||||
|
||||
# Original intro included below, lines with ##
|
||||
## attempt to return a doubly-bounced email to a postmaster
|
||||
## jr@terra.net, 12/4/97
|
||||
##
|
||||
## invoke by creating an mail alias such as:
|
||||
## doublebounce: "|/usr/local/sbin/doublebounce"
|
||||
## then adding this line to your sendmail.cf:
|
||||
## O DoubleBounceAddress=doublebounce
|
||||
##
|
||||
## optionally, add a "-d" flag in the aliases file, to send a
|
||||
## debug trace to your own postmaster showing what is going on
|
||||
##
|
||||
## this allows the "postmaster" address to still go to a human being,
|
||||
## while bounce messages can go to this script, which will bounce them
|
||||
## back to the postmaster at the sending site.
|
||||
##
|
||||
## the algorithm is to scan the double-bounce error report generated
|
||||
## by sendmail on stdin, for the original message (it starts after the
|
||||
## second "Orignal message follows" marker), look for From, Sender, and
|
||||
## Received headers from the point closest to the sender back to the point
|
||||
## closest to us, and try to deliver a double-bounce report back to a
|
||||
## postmaster at one of these sites in the hope that they can
|
||||
## return the message to the original sender, or do something about
|
||||
## the fact that that sender's return address is not valid.
|
||||
|
||||
use Socket;
|
||||
|
||||
# look for debug flag
|
||||
#
|
||||
$dflag = 0;
|
||||
$dflag = 1 if ($ARGV[0] eq "-d");
|
||||
|
||||
# get local host name
|
||||
# you may need to edit these two lines for however your system does this
|
||||
#
|
||||
$host = `hostname`; chop($host);
|
||||
$domain = `dnsdomainname`; chop($domain);
|
||||
|
||||
# get temp file name
|
||||
$tmp = "/tmp/doubb$$";
|
||||
|
||||
# save message from STDIN to a file
|
||||
# I thought about reading it into a buffer here, but some messages
|
||||
# are 10+Mb so a buffer may not be a good idea
|
||||
#
|
||||
if (! open(MSG, "+> $tmp")) {
|
||||
# can't open temp file -- send message to local postmaster
|
||||
# open(MAIL, "| /usr/sbin/sendmail -oeq postmaster");
|
||||
print MAIL <STDIN>;
|
||||
close(MAIL);
|
||||
exit(1);
|
||||
}
|
||||
print MSG <STDIN>;
|
||||
|
||||
# scan message for list of possible sender sites
|
||||
# note that original message appears after the second
|
||||
# "Original message follows" marker
|
||||
# look for From, Sender, and Reply-To and try them, too
|
||||
#
|
||||
$inhdr = 0;
|
||||
$hdrs = 0;
|
||||
$skip = 0;
|
||||
seek(MSG, 0, 0);
|
||||
while (<MSG>) {
|
||||
chop;
|
||||
if (/^ ----- Original message follows -----$/
|
||||
|| /^ ----Unsent message follows----$/) {
|
||||
$i = 0;
|
||||
$inhdr = 1;
|
||||
$hdrs++;
|
||||
$skip = 1;
|
||||
next;
|
||||
}
|
||||
if ($skip) {
|
||||
$skip--;
|
||||
next;
|
||||
}
|
||||
if (/^$/) {
|
||||
last if ($hdrs >= 2);
|
||||
$inhdr = 0;
|
||||
next;
|
||||
}
|
||||
if (! $inhdr) {
|
||||
next;
|
||||
}
|
||||
if (! /^[ \t]/) { $hdr[$i++] = $_ }
|
||||
else {
|
||||
$i--;
|
||||
$hdr[$i++] .= $_;
|
||||
}
|
||||
}
|
||||
$rcvd = 0;
|
||||
for ($j = 0; $j < $i; $j++) {
|
||||
print STDERR "DEBUG hdr[$j] = $hdr[$j]\n";
|
||||
if ($hdr[$j] =~ /^received:/i) {
|
||||
($addr[$rcvd++]) = $hdr[$j] =~ m/.*\sby\s([^\s]+)\s.*/;
|
||||
}
|
||||
if ($hdr[$j] =~ /^reply-to:/i) {
|
||||
($addr1{"reply-to"} = $hdr[$j]) =~ s/^reply-to: *//i;
|
||||
}
|
||||
if ($hdr[$j] =~ /^sender:/i) {
|
||||
($addr1{"sender"} = $hdr[$j]) =~ s/^sender: *//i;
|
||||
}
|
||||
if ($hdr[$j] =~ /^from:/i) {
|
||||
($addr1{"from"} = $hdr[$j]) =~ s/^from: *//i;
|
||||
}
|
||||
}
|
||||
|
||||
# %addr and %addr1 arrays now contain lists of possible sites (or From headers).
|
||||
# Go through them parsing for the site name, and attempting to send
|
||||
# to the named person or postmaster@ each site in turn until successful
|
||||
#
|
||||
if ($dflag) {
|
||||
open(DEBUG, "|/usr/sbin/sendmail postmaster");
|
||||
print DEBUG "Subject: double bounce dialog\n";
|
||||
}
|
||||
$sent = 0;
|
||||
# foreach $x ("from", "sender", "reply-to") {
|
||||
foreach $x ("from", "sender") {
|
||||
$y = &parseaddr($addr1{$x});
|
||||
if ($y) {
|
||||
print DEBUG "Trying $y\n" if ($dflag);
|
||||
if (&sendbounce("$y")) {
|
||||
$sent++;
|
||||
last;
|
||||
}
|
||||
$y =~ s/.*@//;
|
||||
print DEBUG "Trying postmaster\@$y\n" if ($dflag);
|
||||
if (&sendbounce("postmaster\@$y")) {
|
||||
$sent++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $sent) {
|
||||
$rcvd--;
|
||||
for ($i = $rcvd; $i >= 0; $i--) {
|
||||
$y = &parseaddr($addr[$i]);
|
||||
$y =~ s/.*@//;
|
||||
if ($y) {
|
||||
print DEBUG "Trying postmaster\@$y\n" if ($dflag);
|
||||
if (&sendbounce("postmaster\@$y")) {
|
||||
$sent++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $sent) {
|
||||
# queer things are happening to me
|
||||
# $addr[0] should be own domain, so we should have just
|
||||
# tried postmaster@our.domain. theoretically, we should
|
||||
# not get here...
|
||||
if ($dflag) {
|
||||
print DEBUG "queer things are happening to me\n";
|
||||
print DEBUG "Trying postmaster\n";
|
||||
}
|
||||
&sendbounce("postmaster");
|
||||
}
|
||||
|
||||
# clean up and get out
|
||||
#
|
||||
if ($dflag) {
|
||||
seek(MSG, 0, 0);
|
||||
print DEBUG "\n---\n"; print DEBUG <MSG>;
|
||||
close(DEBUG);
|
||||
}
|
||||
close(MSG);
|
||||
unlink("$tmp");
|
||||
exit(0);
|
||||
|
||||
|
||||
|
||||
|
||||
use Getopt::Std;
|
||||
use POSIX;
|
||||
use Sys::Syslog qw(:DEFAULT setlogsock);
|
||||
use strict;
|
||||
use vars qw( $opt_d $tmpfile);
|
||||
|
||||
# parseaddr()
|
||||
# parse hostname from From: header
|
||||
#
|
||||
sub parseaddr {
|
||||
local($hdr) = @_;
|
||||
local($addr);
|
||||
my($hdr) = @_;
|
||||
my($addr);
|
||||
|
||||
if ($hdr =~ /<.*>/) {
|
||||
($addr) = $hdr =~ m/<(.*)>/;
|
||||
return $addr;
|
||||
}
|
||||
if ($addr =~ /\s*\(/) {
|
||||
($addr) = $hdr =~ m/\s*(.*)\s*\(/;
|
||||
return $addr;
|
||||
}
|
||||
($addr) = $hdr =~ m/\s*(.*)\s*/;
|
||||
return $addr;
|
||||
if ($hdr =~ /<.*>/) {
|
||||
($addr) = $hdr =~ m/<(.*)>/;
|
||||
$addr =~ s/.*\@//;
|
||||
return $addr;
|
||||
}
|
||||
if ($addr =~ /\s*\(/) {
|
||||
($addr) = $hdr =~ m/\s*(.*)\s*\(/;
|
||||
$addr =~ s/.*\@//;
|
||||
return $addr;
|
||||
}
|
||||
($addr) = $hdr =~ m/\s*(.*)\s*/;
|
||||
$addr =~ s/.*\@//;
|
||||
return $addr;
|
||||
}
|
||||
|
||||
|
||||
# sendbounce()
|
||||
# send bounce to postmaster
|
||||
#
|
||||
# this re-invokes sendmail in immediate and quiet mode to try
|
||||
# to deliver to a postmaster. sendmail's exit status tells us
|
||||
# wether the delivery attempt really was successful.
|
||||
# whether the delivery attempt really was successful.
|
||||
#
|
||||
sub sendbounce {
|
||||
local($dest) = @_;
|
||||
local($st);
|
||||
sub send_bounce {
|
||||
my($addr, $from) = @_;
|
||||
my($st);
|
||||
my($result);
|
||||
|
||||
open(MAIL, "| /usr/sbin/sendmail -ocn -odi -oeq $dest");
|
||||
print MAIL <<EOT;
|
||||
From: Mail Delivery Subsystem <mail-router\@$domain>
|
||||
my($dest) = "postmaster\@" . parseaddr($addr);
|
||||
|
||||
if ($opt_d) {
|
||||
syslog ('info', "Attempting to send to user $dest");
|
||||
}
|
||||
open(MAIL, "| /usr/sbin/sendmail -oeq $dest");
|
||||
print MAIL <<EOT;
|
||||
From: Mail Delivery Subsystem <mail-router>
|
||||
Subject: Postmaster notify: double bounce
|
||||
Reply-To: nobody\@$domain
|
||||
Errors-To: nobody\@$domain
|
||||
Reply-To: nobody
|
||||
Errors-To: nobody
|
||||
Precedence: junk
|
||||
Auto-Submitted: auto-generated (postmaster notification)
|
||||
|
||||
The following message was received at $host.$domain for an invalid
|
||||
recipient. The sender's address was also invalid. Since the message
|
||||
originated at or transited through your mailer, this notification is being
|
||||
sent to you in the hope that you will determine the real originator and
|
||||
have them correct their From or Sender address.
|
||||
The following message was received for an invalid recipient. The
|
||||
sender's address was also invalid. Since the message originated
|
||||
at or transited through your mailer, this notification is being
|
||||
sent to you in the hope that you will determine the real originator
|
||||
and have them correct their From or Sender address.
|
||||
|
||||
The invalid sender address was: $addr1{"from"}.
|
||||
The from header on the original e-mail was: $from.
|
||||
|
||||
----- The following is a double bounce at $host.$domain -----
|
||||
----- The following is a double bounce -----
|
||||
|
||||
EOT
|
||||
seek(MSG, 0, 0);
|
||||
print MAIL <MSG>;
|
||||
return close(MAIL);
|
||||
|
||||
open(MSG, "<$tmpfile");
|
||||
print MAIL <MSG>;
|
||||
close(MSG);
|
||||
$result = close(MAIL);
|
||||
if ($result) {
|
||||
syslog('info', 'doublebounce successfully sent to %s', $dest);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub main {
|
||||
# Get our command line options
|
||||
getopts('d');
|
||||
|
||||
# Set up syslog
|
||||
setlogsock('unix');
|
||||
openlog('doublebounce', 'pid', 'mail');
|
||||
|
||||
if ($opt_d) {
|
||||
syslog('info', 'Processing a doublebounce.');
|
||||
}
|
||||
|
||||
# The bounced e-mail may be large, so we'd better not try to buffer
|
||||
# it in memory, get a temporary file.
|
||||
$tmpfile = POSIX::tmpnam();
|
||||
|
||||
if (!open(MSG, ">$tmpfile")) {
|
||||
syslog('err', "Unable to open temporary file $tmpfile");
|
||||
exit(75); # 75 is a temporary failure, sendmail should retry
|
||||
}
|
||||
print(MSG <STDIN>);
|
||||
close(MSG);
|
||||
if (!open(MSG, "<$tmpfile")) {
|
||||
syslog('err', "Unable to reopen temporary file $tmpfile");
|
||||
exit(74); # 74 is an IO error
|
||||
}
|
||||
|
||||
# Ok, now we can get down to business, find the original message
|
||||
my($skip_lines, $in_header, $headers_found, @addresses);
|
||||
$skip_lines = 0;
|
||||
$in_header = 0;
|
||||
$headers_found = 0;
|
||||
while (<MSG>) {
|
||||
if ($skip_lines > 0) {
|
||||
$skip_lines--;
|
||||
next;
|
||||
}
|
||||
chomp;
|
||||
# Starting message depends on your version of sendmail
|
||||
if (/^ ----- Original message follows -----$/ ||
|
||||
/^ ----Unsent message follows----$/ ||
|
||||
/^Content-Type: message\/rfc822$/) {
|
||||
# Found the original message
|
||||
$skip_lines++;
|
||||
$in_header = 1;
|
||||
$headers_found++;
|
||||
next;
|
||||
}
|
||||
if (/^$/) {
|
||||
if ($headers_found >= 2) {
|
||||
# We only process two deep, even if there are more
|
||||
last;
|
||||
}
|
||||
if ($in_header) {
|
||||
# We've found the end of a header, scan for the next one
|
||||
$in_header = 0;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if ($in_header) {
|
||||
if (! /^[ \t]/) {
|
||||
# New Header
|
||||
if (/^(received): (.*)/i ||
|
||||
/^(reply-to): (.*)/i ||
|
||||
/^(sender): (.*)/i ||
|
||||
/^(from): (.*)/i ) {
|
||||
$addresses[$headers_found]{$1} = $2;
|
||||
}
|
||||
next;
|
||||
} else {
|
||||
# continuation header
|
||||
# we should really process these, but we don't yet
|
||||
next;
|
||||
}
|
||||
} else {
|
||||
# Nothing to do if we're not in a header
|
||||
next;
|
||||
}
|
||||
}
|
||||
close(MSG);
|
||||
|
||||
# Start with the original (inner) sender
|
||||
my($addr, $sent);
|
||||
foreach $addr (keys %{$addresses[2]}) {
|
||||
if ($opt_d) {
|
||||
syslog('info', "Trying to send to $addresses[2]{$addr} - $addresses[2]{\"From\"}");
|
||||
}
|
||||
$sent = send_bounce($addresses[2]{$addr}, $addresses[2]{"From"});
|
||||
last if $sent;
|
||||
}
|
||||
if (!$sent && $opt_d) {
|
||||
if ($opt_d) {
|
||||
syslog('info', 'Unable to find original sender, falling back.');
|
||||
}
|
||||
foreach $addr (keys %{$addresses[1]}) {
|
||||
if ($opt_d) {
|
||||
syslog('info', "Trying to send to $addresses[2]{$addr} - $addresses[2]{\"From\"}");
|
||||
}
|
||||
$sent = send_bounce($addresses[1]{$addr}, $addresses[2]{"From"});
|
||||
last if $sent;
|
||||
}
|
||||
if (!$sent) {
|
||||
syslog('info', 'Unable to find anyone to send a doublebounce notification');
|
||||
}
|
||||
}
|
||||
|
||||
unlink($tmpfile);
|
||||
}
|
||||
|
||||
main();
|
||||
exit(0);
|
||||
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
System Administration Commands etrn(1M)
|
||||
|
||||
|
||||
NAME
|
||||
etrn - start mail queue run
|
||||
|
||||
SYNOPSIS
|
||||
etrn [-v] server-host [client-hosts]
|
||||
|
||||
DESCRIPTION
|
||||
SMTP's ETRN command allows an SMTP client and server to
|
||||
interact, giving the server an opportunity to start the pro
|
||||
cessing of its queues for messages to go to a given host.
|
||||
This is meant to be used in start-up conditions, as well as
|
||||
for mail nodes that have transient connections to their ser
|
||||
vice providers.
|
||||
|
||||
The etrn utility initiates an SMTP session with the host
|
||||
server-host and sends one or more ETRN commands as follows:
|
||||
If no client-hosts are specified, etrn looks up every host
|
||||
name for which sendmail(1M) accepts email and, for each
|
||||
name, sends an ETRN command with that name as the argument.
|
||||
If any client-hosts are specified, etrn uses each of these
|
||||
as arguments for successive ETRN commands.
|
||||
|
||||
OPTIONS
|
||||
The following option is supported:
|
||||
|
||||
-v The normal mode of operation for etrn is to do all of
|
||||
its work silently. The -v option makes it verbose,
|
||||
which causes etrn to display its conversations with
|
||||
the remote SMTP server.
|
||||
|
||||
ENVIRONMENT
|
||||
No environment variables are used.
|
||||
|
||||
FILES
|
||||
/etc/mail/sendmail.cf
|
||||
sendmail configuration file
|
||||
|
||||
SEE ALSO
|
||||
sendmail(1M), RFC 1985.
|
||||
|
||||
CAVEATS
|
||||
Not all SMTP servers support ETRN.
|
||||
|
||||
CREDITS
|
||||
Leveraged from David Muir Sharnoff's expn.pl script. Chris
|
||||
tian von Roques added support for args and fixed a couple of
|
||||
bugs.
|
||||
|
||||
AVAILABILITY
|
||||
The latest version of etrn is available in the contrib
|
||||
directory of the sendmail distribution through anonymous ftp
|
||||
at ftp://ftp.sendmail.org/ucb/src/sendmail/.
|
||||
|
||||
AUTHOR
|
||||
John T. Beck <john@beck.org>
|
|
@ -3,7 +3,7 @@
|
|||
## Copyright (c) 2000 Sendmail, Inc. and its suppliers.
|
||||
## All rights reserved.
|
||||
##
|
||||
## Id: link_hash.sh,v 1.1.2.1 2000/04/25 00:10:47 ca Exp
|
||||
## Id: link_hash.sh,v 1.2 2000/04/25 00:12:28 ca Exp
|
||||
##
|
||||
#
|
||||
# ln a certificate to its hash
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
use FileHandle;
|
||||
use Socket;
|
||||
|
||||
$sendmailDaemon = "/usr/sbin/sendmail -q30m -bd";
|
||||
my $sendmailDaemon = "/usr/sbin/sendmail -q30m -bd";
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
|
@ -70,6 +72,7 @@ sub do_command
|
|||
my $command = shift;
|
||||
my $proto = getprotobyname('ip');
|
||||
my @reply;
|
||||
my $i;
|
||||
|
||||
socket(SOCK, PF_UNIX, SOCK_STREAM, $proto) or return undef;
|
||||
|
||||
|
@ -216,7 +219,7 @@ sub start_daemon
|
|||
}
|
||||
elsif (defined $pid)
|
||||
{
|
||||
exec($main::sendmailDaemon);
|
||||
exec($sendmailDaemon);
|
||||
die "Unable to start sendmail daemon: $!.\n";
|
||||
}
|
||||
else
|
||||
|
@ -272,6 +275,29 @@ sub restart_daemon
|
|||
return &do_command($control, "RESTART");
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# &memdump -- get memdump from the daemon using the control socket
|
||||
#
|
||||
# Parameters:
|
||||
# control -- control socket name
|
||||
#
|
||||
# Returns:
|
||||
# Error message or status message
|
||||
#
|
||||
|
||||
sub memdump
|
||||
{
|
||||
my $control = shift;
|
||||
my $status;
|
||||
|
||||
if (not defined $control)
|
||||
{
|
||||
return "The control socket is not configured so the daemon can not be queried for memdump.";
|
||||
}
|
||||
return &do_command($control, "MEMDUMP");
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# &help -- get help from the daemon using the control socket
|
||||
|
@ -295,10 +321,14 @@ sub help
|
|||
return &do_command($control, "HELP");
|
||||
}
|
||||
|
||||
my $command = shift;
|
||||
my $control = &get_controlname;
|
||||
my $status = undef;
|
||||
my $daemonStatus = undef;
|
||||
my $opts = {};
|
||||
|
||||
getopts('f:', $opts) || die "Usage: $0 [-f /path/to/control/socket] command\n";
|
||||
|
||||
my $control = $opts->{f} || &get_controlname;
|
||||
my $command = shift;
|
||||
|
||||
if (not defined $control)
|
||||
{
|
||||
|
@ -306,7 +336,7 @@ if (not defined $control)
|
|||
}
|
||||
if (not defined $command)
|
||||
{
|
||||
die "Usage: $0 command\n";
|
||||
die "Usage: $0 [-f /path/to/control/socket] command\n";
|
||||
}
|
||||
if ($command eq "status")
|
||||
{
|
||||
|
@ -341,10 +371,30 @@ elsif (lc($command) eq "start")
|
|||
{
|
||||
$status = &start_daemon($control);
|
||||
}
|
||||
elsif (lc($command) eq "memdump")
|
||||
{
|
||||
$status = &memdump($control);
|
||||
}
|
||||
elsif (lc($command) eq "help")
|
||||
{
|
||||
$status = &help($control);
|
||||
}
|
||||
elsif (lc($command) eq "mstat")
|
||||
{
|
||||
$status = &do_command($control, "mstat");
|
||||
if (not defined $status)
|
||||
{
|
||||
# Not responding on control channel, query via SMTP
|
||||
if (&sendmail_running)
|
||||
{
|
||||
$daemonStatus = "Sendmail is running but not answering status queries.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$daemonStatus = "Sendmail does not appear to be running.";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Unrecognized command $command\n";
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
divert(-1)
|
||||
#
|
||||
# Copyright (c) 2001-2002 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.
|
||||
#
|
||||
# Compile/run a test program for libsm.
|
||||
#
|
||||
# Id: sm-test.m4,v 1.7 2002/02/01 17:38:07 ca Exp
|
||||
#
|
||||
define(`smtest',
|
||||
`bldPUSH_TARGET($1)dnl
|
||||
bldLIST_PUSH_ITEM(`bldC_PRODUCTS', $1)dnl
|
||||
bldPUSH_CLEAN_TARGET($1`-clean')dnl
|
||||
divert(bldTARGETS_SECTION)
|
||||
$1`'SRCS=$1.c
|
||||
$1: ${BEFORE} $1.o ifdef(`confREQUIRE_LIBSM', `libsm.a')
|
||||
${CC} -o $1 ${LDOPTS} ${LIBDIRS} $1.o ifdef(`confREQUIRE_LIBSM', `libsm.a') ${LIBS}
|
||||
ifelse(len(X`'$2), `1', `', `
|
||||
@echo ============================================================
|
||||
./$1
|
||||
@echo ============================================================')
|
||||
$1-clean:
|
||||
rm -f $1 $1.o
|
||||
divert(0)')
|
|
@ -1,6 +1,10 @@
|
|||
# Id: AIX.5.0,v 1.1.2.1 2000/12/09 03:31:23 ca Exp
|
||||
# Id: AIX.5.0,v 1.6 2002/03/21 23:59:25 gshapiro Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
|
||||
define(`confENVDEF', `-D_AIX4=40300 -D_AIX5=50000 -DSM_OS=sm_os_aix')
|
||||
define(`confENVDEF', `-D_AIX5=50000')
|
||||
define(`confOPTIMIZE', `-O3 -qstrict')
|
||||
define(`confCC', `/usr/vac/bin/xlc')
|
||||
define(`confLIBS', `-ldbm')
|
||||
|
@ -9,6 +13,8 @@ define(`confEBINDIR', `/usr/lib')
|
|||
define(`confSBINGRP', `system')
|
||||
define(`confDEPEND_TYPE', `AIX')
|
||||
define(`confLDOPTS', `-blibpath:/usr/lib:/lib')
|
||||
define(`confSM_OS_HEADER', `sm_os_aix')
|
||||
|
||||
define(`confMTCCOPTS', `-D_THREAD_SAFE')
|
||||
define(`confMTLDOPTS', `-lpthread')
|
||||
define(`confLDOPTS_SO', `-Wl,-G -Wl,-bexpall')
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# Id: AIX.5.1,v 1.2 2002/03/21 23:59:25 gshapiro Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
|
||||
define(`confENVDEF', `-D_AIX5=50100')
|
||||
define(`confOPTIMIZE', `-O3 -qstrict')
|
||||
define(`confCC', `/usr/vac/bin/xlc')
|
||||
define(`confLIBS', `-ldbm')
|
||||
define(`confINSTALL', `/usr/ucb/install')
|
||||
define(`confEBINDIR', `/usr/lib')
|
||||
define(`confSBINGRP', `system')
|
||||
define(`confDEPEND_TYPE', `AIX')
|
||||
define(`confLDOPTS', `-blibpath:/usr/lib:/lib')
|
||||
define(`confSM_OS_HEADER', `sm_os_aix')
|
||||
|
||||
define(`confMTCCOPTS', `-D_THREAD_SAFE')
|
||||
define(`confMTLDOPTS', `-lpthread')
|
||||
define(`confLDOPTS_SO', `-Wl,-G -Wl,-bexpall')
|
|
@ -0,0 +1,17 @@
|
|||
# Id: Interix,v 1.1.2.1 2002/08/29 00:07:53 gshapiro Exp
|
||||
# Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confCC', `/usr/local/bin/gcc')
|
||||
define(`confOPTIMIZE', `-O2')
|
||||
APPENDDEF(`confMAPDEF', `-DMAP_REGEX')
|
||||
APPENDDEF(`confENVDEF', `-D__INTERIX -D_ALL_SOURCE')
|
||||
APPENDDEF(`confINCDIRS', `-I/usr/local/include/bind')
|
||||
APPENDDEF(`confLIBDIRS', `-L/usr/local/lib/bind')
|
||||
APPENDDEF(`confLIBS', `-lbind')
|
||||
APPENDDEF(`confLIBS', `-ll')
|
||||
define(`confMAN1EXT', `0')
|
||||
define(`confMAN5EXT', `0')
|
||||
define(`confMAN8EXT', `0')
|
|
@ -0,0 +1,36 @@
|
|||
# Id: MPE-iX,v 1.2 2002/03/21 23:59:25 gshapiro Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confCC', `gcc')
|
||||
define(`confOPTIMIZE', `-O')
|
||||
define(`confMAPDEF', `-DNEWDB -DMAP_REGEX')
|
||||
define(`confENVDEF', `-DMPE -D_SOCKET_SOURCE -D_POSIX_SOURCE -DIS_SOCKET_CLIB_ITSELF')
|
||||
APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_DOTTED_USERNAMES -D_FFR_DROP_TRUSTUSER_WARNING -D_FFR_TRUSTED_QF')
|
||||
define(`confINCDIRS', `-I/BINDFW/CURRENT/include -I/SYSLOG/PUB -I/${HPACCOUNT}/${HPGROUP}/include -I/usr/contrib/include')
|
||||
define(`confLIBDIRS', `-L/BINDFW/CURRENT/lib -L/SYSLOG/PUB -L/${HPACCOUNT}/${HPGROUP}/lib')
|
||||
define(`confLIBS', `-lsyslog -ldb -lsocket -lsvipc')
|
||||
define(`confSM_OS_HEADER', `sm_os_mpeix')
|
||||
define(`conf_sendmail_LIB_POST', `--for-linker="-WL,cap=ia,ba,ph,pm"')
|
||||
define(`confINSTALL', `${BUILDBIN}/install.sh')
|
||||
|
||||
define(`confEBINDIR', `/${HPACCOUNT}/${HPGROUP}/sbin')
|
||||
define(`confGBINGRP', `${HPACCOUNT}')
|
||||
define(`confGBINOWN', `MGR.${HPACCOUNT}')
|
||||
define(`confMSPQOWN', `SERVER.${HPACCOUNT}')
|
||||
define(`confMANROOT', `/${HPACCOUNT}/${HPGROUP}/man/cat')
|
||||
define(`confMANROOTMAN', `/${HPACCOUNT}/${HPGROUP}/man/man')
|
||||
define(`confMANGRP', `${HPACCOUNT}')
|
||||
define(`confMANOWN', `MGR.${HPACCOUNT}')
|
||||
define(`confMBINDIR', `/${HPACCOUNT}/${HPGROUP}/sbin')
|
||||
define(`confMBINGRP', `${HPACCOUNT}')
|
||||
define(`confMBINMODE', `555')
|
||||
define(`confMBINOWN', `MGR.${HPACCOUNT}')
|
||||
define(`confSBINDIR', `/${HPACCOUNT}/${HPGROUP}/sbin')
|
||||
define(`confSBINGRP', `${HPACCOUNT}')
|
||||
define(`confSBINMODE', `6555')
|
||||
define(`confSBINOWN', `MGR.${HPACCOUNT}')
|
||||
define(`confUBINDIR', `/${HPACCOUNT}/${HPGROUP}/bin')
|
||||
define(`confUBINGRP', `${HPACCOUNT}')
|
||||
define(`confUBINOWN', `MGR.${HPACCOUNT}')
|
|
@ -1,12 +1,18 @@
|
|||
# Id: OSF1.V5.x,v 8.1.2.1 2001/02/26 21:09:00 gshapiro Exp
|
||||
# Id: OSF1.V5.x,v 8.4 2002/03/21 23:59:25 gshapiro Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confCC', `cc -std1 -Olimit 1000')
|
||||
define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
|
||||
define(`confENVDEF', `-DHASSNPRINTF=1')
|
||||
define(`confENVDEF', `')
|
||||
define(`confLIBS', `-ldbm')
|
||||
define(`confSM_OS_HEADER', `sm_os_osf1')
|
||||
define(`confSTDIR', `/var/adm/sendmail')
|
||||
define(`confINSTALL', `installbsd')
|
||||
define(`confEBINDIR', `/usr/lbin')
|
||||
define(`confUBINDIR', `${BINDIR}')
|
||||
define(`confDEPEND_TYPE', `CC-M')
|
||||
|
||||
define(`confMTCCOPTS', `-D_REENTRANT')
|
||||
define(`confMTLDOPTS', `-lpthread')
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Id: OpenUNIX.5.i386,v 1.3 2002/03/21 23:59:25 gshapiro Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
#
|
||||
# System V Rel 5.x (a.k.a OpenUNIX)
|
||||
#
|
||||
define(`confSM_OS_HEADER', `sm_os_openunix')
|
||||
define(`confCC', `/usr/ccs/bin/cc')
|
||||
define(`confMAPDEF', `-DNDBM -DMAP_REGEX')
|
||||
define(`confENVDEF', `-D__svr5__')
|
||||
define(`confLIBS', `-lsocket -lnsl -lelf')
|
||||
define(`confSHELL', `/usr/bin/sh')
|
||||
define(`confMBINDIR', `/usr/lib')
|
||||
define(`confSBINDIR', `/etc/mail')
|
||||
define(`confUBINDIR', `/etc/mail')
|
||||
define(`confEBINDIR', `/usr/lib')
|
||||
define(`confSBINGRP', `mail')
|
||||
define(`confINSTALL', `/usr/ucb/install')
|
||||
define(`confMTCCOPTS', `-Kpthread')
|
||||
define(`confMTLDOPTS', `-lpthread')
|
|
@ -0,0 +1,26 @@
|
|||
# Id: SunOS.5.10,v 1.1.2.1 2002/11/09 03:04:19 ca Exp
|
||||
|
||||
dnl DO NOT EDIT THIS FILE.
|
||||
dnl Place personal settings in devtools/Site/site.config.m4
|
||||
|
||||
define(`confCC', `gcc')
|
||||
define(`confLDOPTS_SO', `-G')
|
||||
define(`confBEFORE', `sysexits.h')
|
||||
define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX')
|
||||
define(`confENVDEF', `-DSOLARIS=21000 -DNETINET6')
|
||||
define(`confSM_OS_HEADER', `sm_os_sunos')
|
||||
define(`confLIBS', `-lsocket -lnsl')
|
||||
define(`confMTCCOPTS', `-D_REENTRANT')
|
||||
define(`confMTLDOPTS', `-lpthread')
|
||||
define(`confMBINDIR', `/usr/lib')
|
||||
define(`confEBINDIR', `/usr/lib')
|
||||
define(`confSBINGRP', `sys')
|
||||
define(`confINSTALL', `${BUILDBIN}/install.sh')
|
||||
define(`confDEPEND_TYPE', `CC-M')
|
||||
PUSHDIVERT(3)
|
||||
sysexits.h:
|
||||
if [ -r /usr/include/sysexits.h ]; \
|
||||
then \
|
||||
ln -s /usr/include/sysexits.h; \
|
||||
fi
|
||||
POPDIVERT
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 1999-2000 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.
|
||||
#
|
||||
#
|
||||
# Id: Build,v 1.2 2000/09/17 17:30:02 gshapiro Exp
|
||||
|
||||
exec ../devtools/bin/Build $*
|
|
@ -0,0 +1,17 @@
|
|||
# Id: Makefile,v 1.1 2000/08/31 16:19:25 ca Exp
|
||||
|
||||
SHELL= /bin/sh
|
||||
BUILD= ./Build
|
||||
OPTIONS= $(CONFIG) $(FLAGS)
|
||||
|
||||
all: FRC
|
||||
$(SHELL) $(BUILD) $(OPTIONS) $@
|
||||
clean: FRC
|
||||
$(SHELL) $(BUILD) $(OPTIONS) $@
|
||||
install: FRC
|
||||
$(SHELL) $(BUILD) $(OPTIONS) $@
|
||||
|
||||
fresh: FRC
|
||||
$(SHELL) $(BUILD) $(OPTIONS) -c
|
||||
|
||||
FRC:
|
|
@ -0,0 +1,23 @@
|
|||
dnl Id: Makefile.m4,v 1.4.6.1 2002/06/21 21:58:27 ca Exp
|
||||
include(confBUILDTOOLSDIR`/M4/switch.m4')
|
||||
|
||||
define(`confREQUIRE_LIBSM', `true')
|
||||
# sendmail dir
|
||||
SMSRCDIR= ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
|
||||
PREPENDDEF(`confENVDEF', `confMAPDEF')
|
||||
PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
|
||||
|
||||
bldPRODUCT_START(`executable', `editmap')
|
||||
define(`bldSOURCES', `editmap.c ')
|
||||
define(`bldINSTALL_DIR', `S')
|
||||
bldPUSH_SMLIB(`sm')
|
||||
bldPUSH_SMLIB(`smutil')
|
||||
bldPUSH_SMLIB(`smdb')
|
||||
APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
|
||||
bldPRODUCT_END
|
||||
|
||||
bldPRODUCT_START(`manpage', `editmap')
|
||||
define(`bldSOURCES', `editmap.8')
|
||||
bldPRODUCT_END
|
||||
|
||||
bldFINISH
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
|
||||
|
||||
EDITMAP(8) EDITMAP(8)
|
||||
|
||||
|
||||
NNAAMMEE
|
||||
eeddiittmmaapp - query and edit single records in database maps
|
||||
for sendmail
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
eeddiittmmaapp [--CC _f_i_l_e] [--NN] [--ff] [--qq||--uu||--xx] maptype mapname key
|
||||
[ "value ..." ]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
EEddiittmmaapp queries or edits one record in a database maps
|
||||
used by the keyed map lookups in sendmail(8). Arguments
|
||||
are passed on the command line and output (for queries) is
|
||||
directed to standard output.
|
||||
|
||||
Depending on how it is compiled, eeddiittmmaapp handles up to
|
||||
three different database formats, selected using the _m_a_p_-
|
||||
_t_y_p_e parameter. They may be
|
||||
|
||||
dbm DBM format maps. This requires the ndbm(3)
|
||||
library.
|
||||
|
||||
btree B-Tree format maps. This requires the new Berkeley
|
||||
DB library.
|
||||
|
||||
hash Hash format maps. This also requires the Berkeley
|
||||
DB library.
|
||||
|
||||
If the _T_r_u_s_t_e_d_U_s_e_r option is set in the sendmail configu-
|
||||
ration file and eeddiittmmaapp is invoked as root, the generated
|
||||
files will be owned by the specified _T_r_u_s_t_e_d_U_s_e_r_.
|
||||
|
||||
FFllaaggss
|
||||
--CC Use the specified sseennddmmaaiill configuration file for
|
||||
looking up the TrustedUser option.
|
||||
|
||||
--NN Include the null byte that terminates strings in
|
||||
the map (for alias maps).
|
||||
|
||||
--ff Normally all upper case letters in the key are
|
||||
folded to lower case. This flag disables that
|
||||
behaviour. This is intended to mesh with the -f
|
||||
flag in the KK line in sendmail.cf. The value is
|
||||
never case folded.
|
||||
|
||||
--qq Query the map for the specified key. If found,
|
||||
print value to standard output and exit with 0. If
|
||||
not found then print an error message to stdout and
|
||||
exit with EX_UNAVAILABLE.
|
||||
|
||||
--uu Update the record for _k_e_y with _v_a_l_u_e or inserts a
|
||||
new record if one doesn't exist. Exits with 0 on
|
||||
success or EX_IOERR on failure.
|
||||
|
||||
--xx Deletes the specific key from the map. Exits with
|
||||
|
||||
|
||||
|
||||
Date: 2001/06/15 21:33:19 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EDITMAP(8) EDITMAP(8)
|
||||
|
||||
|
||||
0 on success or EX_IOERR on failure.
|
||||
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
sendmail(8), makemap(8)
|
||||
|
||||
HHIISSTTOORRYY
|
||||
The eeddiittmmaapp command has no history.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Date: 2001/06/15 21:33:19 2
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
.\" Copyright (c) 2000-2001 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.
|
||||
.\"
|
||||
.\"
|
||||
.\" Id: editmap.8,v 1.8 2001/06/15 21:33:19 ca Exp
|
||||
.\"
|
||||
.TH EDITMAP 8 "Date: 2001/06/15 21:33:19"
|
||||
.SH NAME
|
||||
.B editmap
|
||||
\- query and edit single records in database maps for sendmail
|
||||
.SH SYNOPSIS
|
||||
.B editmap
|
||||
.RB [ \-C
|
||||
.IR file ]
|
||||
.RB [ \-N ]
|
||||
.RB [ \-f ]
|
||||
.RB [ \-q|\-u|\-x ]
|
||||
maptype mapname
|
||||
key [ "value ..." ]
|
||||
.SH DESCRIPTION
|
||||
.B Editmap
|
||||
queries or edits one record in a database maps used by the keyed map lookups in
|
||||
sendmail(8).
|
||||
Arguments are passed on the command line and output (for queries) is
|
||||
directed to standard output.
|
||||
.PP
|
||||
Depending on how it is compiled,
|
||||
.B editmap
|
||||
handles up to three different database formats,
|
||||
selected using the
|
||||
.I maptype
|
||||
parameter.
|
||||
They may be
|
||||
.TP
|
||||
dbm
|
||||
DBM format maps.
|
||||
This requires the
|
||||
ndbm(3)
|
||||
library.
|
||||
.TP
|
||||
btree
|
||||
B-Tree format maps.
|
||||
This requires the new Berkeley DB
|
||||
library.
|
||||
.TP
|
||||
hash
|
||||
Hash format maps.
|
||||
This also requires the Berkeley DB
|
||||
library.
|
||||
.PP
|
||||
If the
|
||||
.I TrustedUser
|
||||
option is set in the sendmail configuration file and
|
||||
.B editmap
|
||||
is invoked as root, the generated files will be owned by
|
||||
the specified
|
||||
.IR TrustedUser.
|
||||
.SS Flags
|
||||
.TP
|
||||
.B \-C
|
||||
Use the specified
|
||||
.B sendmail
|
||||
configuration file for looking up the TrustedUser option.
|
||||
.TP
|
||||
.B \-N
|
||||
Include the null byte that terminates strings
|
||||
in the map (for alias maps).
|
||||
.TP
|
||||
.B \-f
|
||||
Normally all upper case letters in the key
|
||||
are folded to lower case.
|
||||
This flag disables that behaviour.
|
||||
This is intended to mesh with the
|
||||
\-f flag in the
|
||||
.B K
|
||||
line in sendmail.cf.
|
||||
The value is never case folded.
|
||||
.TP
|
||||
.B \-q
|
||||
Query the map for the specified key. If found, print value to standard
|
||||
output and exit with 0. If not found then print an error
|
||||
message to stdout and exit with EX_UNAVAILABLE.
|
||||
.TP
|
||||
.B \-u
|
||||
Update the record for
|
||||
.I key
|
||||
with
|
||||
.I value
|
||||
or inserts a new record if one doesn't exist. Exits with 0 on success
|
||||
or EX_IOERR on failure.
|
||||
.TP
|
||||
.B \-x
|
||||
Deletes the specific key from the map. Exits with 0 on success or
|
||||
EX_IOERR on failure.
|
||||
.TP
|
||||
.SH SEE ALSO
|
||||
sendmail(8),
|
||||
makemap(8)
|
||||
.SH HISTORY
|
||||
The
|
||||
.B editmap
|
||||
command has no history.
|
|
@ -0,0 +1,420 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1992 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. 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/gen.h>
|
||||
#ifndef lint
|
||||
SM_UNUSED(static char copyright[]) =
|
||||
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
|
||||
All rights reserved.\n\
|
||||
Copyright (c) 1992 Eric P. Allman. All rights reserved.\n\
|
||||
Copyright (c) 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
SM_UNUSED(static char id[]) = "@(#)Id: editmap.c,v 1.23 2002/03/28 17:49:33 gshapiro Exp";
|
||||
#endif /* ! lint */
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef ISC_UNIX
|
||||
# include <sys/file.h>
|
||||
#endif /* ! ISC_UNIX */
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef EX_OK
|
||||
# undef EX_OK /* unistd.h may have another use for this */
|
||||
#endif /* EX_OK */
|
||||
#include <sysexits.h>
|
||||
#include <assert.h>
|
||||
#include <sendmail/sendmail.h>
|
||||
#include <sendmail/pathnames.h>
|
||||
#include <libsmdb/smdb.h>
|
||||
|
||||
uid_t RealUid;
|
||||
gid_t RealGid;
|
||||
char *RealUserName;
|
||||
uid_t RunAsUid;
|
||||
uid_t RunAsGid;
|
||||
char *RunAsUserName;
|
||||
int Verbose = 2;
|
||||
bool DontInitGroups = false;
|
||||
uid_t TrustedUid = 0;
|
||||
BITMAP256 DontBlameSendmail;
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define ISSEP(c) (isascii(c) && isspace(c))
|
||||
|
||||
|
||||
static void
|
||||
usage(progname)
|
||||
char *progname;
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-C cffile] [-N] [-f] [-q|-u|-x] maptype mapname key [ \"value ...\" ]\n",
|
||||
progname);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *progname;
|
||||
char *cfile;
|
||||
bool verbose = false;
|
||||
bool query = false;
|
||||
bool update = false;
|
||||
bool remove = false;
|
||||
bool inclnull = false;
|
||||
bool foldcase = true;
|
||||
unsigned int nops = 0;
|
||||
int exitstat;
|
||||
int opt;
|
||||
char *typename = NULL;
|
||||
char *mapname = NULL;
|
||||
char *keyname = NULL;
|
||||
char *value = NULL;
|
||||
int mode;
|
||||
int smode;
|
||||
int putflags = 0;
|
||||
long sff = SFF_ROOTOK|SFF_REGONLY;
|
||||
struct passwd *pw;
|
||||
SMDB_DATABASE *database;
|
||||
SMDB_DBENT db_key, db_val;
|
||||
SMDB_DBPARAMS params;
|
||||
SMDB_USER_INFO user_info;
|
||||
#if HASFCHOWN
|
||||
FILE *cfp;
|
||||
char buf[MAXLINE];
|
||||
#endif /* HASFCHOWN */
|
||||
static char rnamebuf[MAXNAME]; /* holds RealUserName */
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
memset(¶ms, '\0', sizeof params);
|
||||
params.smdbp_cache_size = 1024 * 1024;
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
if (progname != NULL)
|
||||
progname++;
|
||||
else
|
||||
progname = argv[0];
|
||||
cfile = _PATH_SENDMAILCF;
|
||||
|
||||
clrbitmap(DontBlameSendmail);
|
||||
RunAsUid = RealUid = getuid();
|
||||
RunAsGid = RealGid = getgid();
|
||||
pw = getpwuid(RealUid);
|
||||
if (pw != NULL)
|
||||
(void) sm_strlcpy(rnamebuf, pw->pw_name, sizeof rnamebuf);
|
||||
else
|
||||
(void) sm_snprintf(rnamebuf, sizeof rnamebuf,
|
||||
"Unknown UID %d", (int) RealUid);
|
||||
RunAsUserName = RealUserName = rnamebuf;
|
||||
user_info.smdbu_id = RunAsUid;
|
||||
user_info.smdbu_group_id = RunAsGid;
|
||||
(void) sm_strlcpy(user_info.smdbu_name, RunAsUserName,
|
||||
SMDB_MAX_USER_NAME_LEN);
|
||||
|
||||
#define OPTIONS "C:fquxvN"
|
||||
while ((opt = getopt(argc, argv, OPTIONS)) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'C':
|
||||
cfile = optarg;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
foldcase = false;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
query = true;
|
||||
nops++;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
update = true;
|
||||
nops++;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
remove = true;
|
||||
nops++;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
inclnull = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(progname);
|
||||
assert(0); /* NOTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
if (!bitnset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail))
|
||||
sff |= SFF_NOSLINK;
|
||||
if (!bitnset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail))
|
||||
sff |= SFF_NOHLINK;
|
||||
if (!bitnset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
|
||||
sff |= SFF_NOWLINK;
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if ((nops != 1) ||
|
||||
(query && argc != 3) ||
|
||||
(remove && argc != 3) ||
|
||||
(update && argc <= 3))
|
||||
{
|
||||
usage(progname);
|
||||
assert(0); /* NOTREACHED */
|
||||
}
|
||||
|
||||
typename = argv[0];
|
||||
mapname = argv[1];
|
||||
keyname = argv[2];
|
||||
if (update)
|
||||
value = argv[3];
|
||||
|
||||
if (foldcase)
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = keyname; *p != '\0'; p++)
|
||||
{
|
||||
if (isascii(*p) && isupper(*p))
|
||||
*p = tolower(*p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HASFCHOWN
|
||||
/* Find TrustedUser value in sendmail.cf */
|
||||
if ((cfp = fopen(cfile, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: %s: %s\n", progname,
|
||||
cfile, sm_errstring(errno));
|
||||
exit(EX_NOINPUT);
|
||||
}
|
||||
while (fgets(buf, sizeof(buf), cfp) != NULL)
|
||||
{
|
||||
register char *b;
|
||||
|
||||
if ((b = strchr(buf, '\n')) != NULL)
|
||||
*b = '\0';
|
||||
|
||||
b = buf;
|
||||
switch (*b++)
|
||||
{
|
||||
case 'O': /* option */
|
||||
if (strncasecmp(b, " TrustedUser", 12) == 0 &&
|
||||
!(isascii(b[12]) && isalnum(b[12])))
|
||||
{
|
||||
b = strchr(b, '=');
|
||||
if (b == NULL)
|
||||
continue;
|
||||
while (isascii(*++b) && isspace(*b))
|
||||
continue;
|
||||
if (isascii(*b) && isdigit(*b))
|
||||
TrustedUid = atoi(b);
|
||||
else
|
||||
{
|
||||
TrustedUid = 0;
|
||||
pw = getpwnam(b);
|
||||
if (pw == NULL)
|
||||
fprintf(stderr,
|
||||
"TrustedUser: unknown user %s\n", b);
|
||||
else
|
||||
TrustedUid = pw->pw_uid;
|
||||
}
|
||||
|
||||
# ifdef UID_MAX
|
||||
if (TrustedUid > UID_MAX)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"TrustedUser: uid value (%ld) > UID_MAX (%ld)",
|
||||
(long) TrustedUid,
|
||||
(long) UID_MAX);
|
||||
TrustedUid = 0;
|
||||
}
|
||||
# endif /* UID_MAX */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
(void) fclose(cfp);
|
||||
#endif /* HASFCHOWN */
|
||||
|
||||
if (query)
|
||||
{
|
||||
mode = O_RDONLY;
|
||||
smode = S_IRUSR;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = O_RDWR | O_CREAT;
|
||||
sff |= SFF_CREAT|SFF_NOTEXCL;
|
||||
smode = S_IWUSR;
|
||||
}
|
||||
|
||||
params.smdbp_num_elements = 4096;
|
||||
|
||||
errno = smdb_open_database(&database, mapname, mode, smode, sff,
|
||||
typename, &user_info, ¶ms);
|
||||
if (errno != SMDBE_OK)
|
||||
{
|
||||
char *hint;
|
||||
|
||||
if (errno == SMDBE_UNSUPPORTED_DB_TYPE &&
|
||||
(hint = smdb_db_definition(typename)) != NULL)
|
||||
fprintf(stderr,
|
||||
"%s: Need to recompile with -D%s for %s support\n",
|
||||
progname, hint, typename);
|
||||
else
|
||||
fprintf(stderr,
|
||||
"%s: error opening type %s map %s: %s\n",
|
||||
progname, typename, mapname,
|
||||
sm_errstring(errno));
|
||||
exit(EX_CANTCREAT);
|
||||
}
|
||||
|
||||
(void) database->smdb_sync(database, 0);
|
||||
|
||||
if (geteuid() == 0 && TrustedUid != 0)
|
||||
{
|
||||
errno = database->smdb_set_owner(database, TrustedUid, -1);
|
||||
if (errno != SMDBE_OK)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WARNING: ownership change on %s failed %s",
|
||||
mapname, sm_errstring(errno));
|
||||
}
|
||||
}
|
||||
|
||||
exitstat = EX_OK;
|
||||
if (query)
|
||||
{
|
||||
memset(&db_key, '\0', sizeof db_key);
|
||||
memset(&db_val, '\0', sizeof db_val);
|
||||
|
||||
db_key.data = keyname;
|
||||
db_key.size = strlen(keyname);
|
||||
if (inclnull)
|
||||
db_key.size++;
|
||||
|
||||
errno = database->smdb_get(database, &db_key, &db_val, 0);
|
||||
if (errno != SMDBE_OK)
|
||||
{
|
||||
/* XXX - Need to distinguish between not found */
|
||||
fprintf(stderr,
|
||||
"%s: couldn't find key %s in map %s\n",
|
||||
progname, keyname, mapname);
|
||||
exitstat = EX_UNAVAILABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%.*s\n", (int) db_val.size,
|
||||
(char *) db_val.data);
|
||||
}
|
||||
}
|
||||
else if (update)
|
||||
{
|
||||
memset(&db_key, '\0', sizeof db_key);
|
||||
memset(&db_val, '\0', sizeof db_val);
|
||||
|
||||
db_key.data = keyname;
|
||||
db_key.size = strlen(keyname);
|
||||
if (inclnull)
|
||||
db_key.size++;
|
||||
db_val.data = value;
|
||||
db_val.size = strlen(value);
|
||||
if (inclnull)
|
||||
db_val.size++;
|
||||
|
||||
errno = database->smdb_put(database, &db_key, &db_val,
|
||||
putflags);
|
||||
if (errno != SMDBE_OK)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: error updating (%s, %s) in map %s: %s\n",
|
||||
progname, keyname, value, mapname,
|
||||
sm_errstring(errno));
|
||||
exitstat = EX_IOERR;
|
||||
}
|
||||
}
|
||||
else if (remove)
|
||||
{
|
||||
memset(&db_key, '\0', sizeof db_key);
|
||||
memset(&db_val, '\0', sizeof db_val);
|
||||
|
||||
db_key.data = keyname;
|
||||
db_key.size = strlen(keyname);
|
||||
if (inclnull)
|
||||
db_key.size++;
|
||||
|
||||
errno = database->smdb_del(database, &db_key, 0);
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
case SMDBE_NOT_FOUND:
|
||||
fprintf(stderr,
|
||||
"%s: key %s doesn't exist in map %s\n",
|
||||
progname, keyname, mapname);
|
||||
/* Don't set exitstat */
|
||||
break;
|
||||
case SMDBE_OK:
|
||||
/* All's well */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"%s: couldn't remove key %s in map %s (error)\n",
|
||||
progname, keyname, mapname);
|
||||
exitstat = EX_IOERR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0); /* NOT REACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
** Now close the database.
|
||||
*/
|
||||
|
||||
errno = database->smdb_close(database);
|
||||
if (errno != SMDBE_OK)
|
||||
{
|
||||
fprintf(stderr, "%s: close(%s): %s\n",
|
||||
progname, mapname, sm_errstring(errno));
|
||||
exitstat = EX_IOERR;
|
||||
}
|
||||
smdb_free_database(database);
|
||||
|
||||
exit(exitstat);
|
||||
/* NOTREACHED */
|
||||
return exitstat;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 1999-2001 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.
|
||||
*
|
||||
*
|
||||
* Id: mfdef.h,v 8.11.2.1 2002/11/11 23:22:28 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** mfdef.h -- Global definitions for mail filter and MTA.
|
||||
*/
|
||||
|
||||
#ifndef _LIBMILTER_MFDEF_H
|
||||
# define _LIBMILTER_MFDEF_H 1
|
||||
|
||||
/* Shared protocol constants */
|
||||
# define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */
|
||||
# define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */
|
||||
# define MILTER_CHUNK_SIZE 65535 /* body chunk size */
|
||||
|
||||
/* These apply to SMFIF_* flags */
|
||||
#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */
|
||||
#if _FFR_QUARANTINE
|
||||
# define SMFI_V2_ACTS 0x0000003FL /* The actions of V2 filter */
|
||||
#else /* _FFR_QUARANTINE */
|
||||
# define SMFI_V2_ACTS 0x0000001FL /* The actions of V2 filter */
|
||||
#endif /* _FFR_QUARANTINE */
|
||||
#define SMFI_CURR_ACTS SMFI_V2_ACTS /* The current version */
|
||||
|
||||
/* address families */
|
||||
# define SMFIA_UNKNOWN 'U' /* unknown */
|
||||
# define SMFIA_UNIX 'L' /* unix/local */
|
||||
# define SMFIA_INET '4' /* inet */
|
||||
# define SMFIA_INET6 '6' /* inet6 */
|
||||
|
||||
/* commands: don't use anything smaller than ' ' */
|
||||
# define SMFIC_ABORT 'A' /* Abort */
|
||||
# define SMFIC_BODY 'B' /* Body chunk */
|
||||
# define SMFIC_CONNECT 'C' /* Connection information */
|
||||
# define SMFIC_MACRO 'D' /* Define macro */
|
||||
# define SMFIC_BODYEOB 'E' /* final body chunk (End) */
|
||||
# define SMFIC_HELO 'H' /* HELO/EHLO */
|
||||
# define SMFIC_HEADER 'L' /* Header */
|
||||
# define SMFIC_MAIL 'M' /* MAIL from */
|
||||
# define SMFIC_EOH 'N' /* EOH */
|
||||
# define SMFIC_OPTNEG 'O' /* Option negotiation */
|
||||
# define SMFIC_QUIT 'Q' /* QUIT */
|
||||
# define SMFIC_RCPT 'R' /* RCPT to */
|
||||
|
||||
/* actions (replies) */
|
||||
# define SMFIR_ADDRCPT '+' /* add recipient */
|
||||
# define SMFIR_DELRCPT '-' /* remove recipient */
|
||||
# define SMFIR_ACCEPT 'a' /* accept */
|
||||
# define SMFIR_REPLBODY 'b' /* replace body (chunk) */
|
||||
# define SMFIR_CONTINUE 'c' /* continue */
|
||||
# define SMFIR_DISCARD 'd' /* discard */
|
||||
# define SMFIR_CHGHEADER 'm' /* change header */
|
||||
# define SMFIR_PROGRESS 'p' /* progress */
|
||||
# define SMFIR_REJECT 'r' /* reject */
|
||||
# define SMFIR_TEMPFAIL 't' /* tempfail */
|
||||
# if _FFR_MILTER_421
|
||||
# define SMFIR_SHUTDOWN '4' /* 421: shutdown (internal to MTA) */
|
||||
# endif /* _FFR_MILTER_421 */
|
||||
# define SMFIR_ADDHEADER 'h' /* add header */
|
||||
# define SMFIR_REPLYCODE 'y' /* reply code etc */
|
||||
# if _FFR_QUARANTINE
|
||||
# define SMFIR_QUARANTINE 'q' /* quarantine */
|
||||
# endif /* _FFR_QUARANTINE */
|
||||
|
||||
/* What the MTA can send/filter wants in protocol */
|
||||
# define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */
|
||||
# define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */
|
||||
# define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */
|
||||
# define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */
|
||||
# define SMFIP_NOBODY 0x00000010L /* MTA should not send body */
|
||||
# define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */
|
||||
# define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */
|
||||
|
||||
# define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */
|
||||
# define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */
|
||||
# define SMFI_CURR_PROT SMFI_V2_PROT /* The current version */
|
||||
|
||||
#endif /* !_LIBMILTER_MFDEF_H */
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: assert.h,v 1.10 2001/06/07 20:04:53 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm abnormal program termination and assertion checking
|
||||
** See libsm/assert.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_ASSERT_H
|
||||
# define SM_ASSERT_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
# include <sm/debug.h>
|
||||
|
||||
/*
|
||||
** abnormal program termination
|
||||
*/
|
||||
|
||||
typedef void (*SM_ABORT_HANDLER_T) __P((const char *, int, const char *));
|
||||
|
||||
extern SM_DEAD(void
|
||||
sm_abort_at __P((
|
||||
const char *,
|
||||
int,
|
||||
const char *)));
|
||||
|
||||
extern void
|
||||
sm_abort_sethandler __P((
|
||||
SM_ABORT_HANDLER_T));
|
||||
|
||||
extern SM_DEAD(void PRINTFLIKE(1, 2)
|
||||
sm_abort __P((
|
||||
char *,
|
||||
...)));
|
||||
|
||||
/*
|
||||
** assertion checking
|
||||
*/
|
||||
|
||||
# ifndef SM_CHECK_ALL
|
||||
# define SM_CHECK_ALL 1
|
||||
# endif /* ! SM_CHECK_ALL */
|
||||
|
||||
# ifndef SM_CHECK_REQUIRE
|
||||
# define SM_CHECK_REQUIRE SM_CHECK_ALL
|
||||
# endif /* ! SM_CHECK_REQUIRE */
|
||||
|
||||
# ifndef SM_CHECK_ENSURE
|
||||
# define SM_CHECK_ENSURE SM_CHECK_ALL
|
||||
# endif /* ! SM_CHECK_ENSURE */
|
||||
|
||||
# ifndef SM_CHECK_ASSERT
|
||||
# define SM_CHECK_ASSERT SM_CHECK_ALL
|
||||
# endif /* ! SM_CHECK_ASSERT */
|
||||
|
||||
# if SM_CHECK_REQUIRE
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define SM_REQUIRE(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_REQUIRE(" #cond ") failed"), 0)))
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define SM_REQUIRE(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_REQUIRE(cond) failed"), 0)))
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# else /* SM_CHECK_REQUIRE */
|
||||
# define SM_REQUIRE(cond) ((void) 0)
|
||||
# endif /* SM_CHECK_REQUIRE */
|
||||
|
||||
# define SM_REQUIRE_ISA(obj, magic) \
|
||||
SM_REQUIRE((obj) != NULL && (obj)->sm_magic == (magic))
|
||||
|
||||
# if SM_CHECK_ENSURE
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define SM_ENSURE(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_ENSURE(" #cond ") failed"), 0)))
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define SM_ENSURE(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_ENSURE(cond) failed"), 0)))
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# else /* SM_CHECK_ENSURE */
|
||||
# define SM_ENSURE(cond) ((void) 0)
|
||||
# endif /* SM_CHECK_ENSURE */
|
||||
|
||||
# if SM_CHECK_ASSERT
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define SM_ASSERT(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_ASSERT(" #cond ") failed"), 0)))
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define SM_ASSERT(cond) \
|
||||
((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
|
||||
"SM_ASSERT(cond) failed"), 0)))
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# else /* SM_CHECK_ASSERT */
|
||||
# define SM_ASSERT(cond) ((void) 0)
|
||||
# endif /* SM_CHECK_ASSERT */
|
||||
|
||||
extern SM_DEBUG_T SmExpensiveRequire;
|
||||
extern SM_DEBUG_T SmExpensiveEnsure;
|
||||
extern SM_DEBUG_T SmExpensiveAssert;
|
||||
|
||||
#endif /* ! SM_ASSERT_H */
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2002 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.
|
||||
*
|
||||
*
|
||||
* Id: bdb.h,v 1.1.2.3 2002/12/05 05:07:44 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_BDB_H
|
||||
#define SM_BDB_H
|
||||
|
||||
#if NEWDB
|
||||
# include <db.h>
|
||||
# ifndef DB_VERSION_MAJOR
|
||||
# define DB_VERSION_MAJOR 1
|
||||
# endif /* ! DB_VERSION_MAJOR */
|
||||
|
||||
# if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
|
||||
|
||||
# define DBTXN NULL ,
|
||||
|
||||
/*
|
||||
** Always turn on DB_FCNTL_LOCKING for DB 4.1.x since its
|
||||
** "workaround" for accepting an empty (locked) file depends on
|
||||
** this flag. Notice: this requires 4.1.24 + patch (which should be
|
||||
** part of 4.1.25).
|
||||
*/
|
||||
|
||||
# define SM_DB_FLAG_ADD(flag) (flag) |= DB_FCNTL_LOCKING
|
||||
|
||||
# else /* DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 */
|
||||
|
||||
# define DBTXN
|
||||
# if !HASFLOCK
|
||||
# define SM_DB_FLAG_ADD(flag) (flag) |= DB_FCNTL_LOCKING
|
||||
# else /* !HASFLOCK */
|
||||
# define SM_DB_FLAG_ADD(flag) ((void) 0)
|
||||
# endif /* !HASFLOCK */
|
||||
|
||||
# endif /* DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 */
|
||||
#endif /* NEWDB */
|
||||
|
||||
#endif /* ! SM_BDB_H */
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. 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.
|
||||
*
|
||||
*
|
||||
* Id: bitops.h,v 1.2 2001/09/22 22:05:42 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_BITOPS_H
|
||||
# define SM_BITOPS_H
|
||||
|
||||
/*
|
||||
** Data structure for bit maps.
|
||||
**
|
||||
** Each bit in this map can be referenced by an ascii character.
|
||||
** This is 256 possible bits, or 32 8-bit bytes.
|
||||
*/
|
||||
|
||||
# define BITMAPBITS 256 /* number of bits in a bit map */
|
||||
# define BYTEBITS 8 /* number of bits in a byte */
|
||||
# define BITMAPBYTES (BITMAPBITS / BYTEBITS) /* number of bytes in bit map */
|
||||
# define BITMAPMAX ((BITMAPBYTES / sizeof (int)) - 1)
|
||||
|
||||
/* internal macros */
|
||||
|
||||
/* make sure this index never leaves the allowed range: 0 to BITMAPMAX */
|
||||
# define _BITWORD(bit) (((unsigned char)(bit) / (BYTEBITS * sizeof (int))) & BITMAPMAX)
|
||||
# define _BITBIT(bit) ((unsigned int)1 << ((unsigned char)(bit) % (BYTEBITS * sizeof (int))))
|
||||
|
||||
typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
|
||||
|
||||
/* properly case and truncate bit */
|
||||
# define bitidx(bit) ((unsigned int) (bit) & 0xff)
|
||||
|
||||
/* test bit number N */
|
||||
# define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit))
|
||||
|
||||
/* set bit number N */
|
||||
# define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit)
|
||||
|
||||
/* clear bit number N */
|
||||
# define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit)
|
||||
|
||||
/* clear an entire bit map */
|
||||
# define clrbitmap(map) memset((char *) map, '\0', BITMAPBYTES)
|
||||
|
||||
/* bit hacking */
|
||||
# define bitset(bit, word) (((word) & (bit)) != 0)
|
||||
|
||||
#endif /* ! SM_BITOPS_H */
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2002 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.
|
||||
*
|
||||
* Id: cdefs.h,v 1.15 2002/01/16 18:30:11 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm C language portability macros
|
||||
** See libsm/cdefs.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_CDEFS_H
|
||||
# define SM_CDEFS_H
|
||||
|
||||
# include <sm/config.h>
|
||||
|
||||
/*
|
||||
** BSD and Linux have <sys/cdefs.h> which defines a set of C language
|
||||
** portability macros that are a defacto standard in the open source
|
||||
** community.
|
||||
*/
|
||||
|
||||
# if SM_CONF_SYS_CDEFS_H
|
||||
# include <sys/cdefs.h>
|
||||
# endif /* SM_CONF_SYS_CDEFS_H */
|
||||
|
||||
/*
|
||||
** Define the standard C language portability macros
|
||||
** for platforms that lack <sys/cdefs.h>.
|
||||
*/
|
||||
|
||||
# if !SM_CONF_SYS_CDEFS_H
|
||||
# if defined(__cplusplus)
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# define __END_DECLS };
|
||||
# else /* defined(__cplusplus) */
|
||||
# define __BEGIN_DECLS
|
||||
# define __END_DECLS
|
||||
# endif /* defined(__cplusplus) */
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# ifndef __P
|
||||
# define __P(protos) protos
|
||||
# endif /* __P */
|
||||
# define __CONCAT(x,y) x ## y
|
||||
# define __STRING(x) #x
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define __P(protos) ()
|
||||
# define __CONCAT(x,y) x/**/y
|
||||
# define __STRING(x) "x"
|
||||
# define const
|
||||
# define signed
|
||||
# define volatile
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# endif /* !SM_CONF_SYS_CDEFS_H */
|
||||
|
||||
/*
|
||||
** Define SM_DEAD, a macro used to declare functions that do not return
|
||||
** to their caller.
|
||||
*/
|
||||
|
||||
# ifndef SM_DEAD
|
||||
# if __GNUC__ >= 2
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ < 5
|
||||
# define SM_DEAD(proto) volatile proto
|
||||
# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
|
||||
# define SM_DEAD(proto) proto __attribute__((__noreturn__))
|
||||
# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
|
||||
# else /* __GNUC__ >= 2 */
|
||||
# define SM_DEAD(proto) proto
|
||||
# endif /* __GNUC__ >= 2 */
|
||||
# endif /* SM_DEAD */
|
||||
|
||||
/*
|
||||
** Define SM_UNUSED, a macro used to declare variables that may be unused.
|
||||
*/
|
||||
|
||||
# ifndef SM_UNUSED
|
||||
# if __GNUC__ >= 2
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
|
||||
# define SM_UNUSED(decl) decl
|
||||
# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
|
||||
# define SM_UNUSED(decl) decl __attribute__((__unused__))
|
||||
# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
|
||||
# else /* __GNUC__ >= 2 */
|
||||
# define SM_UNUSED(decl) decl
|
||||
# endif /* __GNUC__ >= 2 */
|
||||
# endif /* SM_UNUSED */
|
||||
|
||||
/*
|
||||
** The SM_NONVOLATILE macro is used to declare variables that are not
|
||||
** volatile, but which must be declared volatile when compiling with
|
||||
** gcc -O -Wall in order to suppress bogus warning messages.
|
||||
**
|
||||
** Variables that actually are volatile should be declared volatile
|
||||
** using the "volatile" keyword. If a variable actually is volatile,
|
||||
** then SM_NONVOLATILE should not be used.
|
||||
**
|
||||
** To compile sendmail with gcc and see all non-bogus warnings,
|
||||
** you should use
|
||||
** gcc -O -Wall -DSM_OMIT_BOGUS_WARNINGS ...
|
||||
** Do not use -DSM_OMIT_BOGUS_WARNINGS when compiling the production
|
||||
** version of sendmail, because there is a performance hit.
|
||||
*/
|
||||
|
||||
# ifdef SM_OMIT_BOGUS_WARNINGS
|
||||
# define SM_NONVOLATILE volatile
|
||||
# else /* SM_OMIT_BOGUS_WARNINGS */
|
||||
# define SM_NONVOLATILE
|
||||
# endif /* SM_OMIT_BOGUS_WARNINGS */
|
||||
|
||||
/*
|
||||
** Turn on format string argument checking.
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_FORMAT_TEST
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
|
||||
# define SM_CONF_FORMAT_TEST 1
|
||||
# else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
|
||||
# define SM_CONF_FORMAT_TEST 0
|
||||
# endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
|
||||
# endif /* SM_CONF_FORMAT_TEST */
|
||||
|
||||
# ifndef PRINTFLIKE
|
||||
# if SM_CONF_FORMAT_TEST
|
||||
# define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
|
||||
# else /* SM_CONF_FORMAT_TEST */
|
||||
# define PRINTFLIKE(x,y)
|
||||
# endif /* SM_CONF_FORMAT_TEST */
|
||||
# endif /* ! PRINTFLIKE */
|
||||
|
||||
# ifndef SCANFLIKE
|
||||
# if SM_CONF_FORMAT_TEST
|
||||
# define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
|
||||
# else /* SM_CONF_FORMAT_TEST */
|
||||
# define SCANFLIKE(x,y)
|
||||
# endif /* SM_CONF_FORMAT_TEST */
|
||||
# endif /* ! SCANFLIKE */
|
||||
|
||||
#endif /* ! SM_CDEFS_H */
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2001 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.
|
||||
*
|
||||
* Id: cf.h,v 1.2 2001/03/08 03:23:07 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_CF_H
|
||||
# define SM_CF_H
|
||||
|
||||
#include <sm/gen.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *opt_name;
|
||||
char *opt_val;
|
||||
} SM_CF_OPT_T;
|
||||
|
||||
extern int
|
||||
sm_cf_getopt __P((
|
||||
char *path,
|
||||
int optc,
|
||||
SM_CF_OPT_T *optv));
|
||||
|
||||
#endif /* ! SM_CF_H */
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. 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.
|
||||
*
|
||||
* Id: clock.h,v 1.11 2001/05/14 23:25:37 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** CLOCK.H -- for co-ordinating timed events
|
||||
*/
|
||||
|
||||
#ifndef _SM_CLOCK_H
|
||||
# define _SM_CLOCK_H 1
|
||||
|
||||
# include <sm/signal.h>
|
||||
# if SM_CONF_SETITIMER
|
||||
# include <sys/time.h>
|
||||
# endif /* SM_CONF_SETITIMER */
|
||||
|
||||
/*
|
||||
** STRUCT SM_EVENT -- event queue.
|
||||
**
|
||||
** Maintained in sorted order.
|
||||
**
|
||||
** We store the pid of the process that set this event to insure
|
||||
** that when we fork we will not take events intended for the parent.
|
||||
*/
|
||||
|
||||
struct sm_event
|
||||
{
|
||||
# if SM_CONF_SETITIMER
|
||||
struct timeval ev_time; /* time of the call (microseconds) */
|
||||
# else /* SM_CONF_SETITIMER */
|
||||
time_t ev_time; /* time of the call (seconds) */
|
||||
# endif /* SM_CONF_SETITIMER */
|
||||
void (*ev_func)__P((int));
|
||||
/* function to call */
|
||||
int ev_arg; /* argument to ev_func */
|
||||
pid_t ev_pid; /* pid that set this event */
|
||||
struct sm_event *ev_link; /* link to next item */
|
||||
};
|
||||
|
||||
typedef struct sm_event SM_EVENT;
|
||||
|
||||
/* functions */
|
||||
extern void sm_clrevent __P((SM_EVENT *));
|
||||
extern void sm_clear_events __P((void));
|
||||
extern SM_EVENT *sm_setevent __P((time_t, void(*)(), int));
|
||||
extern SM_EVENT *sm_seteventm __P((int, void(*)(), int));
|
||||
extern SM_EVENT *sm_sigsafe_seteventm __P((int, void(*)(), int));
|
||||
extern SIGFUNC_DECL sm_tick __P((int));
|
||||
|
||||
/*
|
||||
** SM_SETEVENT -- set an event to happen at a specific time in seconds.
|
||||
**
|
||||
** Translates the seconds into millseconds and calls sm_seteventm()
|
||||
** to get a specific event to happen in the future at a specific time.
|
||||
**
|
||||
** Parameters:
|
||||
** t -- intvl until next event occurs (seconds).
|
||||
** f -- function to call on event.
|
||||
** a -- argument to func on event.
|
||||
**
|
||||
** Returns:
|
||||
** result of sm_seteventm().
|
||||
**
|
||||
** Side Effects:
|
||||
** Any that sm_seteventm() have.
|
||||
*/
|
||||
|
||||
#define sm_setevent(t, f, a) sm_seteventm((int)((t) * 1000), (f), (a))
|
||||
#define sm_sigsafe_setevent(t, f, a) sm_sigsafe_seteventm((int)((t) * 1000), (f), (a))
|
||||
|
||||
#endif /* _SM_CLOCK_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: config.h,v 1.44 2002/01/23 17:47:15 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm configuration macros.
|
||||
** The values of these macros are platform dependent.
|
||||
** The default values are given here.
|
||||
** If the default is incorrect, then the correct value can be specified
|
||||
** in the m4 configuration file in devtools/OS.
|
||||
*/
|
||||
|
||||
#ifndef SM_CONFIG_H
|
||||
# define SM_CONFIG_H
|
||||
|
||||
# include "sm_os.h"
|
||||
|
||||
/*
|
||||
** SM_CONF_STDBOOL_H is 1 if <stdbool.h> exists
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_STDBOOL_H
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define SM_CONF_STDBOOL_H 1
|
||||
# else /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
|
||||
# define SM_CONF_STDBOOL_H 0
|
||||
# endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
|
||||
# endif /* ! SM_CONF_STDBOOL_H */
|
||||
|
||||
/*
|
||||
** Configuration macros that specify how __P is defined.
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_SYS_CDEFS_H
|
||||
# define SM_CONF_SYS_CDEFS_H 0
|
||||
# endif /* ! SM_CONF_SYS_CDEFS_H */
|
||||
|
||||
/*
|
||||
** SM_CONF_STDDEF_H is 1 if <stddef.h> exists
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_STDDEF_H
|
||||
# define SM_CONF_STDDEF_H 1
|
||||
# endif /* ! SM_CONF_STDDEF_H */
|
||||
|
||||
/*
|
||||
** Configuration macro that specifies whether strlcpy/strlcat are available.
|
||||
** Note: this is the default so that the libsm version (optimized) will
|
||||
** be used by default (sm_strlcpy/sm_strlcat).
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_STRL
|
||||
# define SM_CONF_STRL 0
|
||||
# endif /* ! SM_CONF_STRL */
|
||||
|
||||
/*
|
||||
** Configuration macro indicating that setitimer is available
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_SETITIMER
|
||||
# define SM_CONF_SETITIMER 1
|
||||
# endif /* ! SM_CONF_SETITIMER */
|
||||
|
||||
/*
|
||||
** Does <sys/types.h> define uid_t and gid_t?
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_UID_GID
|
||||
# define SM_CONF_UID_GID 1
|
||||
# endif /* ! SM_CONF_UID_GID */
|
||||
|
||||
/*
|
||||
** Does <sys/types.h> define ssize_t?
|
||||
*/
|
||||
# ifndef SM_CONF_SSIZE_T
|
||||
# define SM_CONF_SSIZE_T 1
|
||||
# endif /* ! SM_CONF_SSIZE_T */
|
||||
|
||||
/*
|
||||
** Does the C compiler support long long?
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_LONGLONG
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define SM_CONF_LONGLONG 1
|
||||
# else /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
|
||||
# if defined(__GNUC__)
|
||||
# define SM_CONF_LONGLONG 1
|
||||
# else /* defined(__GNUC__) */
|
||||
# define SM_CONF_LONGLONG 0
|
||||
# endif /* defined(__GNUC__) */
|
||||
# endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
|
||||
# endif /* ! SM_CONF_LONGLONG */
|
||||
|
||||
/*
|
||||
** Does <sys/types.h> define quad_t and u_quad_t?
|
||||
** We only care if long long is not available.
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_QUAD_T
|
||||
# define SM_CONF_QUAD_T 0
|
||||
# endif /* ! SM_CONF_QUAD_T */
|
||||
|
||||
/*
|
||||
** Configuration macro indicating that shared memory is available
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 0
|
||||
# endif /* ! SM_CONF_SHM */
|
||||
|
||||
/*
|
||||
** Does <setjmp.h> define sigsetjmp?
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_SIGSETJMP
|
||||
# define SM_CONF_SIGSETJMP 1
|
||||
# endif /* ! SM_CONF_SIGSETJMP */
|
||||
|
||||
/*
|
||||
** Does <sysexits.h> exist, and define the EX_* macros with values
|
||||
** that differ from the default BSD values in <sm/sysexits.h>?
|
||||
*/
|
||||
|
||||
# ifndef SM_CONF_SYSEXITS_H
|
||||
# define SM_CONF_SYSEXITS_H 0
|
||||
# endif /* ! SM_CONF_SYSEXITS_H */
|
||||
|
||||
/* has memchr() prototype? (if not: needs memory.h) */
|
||||
# ifndef SM_CONF_MEMCHR
|
||||
# define SM_CONF_MEMCHR 1
|
||||
# endif /* ! SM_CONF_MEMCHR */
|
||||
|
||||
/* try LLONG tests in libsm/t-types.c? */
|
||||
# ifndef SM_CONF_TEST_LLONG
|
||||
# define SM_CONF_TEST_LLONG 1
|
||||
# endif /* !SM_CONF_TEST_LLONG */
|
||||
|
||||
/* Does LDAP library have ldap_memfree()? */
|
||||
# ifndef SM_CONF_LDAP_MEMFREE
|
||||
|
||||
/*
|
||||
** The new LDAP C API (draft-ietf-ldapext-ldap-c-api-04.txt) includes
|
||||
** ldap_memfree() in the API. That draft states to use LDAP_API_VERSION
|
||||
** of 2004 to identify the API.
|
||||
*/
|
||||
|
||||
# if USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004
|
||||
# define SM_CONF_LDAP_MEMFREE 1
|
||||
# else /* USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004 */
|
||||
# define SM_CONF_LDAP_MEMFREE 0
|
||||
# endif /* USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004 */
|
||||
# endif /* ! SM_CONF_LDAP_MEMFREE */
|
||||
|
||||
#endif /* ! SM_CONFIG_H */
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: debug.h,v 1.15 2001/03/08 03:23:07 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm debugging and tracing
|
||||
** See libsm/debug.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_DEBUG_H
|
||||
# define SM_DEBUG_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
# include <sm/io.h>
|
||||
|
||||
/*
|
||||
** abstractions for printing trace messages
|
||||
*/
|
||||
|
||||
extern SM_FILE_T *
|
||||
sm_debug_file __P((void));
|
||||
|
||||
extern void
|
||||
sm_debug_setfile __P((
|
||||
SM_FILE_T *));
|
||||
|
||||
extern void PRINTFLIKE(1, 2)
|
||||
sm_dprintf __P((
|
||||
char *_fmt,
|
||||
...));
|
||||
|
||||
extern void
|
||||
sm_dflush __P((void));
|
||||
|
||||
/*
|
||||
** abstractions for setting and testing debug activation levels
|
||||
*/
|
||||
|
||||
extern void
|
||||
sm_debug_addsettings_x __P((
|
||||
const char *));
|
||||
|
||||
extern void
|
||||
sm_debug_addsetting_x __P((
|
||||
const char *,
|
||||
int));
|
||||
|
||||
# define SM_DEBUG_UNKNOWN ((SM_ATOMIC_UINT_T)(-1))
|
||||
|
||||
extern const char SmDebugMagic[];
|
||||
|
||||
typedef struct sm_debug SM_DEBUG_T;
|
||||
struct sm_debug
|
||||
{
|
||||
const char *sm_magic; /* points to SmDebugMagic */
|
||||
|
||||
/*
|
||||
** debug_level is the activation level of this debug
|
||||
** object. Level 0 means no debug activity.
|
||||
** It is initialized to SM_DEBUG_UNKNOWN, which indicates
|
||||
** that the true value is unknown. If debug_level ==
|
||||
** SM_DEBUG_UNKNOWN, then the access functions will look up
|
||||
** its true value in the internal table of debug settings.
|
||||
*/
|
||||
|
||||
SM_ATOMIC_UINT_T debug_level;
|
||||
|
||||
/*
|
||||
** debug_name is the name used to reference this SM_DEBUG
|
||||
** structure via the sendmail -d option.
|
||||
*/
|
||||
|
||||
char *debug_name;
|
||||
|
||||
/*
|
||||
** debug_desc is a literal character string of the form
|
||||
** "@(#)$Debug: <name> - <short description> $"
|
||||
*/
|
||||
|
||||
char *debug_desc;
|
||||
|
||||
/*
|
||||
** We keep a linked list of initialized SM_DEBUG structures
|
||||
** so that when sm_debug_addsetting is called, we can reset
|
||||
** them all back to the uninitialized state.
|
||||
*/
|
||||
|
||||
SM_DEBUG_T *debug_next;
|
||||
};
|
||||
|
||||
# ifndef SM_DEBUG_CHECK
|
||||
# define SM_DEBUG_CHECK 1
|
||||
# endif /* ! SM_DEBUG_CHECK */
|
||||
|
||||
# if SM_DEBUG_CHECK
|
||||
/*
|
||||
** This macro is cleverly designed so that if the debug object is below
|
||||
** the specified level, then the only overhead is a single comparison
|
||||
** (except for the first time this macro is invoked).
|
||||
*/
|
||||
|
||||
# define sm_debug_active(debug, level) \
|
||||
((debug)->debug_level >= (level) && \
|
||||
((debug)->debug_level != SM_DEBUG_UNKNOWN || \
|
||||
sm_debug_loadactive(debug, level)))
|
||||
|
||||
# define sm_debug_level(debug) \
|
||||
((debug)->debug_level == SM_DEBUG_UNKNOWN \
|
||||
? sm_debug_loadlevel(debug) : (debug)->debug_level)
|
||||
|
||||
# define sm_debug_unknown(debug) ((debug)->debug_level == SM_DEBUG_UNKNOWN)
|
||||
# else /* SM_DEBUG_CHECK */
|
||||
# define sm_debug_active(debug, level) 0
|
||||
# define sm_debug_level(debug) 0
|
||||
# define sm_debug_unknown(debug) 0
|
||||
# endif /* SM_DEBUG_CHECK */
|
||||
|
||||
extern bool
|
||||
sm_debug_loadactive __P((
|
||||
SM_DEBUG_T *,
|
||||
int));
|
||||
|
||||
extern int
|
||||
sm_debug_loadlevel __P((
|
||||
SM_DEBUG_T *));
|
||||
|
||||
# define SM_DEBUG_INITIALIZER(name, desc) { \
|
||||
SmDebugMagic, \
|
||||
SM_DEBUG_UNKNOWN, \
|
||||
name, \
|
||||
desc, \
|
||||
NULL}
|
||||
|
||||
#endif /* ! SM_DEBUG_H */
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2001 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.
|
||||
*
|
||||
*
|
||||
* Id: errstring.h,v 1.4 2001/06/07 20:04:53 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Error codes.
|
||||
*/
|
||||
|
||||
#ifndef SM_ERRSTRING_H
|
||||
# define SM_ERRSTRING_H
|
||||
|
||||
#include <errno.h>
|
||||
extern int errno;
|
||||
|
||||
/*
|
||||
** These are used in a few cases where we need some special
|
||||
** error codes, but where the system doesn't provide something
|
||||
** reasonable. They are printed in sm_errstring.
|
||||
*/
|
||||
|
||||
#ifndef E_PSEUDOBASE
|
||||
# define E_PSEUDOBASE 256
|
||||
#endif /* ! E_PSEUDOBASE */
|
||||
|
||||
#define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0) /* Timeout on file open */
|
||||
#define E_SM_NOSLINK (E_PSEUDOBASE + 1) /* Symbolic links not allowed */
|
||||
#define E_SM_NOHLINK (E_PSEUDOBASE + 2) /* Hard links not allowed */
|
||||
#define E_SM_REGONLY (E_PSEUDOBASE + 3) /* Regular files only */
|
||||
#define E_SM_ISEXEC (E_PSEUDOBASE + 4) /* Executable files not allowed */
|
||||
#define E_SM_WWDIR (E_PSEUDOBASE + 5) /* World writable directory */
|
||||
#define E_SM_GWDIR (E_PSEUDOBASE + 6) /* Group writable directory */
|
||||
#define E_SM_FILECHANGE (E_PSEUDOBASE + 7) /* File changed after open */
|
||||
#define E_SM_WWFILE (E_PSEUDOBASE + 8) /* World writable file */
|
||||
#define E_SM_GWFILE (E_PSEUDOBASE + 9) /* Group writable file */
|
||||
#define E_SM_GRFILE (E_PSEUDOBASE + 10) /* g readable file */
|
||||
#define E_SM_WRFILE (E_PSEUDOBASE + 11) /* o readable file */
|
||||
#define E_DNSBASE (E_PSEUDOBASE + 20) /* base for DNS h_errno */
|
||||
#define E_SMDBBASE (E_PSEUDOBASE + 40) /* base for libsmdb errors */
|
||||
#define E_LDAPBASE (E_PSEUDOBASE + 70) /* base for LDAP errors */
|
||||
|
||||
/* libsmdb */
|
||||
#define SMDBE_OK 0
|
||||
#define SMDBE_MALLOC (E_SMDBBASE + 1)
|
||||
#define SMDBE_GDBM_IS_BAD (E_SMDBBASE + 2)
|
||||
#define SMDBE_UNSUPPORTED (E_SMDBBASE + 3)
|
||||
#define SMDBE_DUPLICATE (E_SMDBBASE + 4)
|
||||
#define SMDBE_BAD_OPEN (E_SMDBBASE + 5)
|
||||
#define SMDBE_NOT_FOUND (E_SMDBBASE + 6)
|
||||
#define SMDBE_UNKNOWN_DB_TYPE (E_SMDBBASE + 7)
|
||||
#define SMDBE_UNSUPPORTED_DB_TYPE (E_SMDBBASE + 8)
|
||||
#define SMDBE_INCOMPLETE (E_SMDBBASE + 9)
|
||||
#define SMDBE_KEY_EMPTY (E_SMDBBASE + 10)
|
||||
#define SMDBE_KEY_EXIST (E_SMDBBASE + 11)
|
||||
#define SMDBE_LOCK_DEADLOCK (E_SMDBBASE + 12)
|
||||
#define SMDBE_LOCK_NOT_GRANTED (E_SMDBBASE + 13)
|
||||
#define SMDBE_LOCK_NOT_HELD (E_SMDBBASE + 14)
|
||||
#define SMDBE_RUN_RECOVERY (E_SMDBBASE + 15)
|
||||
#define SMDBE_IO_ERROR (E_SMDBBASE + 16)
|
||||
#define SMDBE_READ_ONLY (E_SMDBBASE + 17)
|
||||
#define SMDBE_DB_NAME_TOO_LONG (E_SMDBBASE + 18)
|
||||
#define SMDBE_INVALID_PARAMETER (E_SMDBBASE + 19)
|
||||
#define SMDBE_ONLY_SUPPORTS_ONE_CURSOR (E_SMDBBASE + 20)
|
||||
#define SMDBE_NOT_A_VALID_CURSOR (E_SMDBBASE + 21)
|
||||
#define SMDBE_LAST_ENTRY (E_SMDBBASE + 22)
|
||||
#define SMDBE_OLD_VERSION (E_SMDBBASE + 23)
|
||||
|
||||
extern const char *
|
||||
sm_errstring __P((
|
||||
int _errno));
|
||||
|
||||
#endif /* SM_ERRSTRING_H */
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: exc.h,v 1.23 2001/06/07 20:04:53 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm exception handling
|
||||
** See libsm/exc.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_EXC_H
|
||||
# define SM_EXC_H
|
||||
|
||||
#include <sm/setjmp.h>
|
||||
#include <sm/io.h>
|
||||
#include <sm/gen.h>
|
||||
#include <sm/assert.h>
|
||||
|
||||
typedef struct sm_exc SM_EXC_T;
|
||||
typedef struct sm_exc_type SM_EXC_TYPE_T;
|
||||
typedef union sm_val SM_VAL_T;
|
||||
|
||||
/*
|
||||
** Exception types
|
||||
*/
|
||||
|
||||
extern const char SmExcTypeMagic[];
|
||||
|
||||
struct sm_exc_type
|
||||
{
|
||||
const char *sm_magic;
|
||||
const char *etype_category;
|
||||
const char *etype_argformat;
|
||||
void (*etype_print) __P((SM_EXC_T *, SM_FILE_T *));
|
||||
const char *etype_printcontext;
|
||||
};
|
||||
|
||||
extern const SM_EXC_TYPE_T SmEtypeOs;
|
||||
extern const SM_EXC_TYPE_T SmEtypeErr;
|
||||
|
||||
extern void
|
||||
sm_etype_printf __P((
|
||||
SM_EXC_T *_exc,
|
||||
SM_FILE_T *_stream));
|
||||
|
||||
/*
|
||||
** Exception objects
|
||||
*/
|
||||
|
||||
extern const char SmExcMagic[];
|
||||
|
||||
union sm_val
|
||||
{
|
||||
int v_int;
|
||||
long v_long;
|
||||
char *v_str;
|
||||
SM_EXC_T *v_exc;
|
||||
};
|
||||
|
||||
struct sm_exc
|
||||
{
|
||||
const char *sm_magic;
|
||||
size_t exc_refcount;
|
||||
const SM_EXC_TYPE_T *exc_type;
|
||||
SM_VAL_T *exc_argv;
|
||||
};
|
||||
|
||||
# define SM_EXC_INITIALIZER(type, argv) \
|
||||
{ \
|
||||
SmExcMagic, \
|
||||
0, \
|
||||
type, \
|
||||
argv, \
|
||||
}
|
||||
|
||||
extern SM_EXC_T *
|
||||
sm_exc_new_x __P((
|
||||
const SM_EXC_TYPE_T *_type,
|
||||
...));
|
||||
|
||||
extern SM_EXC_T *
|
||||
sm_exc_addref __P((
|
||||
SM_EXC_T *_exc));
|
||||
|
||||
extern void
|
||||
sm_exc_free __P((
|
||||
SM_EXC_T *_exc));
|
||||
|
||||
extern bool
|
||||
sm_exc_match __P((
|
||||
SM_EXC_T *_exc,
|
||||
const char *_pattern));
|
||||
|
||||
extern void
|
||||
sm_exc_write __P((
|
||||
SM_EXC_T *_exc,
|
||||
SM_FILE_T *_stream));
|
||||
|
||||
extern void
|
||||
sm_exc_print __P((
|
||||
SM_EXC_T *_exc,
|
||||
SM_FILE_T *_stream));
|
||||
|
||||
extern SM_DEAD(void
|
||||
sm_exc_raise_x __P((
|
||||
SM_EXC_T *_exc)));
|
||||
|
||||
extern SM_DEAD(void
|
||||
sm_exc_raisenew_x __P((
|
||||
const SM_EXC_TYPE_T *_type,
|
||||
...)));
|
||||
|
||||
/*
|
||||
** Exception handling
|
||||
*/
|
||||
|
||||
typedef void (*SM_EXC_DEFAULT_HANDLER_T) __P((SM_EXC_T *));
|
||||
|
||||
extern void
|
||||
sm_exc_newthread __P((
|
||||
SM_EXC_DEFAULT_HANDLER_T _handle));
|
||||
|
||||
typedef struct sm_exc_handler SM_EXC_HANDLER_T;
|
||||
struct sm_exc_handler
|
||||
{
|
||||
SM_EXC_T *eh_value;
|
||||
SM_JMPBUF_T eh_context;
|
||||
SM_EXC_HANDLER_T *eh_parent;
|
||||
int eh_state;
|
||||
};
|
||||
|
||||
/* values for eh_state */
|
||||
enum
|
||||
{
|
||||
SM_EH_PUSHED = 2,
|
||||
SM_EH_POPPED = 0,
|
||||
SM_EH_HANDLED = 1
|
||||
};
|
||||
|
||||
extern SM_EXC_HANDLER_T *SmExcHandler;
|
||||
|
||||
# define SM_TRY { SM_EXC_HANDLER_T _h; \
|
||||
do { \
|
||||
_h.eh_value = NULL; \
|
||||
_h.eh_parent = SmExcHandler; \
|
||||
_h.eh_state = SM_EH_PUSHED; \
|
||||
SmExcHandler = &_h; \
|
||||
if (sm_setjmp_nosig(_h.eh_context) == 0) {
|
||||
|
||||
# define SM_FINALLY SM_ASSERT(SmExcHandler == &_h); \
|
||||
} \
|
||||
if (sm_setjmp_nosig(_h.eh_context) == 0) {
|
||||
|
||||
# define SM_EXCEPT(e,pat) } \
|
||||
if (_h.eh_state == SM_EH_HANDLED) \
|
||||
break; \
|
||||
if (_h.eh_state == SM_EH_PUSHED) { \
|
||||
SM_ASSERT(SmExcHandler == &_h); \
|
||||
SmExcHandler = _h.eh_parent; \
|
||||
} \
|
||||
_h.eh_state = sm_exc_match(_h.eh_value,pat) \
|
||||
? SM_EH_HANDLED : SM_EH_POPPED; \
|
||||
if (_h.eh_state == SM_EH_HANDLED) { \
|
||||
SM_UNUSED(SM_EXC_T *e) = _h.eh_value;
|
||||
|
||||
# define SM_END_TRY } \
|
||||
} while (0); \
|
||||
if (_h.eh_state == SM_EH_PUSHED) { \
|
||||
SM_ASSERT(SmExcHandler == &_h); \
|
||||
SmExcHandler = _h.eh_parent; \
|
||||
if (_h.eh_value != NULL) \
|
||||
sm_exc_raise_x(_h.eh_value); \
|
||||
} else if (_h.eh_state == SM_EH_POPPED) { \
|
||||
if (_h.eh_value != NULL) \
|
||||
sm_exc_raise_x(_h.eh_value); \
|
||||
} else \
|
||||
sm_exc_free(_h.eh_value); \
|
||||
}
|
||||
|
||||
#endif /* SM_EXC_H */
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2002 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.
|
||||
*
|
||||
* Id: fdset.h,v 1.3.10.2 2002/12/10 04:02:25 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_FDSET_H
|
||||
# define SM_FDSET_H
|
||||
|
||||
/*
|
||||
** Note: SM_FD_OK_SELECT(fd) requires that ValidSocket(fd) has been checked
|
||||
** before.
|
||||
*/
|
||||
|
||||
# define SM_FD_SET(fd, pfdset) FD_SET(fd, pfdset)
|
||||
# define SM_FD_ISSET(fd, pfdset) FD_ISSET(fd, pfdset)
|
||||
# define SM_FD_SETSIZE FD_SETSIZE
|
||||
# define SM_FD_OK_SELECT(fd) (FD_SETSIZE <= 0 || (fd) < FD_SETSIZE)
|
||||
|
||||
#endif /* SM_FDSET_H */
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2002 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.
|
||||
*
|
||||
* Id: gen.h,v 1.22 2002/04/03 00:40:42 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm general definitions
|
||||
** See libsm/gen.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_GEN_H
|
||||
# define SM_GEN_H
|
||||
|
||||
# include <sm/config.h>
|
||||
# include <sm/cdefs.h>
|
||||
# include <sm/types.h>
|
||||
|
||||
/*
|
||||
** Define SM_RCSID and SM_IDSTR,
|
||||
** macros used to embed RCS and SCCS identification strings in object files.
|
||||
*/
|
||||
|
||||
# ifdef lint
|
||||
# define SM_RCSID(str)
|
||||
# define SM_IDSTR(id,str)
|
||||
# else /* lint */
|
||||
# define SM_RCSID(str) SM_UNUSED(static const char RcsId[]) = str;
|
||||
# define SM_IDSTR(id,str) SM_UNUSED(static const char id[]) = str;
|
||||
# endif /* lint */
|
||||
|
||||
/*
|
||||
** Define NULL and offsetof (from the C89 standard)
|
||||
*/
|
||||
|
||||
# if SM_CONF_STDDEF_H
|
||||
# include <stddef.h>
|
||||
# else /* SM_CONF_STDDEF_H */
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
# define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
||||
# endif /* SM_CONF_STDDEF_H */
|
||||
|
||||
/*
|
||||
** Define bool, true, false (from the C99 standard)
|
||||
*/
|
||||
|
||||
# if SM_CONF_STDBOOL_H
|
||||
# include <stdbool.h>
|
||||
# else /* SM_CONF_STDBOOL_H */
|
||||
# ifndef __cplusplus
|
||||
typedef int bool;
|
||||
# define false 0
|
||||
# define true 1
|
||||
# endif
|
||||
# endif /* SM_CONF_STDBOOL_H */
|
||||
|
||||
/*
|
||||
** Define SM_MAX and SM_MIN
|
||||
*/
|
||||
|
||||
# define SM_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
# define SM_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
/* Define SM_SUCCESS and SM_FAILURE */
|
||||
# define SM_SUCCESS 0
|
||||
# define SM_FAILURE (-1)
|
||||
|
||||
/* XXX This needs to be fixed when we start to use threads: */
|
||||
typedef int SM_ATOMIC_INT_T;
|
||||
typedef unsigned int SM_ATOMIC_UINT_T;
|
||||
|
||||
#endif /* SM_GEN_H */
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: heap.h,v 1.22 2001/09/04 22:41:55 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Sendmail debugging memory allocation package.
|
||||
** See libsm/heap.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_HEAP_H
|
||||
# define SM_HEAP_H
|
||||
|
||||
# include <sm/io.h>
|
||||
# include <stdlib.h>
|
||||
# include <sm/debug.h>
|
||||
# include <sm/exc.h>
|
||||
|
||||
/* change default to 0 for production? */
|
||||
# ifndef SM_HEAP_CHECK
|
||||
# define SM_HEAP_CHECK 1
|
||||
# endif /* ! SM_HEAP_CHECK */
|
||||
|
||||
# if SM_HEAP_CHECK
|
||||
# define sm_malloc_x(sz) sm_malloc_tagged_x(sz, __FILE__, __LINE__, SmHeapGroup)
|
||||
# define sm_malloc(size) sm_malloc_tagged(size, __FILE__, __LINE__, SmHeapGroup)
|
||||
# define sm_free(ptr) sm_free_tagged(ptr, __FILE__, __LINE__)
|
||||
|
||||
extern void *sm_malloc_tagged __P((size_t, char *, int, int));
|
||||
extern void *sm_malloc_tagged_x __P((size_t, char *, int, int));
|
||||
extern void sm_free_tagged __P((void *, char *, int));
|
||||
extern void *sm_realloc_x __P((void *, size_t));
|
||||
extern bool sm_heap_register __P((void *, size_t, char *, int, int));
|
||||
extern void sm_heap_checkptr_tagged __P((void *, char *, int));
|
||||
extern void sm_heap_report __P((SM_FILE_T *, int));
|
||||
|
||||
# else /* SM_HEAP_CHECK */
|
||||
# define sm_malloc_tagged(size, file, line, grp) sm_malloc(size)
|
||||
# define sm_malloc_tagged_x(size, file, line, grp) sm_malloc_x(size)
|
||||
# define sm_free_tagged(ptr, file, line) sm_free(ptr)
|
||||
# define sm_heap_register(ptr, size, file, line, grp) (true)
|
||||
# define sm_heap_checkptr_tagged(ptr, tag, num) ((void)0)
|
||||
# define sm_heap_report(file, verbose) ((void)0)
|
||||
|
||||
extern void *sm_malloc __P((size_t));
|
||||
extern void *sm_malloc_x __P((size_t));
|
||||
extern void *sm_realloc_x __P((void *, size_t));
|
||||
extern void sm_free __P((void *));
|
||||
# endif /* SM_HEAP_CHECK */
|
||||
|
||||
extern void *sm_realloc __P((void *, size_t));
|
||||
|
||||
# define sm_heap_checkptr(ptr) sm_heap_checkptr_tagged(ptr, __FILE__, __LINE__)
|
||||
|
||||
#if 0
|
||||
/*
|
||||
** sm_f[mc]alloc are plug in replacements for malloc and calloc
|
||||
** which can be used in a context requiring a function pointer,
|
||||
** and which are compatible with sm_free. Warning: sm_heap_report
|
||||
** cannot report where storage leaked by sm_f[mc]alloc was allocated.
|
||||
*/
|
||||
|
||||
/* XXX unused right now */
|
||||
|
||||
extern void *
|
||||
sm_fmalloc __P((
|
||||
size_t));
|
||||
|
||||
extern void *
|
||||
sm_fcalloc __P((
|
||||
size_t,
|
||||
size_t));
|
||||
#endif /* 0 */
|
||||
|
||||
/*
|
||||
** Allocate 'permanent' storage that can be freed but may still be
|
||||
** allocated when the process exits. sm_heap_report will not complain
|
||||
** about a storage leak originating from a call to sm_pmalloc.
|
||||
*/
|
||||
|
||||
# define sm_pmalloc(size) sm_malloc_tagged(size, __FILE__, __LINE__, 0)
|
||||
# define sm_pmalloc_x(size) sm_malloc_tagged_x(size, __FILE__, __LINE__, 0)
|
||||
|
||||
# define sm_heap_group() SmHeapGroup
|
||||
# define sm_heap_setgroup(g) (SmHeapGroup = (g))
|
||||
# define sm_heap_newgroup() (SmHeapGroup = ++SmHeapMaxGroup)
|
||||
|
||||
extern int SmHeapGroup;
|
||||
extern int SmHeapMaxGroup;
|
||||
|
||||
extern SM_DEBUG_T SmHeapTrace;
|
||||
extern SM_DEBUG_T SmHeapCheck;
|
||||
extern SM_EXC_T SmHeapOutOfMemory;
|
||||
|
||||
#endif /* ! SM_HEAP_H */
|
|
@ -0,0 +1,378 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1990
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Id: io.h,v 1.23 2002/02/23 19:32:17 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*-
|
||||
* @(#)stdio.h 5.17 (Berkeley) 6/3/91
|
||||
*/
|
||||
|
||||
#ifndef SM_IO_H
|
||||
#define SM_IO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sm/gen.h>
|
||||
#include <sm/varargs.h>
|
||||
|
||||
/* mode for sm io (exposed) */
|
||||
#define SM_IO_RDWR 1 /* read-write */
|
||||
#define SM_IO_RDONLY 2 /* read-only */
|
||||
#define SM_IO_WRONLY 3 /* write-only */
|
||||
#define SM_IO_APPEND 4 /* write-only from eof */
|
||||
#define SM_IO_APPENDRW 5 /* read-write from eof */
|
||||
#define SM_IO_RDWRTR 6 /* read-write with truncation indicated */
|
||||
|
||||
/* for sm_io_fseek, et al api's (exposed) */
|
||||
#define SM_IO_SEEK_SET 0
|
||||
#define SM_IO_SEEK_CUR 1
|
||||
#define SM_IO_SEEK_END 2
|
||||
|
||||
/* flags for info what's with different types (exposed) */
|
||||
#define SM_IO_WHAT_MODE 1
|
||||
#define SM_IO_WHAT_VECTORS 2
|
||||
#define SM_IO_WHAT_FD 3
|
||||
#define SM_IO_WHAT_TYPE 4
|
||||
#define SM_IO_WHAT_ISTYPE 5
|
||||
#define SM_IO_IS_READABLE 6
|
||||
#define SM_IO_WHAT_TIMEOUT 7
|
||||
#define SM_IO_WHAT_SIZE 8
|
||||
|
||||
/* info flags (exposed) */
|
||||
#define SM_IO_FTYPE_CREATE 1
|
||||
#define SM_IO_FTYPE_MODIFY 2
|
||||
#define SM_IO_FTYPE_DELETE 3
|
||||
|
||||
#define SM_IO_SL_PRIO 1
|
||||
|
||||
#define SM_IO_OPEN_MAX 20
|
||||
|
||||
/* for internal buffers */
|
||||
struct smbuf
|
||||
{
|
||||
unsigned char *smb_base;
|
||||
int smb_size;
|
||||
};
|
||||
|
||||
/*
|
||||
** sm I/O state variables (internal only).
|
||||
**
|
||||
** The following always hold:
|
||||
**
|
||||
** if (flags&(SMLBF|SMWR)) == (SMLBF|SMWR),
|
||||
** lbfsize is -bf.size, else lbfsize is 0
|
||||
** if flags&SMRD, w is 0
|
||||
** if flags&SMWR, r is 0
|
||||
**
|
||||
** This ensures that the getc and putc macros (or inline functions) never
|
||||
** try to write or read from a file that is in `read' or `write' mode.
|
||||
** (Moreover, they can, and do, automatically switch from read mode to
|
||||
** write mode, and back, on "r+" and "w+" files.)
|
||||
**
|
||||
** lbfsize is used only to make the inline line-buffered output stream
|
||||
** code as compact as possible.
|
||||
**
|
||||
** ub, up, and ur are used when ungetc() pushes back more characters
|
||||
** than fit in the current bf, or when ungetc() pushes back a character
|
||||
** that does not match the previous one in bf. When this happens,
|
||||
** ub.base becomes non-nil (i.e., a stream has ungetc() data iff
|
||||
** ub.base!=NULL) and up and ur save the current values of p and r.
|
||||
*/
|
||||
|
||||
typedef struct sm_file SM_FILE_T;
|
||||
|
||||
struct sm_file
|
||||
{
|
||||
const char *sm_magic; /* This SM_FILE_T is free when NULL */
|
||||
unsigned char *f_p; /* current position in (some) buffer */
|
||||
int f_r; /* read space left for getc() */
|
||||
int f_w; /* write space left for putc() */
|
||||
long f_flags; /* flags, below */
|
||||
short f_file; /* fileno, if Unix fd, else -1 */
|
||||
struct smbuf f_bf; /* the buffer (>= 1 byte, if !NULL) */
|
||||
int f_lbfsize; /* 0 or -bf.size, for inline putc */
|
||||
|
||||
/* These can be used for any purpose by a file type implementation: */
|
||||
void *f_cookie;
|
||||
int f_ival;
|
||||
|
||||
/* operations */
|
||||
int (*f_close) __P((SM_FILE_T *));
|
||||
ssize_t (*f_read) __P((SM_FILE_T *, char *, size_t));
|
||||
off_t (*f_seek) __P((SM_FILE_T *, off_t, int));
|
||||
ssize_t (*f_write) __P((SM_FILE_T *, const char *, size_t));
|
||||
int (*f_open) __P((SM_FILE_T *, const void *, int,
|
||||
const void *));
|
||||
int (*f_setinfo) __P((SM_FILE_T *, int , void *));
|
||||
int (*f_getinfo) __P((SM_FILE_T *, int , void *));
|
||||
int f_timeout;
|
||||
int f_timeoutstate; /* either blocking or non-blocking */
|
||||
char *f_type; /* for by-type lookups */
|
||||
struct sm_file *f_flushfp; /* flush this before reading parent */
|
||||
struct sm_file *f_modefp; /* sync mode with this fp */
|
||||
|
||||
/* separate buffer for long sequences of ungetc() */
|
||||
struct smbuf f_ub; /* ungetc buffer */
|
||||
unsigned char *f_up; /* saved f_p when f_p is doing ungetc */
|
||||
int f_ur; /* saved f_r when f_r is counting ungetc */
|
||||
|
||||
/* tricks to meet minimum requirements even when malloc() fails */
|
||||
unsigned char f_ubuf[3]; /* guarantee an ungetc() buffer */
|
||||
unsigned char f_nbuf[1]; /* guarantee a getc() buffer */
|
||||
|
||||
/* Unix stdio files get aligned to block boundaries on fseek() */
|
||||
int f_blksize; /* stat.st_blksize (may be != bf.size) */
|
||||
off_t f_lseekoff; /* current lseek offset */
|
||||
int f_dup_cnt; /* count file dup'd */
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern SM_FILE_T SmIoF[];
|
||||
extern const char SmFileMagic[];
|
||||
extern SM_FILE_T SmFtStdio_def;
|
||||
extern SM_FILE_T SmFtStdiofd_def;
|
||||
extern SM_FILE_T SmFtString_def;
|
||||
extern SM_FILE_T SmFtSyslog_def;
|
||||
extern SM_FILE_T SmFtRealStdio_def;
|
||||
|
||||
#define SMIOIN_FILENO 0
|
||||
#define SMIOOUT_FILENO 1
|
||||
#define SMIOERR_FILENO 2
|
||||
#define SMIOSTDIN_FILENO 3
|
||||
#define SMIOSTDOUT_FILENO 4
|
||||
#define SMIOSTDERR_FILENO 5
|
||||
|
||||
/* Common predefined and already (usually) open files (exposed) */
|
||||
#define smioin (&SmIoF[SMIOIN_FILENO])
|
||||
#define smioout (&SmIoF[SMIOOUT_FILENO])
|
||||
#define smioerr (&SmIoF[SMIOERR_FILENO])
|
||||
#define smiostdin (&SmIoF[SMIOSTDIN_FILENO])
|
||||
#define smiostdout (&SmIoF[SMIOSTDOUT_FILENO])
|
||||
#define smiostderr (&SmIoF[SMIOSTDERR_FILENO])
|
||||
|
||||
#define SmFtStdio (&SmFtStdio_def)
|
||||
#define SmFtStdiofd (&SmFtStdiofd_def)
|
||||
#define SmFtString (&SmFtString_def)
|
||||
#define SmFtSyslog (&SmFtSyslog_def)
|
||||
#define SmFtRealStdio (&SmFtRealStdio_def)
|
||||
|
||||
#ifdef __STDC__
|
||||
# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \
|
||||
(f) = {SmFileMagic, (unsigned char *) 0, 0, 0, 0L, -1, {0}, 0, (void *) 0,\
|
||||
0, (close), (read), (seek), (write), (open), (set), (get), (timeout),\
|
||||
0, (name)}
|
||||
# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout)
|
||||
|
||||
#else /* __STDC__ */
|
||||
# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) (f)
|
||||
# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \
|
||||
(f).sm_magic = SmFileMagic; \
|
||||
(f).f_p = (unsigned char *) 0; \
|
||||
(f).f_r = 0; \
|
||||
(f).f_w = 0; \
|
||||
(f).f_flags = 0L; \
|
||||
(f).f_file = 0; \
|
||||
(f).f_bf.smb_base = (unsigned char *) 0; \
|
||||
(f).f_bf.smb_size = 0; \
|
||||
(f).f_lbfsize = 0; \
|
||||
(f).f_cookie = (void *) 0; \
|
||||
(f).f_ival = 0; \
|
||||
(f).f_close = (close); \
|
||||
(f).f_read = (read); \
|
||||
(f).f_seek = (seek); \
|
||||
(f).f_write = (write); \
|
||||
(f).f_open = (open); \
|
||||
(f).f_setinfo = (set); \
|
||||
(f).f_getinfo = (get); \
|
||||
(f).f_timeout = (timeout); \
|
||||
(f).f_timeoutstate = 0; \
|
||||
(f).f_type = (name);
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/* Internal flags */
|
||||
#define SMFBF 0x000001 /* XXXX fully buffered */
|
||||
#define SMLBF 0x000002 /* line buffered */
|
||||
#define SMNBF 0x000004 /* unbuffered */
|
||||
#define SMNOW 0x000008 /* Flush each write; take read now */
|
||||
#define SMRD 0x000010 /* OK to read */
|
||||
#define SMWR 0x000020 /* OK to write */
|
||||
/* RD and WR are never simultaneously asserted */
|
||||
#define SMRW 0x000040 /* open for reading & writing */
|
||||
#define SMFEOF 0x000080 /* found EOF */
|
||||
#define SMERR 0x000100 /* found error */
|
||||
#define SMMBF 0x000200 /* buf is from malloc */
|
||||
#define SMAPP 0x000400 /* fdopen()ed in append mode */
|
||||
#define SMSTR 0x000800 /* this is an snprintf string */
|
||||
#define SMOPT 0x001000 /* do fseek() optimisation */
|
||||
#define SMNPT 0x002000 /* do not do fseek() optimisation */
|
||||
#define SMOFF 0x004000 /* set iff offset is in fact correct */
|
||||
#define SMALC 0x010000 /* allocate string space dynamically */
|
||||
|
||||
#define SMMODEMASK 0x0070 /* read/write mode */
|
||||
|
||||
/* defines for timeout constants */
|
||||
#define SM_TIME_IMMEDIATE (0)
|
||||
#define SM_TIME_FOREVER (-1)
|
||||
#define SM_TIME_DEFAULT (-2)
|
||||
|
||||
/* timeout state for blocking */
|
||||
#define SM_TIME_BLOCK (0) /* XXX just bool? */
|
||||
#define SM_TIME_NONBLOCK (1)
|
||||
|
||||
/* Exposed buffering type flags */
|
||||
#define SM_IO_FBF 0 /* setvbuf should set fully buffered */
|
||||
#define SM_IO_LBF 1 /* setvbuf should set line buffered */
|
||||
#define SM_IO_NBF 2 /* setvbuf should set unbuffered */
|
||||
|
||||
/* setvbuf buffered, but through at lower file type layers */
|
||||
#define SM_IO_NOW 3
|
||||
|
||||
/*
|
||||
** size of buffer used by setbuf.
|
||||
** If underlying filesystem blocksize is discoverable that is used instead
|
||||
*/
|
||||
|
||||
#define SM_IO_BUFSIZ 4096
|
||||
|
||||
#define SM_IO_EOF (-1)
|
||||
|
||||
/* Functions defined in ANSI C standard. */
|
||||
__BEGIN_DECLS
|
||||
SM_FILE_T *sm_io_autoflush __P((SM_FILE_T *, SM_FILE_T *));
|
||||
void sm_io_automode __P((SM_FILE_T *, SM_FILE_T *));
|
||||
void sm_io_clearerr __P((SM_FILE_T *));
|
||||
int sm_io_close __P((SM_FILE_T *, int SM_NONVOLATILE));
|
||||
SM_FILE_T *sm_io_dup __P((SM_FILE_T *));
|
||||
int sm_io_eof __P((SM_FILE_T *));
|
||||
int sm_io_error __P((SM_FILE_T *));
|
||||
char *sm_io_fgets __P((SM_FILE_T *, int, char *, int));
|
||||
int sm_io_flush __P((SM_FILE_T *, int SM_NONVOLATILE));
|
||||
|
||||
int PRINTFLIKE(3, 4)
|
||||
sm_io_fprintf __P((SM_FILE_T *, int, const char *, ...));
|
||||
|
||||
int sm_io_fputs __P((SM_FILE_T *, int, const char *));
|
||||
|
||||
int SCANFLIKE(3, 4)
|
||||
sm_io_fscanf __P((SM_FILE_T *, int, const char *, ...));
|
||||
|
||||
int sm_io_getc __P((SM_FILE_T *, int));
|
||||
int sm_io_getinfo __P((SM_FILE_T *, int, void *));
|
||||
SM_FILE_T *sm_io_open __P((const SM_FILE_T *, int SM_NONVOLATILE, const void *,
|
||||
int, const void *));
|
||||
int sm_io_purge __P((SM_FILE_T *));
|
||||
int sm_io_putc __P((SM_FILE_T *, int, int));
|
||||
size_t sm_io_read __P((SM_FILE_T *, int, void *, size_t));
|
||||
SM_FILE_T *sm_io_reopen __P((const SM_FILE_T *, int SM_NONVOLATILE,
|
||||
const void *, int, const void *, SM_FILE_T *));
|
||||
void sm_io_rewind __P((SM_FILE_T *, int));
|
||||
int sm_io_seek __P((SM_FILE_T *, int SM_NONVOLATILE, long SM_NONVOLATILE,
|
||||
int SM_NONVOLATILE));
|
||||
int sm_io_setinfo __P((SM_FILE_T *, int, void *));
|
||||
int sm_io_setvbuf __P((SM_FILE_T *, int, char *, int, size_t));
|
||||
|
||||
int SCANFLIKE(2, 3)
|
||||
sm_io_sscanf __P((const char *, char const *, ...));
|
||||
|
||||
long sm_io_tell __P((SM_FILE_T *, int SM_NONVOLATILE));
|
||||
int sm_io_ungetc __P((SM_FILE_T *, int, int));
|
||||
int sm_io_vfprintf __P((SM_FILE_T *, int, const char *, va_list));
|
||||
size_t sm_io_write __P((SM_FILE_T *, int, const void *, size_t));
|
||||
|
||||
void sm_strio_init __P((SM_FILE_T *, char *, size_t));
|
||||
|
||||
extern SM_FILE_T *
|
||||
sm_io_fopen __P((
|
||||
char *_pathname,
|
||||
int _flags,
|
||||
...));
|
||||
|
||||
extern SM_FILE_T *
|
||||
sm_io_stdioopen __P((
|
||||
FILE *_stream,
|
||||
char *_mode));
|
||||
|
||||
extern int
|
||||
sm_vasprintf __P((
|
||||
char **_str,
|
||||
const char *_fmt,
|
||||
va_list _ap));
|
||||
|
||||
extern int
|
||||
sm_vsnprintf __P((
|
||||
char *,
|
||||
size_t,
|
||||
const char *,
|
||||
va_list));
|
||||
|
||||
extern void
|
||||
sm_perror __P((
|
||||
const char *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
** Functions internal to the implementation.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sm_rget __P((SM_FILE_T *, int));
|
||||
int sm_vfscanf __P((SM_FILE_T *, int SM_NONVOLATILE, const char *,
|
||||
va_list SM_NONVOLATILE));
|
||||
int sm_wbuf __P((SM_FILE_T *, int, int));
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
** The macros are here so that we can
|
||||
** define function versions in the library.
|
||||
*/
|
||||
|
||||
#define sm_getc(f, t) \
|
||||
(--(f)->f_r < 0 ? \
|
||||
sm_rget(f, t) : \
|
||||
(int)(*(f)->f_p++))
|
||||
|
||||
/*
|
||||
** This has been tuned to generate reasonable code on the vax using pcc.
|
||||
** (It also generates reasonable x86 code using gcc.)
|
||||
*/
|
||||
|
||||
#define sm_putc(f, t, c) \
|
||||
(--(f)->f_w < 0 ? \
|
||||
(f)->f_w >= (f)->f_lbfsize ? \
|
||||
(*(f)->f_p = (c)), *(f)->f_p != '\n' ? \
|
||||
(int)*(f)->f_p++ : \
|
||||
sm_wbuf(f, t, '\n') : \
|
||||
sm_wbuf(f, t, (int)(c)) : \
|
||||
(*(f)->f_p = (c), (int)*(f)->f_p++))
|
||||
|
||||
#define sm_eof(p) (((p)->f_flags & SMFEOF) != 0)
|
||||
#define sm_error(p) (((p)->f_flags & SMERR) != 0)
|
||||
#define sm_clearerr(p) ((void)((p)->f_flags &= ~(SMERR|SMFEOF)))
|
||||
|
||||
#define sm_io_eof(p) sm_eof(p)
|
||||
#define sm_io_error(p) sm_error(p)
|
||||
|
||||
#define sm_io_clearerr(p) sm_clearerr(p)
|
||||
|
||||
#ifndef lint
|
||||
# ifndef _POSIX_SOURCE
|
||||
# define sm_io_getc(fp, t) sm_getc(fp, t)
|
||||
# define sm_io_putc(fp, t, x) sm_putc(fp, t, x)
|
||||
# endif /* _POSIX_SOURCE */
|
||||
#endif /* lint */
|
||||
|
||||
#endif /* SM_IO_H */
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2002 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.
|
||||
*
|
||||
* Id: ldap.h,v 1.22 2002/03/05 02:17:26 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_LDAP_H
|
||||
# define SM_LDAP_H
|
||||
|
||||
# include <sm/conf.h>
|
||||
# include <sm/rpool.h>
|
||||
|
||||
/*
|
||||
** NOTE: These should be changed from LDAPMAP_* to SM_LDAP_*
|
||||
** in the next major release (8.13) of sendmail.
|
||||
*/
|
||||
|
||||
# ifndef LDAPMAP_MAX_ATTR
|
||||
# define LDAPMAP_MAX_ATTR 64
|
||||
# endif /* ! LDAPMAP_MAX_ATTR */
|
||||
# ifndef LDAPMAP_MAX_FILTER
|
||||
# define LDAPMAP_MAX_FILTER 1024
|
||||
# endif /* ! LDAPMAP_MAX_FILTER */
|
||||
# ifndef LDAPMAP_MAX_PASSWD
|
||||
# define LDAPMAP_MAX_PASSWD 256
|
||||
# endif /* ! LDAPMAP_MAX_PASSWD */
|
||||
|
||||
# if LDAPMAP
|
||||
|
||||
# if _FFR_LDAP_RECURSION
|
||||
|
||||
/* Attribute types */
|
||||
# define SM_LDAP_ATTR_NONE (-1)
|
||||
# define SM_LDAP_ATTR_OBJCLASS 0
|
||||
# define SM_LDAP_ATTR_NORMAL 1
|
||||
# define SM_LDAP_ATTR_DN 2
|
||||
# define SM_LDAP_ATTR_FILTER 3
|
||||
# define SM_LDAP_ATTR_URL 4
|
||||
|
||||
/* sm_ldap_results() flags */
|
||||
# define SM_LDAP_SINGLEMATCH 0x0001
|
||||
# define SM_LDAP_MATCHONLY 0x0002
|
||||
# define SM_LDAP_USE_ALLATTR 0x0004
|
||||
|
||||
# endif /* _FFR_LDAP_RECURSION */
|
||||
|
||||
struct sm_ldap_struct
|
||||
{
|
||||
/* needed for ldap_open or ldap_init */
|
||||
char *ldap_target;
|
||||
int ldap_port;
|
||||
# if _FFR_LDAP_URI
|
||||
bool ldap_uri;
|
||||
# endif /* _FFR_LDAP_URI */
|
||||
# if _FFR_LDAP_SETVERSION
|
||||
int ldap_version;
|
||||
# endif /* _FFR_LDAP_SETVERSION */
|
||||
pid_t ldap_pid;
|
||||
|
||||
/* options set in ld struct before ldap_bind_s */
|
||||
int ldap_deref;
|
||||
time_t ldap_timelimit;
|
||||
int ldap_sizelimit;
|
||||
int ldap_options;
|
||||
|
||||
/* args for ldap_bind_s */
|
||||
LDAP *ldap_ld;
|
||||
char *ldap_binddn;
|
||||
char *ldap_secret;
|
||||
int ldap_method;
|
||||
|
||||
/* args for ldap_search */
|
||||
char *ldap_base;
|
||||
int ldap_scope;
|
||||
char *ldap_filter;
|
||||
char *ldap_attr[LDAPMAP_MAX_ATTR + 1];
|
||||
# if _FFR_LDAP_RECURSION
|
||||
int ldap_attr_type[LDAPMAP_MAX_ATTR + 1];
|
||||
char *ldap_attr_needobjclass[LDAPMAP_MAX_ATTR + 1];
|
||||
# endif /* _FFR_LDAP_RECURSION */
|
||||
bool ldap_attrsonly;
|
||||
|
||||
/* args for ldap_result */
|
||||
struct timeval ldap_timeout;
|
||||
LDAPMessage *ldap_res;
|
||||
|
||||
/* ldapmap_lookup options */
|
||||
char ldap_attrsep;
|
||||
|
||||
/* Linked list of maps sharing the same LDAP binding */
|
||||
void *ldap_next;
|
||||
};
|
||||
|
||||
typedef struct sm_ldap_struct SM_LDAP_STRUCT;
|
||||
|
||||
# if _FFR_LDAP_RECURSION
|
||||
struct sm_ldap_recurse_entry
|
||||
{
|
||||
char *lr_search;
|
||||
int lr_type;
|
||||
bool lr_done;
|
||||
};
|
||||
|
||||
struct sm_ldap_recurse_list
|
||||
{
|
||||
int lr_size;
|
||||
int lr_cnt;
|
||||
struct sm_ldap_recurse_entry **lr_data;
|
||||
};
|
||||
|
||||
typedef struct sm_ldap_recurse_entry SM_LDAP_RECURSE_ENTRY;
|
||||
typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST;
|
||||
# endif /* _FFR_LDAP_RECURSION */
|
||||
|
||||
/* functions */
|
||||
extern void sm_ldap_clear __P((SM_LDAP_STRUCT *));
|
||||
extern bool sm_ldap_start __P((char *, SM_LDAP_STRUCT *));
|
||||
extern int sm_ldap_search __P((SM_LDAP_STRUCT *, char *));
|
||||
# if _FFR_LDAP_RECURSION
|
||||
extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, int,
|
||||
SM_RPOOL_T *, char **, int *, int *,
|
||||
SM_LDAP_RECURSE_LIST *));
|
||||
# endif /* _FFR_LDAP_RECURSION */
|
||||
extern void sm_ldap_setopts __P((LDAP *, SM_LDAP_STRUCT *));
|
||||
extern int sm_ldap_geterrno __P((LDAP *));
|
||||
extern void sm_ldap_close __P((SM_LDAP_STRUCT *));
|
||||
|
||||
/* Portability defines */
|
||||
# if !SM_CONF_LDAP_MEMFREE
|
||||
# define ldap_memfree(x) ((void) 0)
|
||||
# endif /* !SM_CONF_LDAP_MEMFREE */
|
||||
|
||||
# endif /* LDAPMAP */
|
||||
#endif /* ! SM_LDAP_H */
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: limits.h,v 1.6 2001/03/08 03:23:08 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** <sm/limits.h>
|
||||
** This header file is a portability wrapper for <limits.h>.
|
||||
** It includes <limits.h>, then it ensures that the following macros
|
||||
** from the C 1999 standard for <limits.h> are defined:
|
||||
** LLONG_MIN, LLONG_MAX
|
||||
** ULLONG_MAX
|
||||
*/
|
||||
|
||||
#ifndef SM_LIMITS_H
|
||||
# define SM_LIMITS_H
|
||||
|
||||
# include <limits.h>
|
||||
# include <sm/types.h>
|
||||
# include <sys/param.h>
|
||||
|
||||
/*
|
||||
** The following assumes two's complement binary arithmetic.
|
||||
*/
|
||||
|
||||
# ifndef LLONG_MIN
|
||||
# define LLONG_MIN ((LONGLONG_T)(~(ULLONG_MAX >> 1)))
|
||||
# endif /* ! LLONG_MIN */
|
||||
# ifndef LLONG_MAX
|
||||
# define LLONG_MAX ((LONGLONG_T)(ULLONG_MAX >> 1))
|
||||
# endif /* ! LLONG_MAX */
|
||||
# ifndef ULLONG_MAX
|
||||
# define ULLONG_MAX ((ULONGLONG_T)(-1))
|
||||
# endif /* ! ULLONG_MAX */
|
||||
|
||||
/*
|
||||
** PATH_MAX is defined by the POSIX standard. All modern systems
|
||||
** provide it. Older systems define MAXPATHLEN in <sys/param.h> instead.
|
||||
*/
|
||||
|
||||
# ifndef PATH_MAX
|
||||
# ifdef MAXPATHLEN
|
||||
# define PATH_MAX MAXPATHLEN
|
||||
# else /* MAXPATHLEN */
|
||||
# define PATH_MAX 2048
|
||||
# endif /* MAXPATHLEN */
|
||||
# endif /* ! PATH_MAX */
|
||||
|
||||
#endif /* ! SM_LIMITS_H */
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2002 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.
|
||||
*
|
||||
* Id: mbdb.h,v 1.6 2002/05/24 20:50:14 gshapiro Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_MBDB_H
|
||||
# define SM_MBDB_H
|
||||
|
||||
#include <pwd.h>
|
||||
#include <sm/types.h>
|
||||
#include <sm/limits.h>
|
||||
|
||||
/*
|
||||
** This is an abstract interface for looking up local mail recipients.
|
||||
*/
|
||||
|
||||
#define MBDB_MAXNAME 256
|
||||
#define SM_NO_UID ((uid_t)(-1))
|
||||
#define SM_NO_GID ((gid_t)(-1))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uid_t mbdb_uid;
|
||||
gid_t mbdb_gid;
|
||||
char mbdb_name[MBDB_MAXNAME];
|
||||
char mbdb_fullname[MBDB_MAXNAME];
|
||||
char mbdb_homedir[PATH_MAX];
|
||||
char mbdb_shell[PATH_MAX];
|
||||
} SM_MBDB_T;
|
||||
|
||||
extern int sm_mbdb_initialize __P((char *));
|
||||
extern void sm_mbdb_terminate __P((void));
|
||||
extern int sm_mbdb_lookup __P((char *, SM_MBDB_T *));
|
||||
extern void sm_mbdb_frompw __P((SM_MBDB_T *, struct passwd *));
|
||||
extern void sm_pwfullname __P((char *, char *, char *, size_t));
|
||||
|
||||
#endif /* ! SM_MBDB_H */
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_aix.h,v 1.9 2001/10/09 23:12:13 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** sm_os_aix.h -- platform definitions for AIX
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "aix"
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 2
|
||||
#endif /* SM_CONF_SEM */
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
||||
|
||||
/* AIX 3 doesn't have a prototype for syslog()? */
|
||||
#ifdef _AIX3
|
||||
# ifndef _AIX4
|
||||
# ifndef SM_CONF_SYSLOG
|
||||
# define SM_CONF_SYSLOG 0
|
||||
# endif /* SM_CONF_SYSLOG */
|
||||
# endif /* ! _AIX4 */
|
||||
#endif /* _AIX3 */
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_freebsd.h,v 1.11 2002/04/15 17:17:05 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Platform definitions for FreeBSD
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "freebsd"
|
||||
|
||||
#define SM_CONF_SYS_CDEFS_H 1
|
||||
|
||||
#if __FreeBSD__ >= 2
|
||||
# include <osreldate.h> /* defines __FreeBSD_version */
|
||||
# if __FreeBSD_version >= 199512 /* 2.2-current when it appeared */
|
||||
# define MI_SOMAXCONN -1 /* listen() max backlog for milter */
|
||||
# endif /* __FreeBSD_version >= 199512 */
|
||||
# if __FreeBSD_version >= 330000
|
||||
/* 3.3.0-release and later have strlcpy()/strlcat() */
|
||||
# ifndef SM_CONF_STRL
|
||||
# define SM_CONF_STRL 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 1
|
||||
#endif /* SM_CONF_SEM */
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_hp.h,v 1.8 2001/10/31 15:36:56 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** sm_os_hp.h -- platform definitions for HP
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "hp"
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 2
|
||||
#endif /* SM_CONF_SEM */
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
||||
|
||||
/* max/min buffer size of other than regular files */
|
||||
#ifndef SM_IO_MAX_BUF
|
||||
# define SM_IO_MAX_BUF 8192
|
||||
#endif /* SM_IO_MAX_BUF */
|
||||
#ifndef SM_IO_MIN_BUF
|
||||
# define SM_IO_MIN_BUF 4096
|
||||
#endif /* SM_IO_MIN_BUF */
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_irix.h,v 1.7 2001/10/09 23:12:13 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Silicon Graphics IRIX
|
||||
**
|
||||
** Compiles on 4.0.1.
|
||||
**
|
||||
** Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
|
||||
** Use IRIX5 instead of IRIX for IRIX 5.x.
|
||||
**
|
||||
** This version tries to be adaptive using _MIPS_SIM:
|
||||
** _MIPS_SIM == _ABIO32 (= 1) Abi: -32 on IRIX 6.2
|
||||
** _MIPS_SIM == _ABIN32 (= 2) Abi: -n32 on IRIX 6.2
|
||||
** _MIPS_SIM == _ABI64 (= 3) Abi: -64 on IRIX 6.2
|
||||
**
|
||||
** _MIPS_SIM is 1 also on IRIX 5.3
|
||||
**
|
||||
** IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
|
||||
** IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
|
||||
** Adaptive changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
|
||||
*/
|
||||
|
||||
#ifndef IRIX
|
||||
# define IRIX
|
||||
#endif /* ! IRIX */
|
||||
#if _MIPS_SIM > 0 && !defined(IRIX5)
|
||||
# define IRIX5 /* IRIX5 or IRIX6 */
|
||||
#endif /* _MIPS_SIM > 0 && !defined(IRIX5) */
|
||||
#if _MIPS_SIM > 1 && !defined(IRIX6) && !defined(IRIX64)
|
||||
# define IRIX6 /* IRIX6 */
|
||||
#endif /* _MIPS_SIM > 1 && !defined(IRIX6) && !defined(IRIX64) */
|
||||
|
||||
#define SM_OS_NAME "irix"
|
||||
|
||||
#if defined(IRIX6) || defined(IRIX64)
|
||||
# define SM_CONF_LONGLONG 1
|
||||
#endif /* defined(IRIX6) || defined(IRIX64) */
|
||||
|
||||
#if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
|
||||
# define SM_CONF_SYS_CDEFS_H 1
|
||||
#endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
|
||||
|
||||
/* try LLONG tests in libsm/t-types.c? */
|
||||
#ifndef SM_CONF_TEST_LLONG
|
||||
# define SM_CONF_TEST_LLONG 0
|
||||
#endif /* !SM_CONF_TEST_LLONG */
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_linux.h,v 1.12 2001/10/05 01:52:41 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Platform definitions for Linux
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "linux"
|
||||
|
||||
/* to get version number */
|
||||
#include <linux/version.h>
|
||||
|
||||
# if !defined(KERNEL_VERSION) /* not defined in 2.0.x kernel series */
|
||||
# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||
# endif /* ! KERNEL_VERSION */
|
||||
|
||||
/* doesn't seem to work on Linux */
|
||||
#ifndef SM_CONF_SETITIMER
|
||||
# define SM_CONF_SETITIMER 0
|
||||
#endif /* SM_CONF_SETITIMER */
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,19))
|
||||
# define SM_CONF_SHM 1
|
||||
# endif /* LINUX_VERSION_CODE */
|
||||
#endif /* SM_CONF_SHM */
|
||||
|
||||
#define SM_CONF_SYS_CDEFS_H 1
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 2
|
||||
#endif /* SM_CONF_SEM */
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2001 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.
|
||||
*
|
||||
* Id: sm_os_mpeix.h,v 1.2 2001/12/14 00:23:02 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** sm_os_mpeix.h -- platform definitions for HP MPE/iX
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "mpeix"
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 2
|
||||
#endif /* SM_CONF_SEM */
|
||||
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
||||
|
||||
#define SM_CONF_SETITIMER 0
|
||||
|
||||
#ifndef SM_CONF_CANT_SETRGID
|
||||
# define SM_CONF_CANT_SETRGID 1
|
||||
#endif /* SM_CONF_CANT_SETRGID */
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_next.h,v 1.7 2001/04/03 01:53:06 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Platform definitions for NeXT
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "next"
|
||||
|
||||
#define SM_CONF_SIGSETJMP 0
|
||||
#define SM_CONF_SSIZE_T 0
|
||||
#define SM_CONF_FORMAT_TEST 0
|
||||
|
||||
/* doesn't seem to work on NeXT 3.x */
|
||||
#define SM_DEAD(proto) proto
|
||||
#define SM_UNUSED(decl) decl
|
||||
|
||||
/* try LLONG tests in libsm/t-types.c? */
|
||||
#ifndef SM_CONF_TEST_LLONG
|
||||
# define SM_CONF_TEST_LLONG 0
|
||||
#endif /* !SM_CONF_TEST_LLONG */
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2000 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.
|
||||
*
|
||||
* Id: sm_os_openbsd.h,v 1.7 2000/12/05 19:00:47 dmoen Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** sm_os_openbsd.h -- platform definitions for OpenBSD
|
||||
**
|
||||
** Note: this header file cannot be called OpenBSD.h
|
||||
** because <sys/param.h> defines the macro OpenBSD.
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "openbsd"
|
||||
|
||||
#define SM_CONF_SYS_CDEFS_H 1
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
#ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 1
|
||||
#endif /* SM_CONF_SEM */
|
||||
#ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
#endif /* SM_CONF_MSG */
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2001 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.
|
||||
*
|
||||
* Id: sm_os_openunix.h,v 1.5 2001/11/11 16:32:00 ca Exp
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "openunix"
|
||||
|
||||
/* needs alarm(), our sleep() otherwise hangs. */
|
||||
#define SM_CONF_SETITIMER 0
|
||||
|
||||
/* long long seems to work */
|
||||
#define SM_CONF_LONGLONG 1
|
||||
|
||||
/* don't use flock() in mail.local.c */
|
||||
#define LDA_USE_LOCKF 1
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2001 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.
|
||||
*
|
||||
* Id: sm_os_osf1.h,v 1.3 2001/10/09 23:12:13 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** platform definitions for Digital UNIX
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "osf1"
|
||||
|
||||
#define SM_CONF_SETITIMER 0
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: sm_os_sunos.h,v 1.14 2001/08/14 18:09:42 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** platform definitions for SunOS 4.0.3, SunOS 4.1.x and Solaris 2.x
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "sunos"
|
||||
|
||||
#ifdef SOLARIS
|
||||
/*
|
||||
** Solaris 2.x (aka SunOS 5.x)
|
||||
** M4 config file is devtools/OS/SunOS.5.x, which defines the SOLARIS macro.
|
||||
*/
|
||||
|
||||
# define SM_CONF_LONGLONG 1
|
||||
# ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
# endif /* SM_CONF_SHM */
|
||||
# ifndef SM_CONF_SEM
|
||||
# define SM_CONF_SEM 2
|
||||
# endif /* SM_CONF_SEM */
|
||||
# ifndef SM_CONF_MSG
|
||||
# define SM_CONF_MSG 1
|
||||
# endif /* SM_CONF_MSG */
|
||||
|
||||
#else /* SOLARIS */
|
||||
|
||||
/*
|
||||
** SunOS 4.0.3 or 4.1.x
|
||||
*/
|
||||
|
||||
# define SM_CONF_SSIZE_T 0
|
||||
# ifndef SM_CONF_BROKEN_SIZE_T
|
||||
# define SM_CONF_BROKEN_SIZE_T 1 /* size_t is signed? */
|
||||
# endif /* SM_CONF_BROKEN_SIZE_T */
|
||||
|
||||
# ifndef SM_CONF_BROKEN_STRTOD
|
||||
# define SM_CONF_BROKEN_STRTOD 1
|
||||
# endif /* ! SM_CONF_BROKEN_STRTOD */
|
||||
|
||||
/* has memchr() prototype? (if not: needs memory.h) */
|
||||
# ifndef SM_CONF_MEMCHR
|
||||
# define SM_CONF_MEMCHR 0
|
||||
# endif /* ! SM_CONF_MEMCHR */
|
||||
|
||||
# ifdef SUNOS403
|
||||
|
||||
/*
|
||||
** SunOS 4.0.3
|
||||
** M4 config file is devtools/OS/SunOS4.0, which defines the SUNOS403 macro.
|
||||
*/
|
||||
|
||||
# else /* SUNOS403 */
|
||||
|
||||
/*
|
||||
** SunOS 4.1.x
|
||||
** M4 config file is devtools/OS/SunOS, which defines no macros.
|
||||
*/
|
||||
|
||||
# endif /* SUNOS403 */
|
||||
#endif /* SOLARIS */
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2001 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.
|
||||
*
|
||||
* Id: sm_os_ultrix.h,v 1.3 2001/10/09 23:12:13 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** platform definitions for Ultrix
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "ultrix"
|
||||
|
||||
#define SM_CONF_SSIZE_T 0
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2002 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.
|
||||
*
|
||||
* Id: sm_os_unixware.h,v 1.7.2.1 2002/10/24 18:02:14 ca Exp
|
||||
*/
|
||||
|
||||
#define SM_OS_NAME "unixware"
|
||||
|
||||
#ifndef SM_CONF_LONGLONG
|
||||
# if defined(__SCO_VERSION__) && __SCO_VERSION__ > 400000000L
|
||||
# define SM_CONF_LONGLONG 1
|
||||
# define SM_CONF_TEST_LLONG 1
|
||||
# define SM_CONF_BROKEN_SIZE_T 0
|
||||
# endif /* defined(__SCO_VERSION__) && __SCO_VERSION__ > 400000000L */
|
||||
#endif /* !SM_CONF_LONGLONG */
|
||||
|
||||
/* try LLONG tests in libsm/t-types.c? */
|
||||
#ifndef SM_CONF_TEST_LLONG
|
||||
# define SM_CONF_TEST_LLONG 0
|
||||
#endif /* !SM_CONF_TEST_LLONG */
|
||||
|
||||
/* needs alarm(), our sleep() otherwise hangs. */
|
||||
#define SM_CONF_SETITIMER 0
|
||||
|
||||
#ifndef SM_CONF_SHM
|
||||
# define SM_CONF_SHM 1
|
||||
#endif /* SM_CONF_SHM */
|
||||
|
||||
/* size_t seems to be signed */
|
||||
#ifndef SM_CONF_BROKEN_SIZE_T
|
||||
# define SM_CONF_BROKEN_SIZE_T 1
|
||||
#endif /* SM_CONF_BROKEN_SIZE_T */
|
||||
|
||||
/* don't use flock() in mail.local.c */
|
||||
#ifndef LDA_USE_LOCKF
|
||||
# define LDA_USE_LOCKF 1
|
||||
#endif /* LDA_USE_LOCKF */
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: path.h,v 1.6 2001/04/03 01:53:00 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Portable names for standard filesystem paths
|
||||
** and macros for directories.
|
||||
*/
|
||||
|
||||
#ifndef SM_PATH_H
|
||||
# define SM_PATH_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
|
||||
# define SM_PATH_DEVNULL "/dev/null"
|
||||
# define SM_IS_DIR_DELIM(c) ((c) == '/')
|
||||
# define SM_FIRST_DIR_DELIM(s) strchr(s, '/')
|
||||
# define SM_LAST_DIR_DELIM(s) strrchr(s, '/')
|
||||
|
||||
/* Warning: this must be accessible as array */
|
||||
# define SM_IS_DIR_START(s) ((s)[0] == '/')
|
||||
|
||||
# define sm_path_isdevnull(path) (strcmp(path, "/dev/null") == 0)
|
||||
|
||||
#endif /* ! SM_PATH_H */
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: rpool.h,v 1.15 2001/09/04 22:41:55 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm resource pools
|
||||
** See libsm/rpool.html for documentation.
|
||||
*/
|
||||
|
||||
#ifndef SM_RPOOL_H
|
||||
# define SM_RPOOL_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
# include <sm/heap.h>
|
||||
# include <sm/string.h>
|
||||
|
||||
/*
|
||||
** Each memory pool object consists of an SM_POOLLINK_T,
|
||||
** followed by a platform specific amount of padding,
|
||||
** followed by 'poolsize' bytes of pool data,
|
||||
** where 'poolsize' is the value of rpool->sm_poolsize at the time
|
||||
** the pool is allocated.
|
||||
*/
|
||||
|
||||
typedef struct sm_poollink SM_POOLLINK_T;
|
||||
struct sm_poollink
|
||||
{
|
||||
SM_POOLLINK_T *sm_pnext;
|
||||
};
|
||||
|
||||
typedef void (*SM_RPOOL_RFREE_T) __P((void *_rcontext));
|
||||
|
||||
typedef SM_RPOOL_RFREE_T *SM_RPOOL_ATTACH_T;
|
||||
|
||||
typedef struct sm_resource SM_RESOURCE_T;
|
||||
struct sm_resource
|
||||
{
|
||||
/*
|
||||
** Function for freeing this resource. It may be NULL,
|
||||
** meaning that this resource has already been freed.
|
||||
*/
|
||||
|
||||
SM_RPOOL_RFREE_T sm_rfree;
|
||||
void *sm_rcontext; /* resource data */
|
||||
};
|
||||
|
||||
# define SM_RLIST_MAX 511
|
||||
|
||||
typedef struct sm_rlist SM_RLIST_T;
|
||||
struct sm_rlist
|
||||
{
|
||||
SM_RESOURCE_T sm_rvec[SM_RLIST_MAX];
|
||||
SM_RLIST_T *sm_rnext;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Points to SmRpoolMagic, or is NULL if rpool is freed. */
|
||||
const char *sm_magic;
|
||||
|
||||
/*
|
||||
** If this rpool object has no parent, then sm_parentlink
|
||||
** is NULL. Otherwise, we set *sm_parentlink = NULL
|
||||
** when this rpool is freed, so that it isn't freed a
|
||||
** second time when the parent is freed.
|
||||
*/
|
||||
|
||||
SM_RPOOL_RFREE_T *sm_parentlink;
|
||||
|
||||
/*
|
||||
** Memory pools
|
||||
*/
|
||||
|
||||
/* Size of the next pool to be allocated, not including the header. */
|
||||
size_t sm_poolsize;
|
||||
|
||||
/*
|
||||
** If an sm_rpool_malloc_x request is too big to fit
|
||||
** in the current pool, and the request size > bigobjectsize,
|
||||
** then the object will be given its own malloc'ed block.
|
||||
** sm_bigobjectsize <= sm_poolsize. The maximum wasted space
|
||||
** at the end of a pool is maxpooledobjectsize - 1.
|
||||
*/
|
||||
|
||||
size_t sm_bigobjectsize;
|
||||
|
||||
/* Points to next free byte in the current pool. */
|
||||
char *sm_poolptr;
|
||||
|
||||
/*
|
||||
** Number of bytes available in the current pool.
|
||||
** Initially 0. Set to 0 by sm_rpool_free.
|
||||
*/
|
||||
|
||||
size_t sm_poolavail;
|
||||
|
||||
/* Linked list of memory pools. Initially NULL. */
|
||||
SM_POOLLINK_T *sm_pools;
|
||||
|
||||
/*
|
||||
** Resource lists
|
||||
*/
|
||||
|
||||
SM_RESOURCE_T *sm_rptr; /* Points to next free resource slot. */
|
||||
|
||||
/*
|
||||
** Number of available resource slots in current list.
|
||||
** Initially 0. Set to 0 by sm_rpool_free.
|
||||
*/
|
||||
|
||||
size_t sm_ravail;
|
||||
|
||||
/* Linked list of resource lists. Initially NULL. */
|
||||
SM_RLIST_T *sm_rlists;
|
||||
|
||||
#if _FFR_PERF_RPOOL
|
||||
int sm_nbigblocks;
|
||||
int sm_npools;
|
||||
#endif /* _FFR_PERF_RPOOL */
|
||||
|
||||
} SM_RPOOL_T;
|
||||
|
||||
extern SM_RPOOL_T *
|
||||
sm_rpool_new_x __P((
|
||||
SM_RPOOL_T *_parent));
|
||||
|
||||
extern void
|
||||
sm_rpool_free __P((
|
||||
SM_RPOOL_T *_rpool));
|
||||
|
||||
# if SM_HEAP_CHECK
|
||||
extern void *
|
||||
sm_rpool_malloc_tagged_x __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
size_t _size,
|
||||
char *_file,
|
||||
int _line,
|
||||
int _group));
|
||||
# define sm_rpool_malloc_x(rpool, size) \
|
||||
sm_rpool_malloc_tagged_x(rpool, size, __FILE__, __LINE__, SmHeapGroup)
|
||||
extern void *
|
||||
sm_rpool_malloc_tagged __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
size_t _size,
|
||||
char *_file,
|
||||
int _line,
|
||||
int _group));
|
||||
# define sm_rpool_malloc(rpool, size) \
|
||||
sm_rpool_malloc_tagged(rpool, size, __FILE__, __LINE__, SmHeapGroup)
|
||||
# else /* SM_HEAP_CHECK */
|
||||
extern void *
|
||||
sm_rpool_malloc_x __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
size_t _size));
|
||||
extern void *
|
||||
sm_rpool_malloc __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
size_t _size));
|
||||
# endif /* SM_HEAP_CHECK */
|
||||
|
||||
# define sm_rpool_strdup_x(rpool, str) \
|
||||
strcpy(sm_rpool_malloc_x(rpool, strlen(str) + 1), str)
|
||||
|
||||
extern SM_RPOOL_ATTACH_T
|
||||
sm_rpool_attach_x __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
SM_RPOOL_RFREE_T _rfree,
|
||||
void *_rcontext));
|
||||
|
||||
# define sm_rpool_detach(a) ((void)(*(a) = NULL))
|
||||
|
||||
extern void
|
||||
sm_rpool_setsizes __P((
|
||||
SM_RPOOL_T *_rpool,
|
||||
size_t _poolsize,
|
||||
size_t _bigobjectsize));
|
||||
|
||||
#endif /* ! SM_RPOOL_H */
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: setjmp.h,v 1.3 2001/03/08 03:23:08 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_SETJMP_H
|
||||
# define SM_SETJMP_H
|
||||
|
||||
# include <sm/config.h>
|
||||
# include <setjmp.h>
|
||||
|
||||
/*
|
||||
** sm_setjmp_sig is a setjmp that saves the signal mask.
|
||||
** sm_setjmp_nosig is a setjmp that does *not* save the signal mask.
|
||||
** SM_JMPBUF_T is used with both of the above macros.
|
||||
**
|
||||
** On most systems, these can be implemented using sigsetjmp.
|
||||
** Some old BSD systems do not have sigsetjmp, but they do have
|
||||
** setjmp and _setjmp, which are just as good.
|
||||
*/
|
||||
|
||||
# if SM_CONF_SIGSETJMP
|
||||
|
||||
typedef sigjmp_buf SM_JMPBUF_T;
|
||||
# define sm_setjmp_sig(buf) sigsetjmp(buf, 1)
|
||||
# define sm_setjmp_nosig(buf) sigsetjmp(buf, 0)
|
||||
# define sm_longjmp_sig(buf, val) siglongjmp(buf, val)
|
||||
# define sm_longjmp_nosig(buf, val) siglongjmp(buf, val)
|
||||
|
||||
# else /* SM_CONF_SIGSETJMP */
|
||||
|
||||
typedef jmp_buf SM_JMPBUF_T;
|
||||
# define sm_setjmp_sig(buf) setjmp(buf)
|
||||
# define sm_longjmp_sig(buf, val) longjmp(buf, val)
|
||||
# define sm_setjmp_nosig(buf) _setjmp(buf)
|
||||
# define sm_longjmp_nosig(buf, val) _longjmp(buf, val)
|
||||
|
||||
# endif /* SM_CONF_SIGSETJMP */
|
||||
|
||||
#endif /* ! SM_SETJMP_H */
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2002 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.
|
||||
*
|
||||
* Id: shm.h,v 1.8 2002/04/10 23:11:35 ca Exp
|
||||
*/
|
||||
|
||||
#ifndef SM_SHM_H
|
||||
# define SM_SHM_H
|
||||
|
||||
# if SM_CONF_SHM
|
||||
# include <sys/types.h>
|
||||
# include <sys/ipc.h>
|
||||
# include <sys/shm.h>
|
||||
|
||||
/* # include "def.h" */
|
||||
|
||||
/* key for shared memory */
|
||||
# define SM_SHM_KEY ((key_t) 42)
|
||||
|
||||
/* return value for failed shmget() */
|
||||
# define SM_SHM_NULL ((void *) -1)
|
||||
# define SM_SHM_NO_ID (-2)
|
||||
|
||||
extern void *sm_shmstart __P((key_t, int , int , int *, bool));
|
||||
extern int sm_shmstop __P((void *, int, bool));
|
||||
|
||||
/* for those braindead systems... (e.g., SunOS 4) */
|
||||
# ifndef SHM_R
|
||||
# define SHM_R 0400
|
||||
# endif /* SHM_R */
|
||||
# ifndef SHM_W
|
||||
# define SHM_W 0200
|
||||
# endif /* SHM_W */
|
||||
|
||||
# endif /* SM_CONF_SHM */
|
||||
#endif /* ! SM_SHM_H */
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. 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.
|
||||
*
|
||||
* Id: signal.h,v 1.16 2001/07/20 19:48:21 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** SIGNAL.H -- libsm (and sendmail) signal facilities
|
||||
** Extracted from sendmail/conf.h and focusing
|
||||
** on signal configuration.
|
||||
*/
|
||||
|
||||
#ifndef SM_SIGNAL_H
|
||||
#define SM_SIGNAL_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <sm/cdefs.h>
|
||||
#include <sm/conf.h>
|
||||
|
||||
/*
|
||||
** Critical signal sections
|
||||
*/
|
||||
|
||||
#define PEND_SIGHUP 0x0001
|
||||
#define PEND_SIGINT 0x0002
|
||||
#define PEND_SIGTERM 0x0004
|
||||
#define PEND_SIGUSR1 0x0008
|
||||
|
||||
#define ENTER_CRITICAL() InCriticalSection++
|
||||
|
||||
#define LEAVE_CRITICAL() \
|
||||
do \
|
||||
{ \
|
||||
if (InCriticalSection > 0) \
|
||||
InCriticalSection--; \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_CRITICAL(sig) \
|
||||
do \
|
||||
{ \
|
||||
if (InCriticalSection > 0 && (sig) != 0) \
|
||||
{ \
|
||||
pend_signal((sig)); \
|
||||
return SIGFUNC_RETURN; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* variables */
|
||||
extern unsigned int volatile InCriticalSection; /* >0 if in critical section */
|
||||
extern int volatile PendingSignal; /* pending signal to resend */
|
||||
|
||||
/* functions */
|
||||
extern void pend_signal __P((int));
|
||||
|
||||
/* reset signal in case System V semantics */
|
||||
#ifdef SYS5SIGNALS
|
||||
# define FIX_SYSV_SIGNAL(sig, handler) \
|
||||
{ \
|
||||
if ((sig) != 0) \
|
||||
(void) sm_signal((sig), (handler)); \
|
||||
}
|
||||
#else /* SYS5SIGNALS */
|
||||
# define FIX_SYSV_SIGNAL(sig, handler) { /* EMPTY */ }
|
||||
#endif /* SYS5SIGNALS */
|
||||
|
||||
extern void sm_allsignals __P((bool));
|
||||
extern int sm_blocksignal __P((int));
|
||||
extern int sm_releasesignal __P((int));
|
||||
extern sigfunc_t sm_signal __P((int, sigfunc_t));
|
||||
extern SIGFUNC_DECL sm_signal_noop __P((int));
|
||||
#endif /* SM_SIGNAL_H */
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: string.h,v 1.36 2001/06/17 21:31:11 ca Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm string manipulation
|
||||
*/
|
||||
|
||||
#ifndef SM_STRING_H
|
||||
# define SM_STRING_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
# include <sm/varargs.h>
|
||||
# include <string.h> /* strlc{py,at}, strerror */
|
||||
|
||||
/* return number of bytes left in a buffer */
|
||||
#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
|
||||
|
||||
extern int PRINTFLIKE(3, 4)
|
||||
sm_snprintf __P((
|
||||
char *,
|
||||
size_t,
|
||||
const char *,
|
||||
...));
|
||||
|
||||
extern bool
|
||||
sm_match __P((
|
||||
const char *_str,
|
||||
const char *_pattern));
|
||||
|
||||
extern char *
|
||||
sm_strdup __P((
|
||||
char *));
|
||||
|
||||
extern char *
|
||||
sm_strndup_x __P((
|
||||
const char *_str,
|
||||
size_t _len));
|
||||
|
||||
/* for "normal" data (free'd before end of process) */
|
||||
# define sm_strdup_x(str) strcpy(sm_malloc_x(strlen(str) + 1), str)
|
||||
|
||||
/* for data that is supposed to be persistent. */
|
||||
# define sm_pstrdup_x(str) strcpy(sm_pmalloc_x(strlen(str) + 1), str)
|
||||
|
||||
# define sm_strdup_tagged_x(str, file, line, group) \
|
||||
strcpy(sm_malloc_tagged_x(strlen(str) + 1, file, line, group), str)
|
||||
|
||||
extern char *
|
||||
sm_stringf_x __P((
|
||||
const char *_fmt,
|
||||
...));
|
||||
|
||||
extern char *
|
||||
sm_vstringf_x __P((
|
||||
const char *_fmt,
|
||||
va_list _ap));
|
||||
|
||||
extern size_t
|
||||
sm_strlcpy __P((
|
||||
char *_dst,
|
||||
const char *_src,
|
||||
ssize_t _len));
|
||||
|
||||
extern size_t
|
||||
sm_strlcat __P((
|
||||
char *_dst,
|
||||
const char *_src,
|
||||
ssize_t _len));
|
||||
|
||||
extern size_t
|
||||
sm_strlcat2 __P((
|
||||
char *,
|
||||
const char *,
|
||||
const char *,
|
||||
ssize_t));
|
||||
|
||||
extern size_t
|
||||
#ifdef __STDC__
|
||||
sm_strlcpyn(char *dst, ssize_t len, int n, ...);
|
||||
#else /* __STDC__ */
|
||||
sm_strlcpyn __P((char *,
|
||||
ssize_t,
|
||||
int,
|
||||
va_dcl));
|
||||
#endif /* __STDC__ */
|
||||
|
||||
# if !HASSTRERROR
|
||||
extern char *
|
||||
strerror __P((
|
||||
int _errno));
|
||||
# endif /* !HASSTRERROR */
|
||||
|
||||
extern int
|
||||
sm_strrevcmp __P((
|
||||
const char *,
|
||||
const char *));
|
||||
|
||||
extern int
|
||||
sm_strrevcasecmp __P((
|
||||
const char *,
|
||||
const char *));
|
||||
|
||||
extern int
|
||||
sm_strcasecmp __P((
|
||||
const char *,
|
||||
const char *));
|
||||
|
||||
extern int
|
||||
sm_strncasecmp __P((
|
||||
const char *,
|
||||
const char *,
|
||||
size_t));
|
||||
|
||||
extern LONGLONG_T
|
||||
sm_strtoll __P((
|
||||
const char *,
|
||||
char**, int));
|
||||
|
||||
extern ULONGLONG_T
|
||||
sm_strtoull __P((
|
||||
const char *,
|
||||
char**, int));
|
||||
|
||||
extern void
|
||||
stripquotes __P((char *));
|
||||
|
||||
#endif /* SM_STRING_H */
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1987, 1993
|
||||
* The Regents of the University of California. 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.
|
||||
*
|
||||
* Id: sysexits.h,v 1.5 2001/03/10 17:30:01 ca Exp
|
||||
* @(#)sysexits.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef SM_SYSEXITS_H
|
||||
# define SM_SYSEXITS_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
|
||||
/*
|
||||
** SYSEXITS.H -- Exit status codes for system programs.
|
||||
**
|
||||
** This include file attempts to categorize possible error
|
||||
** exit statuses for system programs, notably delivermail
|
||||
** and the Berkeley network.
|
||||
**
|
||||
** Error numbers begin at EX__BASE to reduce the possibility of
|
||||
** clashing with other exit statuses that random programs may
|
||||
** already return. The meaning of the codes is approximately
|
||||
** as follows:
|
||||
**
|
||||
** EX_USAGE -- The command was used incorrectly, e.g., with
|
||||
** the wrong number of arguments, a bad flag, a bad
|
||||
** syntax in a parameter, or whatever.
|
||||
** EX_DATAERR -- The input data was incorrect in some way.
|
||||
** This should only be used for user's data & not
|
||||
** system files.
|
||||
** EX_NOINPUT -- An input file (not a system file) did not
|
||||
** exist or was not readable. This could also include
|
||||
** errors like "No message" to a mailer (if it cared
|
||||
** to catch it).
|
||||
** EX_NOUSER -- The user specified did not exist. This might
|
||||
** be used for mail addresses or remote logins.
|
||||
** EX_NOHOST -- The host specified did not exist. This is used
|
||||
** in mail addresses or network requests.
|
||||
** EX_UNAVAILABLE -- A service is unavailable. This can occur
|
||||
** if a support program or file does not exist. This
|
||||
** can also be used as a catchall message when something
|
||||
** you wanted to do doesn't work, but you don't know
|
||||
** why.
|
||||
** EX_SOFTWARE -- An internal software error has been detected.
|
||||
** This should be limited to non-operating system related
|
||||
** errors as possible.
|
||||
** EX_OSERR -- An operating system error has been detected.
|
||||
** This is intended to be used for such things as "cannot
|
||||
** fork", "cannot create pipe", or the like. It includes
|
||||
** things like getuid returning a user that does not
|
||||
** exist in the passwd file.
|
||||
** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
|
||||
** etc.) does not exist, cannot be opened, or has some
|
||||
** sort of error (e.g., syntax error).
|
||||
** EX_CANTCREAT -- A (user specified) output file cannot be
|
||||
** created.
|
||||
** EX_IOERR -- An error occurred while doing I/O on some file.
|
||||
** EX_TEMPFAIL -- temporary failure, indicating something that
|
||||
** is not really an error. In sendmail, this means
|
||||
** that a mailer (e.g.) could not create a connection,
|
||||
** and the request should be reattempted later.
|
||||
** EX_PROTOCOL -- the remote system returned something that
|
||||
** was "not possible" during a protocol exchange.
|
||||
** EX_NOPERM -- You did not have sufficient permission to
|
||||
** perform the operation. This is not intended for
|
||||
** file system problems, which should use NOINPUT or
|
||||
** CANTCREAT, but rather for higher level permissions.
|
||||
*/
|
||||
|
||||
# if SM_CONF_SYSEXITS_H
|
||||
# include <sysexits.h>
|
||||
# else /* SM_CONF_SYSEXITS_H */
|
||||
|
||||
# define EX_OK 0 /* successful termination */
|
||||
|
||||
# define EX__BASE 64 /* base value for error messages */
|
||||
|
||||
# define EX_USAGE 64 /* command line usage error */
|
||||
# define EX_DATAERR 65 /* data format error */
|
||||
# define EX_NOINPUT 66 /* cannot open input */
|
||||
# define EX_NOUSER 67 /* addressee unknown */
|
||||
# define EX_NOHOST 68 /* host name unknown */
|
||||
# define EX_UNAVAILABLE 69 /* service unavailable */
|
||||
# define EX_SOFTWARE 70 /* internal software error */
|
||||
# define EX_OSERR 71 /* system error (e.g., can't fork) */
|
||||
# define EX_OSFILE 72 /* critical OS file missing */
|
||||
# define EX_CANTCREAT 73 /* can't create (user) output file */
|
||||
# define EX_IOERR 74 /* input/output error */
|
||||
# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
|
||||
# define EX_PROTOCOL 76 /* remote error in protocol */
|
||||
# define EX_NOPERM 77 /* permission denied */
|
||||
# define EX_CONFIG 78 /* configuration error */
|
||||
|
||||
# define EX__MAX 78 /* maximum listed value */
|
||||
|
||||
# endif /* SM_CONF_SYSEXITS_H */
|
||||
|
||||
extern char *sm_strexit __P((int));
|
||||
extern char *sm_sysexitmsg __P((int));
|
||||
extern char *sm_sysexmsg __P((int));
|
||||
|
||||
#endif /* ! SM_SYSEXITS_H */
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: test.h,v 1.6 2001/04/03 01:53:01 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** Abstractions for writing a libsm test program.
|
||||
*/
|
||||
|
||||
#ifndef SM_TEST_H
|
||||
# define SM_TEST_H
|
||||
|
||||
# include <sm/gen.h>
|
||||
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define SM_TEST(cond) sm_test(cond, #cond, __FILE__, __LINE__)
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define SM_TEST(cond) sm_test(cond, "cond", __FILE__, __LINE__)
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
|
||||
extern int SmTestIndex;
|
||||
extern int SmTestNumErrors;
|
||||
|
||||
extern void
|
||||
sm_test_begin __P((
|
||||
int _argc,
|
||||
char **_argv,
|
||||
char *_testname));
|
||||
|
||||
extern bool
|
||||
sm_test __P((
|
||||
bool _success,
|
||||
char *_expr,
|
||||
char *_filename,
|
||||
int _lineno));
|
||||
|
||||
extern int
|
||||
sm_test_end __P((void));
|
||||
|
||||
#endif /* ! SM_TEST_H */
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: types.h,v 1.13 2001/04/03 01:53:01 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header file defines standard integral types.
|
||||
** - It includes <sys/types.h>, and fixes portability problems that
|
||||
** exist on older Unix platforms.
|
||||
** - It defines LONGLONG_T and ULONGLONG_T, which are portable locutions
|
||||
** for 'long long' and 'unsigned long long'.
|
||||
*/
|
||||
|
||||
#ifndef SM_TYPES_H
|
||||
# define SM_TYPES_H
|
||||
|
||||
# include <sm/config.h>
|
||||
|
||||
/*
|
||||
** On BSD 4.2 systems, <sys/types.h> was not idempotent.
|
||||
** This problem is circumvented by replacing all occurrences
|
||||
** of <sys/types.h> with <sm/types.h>, which is idempotent.
|
||||
*/
|
||||
|
||||
# include <sys/types.h>
|
||||
|
||||
/*
|
||||
** On some old Unix platforms, some of the standard types are missing.
|
||||
** We fix that here.
|
||||
*/
|
||||
|
||||
# if !SM_CONF_UID_GID
|
||||
# define uid_t int
|
||||
# define gid_t int
|
||||
# endif /* !SM_CONF_UID_GID */
|
||||
|
||||
# if !SM_CONF_SSIZE_T
|
||||
# define ssize_t int
|
||||
# endif /* !SM_CONF_SSIZE_T */
|
||||
|
||||
/*
|
||||
** Define LONGLONG_T and ULONGLONG_T, which are portable locutions
|
||||
** for 'long long' and 'unsigned long long' from the C 1999 standard.
|
||||
*/
|
||||
|
||||
# if SM_CONF_LONGLONG
|
||||
typedef long long LONGLONG_T;
|
||||
typedef unsigned long long ULONGLONG_T;
|
||||
# else /* SM_CONF_LONGLONG */
|
||||
# if SM_CONF_QUAD_T
|
||||
typedef quad_t LONGLONG_T;
|
||||
typedef u_quad_t ULONGLONG_T;
|
||||
# else /* SM_CONF_QUAD_T */
|
||||
typedef long LONGLONG_T;
|
||||
typedef unsigned long ULONGLONG_T;
|
||||
# endif /* SM_CONF_QUAD_T */
|
||||
# endif /* SM_CONF_LONGLONG */
|
||||
|
||||
#endif /* ! SM_TYPES_H */
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: varargs.h,v 1.7.2.1 2002/07/29 21:43:20 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** libsm variable argument lists
|
||||
*/
|
||||
|
||||
#ifndef SM_VARARGS_H
|
||||
# define SM_VARARGS_H
|
||||
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define SM_VA_STD 1
|
||||
# include <stdarg.h>
|
||||
# define SM_VA_START(ap, f) va_start(ap, f)
|
||||
# else /* defined(__STDC__) || defined(__cplusplus) */
|
||||
# define SM_VA_STD 0
|
||||
# include <varargs.h>
|
||||
# define SM_VA_START(ap, f) va_start(ap)
|
||||
# endif /* defined(__STDC__) || defined(__cplusplus) */
|
||||
|
||||
# if defined(va_copy)
|
||||
# define SM_VA_COPY(dst, src) va_copy((dst), (src))
|
||||
# elif defined(__va_copy)
|
||||
# define SM_VA_COPY(dst, src) __va_copy((dst), (src))
|
||||
# else
|
||||
# define SM_VA_COPY(dst, src) memcpy(&(dst), &(src), sizeof((dst)))
|
||||
# endif
|
||||
|
||||
/*
|
||||
** The following macros are useless, but are provided for symmetry.
|
||||
*/
|
||||
|
||||
# define SM_VA_LOCAL_DECL va_list ap;
|
||||
# define SM_VA_ARG(ap, type) va_arg(ap, type)
|
||||
# define SM_VA_END(ap) va_end(ap)
|
||||
|
||||
#endif /* ! SM_VARARGS_H */
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2001 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.
|
||||
*
|
||||
* Id: xtrap.h,v 1.7 2001/04/03 01:53:01 gshapiro Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
** scaffolding for testing exception handler code
|
||||
*/
|
||||
|
||||
#ifndef SM_XTRAP_H
|
||||
# define SM_XTRAP_H
|
||||
|
||||
# include <sm/debug.h>
|
||||
# include <sm/exc.h>
|
||||
|
||||
extern SM_ATOMIC_UINT_T SmXtrapCount;
|
||||
extern SM_DEBUG_T SmXtrapDebug;
|
||||
extern SM_DEBUG_T SmXtrapReport;
|
||||
|
||||
# if SM_DEBUG_CHECK
|
||||
# define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug))
|
||||
# else /* SM_DEBUG_CHECK */
|
||||
# define sm_xtrap_check() (0)
|
||||
# endif /* SM_DEBUG_CHECK */
|
||||
|
||||
# define sm_xtrap_raise_x(exc) \
|
||||
if (sm_xtrap_check()) \
|
||||
{ \
|
||||
sm_exc_raise_x(exc); \
|
||||
} else
|
||||
|
||||
#endif /* ! SM_XTRAP_H */
|
|
@ -1,5 +1,8 @@
|
|||
dnl Id: Makefile.m4,v 8.30.2.1 2002/06/21 21:58:28 ca Exp
|
||||
include(confBUILDTOOLSDIR`/M4/switch.m4')
|
||||
|
||||
dnl only required for compilation of EXTRAS
|
||||
define(`confREQUIRE_LIBSM', `true')
|
||||
define(`confMT', `true')
|
||||
|
||||
# sendmail dir
|
||||
|
@ -8,17 +11,30 @@ PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
|
|||
|
||||
bldPRODUCT_START(`library', `libmilter')
|
||||
define(`bldINSTALLABLE', `true')
|
||||
define(`bldSOURCES', `main.c engine.c listener.c handler.c comm.c smfi.c signal.c sm_gethost.c ')
|
||||
bldPUSH_SMLIB(`smutil')
|
||||
define(`LIBMILTER_EXTRAS', `errstring.c strl.c')
|
||||
APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf')
|
||||
define(`bldSOURCES', `main.c engine.c listener.c handler.c comm.c smfi.c signal.c sm_gethost.c LIBMILTER_EXTRAS ')
|
||||
define(`confBEFORE', `LIBMILTER_EXTRAS')
|
||||
bldPUSH_INSTALL_TARGET(`install-mfapi')
|
||||
bldPRODUCT_END
|
||||
APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
|
||||
|
||||
PUSHDIVERT(3)
|
||||
errstring.c:
|
||||
${LN} ${LNOPTS} ${SRCDIR}/libsm/errstring.c .
|
||||
|
||||
strl.c:
|
||||
${LN} ${LNOPTS} ${SRCDIR}/libsm/strl.c .
|
||||
POPDIVERT
|
||||
|
||||
|
||||
divert(bldTARGETS_SECTION)
|
||||
# Install the API header file
|
||||
# Install the API header files
|
||||
MFAPI= ${SRCDIR}/inc`'lude/libmilter/mfapi.h
|
||||
MFDEF= ${SRCDIR}/inc`'lude/libmilter/mfdef.h
|
||||
install-mfapi: ${MFAPI}
|
||||
${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}
|
||||
if [ ! -d ${DESTDIR}${INCLUDEDIR}/libmilter ]; then mkdir -p ${DESTDIR}${INCLUDEDIR}/libmilter; else :; fi
|
||||
${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
|
||||
${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
|
||||
divert(0)
|
||||
|
||||
bldFINISH
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
<html>
|
||||
<head><title>Milter API</title></head>
|
||||
<body>
|
||||
<h1>Milter API</h1>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li>Library Control Functions
|
||||
<li>Data Access Functions
|
||||
<li>Message Modification Functions
|
||||
<li>Callbacks
|
||||
</ul>
|
||||
|
||||
<h2>Library Control Functions</h2>
|
||||
|
||||
Before handing control to libmilter (by calling <a
|
||||
href="smfi_main.html">smfi_main</a>), a filter may call the following
|
||||
functions to set libmilter parameters. In particular, the filter must
|
||||
call <a href="smfi_register.html">smfi_register</a> to register its
|
||||
callbacks. Each function will return either MI_SUCCESS or MI_FAILURE to
|
||||
indicate the status of the operation.
|
||||
<p>
|
||||
None of these functions communicate with the MTA. All alter the
|
||||
library's state, some of which is communicated to the MTA inside <a
|
||||
href="smfi_main.html">smfi_main</a>.
|
||||
<p>
|
||||
<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th></tr>
|
||||
|
||||
<tr><td><a href="smfi_register.html">smfi_register</a></td><td>Register a filter.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_setconn.html">smfi_setconn</a></td><td>Specify socket to use.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_settimeout.html">smfi_settimeout</a></td><td>Set timeout.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_main.html">smfi_main</a></td><td>Hand control to libmilter.</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>Data Access Functions</h2>
|
||||
|
||||
The following functions may be called from within the filter-defined callbacks
|
||||
to access information about the current connection or message.
|
||||
<p>
|
||||
<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th></tr>
|
||||
<tr><td><a href="smfi_getsymval.html">smfi_getsymval</a></td><td>Return the value
|
||||
of a symbol.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_getpriv.html">smfi_getpriv</a></td><td>Get the private data
|
||||
pointer.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_setpriv.html">smfi_setpriv</a></td><td>Set the private data
|
||||
pointer.</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_setreply.html">smfi_setreply</a></td><td>Set the specific
|
||||
reply code to be used.</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>Message Modification Functions</h2>
|
||||
|
||||
The following functions change a message's contents and attributes.
|
||||
<b>They may only be called in <a href="xxfi_eom.html">xxfi_eom</a></b>.
|
||||
All of these functions may invoke additional communication with the MTA.
|
||||
They will return either MI_SUCCESS or MI_FAILURE to indicate the status of
|
||||
the operation.
|
||||
|
||||
<p>
|
||||
A filter must have set the appropriate flag (listed below) in the
|
||||
description passed to <a href="smfi_register.html">smfi_register</a>
|
||||
to call any message modification function. Failure to do so will
|
||||
cause the MTA to treat a call to the function as a failure of the
|
||||
filter, terminating its connection.
|
||||
|
||||
<p>
|
||||
Note that the status returned indicates only whether or not the
|
||||
filter's message was successfully sent to the MTA, not whether or not
|
||||
the MTA performed the requested operation. For example, <a
|
||||
href="smfi_addheader.html">smfi_addheader</a>, when called with an
|
||||
illegal header name, will return MI_SUCCESS even though the MTA may
|
||||
later refuse to add the illegal header.
|
||||
<p>
|
||||
<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th><th>SMFIF_* flag</tr>
|
||||
<tr><td><a href="smfi_addheader.html">smfi_addheader</a></td><td>Add a header to
|
||||
the message.</td><td>SMFIF_ADDHDRS</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_chgheader.html">smfi_chgheader</a></td><td>Change or delete a header.</td><td>SMFIF_CHGHDRS</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_addrcpt.html">smfi_addrcpt</a></td><td>Add a recipient to
|
||||
the envelope.</td><td>SMFIF_ADDRCPT</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_delrcpt.html">smfi_delrcpt</a></td><td>Delete a recipient
|
||||
from the envelope.</td><td>SMFIF_DELRCPT</td></tr>
|
||||
|
||||
<tr><td><a href="smfi_replacebody.html">smfi_replacebody</a></td><td>Replace the
|
||||
body of the message.</td><td>SMFIF_CHGBODY</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>Callbacks</h2>
|
||||
|
||||
The filter should implement one or more of the following callbacks,
|
||||
which are registered via <a href="smfi_register.html">smfi_register</a>:
|
||||
<p>
|
||||
<table border="1" cellspacing=0 cellpadding=2><tr bgcolor="#dddddd"><th>Function</th><th>Description</th></tr>
|
||||
|
||||
<tr><td><a href="xxfi_connect.html">xxfi_connect</a></td><td>connection info</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_helo.html">xxfi_helo</a></td><td>SMTP HELO/EHLO command</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_envfrom.html">xxfi_envfrom</a></td><td>envelope sender</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_envrcpt.html">xxfi_envrcpt</a></td><td>envelope recipient</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_header.html">xxfi_header</a></td><td>header</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_eoh.html">xxfi_eoh</a></td><td>end of header</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_body.html">xxfi_body</a></td><td>body block</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_eom.html">xxfi_eom</a></td><td>end of message</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_abort.html">xxfi_abort</a></td><td>message aborted</td></tr>
|
||||
|
||||
<tr><td><a href="xxfi_close.html">xxfi_close</a></td><td>connection cleanup</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The above callbacks should all return one of the following return values,
|
||||
having the indicated meanings. Any return other than one of the below
|
||||
values constitutes an error, and will cause sendmail to terminate its
|
||||
connection to the offending filter.
|
||||
|
||||
<p><a name="conn-spec"></a>Milter distinguishes between recipient-,
|
||||
message-, and connection-oriented routines. Recipient-oriented
|
||||
callbacks may affect the processing of a single message recipient;
|
||||
message-oriented callbacks, a single message; connection-oriented
|
||||
callbacks, an entire connection (during which multiple messages may be
|
||||
delivered to multiple sets of recipients).
|
||||
<a href="xxfi_envrcpt.html">xxfi_envrcpt</a> is recipient-oriented.
|
||||
<a href="xxfi_connect.html">xxfi_connect</a>,
|
||||
<a href="xxfi_helo.html">xxfi_helo</a> and
|
||||
<a href="xxfi_close.html">xxfi_close</a> are connection-oriented. All
|
||||
other callbacks are message-oriented.
|
||||
|
||||
<p>
|
||||
<table border="1" cellspacing=0 cellpadding=2>
|
||||
<tr bgcolor="#dddddd"><th>Return value</th><th>Description</th></tr>
|
||||
<tr valign="top">
|
||||
<td>SMFIS_CONTINUE</td>
|
||||
<td>Continue processing the current connection, message, or recipient.
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>SMFIS_REJECT</td>
|
||||
<td>For a connection-oriented routine, reject this connection; call <a href="xxfi_close.html">xxfi_close</a>.<br>
|
||||
For a message-oriented routine (except
|
||||
<a href="xxfi_eom.html">xxfi_eom</a> or
|
||||
<a href="xxfi_abort.html">xxfi_abort</a>), reject this message.<br>
|
||||
For a recipient-oriented routine, reject the current recipient (but continue processing the current message).
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>SMFIS_DISCARD</td>
|
||||
<td>For a message- or recipient-oriented routine, accept this message, but silently discard it.<br>
|
||||
SMFIS_DISCARD should not be returned by a connection-oriented routine.
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>SMFIS_ACCEPT</td>
|
||||
<td>For a connection-oriented routine, accept this connection without further filter processing; call <a href="xxfi_close.html">xxfi_close</a>.<br>
|
||||
For a message- or recipient-oriented routine, accept this message without further filtering.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>SMFIS_TEMPFAIL</td>
|
||||
<td>Return a temporary failure, i.e., the corresponding SMTP command will return an appropriate 4xx status code.
|
||||
For a message-oriented routine (except <a href="xxfi_envfrom.html">xxfi_envfrom</a>), fail for this message. <br>
|
||||
For a connection-oriented routine, fail for this connection; call <a href="xxfi_close.html">xxfi_close</a>. <br>
|
||||
For a recipient-oriented routine, only fail for the current recipient; continue message processing.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr size="1">
|
||||
<font size="-1">
|
||||
Copyright (c) 2000 Sendmail, Inc. and its suppliers.
|
||||
All rights reserved.
|
||||
<br>
|
||||
By using this file, you agree to the terms and conditions set
|
||||
forth in the <a href="LICENSE.txt">LICENSE</a>.
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,144 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Architecture</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Architecture</h1>
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
<ul>
|
||||
<li>Design Goals
|
||||
<li>Implementing Filtering Policies
|
||||
<li>MTA - Filter Communication
|
||||
</ul>
|
||||
|
||||
<h2>Goals</h2>
|
||||
|
||||
The Sendmail Content Management API (Milter) provides an interface for
|
||||
third-party software to validate and modify messages as they pass
|
||||
through the mail transport system. Filters can process messages'
|
||||
connection (IP) information, envelope protocol elements, message
|
||||
headers, and/or message body contents, and modify a message's
|
||||
recipients, headers, and body. The MTA configuration file specifies
|
||||
which filters are to be applied, and in what order, allowing an
|
||||
administrator to combine multiple independently-developed filters.
|
||||
|
||||
<p>
|
||||
We expect to see both vendor-supplied, configurable mail filtering
|
||||
applications and a multiplicity of script-like filters designed by and
|
||||
for MTA administrators. A certain degree of coding sophistication and
|
||||
domain knowledge on the part of the filter provider is assumed. This
|
||||
allows filters to exercise fine-grained control at the SMTP level.
|
||||
However, as will be seen in the example, many filtering applications
|
||||
can be written with relatively little protocol knowledge.
|
||||
|
||||
<p>
|
||||
Given these expectations, the API is designed to achieve the following
|
||||
goals:
|
||||
|
||||
<OL>
|
||||
<LI>Safety/security.
|
||||
Filter processes should not need to run as root
|
||||
(of course, they can if required, but that is a local issue);
|
||||
this will simplify coding
|
||||
and limit the impact of security flaws in the filter program.
|
||||
<p>
|
||||
<LI>Reliability.
|
||||
Coding failures in a Milter process that cause that process
|
||||
to hang or core-dump
|
||||
should not stop mail delivery.
|
||||
Faced with such a failure,
|
||||
sendmail should use a default mechanism,
|
||||
either behaving as if the filter were not present
|
||||
or as if a required resource were unavailable.
|
||||
The latter failure mode will generally have sendmail return
|
||||
a 4xx SMTP code (although in later phases of the SMTP protocol
|
||||
it may cause the mail to be queued for later processing).
|
||||
<p>
|
||||
<LI>Simplicity.
|
||||
The API should make implementation of a new filter
|
||||
no more difficult than absolutely necessary.
|
||||
Subgoals include:
|
||||
<UL>
|
||||
<LI>Encourage good thread practice
|
||||
by defining thread-clean interfaces including local data hooks.
|
||||
<LI>Provide all interfaces required
|
||||
while avoiding unnecessary pedanticism.
|
||||
</UL>
|
||||
<p>
|
||||
<LI>Performance.
|
||||
Simple filters should not seriously impact overall MTA performance.
|
||||
</OL>
|
||||
|
||||
<h2>Implementing Filtering Policies</h2>
|
||||
|
||||
Milter is designed to allow a server administrator to combine
|
||||
third-party filters to implement a desired mail filtering policy. For
|
||||
example, if a site wished to scan incoming mail for viruses on several
|
||||
platforms, eliminate unsolicited commercial email, and append a mandated
|
||||
footer to selected incoming messages, the administrator could configure
|
||||
the MTA to filter messages first through a server based anti-virus
|
||||
engine, then via a large-scale spam-catching service, and finally
|
||||
append the desired footer if the message still met requisite criteria.
|
||||
Any of these filters could be added or changed independently.
|
||||
|
||||
<p>
|
||||
Thus the site administrator, not the filter writer, controls the
|
||||
overall mail filtering environment. In particular, he/she must decide
|
||||
which filters are run, in what order they are run, and how they
|
||||
communicate with the MTA. These parameters, as well as the
|
||||
actions to be taken if a filter becomes unavailable, are selectable
|
||||
during MTA configuration. <a href="installation.html">Further
|
||||
details</a> are available later in this document.
|
||||
|
||||
<h2>MTA - Filter communication</h2>
|
||||
|
||||
Filters run as separate processes, outside of the sendmail address
|
||||
space. The benefits of this are threefold:
|
||||
|
||||
<OL>
|
||||
<LI>The filter need not run with "root" permissions, thereby
|
||||
avoiding a large family of potential security problems.</LI>
|
||||
|
||||
<LI>Failures in a particular filter will not affect the MTA or
|
||||
other filters.</LI>
|
||||
|
||||
<LI>The filter can potentially have higher performance because of
|
||||
the parallelism inherent in multiple processes.</LI>
|
||||
</OL>
|
||||
|
||||
<p>
|
||||
Each filter may communicate with multiple MTAs at the same time over
|
||||
local or remote connections, using multiple threads of execution. <a
|
||||
href="#figure-1">Figure 1</a> illustrates a possible network of
|
||||
communication channels between a site's filters, its MTAs, and other
|
||||
MTAs on the network:
|
||||
</p>
|
||||
<div align="center">
|
||||
<a name="figure-1"><img src="figure1.jpg" ALT=""></A><br>
|
||||
<b>Figure 1: A set of MTA's interacting with a set of filters.</b>
|
||||
</div>
|
||||
<p>
|
||||
The Milter library (libmilter) implements the communication protocol.
|
||||
It accepts connections from various MTAs, passes the relevant data to
|
||||
the filter through callbacks, then makes appropriate responses based
|
||||
on return codes. A filter may also send data to the MTA as a result
|
||||
of library calls. <a href="#figure-2">Figure 2</a> shows a single
|
||||
filter process processing messages from two MTAs:
|
||||
</p>
|
||||
<div align="center">
|
||||
<img src="figure2.jpg" ALT=""><br>
|
||||
<b>Figure 2: A filter handling simultaneous requests from two MTA's.</b>
|
||||
</div>
|
||||
<hr size="1">
|
||||
<font size="-1">
|
||||
Copyright (c) 2000 Sendmail, Inc. and its suppliers.
|
||||
All rights reserved.
|
||||
<br>
|
||||
By using this file, you agree to the terms and conditions set
|
||||
forth in the <a href="LICENSE.txt">LICENSE</a>.
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,56 @@
|
|||
#FIG 3.2
|
||||
Landscape
|
||||
Center
|
||||
Inches
|
||||
Letter
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
6 975 225 5025 3375
|
||||
6 1500 1275 2700 2025
|
||||
2 2 0 2 1 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
1650 1425 2550 1425 2550 1875 1650 1875 1650 1425
|
||||
4 0 1 50 0 0 20 0.0000 4 195 645 1800 1725 MTA\001
|
||||
-6
|
||||
6 1950 2625 3150 3375
|
||||
2 2 0 2 4 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
2100 2775 3000 2775 3000 3225 2100 3225 2100 2775
|
||||
4 0 4 50 0 0 20 0.0000 4 195 645 2250 3075 MTA\001
|
||||
-6
|
||||
6 1050 225 2250 975
|
||||
2 2 0 2 14 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
1200 375 2100 375 2100 825 1200 825 1200 375
|
||||
4 0 14 50 0 0 20 0.0000 4 195 645 1350 675 MTA\001
|
||||
-6
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
2550 1575 3750 2625
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
2550 1575 3750 1575
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
2550 1575 3750 825
|
||||
2 1 0 2 4 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
3000 2925 3750 2625
|
||||
2 1 0 2 14 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
2100 525 3750 825
|
||||
2 1 0 2 14 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
2100 525 3750 2625
|
||||
2 1 0 4 0 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
1050 3075 2100 3075
|
||||
2 1 0 4 0 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
1050 1725 1650 1725
|
||||
2 1 0 4 0 7 50 0 -1 0.000 0 0 7 0 0 2
|
||||
1050 675 1200 675
|
||||
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
3750 2475 4950 2475 4950 2925 3750 2925 3750 2475
|
||||
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
3750 1425 4950 1425 4950 1875 3750 1875 3750 1425
|
||||
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
3750 525 4950 525 4950 975 3750 975 3750 525
|
||||
4 0 0 50 0 1 20 0.0000 4 210 795 3900 2775 Filter 3\001
|
||||
4 0 0 50 0 1 20 0.0000 4 210 795 3900 1725 Filter 2\001
|
||||
4 0 0 50 0 1 20 0.0000 4 210 795 3900 825 Filter 1\001
|
||||
-6
|
||||
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
300 525 1050 525 1050 3225 300 3225 300 525
|
||||
4 0 0 50 0 2 24 1.5708 4 255 1950 825 2850 INTERNET\001
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -0,0 +1,173 @@
|
|||
%!PS-Adobe-2.0
|
||||
%%Title: figure1.fig
|
||||
%%Creator: fig2dev Version 3.2.3 Patchlevel
|
||||
%%CreationDate: Tue Jun 6 14:00:04 2000
|
||||
%%For: sean@host232.Sendmail.COM (Sean O'rourke,5400)
|
||||
%%Orientation: Landscape
|
||||
%%Pages: 1
|
||||
%%BoundingBox: 0 0 612 792
|
||||
%%BeginSetup
|
||||
%%IncludeFeature: *PageSize Letter
|
||||
%%EndSetup
|
||||
%%Magnification: 1.0000
|
||||
%%EndComments
|
||||
/$F2psDict 200 dict def
|
||||
$F2psDict begin
|
||||
$F2psDict /mtrx matrix put
|
||||
/col-1 {0 setgray} bind def
|
||||
/col0 {0.000 0.000 0.000 srgb} bind def
|
||||
/col1 {0.000 0.000 1.000 srgb} bind def
|
||||
/col2 {0.000 1.000 0.000 srgb} bind def
|
||||
/col3 {0.000 1.000 1.000 srgb} bind def
|
||||
/col4 {1.000 0.000 0.000 srgb} bind def
|
||||
/col5 {1.000 0.000 1.000 srgb} bind def
|
||||
/col6 {1.000 1.000 0.000 srgb} bind def
|
||||
/col7 {1.000 1.000 1.000 srgb} bind def
|
||||
/col8 {0.000 0.000 0.560 srgb} bind def
|
||||
/col9 {0.000 0.000 0.690 srgb} bind def
|
||||
/col10 {0.000 0.000 0.820 srgb} bind def
|
||||
/col11 {0.530 0.810 1.000 srgb} bind def
|
||||
/col12 {0.000 0.560 0.000 srgb} bind def
|
||||
/col13 {0.000 0.690 0.000 srgb} bind def
|
||||
/col14 {0.000 0.820 0.000 srgb} bind def
|
||||
/col15 {0.000 0.560 0.560 srgb} bind def
|
||||
/col16 {0.000 0.690 0.690 srgb} bind def
|
||||
/col17 {0.000 0.820 0.820 srgb} bind def
|
||||
/col18 {0.560 0.000 0.000 srgb} bind def
|
||||
/col19 {0.690 0.000 0.000 srgb} bind def
|
||||
/col20 {0.820 0.000 0.000 srgb} bind def
|
||||
/col21 {0.560 0.000 0.560 srgb} bind def
|
||||
/col22 {0.690 0.000 0.690 srgb} bind def
|
||||
/col23 {0.820 0.000 0.820 srgb} bind def
|
||||
/col24 {0.500 0.190 0.000 srgb} bind def
|
||||
/col25 {0.630 0.250 0.000 srgb} bind def
|
||||
/col26 {0.750 0.380 0.000 srgb} bind def
|
||||
/col27 {1.000 0.500 0.500 srgb} bind def
|
||||
/col28 {1.000 0.630 0.630 srgb} bind def
|
||||
/col29 {1.000 0.750 0.750 srgb} bind def
|
||||
/col30 {1.000 0.880 0.880 srgb} bind def
|
||||
/col31 {1.000 0.840 0.000 srgb} bind def
|
||||
|
||||
end
|
||||
save
|
||||
newpath 0 792 moveto 0 0 lineto 612 0 lineto 612 792 lineto closepath clip newpath
|
||||
198.0 238.0 translate
|
||||
90 rotate
|
||||
1 -1 scale
|
||||
|
||||
/cp {closepath} bind def
|
||||
/ef {eofill} bind def
|
||||
/gr {grestore} bind def
|
||||
/gs {gsave} bind def
|
||||
/sa {save} bind def
|
||||
/rs {restore} bind def
|
||||
/l {lineto} bind def
|
||||
/m {moveto} bind def
|
||||
/rm {rmoveto} bind def
|
||||
/n {newpath} bind def
|
||||
/s {stroke} bind def
|
||||
/sh {show} bind def
|
||||
/slc {setlinecap} bind def
|
||||
/slj {setlinejoin} bind def
|
||||
/slw {setlinewidth} bind def
|
||||
/srgb {setrgbcolor} bind def
|
||||
/rot {rotate} bind def
|
||||
/sc {scale} bind def
|
||||
/sd {setdash} bind def
|
||||
/ff {findfont} bind def
|
||||
/sf {setfont} bind def
|
||||
/scf {scalefont} bind def
|
||||
/sw {stringwidth} bind def
|
||||
/tr {translate} bind def
|
||||
/tnt {dup dup currentrgbcolor
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
|
||||
bind def
|
||||
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
|
||||
4 -2 roll mul srgb} bind def
|
||||
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
|
||||
/$F2psEnd {$F2psEnteredState restore end} def
|
||||
|
||||
$F2psBegin
|
||||
%%Page: 1 1
|
||||
10 setmiterlimit
|
||||
0.06000 0.06000 sc
|
||||
%%Page: 1 1
|
||||
/Times-Bold ff 360.00 scf sf
|
||||
825 2850 m
|
||||
gs 1 -1 sc 90.0 rot (INTERNET) col0 sh gr
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
1800 1725 m
|
||||
gs 1 -1 sc (MTA) col1 sh gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 2100 2775 m 3000 2775 l 3000 3225 l 2100 3225 l
|
||||
cp gs col4 s gr
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
2250 3075 m
|
||||
gs 1 -1 sc (MTA) col4 sh gr
|
||||
% Polyline
|
||||
n 1200 375 m 2100 375 l 2100 825 l 1200 825 l
|
||||
cp gs col14 s gr
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
1350 675 m
|
||||
gs 1 -1 sc (MTA) col14 sh gr
|
||||
% Polyline
|
||||
n 2550 1575 m
|
||||
3750 2625 l gs col1 s gr
|
||||
% Polyline
|
||||
n 2550 1575 m
|
||||
3750 1575 l gs col1 s gr
|
||||
% Polyline
|
||||
n 2550 1575 m
|
||||
3750 825 l gs col1 s gr
|
||||
% Polyline
|
||||
n 3000 2925 m
|
||||
3750 2625 l gs col4 s gr
|
||||
% Polyline
|
||||
n 2100 525 m
|
||||
3750 825 l gs col14 s gr
|
||||
% Polyline
|
||||
n 2100 525 m
|
||||
3750 2625 l gs col14 s gr
|
||||
% Polyline
|
||||
45.000 slw
|
||||
n 1050 3075 m
|
||||
2100 3075 l gs col0 s gr
|
||||
% Polyline
|
||||
n 1050 1725 m
|
||||
1650 1725 l gs col0 s gr
|
||||
% Polyline
|
||||
n 1050 675 m
|
||||
1200 675 l gs col0 s gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 3750 2475 m 4950 2475 l 4950 2925 l 3750 2925 l
|
||||
cp gs col0 s gr
|
||||
% Polyline
|
||||
n 3750 1425 m 4950 1425 l 4950 1875 l 3750 1875 l
|
||||
cp gs col0 s gr
|
||||
% Polyline
|
||||
n 3750 525 m 4950 525 l 4950 975 l 3750 975 l
|
||||
cp gs col0 s gr
|
||||
/Times-Italic ff 300.00 scf sf
|
||||
3900 2775 m
|
||||
gs 1 -1 sc (Filter 3) col0 sh gr
|
||||
/Times-Italic ff 300.00 scf sf
|
||||
3900 1725 m
|
||||
gs 1 -1 sc (Filter 2) col0 sh gr
|
||||
/Times-Italic ff 300.00 scf sf
|
||||
3900 825 m
|
||||
gs 1 -1 sc (Filter 1) col0 sh gr
|
||||
% Polyline
|
||||
7.500 slw
|
||||
n 300 525 m 1050 525 l 1050 3225 l 300 3225 l
|
||||
cp gs col0 s gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 1650 1425 m 2550 1425 l 2550 1875 l 1650 1875 l
|
||||
cp gs col1 s gr
|
||||
$F2psEnd
|
||||
rs
|
||||
showpage
|
|
@ -0,0 +1,67 @@
|
|||
#FIG 3.2
|
||||
Landscape
|
||||
Center
|
||||
Inches
|
||||
Letter
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
5 1 0 1 0 7 50 0 -1 0.000 0 0 1 0 2981.250 1200.000 2700 1050 3300 1200 2700 1350
|
||||
1 1 1.00 60.00 120.00
|
||||
6 4200 900 6450 1350
|
||||
2 2 0 1 1 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
4200 900 6450 900 6450 1350 4200 1350 4200 900
|
||||
4 0 1 50 0 0 16 0.0000 4 195 2040 4350 1200 xxfi_header callback\001
|
||||
-6
|
||||
6 4200 2250 6450 2700
|
||||
2 2 0 1 4 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
4200 2250 6450 2250 6450 2700 4200 2700 4200 2250
|
||||
4 0 4 50 0 0 16 0.0000 4 195 2040 4350 2550 xxfi_header callback\001
|
||||
-6
|
||||
6 600 2100 1800 2850
|
||||
2 2 0 2 4 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
750 2250 1650 2250 1650 2700 750 2700 750 2250
|
||||
4 0 4 50 0 0 20 0.0000 4 195 645 900 2550 MTA\001
|
||||
-6
|
||||
6 600 750 1800 1500
|
||||
2 2 0 2 1 7 50 0 -1 0.000 0 0 7 0 0 5
|
||||
750 900 1650 900 1650 1350 750 1350 750 900
|
||||
4 0 1 50 0 0 20 0.0000 4 195 645 900 1200 MTA\001
|
||||
-6
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
4200 1200 3600 1200
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
3450 900 4050 900
|
||||
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
2400 300 6600 300 6600 3300 2400 3300 2400 300
|
||||
2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
|
||||
2550 750 3450 750 3450 2700 2550 2700 2550 750
|
||||
2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
3450 2700 4050 2700
|
||||
2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
4200 2400 3600 2400
|
||||
2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
1650 2700 2250 2700
|
||||
2 1 0 2 4 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
2400 2400 1800 2400
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
1650 900 2250 900
|
||||
2 1 0 2 1 7 50 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 2.00 120.00 240.00
|
||||
2400 1200 1800 1200
|
||||
4 0 0 50 0 0 20 0.0000 4 195 630 3900 600 Filter\001
|
||||
4 0 4 50 0 0 12 0.0000 4 180 1620 3450 3000 callback (arguments)\001
|
||||
4 0 4 50 0 0 12 0.0000 4 180 1575 3900 1950 optional library calls,\001
|
||||
4 0 4 50 0 0 12 0.0000 4 135 855 3900 2175 return code\001
|
||||
4 0 4 50 0 0 12 0.0000 4 135 780 1500 2100 responses\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 645 2700 2085 Milter\001
|
||||
4 0 0 50 0 0 16 0.0000 4 225 675 2700 2400 library\001
|
||||
4 0 4 50 0 0 12 0.0000 4 135 510 1500 3000 header\001
|
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -0,0 +1,242 @@
|
|||
%!PS-Adobe-2.0
|
||||
%%Title: figure2.fig
|
||||
%%Creator: fig2dev Version 3.2.3 Patchlevel
|
||||
%%CreationDate: Tue Jun 6 13:57:47 2000
|
||||
%%For: sean@host232.Sendmail.COM (Sean O'rourke,5400)
|
||||
%%Orientation: Landscape
|
||||
%%Pages: 1
|
||||
%%BoundingBox: 0 0 612 792
|
||||
%%BeginSetup
|
||||
%%IncludeFeature: *PageSize Letter
|
||||
%%EndSetup
|
||||
%%Magnification: 1.5000
|
||||
%%EndComments
|
||||
/$F2psDict 200 dict def
|
||||
$F2psDict begin
|
||||
$F2psDict /mtrx matrix put
|
||||
/col-1 {0 setgray} bind def
|
||||
/col0 {0.000 0.000 0.000 srgb} bind def
|
||||
/col1 {0.000 0.000 1.000 srgb} bind def
|
||||
/col2 {0.000 1.000 0.000 srgb} bind def
|
||||
/col3 {0.000 1.000 1.000 srgb} bind def
|
||||
/col4 {1.000 0.000 0.000 srgb} bind def
|
||||
/col5 {1.000 0.000 1.000 srgb} bind def
|
||||
/col6 {1.000 1.000 0.000 srgb} bind def
|
||||
/col7 {1.000 1.000 1.000 srgb} bind def
|
||||
/col8 {0.000 0.000 0.560 srgb} bind def
|
||||
/col9 {0.000 0.000 0.690 srgb} bind def
|
||||
/col10 {0.000 0.000 0.820 srgb} bind def
|
||||
/col11 {0.530 0.810 1.000 srgb} bind def
|
||||
/col12 {0.000 0.560 0.000 srgb} bind def
|
||||
/col13 {0.000 0.690 0.000 srgb} bind def
|
||||
/col14 {0.000 0.820 0.000 srgb} bind def
|
||||
/col15 {0.000 0.560 0.560 srgb} bind def
|
||||
/col16 {0.000 0.690 0.690 srgb} bind def
|
||||
/col17 {0.000 0.820 0.820 srgb} bind def
|
||||
/col18 {0.560 0.000 0.000 srgb} bind def
|
||||
/col19 {0.690 0.000 0.000 srgb} bind def
|
||||
/col20 {0.820 0.000 0.000 srgb} bind def
|
||||
/col21 {0.560 0.000 0.560 srgb} bind def
|
||||
/col22 {0.690 0.000 0.690 srgb} bind def
|
||||
/col23 {0.820 0.000 0.820 srgb} bind def
|
||||
/col24 {0.500 0.190 0.000 srgb} bind def
|
||||
/col25 {0.630 0.250 0.000 srgb} bind def
|
||||
/col26 {0.750 0.380 0.000 srgb} bind def
|
||||
/col27 {1.000 0.500 0.500 srgb} bind def
|
||||
/col28 {1.000 0.630 0.630 srgb} bind def
|
||||
/col29 {1.000 0.750 0.750 srgb} bind def
|
||||
/col30 {1.000 0.880 0.880 srgb} bind def
|
||||
/col31 {1.000 0.840 0.000 srgb} bind def
|
||||
|
||||
end
|
||||
save
|
||||
newpath 0 792 moveto 0 0 lineto 612 0 lineto 612 792 lineto closepath clip newpath
|
||||
144.0 65.5 translate
|
||||
90 rotate
|
||||
1 -1 scale
|
||||
|
||||
/cp {closepath} bind def
|
||||
/ef {eofill} bind def
|
||||
/gr {grestore} bind def
|
||||
/gs {gsave} bind def
|
||||
/sa {save} bind def
|
||||
/rs {restore} bind def
|
||||
/l {lineto} bind def
|
||||
/m {moveto} bind def
|
||||
/rm {rmoveto} bind def
|
||||
/n {newpath} bind def
|
||||
/s {stroke} bind def
|
||||
/sh {show} bind def
|
||||
/slc {setlinecap} bind def
|
||||
/slj {setlinejoin} bind def
|
||||
/slw {setlinewidth} bind def
|
||||
/srgb {setrgbcolor} bind def
|
||||
/rot {rotate} bind def
|
||||
/sc {scale} bind def
|
||||
/sd {setdash} bind def
|
||||
/ff {findfont} bind def
|
||||
/sf {setfont} bind def
|
||||
/scf {scalefont} bind def
|
||||
/sw {stringwidth} bind def
|
||||
/tr {translate} bind def
|
||||
/tnt {dup dup currentrgbcolor
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
|
||||
bind def
|
||||
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
|
||||
4 -2 roll mul srgb} bind def
|
||||
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
|
||||
/$F2psEnd {$F2psEnteredState restore end} def
|
||||
|
||||
$F2psBegin
|
||||
%%Page: 1 1
|
||||
10 setmiterlimit
|
||||
0.09000 0.09000 sc
|
||||
%%Page: 1 1
|
||||
/Times-Roman ff 180.00 scf sf
|
||||
1500 3000 m
|
||||
gs 1 -1 sc (header) col4 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
4350 1200 m
|
||||
gs 1 -1 sc (xxfi_header callback) col1 sh gr
|
||||
% Polyline
|
||||
7.500 slw
|
||||
n 4200 2250 m 6450 2250 l 6450 2700 l 4200 2700 l
|
||||
cp gs col4 s gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
4350 2550 m
|
||||
gs 1 -1 sc (xxfi_header callback) col4 sh gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 750 2250 m 1650 2250 l 1650 2700 l 750 2700 l
|
||||
cp gs col4 s gr
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
900 2550 m
|
||||
gs 1 -1 sc (MTA) col4 sh gr
|
||||
% Polyline
|
||||
n 750 900 m 1650 900 l 1650 1350 l 750 1350 l
|
||||
cp gs col1 s gr
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
900 1200 m
|
||||
gs 1 -1 sc (MTA) col1 sh gr
|
||||
% Arc
|
||||
7.500 slw
|
||||
gs clippath
|
||||
2713 1319 m 2667 1357 l 2761 1475 l 2710 1363 l 2808 1437 l cp
|
||||
eoclip
|
||||
n 2981.2 1200.0 318.8 -151.9 151.9 arc
|
||||
gs col0 s gr
|
||||
gr
|
||||
|
||||
% arrowhead
|
||||
n 2808 1437 m 2710 1363 l 2761 1475 l 2808 1437 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
15.000 slw
|
||||
gs clippath
|
||||
3585 1140 m 3585 1260 l 3872 1260 l 3632 1200 l 3872 1140 l cp
|
||||
eoclip
|
||||
n 4200 1200 m
|
||||
3600 1200 l gs col1 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3872 1140 m 3632 1200 l 3872 1260 l 3872 1140 l cp gs col1 1.00 shd ef gr col1 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
4065 960 m 4065 840 l 3778 840 l 4018 900 l 3778 960 l cp
|
||||
eoclip
|
||||
n 3450 900 m
|
||||
4050 900 l gs col1 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3778 960 m 4018 900 l 3778 840 l 3778 960 l cp gs col1 1.00 shd ef gr col1 s
|
||||
% Polyline
|
||||
n 2400 300 m 6600 300 l 6600 3300 l 2400 3300 l
|
||||
cp gs col0 s gr
|
||||
% Polyline
|
||||
7.500 slw
|
||||
n 2550 750 m 3450 750 l 3450 2700 l 2550 2700 l
|
||||
cp gs col0 s gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
gs clippath
|
||||
4065 2760 m 4065 2640 l 3778 2640 l 4018 2700 l 3778 2760 l cp
|
||||
eoclip
|
||||
n 3450 2700 m
|
||||
4050 2700 l gs col4 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3778 2760 m 4018 2700 l 3778 2640 l 3778 2760 l cp gs col4 1.00 shd ef gr col4 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
3585 2340 m 3585 2460 l 3872 2460 l 3632 2400 l 3872 2340 l cp
|
||||
eoclip
|
||||
n 4200 2400 m
|
||||
3600 2400 l gs col4 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3872 2340 m 3632 2400 l 3872 2460 l 3872 2340 l cp gs col4 1.00 shd ef gr col4 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
2265 2760 m 2265 2640 l 1978 2640 l 2218 2700 l 1978 2760 l cp
|
||||
eoclip
|
||||
n 1650 2700 m
|
||||
2250 2700 l gs col4 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 1978 2760 m 2218 2700 l 1978 2640 l 1978 2760 l cp gs col4 1.00 shd ef gr col4 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
1785 2340 m 1785 2460 l 2072 2460 l 1832 2400 l 2072 2340 l cp
|
||||
eoclip
|
||||
n 2400 2400 m
|
||||
1800 2400 l gs col4 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 2072 2340 m 1832 2400 l 2072 2460 l 2072 2340 l cp gs col4 1.00 shd ef gr col4 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
2265 960 m 2265 840 l 1978 840 l 2218 900 l 1978 960 l cp
|
||||
eoclip
|
||||
n 1650 900 m
|
||||
2250 900 l gs col1 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 1978 960 m 2218 900 l 1978 840 l 1978 960 l cp gs col1 1.00 shd ef gr col1 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
1785 1140 m 1785 1260 l 2072 1260 l 1832 1200 l 2072 1140 l cp
|
||||
eoclip
|
||||
n 2400 1200 m
|
||||
1800 1200 l gs col1 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 2072 1140 m 1832 1200 l 2072 1260 l 2072 1140 l cp gs col1 1.00 shd ef gr col1 s
|
||||
/Times-Roman ff 300.00 scf sf
|
||||
3900 600 m
|
||||
gs 1 -1 sc (Filter) col0 sh gr
|
||||
/Times-Roman ff 180.00 scf sf
|
||||
3450 3000 m
|
||||
gs 1 -1 sc (callback \(arguments\)) col4 sh gr
|
||||
/Times-Roman ff 180.00 scf sf
|
||||
3900 1950 m
|
||||
gs 1 -1 sc (optional library calls,) col4 sh gr
|
||||
/Times-Roman ff 180.00 scf sf
|
||||
3900 2175 m
|
||||
gs 1 -1 sc (return code) col4 sh gr
|
||||
/Times-Roman ff 180.00 scf sf
|
||||
1500 2100 m
|
||||
gs 1 -1 sc (responses) col4 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
2700 2085 m
|
||||
gs 1 -1 sc (Milter) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
2700 2400 m
|
||||
gs 1 -1 sc (library) col0 sh gr
|
||||
% Polyline
|
||||
7.500 slw
|
||||
n 4200 900 m 6450 900 l 6450 1350 l 4200 1350 l
|
||||
cp gs col1 s gr
|
||||
$F2psEnd
|
||||
rs
|
||||
showpage
|
|
@ -0,0 +1,92 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Filtering Mail with Sendmail</title>
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
Id: index.html,v 1.10 2001/06/01 00:05:03 ca Exp
|
||||
-->
|
||||
|
||||
<h1>Filtering Mail with Sendmail</h1>
|
||||
|
||||
<!--
|
||||
<P><b>Disclaimer</b>:
|
||||
This preliminary API description is provided for review only. This
|
||||
specification may change based on feedback from reviewers, and does
|
||||
not bind Sendmail to offer this functionality in any release.
|
||||
-->
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<P>
|
||||
Sendmail's Content Management API (milter) provides third-party
|
||||
programs to access mail messages as they are being processed by the
|
||||
Mail Transfer Agent (MTA), allowing them to examine and modify message
|
||||
content and meta-information. Filtering policies implemented by
|
||||
Milter-conformant filters may then be centrally configured and
|
||||
composed in an end-user's MTA configuration file.
|
||||
|
||||
<p>
|
||||
Possible uses for filters include spam rejection, virus
|
||||
filtering, and content control. In general, Milter seeks to address
|
||||
site-wide filtering concerns in a scalable way. Individual users' mail
|
||||
filtering needs (e.g. sorting messages by subject) are left to
|
||||
client-level programs such as <a href="http://www.procmail.org">Procmail</a>.
|
||||
|
||||
<P>
|
||||
This document is a technical introduction intended for those
|
||||
interested in developing Milter filters. It includes:
|
||||
<ul>
|
||||
<li>A description of Milter's design goals.
|
||||
|
||||
<li>An explanation of Milter application architecture, including
|
||||
interactions between the support library and user code, and between
|
||||
filters and the MTA.
|
||||
|
||||
<li>A specification of the C application programming interface.
|
||||
<li>An example of a simple Milter filter.
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="design.html">Architecture</a>
|
||||
<ul>
|
||||
<li>Design Goals
|
||||
<li>Implementing Filtering Policies
|
||||
<li>MTA - Filter communication
|
||||
</ul>
|
||||
<li><a href="overview.html">Technical Overview</a>
|
||||
<ul>
|
||||
<li>Initialization
|
||||
<li>Control flow
|
||||
<li>Multithreading
|
||||
<li>Resource Management
|
||||
<li>Signal Handling
|
||||
</ul>
|
||||
<li><a href="api.html">API Documentation</a>
|
||||
<ul>
|
||||
<li>Library Control Functions
|
||||
<li>Data Access Functions
|
||||
<li>Message Modification Functions
|
||||
<li>Callbacks
|
||||
</ul>
|
||||
<li><a href="installation.html">Installation and Configuration</a>
|
||||
<ul>
|
||||
<li>Compiling and Installing Your Filter
|
||||
<li>Configuring Sendmail
|
||||
</ul>
|
||||
<li><a href="sample.html">A Sample Filter</a>
|
||||
<!-- <li><a href="other.html">Other Sources of Information</a> -->
|
||||
</ul>
|
||||
|
||||
<hr size="1">
|
||||
<font size="-1">
|
||||
Copyright (c) 2000, 2001 Sendmail, Inc. and its suppliers.
|
||||
All rights reserved.
|
||||
<br>
|
||||
By using this file, you agree to the terms and conditions set
|
||||
forth in the <a href="LICENSE.txt">LICENSE</a>.
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,170 @@
|
|||
<html>
|
||||
<head><title>Installation and Configuration</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Installation</h1>
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#compile">Compiling and Installing Your Filter</a>
|
||||
<li><a href="#config">Configuring Sendmail</a>
|
||||
</ul>
|
||||
|
||||
<h2><a name="compile">Compiling and Installing Your Filter</A></h2>
|
||||
|
||||
To compile a filter, modify the Makefile provided with the sample program, or:
|
||||
<ul>
|
||||
<li>Put the include and Sendmail directories in your include path
|
||||
(e.g. -I/path/to/include -I/path/to/sendmail).
|
||||
|
||||
<li>Make sure libmilter.so is in your library path, and link your
|
||||
application with it (e.g. "-lmilter").
|
||||
|
||||
<li>Compile with pthreads, either by using -pthread for gcc, or
|
||||
linking with a pthreads support library (-lpthread).
|
||||
</ul>
|
||||
Your compile command line will look like
|
||||
<pre>
|
||||
cc -I/path/to/include -I/path/to/sendmail -c myfile.c
|
||||
</pre>
|
||||
and your linking command line will look something like
|
||||
<pre>
|
||||
cc -o myfilter [object-files] -L[library-location] -lmilter -pthread
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
To run the filter, the Milter shared library must be available to the
|
||||
run-time linker.
|
||||
|
||||
<H2><a name="config">Configuring Sendmail</A></H2>
|
||||
|
||||
First, you must compile sendmail with MILTER defined.
|
||||
If you use a sendmail version older than 8.12 please see
|
||||
the instructions for your version.
|
||||
To do this, add the following lines to your build
|
||||
configuration file (devtools/Site/config.site.m4)
|
||||
<pre>
|
||||
APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
|
||||
</pre>
|
||||
|
||||
then type <code>./Build -c</code> in your sendmail directory.
|
||||
|
||||
<P>
|
||||
Next, you must add the desired filters to your sendmail configuration
|
||||
(.mc) file.
|
||||
Mail filters have three equates:
|
||||
The required <code>S=</code> equate specifies the socket where
|
||||
sendmail should look for the filter; The optional <code>F=</code> and
|
||||
<code>T=</code> equates specify flags and timeouts, respectively. All
|
||||
equates names, equate field names, and flag values are case sensitive.
|
||||
|
||||
<P>
|
||||
The current flags (<code>F=</code>) are:
|
||||
<p>
|
||||
<table cellspacing="1" cellpadding=4 border=1>
|
||||
<tr bgcolor="#dddddd" align=left valign=top>
|
||||
<th>Flag</TH> <th align="center">Meaning</TH>
|
||||
</TR>
|
||||
<tr align="left" valign=top>
|
||||
<TD>R</TD> <TD>Reject connection if filter unavailable</TD>
|
||||
</TR>
|
||||
<tr align="left" valign=top>
|
||||
<TD>T</TD> <TD>Temporary fail connection if filter unavailable</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
If a filter is unavailable or unresponsive and no flags have been
|
||||
specified, the MTA will continue normal handling of the current
|
||||
connection. The MTA will try to contact the filter again on each new
|
||||
connection.
|
||||
|
||||
<P>
|
||||
There are three fields inside of the <code>T=</code> equate: S, R, and
|
||||
E. Note the separator between each is a ";" (semicolon), as ","
|
||||
(comma) already separates equates. The value of each field is a
|
||||
decimal number followed by a single letter designating the units ("s"
|
||||
for seconds, "m" for minutes). The fields have the following
|
||||
meanings:
|
||||
<p>
|
||||
<TABLE cellspacing="1" cellpadding=4 border=1>
|
||||
<TR bgcolor="#dddddd" align=left valign=top>
|
||||
<TH>Flag</TH> <TH align="center">Meaning</TH>
|
||||
</TR>
|
||||
<TR align="left" valign=top>
|
||||
<TD>C</TD> <TD>Timeout for connecting to a filter. If set to 0, the
|
||||
system's <CODE>connect()</CODE> timeout will be used.
|
||||
Default: 5m</TD>
|
||||
</TR>
|
||||
<TR align="left" valign=top>
|
||||
<TD>S</TD> <TD>Timeout for sending information from the MTA to a
|
||||
filter. Default: 10s</TD>
|
||||
</TR>
|
||||
<TR align="left" valign=top>
|
||||
<TD>R</TD> <TD>Timeout for reading reply from the filter. Default: 10s</TD>
|
||||
</TR>
|
||||
<TR align="left" valign=top>
|
||||
<TD>E</TD> <TD>Overall timeout between sending end-of-message to
|
||||
filter and waiting for the final acknowledgment. Default: 5m</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<p>
|
||||
The following sendmail.mc example specifies three filters. The first
|
||||
two rendezvous on Unix-domain sockets in the /var/run directory; the
|
||||
third uses an IP socket on port 999.
|
||||
<pre>
|
||||
INPUT_MAIL_FILTER(`filter1', `S=unix:/var/run/f1.sock, F=R')
|
||||
INPUT_MAIL_FILTER(`filter2', `S=unix:/var/run/f2.sock, F=T, T=S:1s;R:1s;E:5m')
|
||||
INPUT_MAIL_FILTER(`filter3', `S=inet:999@localhost, T=C:2m')
|
||||
|
||||
define(`confINPUT_MAIL_FILTERS', `filter2,filter1,filter3')
|
||||
<hr width="30%">
|
||||
m4 ../m4/cf.m4 myconfig.mc > myconfig.cf
|
||||
</pre>
|
||||
By default, the filters would be run in the order declared,
|
||||
i.e. "filter1, filter2, filter3"; however, since
|
||||
<code>confINPUT_MAIL_FILTERS</code> is defined, the filters will be
|
||||
run "filter2, filter1, filter3". Also note that a filter can be
|
||||
defined without adding it to the input filter list by using
|
||||
MAIL_FILTER() instead of INPUT_MAIL_FILTER().
|
||||
|
||||
<p>
|
||||
The above macros will result in the following lines being added to
|
||||
your .cf file:
|
||||
<PRE>
|
||||
Xfilter1, S=unix:/var/run/f1.sock, F=R
|
||||
Xfilter2, S=unix:/var/run/f2.sock, F=T, T=S:1s;R:1s;E:5m
|
||||
Xfilter3, S=inet:999@localhost, T=C:2m
|
||||
|
||||
O InputMailFilters=filter2,filter1,filter3
|
||||
</PRE>
|
||||
<p>
|
||||
Finally, the sendmail macros accessible via <a
|
||||
href="smfi_getsymval.html">smfi_getsymval</a> can be configured by
|
||||
defining the following m4 variables (or cf options):
|
||||
<table cellspacing="1" cellpadding=4 border=1>
|
||||
<tr bgcolor="#dddddd" align=left valign=top>
|
||||
<th align="center">In .mc file</th> <th align="center">In .cf file</TH>
|
||||
<th align="center">Default Value</th>
|
||||
</tr>
|
||||
<tr><td>confMILTER_MACROS_CONNECT</td><td>Milter.macros.connect</td>
|
||||
<td><code>j, _, {daemon_name}, {if_name}, {if_addr}</code></td></tr>
|
||||
<tr><td>confMILTER_MACROS_HELO</td><td>Milter.macros.helo</td>
|
||||
<td><code>{tls_version}, {cipher}, {cipher_bits}, {cert_subject},
|
||||
{cert_issuer}</code></td></tr>
|
||||
<tr><td>confMILTER_MACROS_ENVFROM</td><td>Milter.macros.envfrom</td>
|
||||
<td><code>i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author},
|
||||
{mail_mailer}, {mail_host}, {mail_addr}</code></td></tr>
|
||||
<tr><td>confMILTER_MACROS_ENVRCPT</td><td>Milter.macros.envrcpt</td>
|
||||
<td><code>{rcpt_mailer}, {rcpt_host}, {rcpt_addr}</code></td></tr>
|
||||
</table>
|
||||
For information about available macros and their meanings, please
|
||||
consult the sendmail documentation.
|
||||
<hr size="1">
|
||||
<font size="-1">
|
||||
Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
|
||||
All rights reserved.
|
||||
<br>
|
||||
By using this file, you agree to the terms and conditions set
|
||||
forth in the <a href="LICENSE.txt">LICENSE</a>.
|
||||
</font>
|
||||
</body> </html>
|
|
@ -0,0 +1,15 @@
|
|||
<html>
|
||||
<head><title>Other Resources</title>
|
||||
</head>
|
||||
<body>
|
||||
FAQ? Mailing list? More sample filters?
|
||||
<hr size="1">
|
||||
<font size="-1">
|
||||
Copyright (c) 2000 Sendmail, Inc. and its suppliers.
|
||||
All rights reserved.
|
||||
<br>
|
||||
By using this file, you agree to the terms and conditions set
|
||||
forth in the <a href="LICENSE.txt">LICENSE</a>.
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue