164562Sgshapirodivert(-1)
264562Sgshapiro#
3223067Sgshapiro# Copyright (c) 1999-2002, 2004, 2007 Sendmail, Inc. and its suppliers.
464562Sgshapiro#	All rights reserved.
564562Sgshapiro#
664562Sgshapiro# By using this file, you agree to the terms and conditions set
764562Sgshapiro# forth in the LICENSE file which can be found at the top level of
864562Sgshapiro# the sendmail distribution.
964562Sgshapiro#
1064562Sgshapiro#
1164562Sgshapiro
1264562Sgshapirodivert(0)
13244833SgshapiroVERSIONID(`$Id: ldap_routing.m4,v 8.20 2012/01/18 22:27:06 ca Exp $')
1464562Sgshapirodivert(-1)
1564562Sgshapiro
1664562Sgshapiro# Check first two arguments.  If they aren't set, may need to warn in proto.m4
1764562Sgshapiroifelse(len(X`'_ARG1_), `1', `define(`_LDAP_ROUTING_WARN_', `yes')')
1864562Sgshapiroifelse(len(X`'_ARG2_), `1', `define(`_LDAP_ROUTING_WARN_', `yes')')
19132943Sgshapiroifelse(len(X`'_ARG5_), `1', `', `define(`_LDAP_ROUTE_NODOMAIN_', `yes')')
2064562Sgshapiro
2164562Sgshapiro# Check for third argument to indicate how to deal with non-existant
2264562Sgshapiro# LDAP records
2364562Sgshapiroifelse(len(X`'_ARG3_), `1', `define(`_LDAP_ROUTING_', `_PASS_THROUGH_')',
2464562Sgshapiro       _ARG3_, `passthru', `define(`_LDAP_ROUTING_', `_PASS_THROUGH_')',
25132943Sgshapiro       _ARG3_, `sendertoo', `define(`_LDAP_ROUTING_', `_MUST_EXIST_')define(`_LDAP_SENDER_MUST_EXIST_')',
2664562Sgshapiro       `define(`_LDAP_ROUTING_', `_MUST_EXIST_')')
2764562Sgshapiro
28132943Sgshapiro# Check for fourth argument to indicate how to deal with +detail info
2990792Sgshapiroifelse(len(X`'_ARG4_), `1', `',
3090792Sgshapiro       _ARG4_, `strip', `define(`_LDAP_ROUTE_DETAIL_', `_STRIP_')',
3190792Sgshapiro       _ARG4_, `preserve', `define(`_LDAP_ROUTE_DETAIL_', `_PRESERVE_')')
3290792Sgshapiro
33132943Sgshapiro# Check for sixth argument to indicate how to deal with tempfails
34132943Sgshapiroifelse(len(X`'_ARG6_), `1', `define(`_LDAP_ROUTE_MAPTEMP_', `_QUEUE_')',
35132943Sgshapiro       _ARG6_, `tempfail', `define(`_LDAP_ROUTE_MAPTEMP_', `_TEMPFAIL_')',
36132943Sgshapiro       _ARG6_, `queue', `define(`_LDAP_ROUTE_MAPTEMP_', `_QUEUE_')')
37132943Sgshapiro
3864562SgshapiroLOCAL_CONFIG
3964562Sgshapiro# LDAP routing maps
4064562SgshapiroKldapmh ifelse(len(X`'_ARG1_), `1',
4194334Sgshapiro	       `ldap -1 -T<TMPF> -v mailHost -k (&(objectClass=inetLocalMailRecipient)(mailLocalAddress=%0))',
42223067Sgshapiro	       `_ARG1_')
4364562Sgshapiro
4464562SgshapiroKldapmra ifelse(len(X`'_ARG2_), `1',
4594334Sgshapiro		`ldap -1 -T<TMPF> -v mailRoutingAddress -k (&(objectClass=inetLocalMailRecipient)(mailLocalAddress=%0))',
46223067Sgshapiro		`_ARG2_')
47