Deleted Added
full compact
map.c (223067) map.c (244833)
1/*
2 * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
1/*
2 * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
16SM_RCSID("@(#)$Id: map.c,v 8.706 2010/07/27 03:35:42 ca Exp $")
16SM_RCSID("@(#)$Id: map.c,v 8.709 2012/04/20 18:47:09 ca Exp $")
17
18#if LDAPMAP
19# include <sm/ldap.h>
20#endif /* LDAPMAP */
21
22#if NDBM
23# include <ndbm.h>
24# ifdef R_FIRST

--- 3404 unchanged lines hidden (view full) ---

3429
3430 /* No connection yet, connect */
3431 if (!sm_ldap_start(map->map_mname, lmap))
3432 {
3433 if (errno == ETIMEDOUT)
3434 {
3435 if (LogLevel > 1)
3436 sm_syslog(LOG_NOTICE, CurEnv->e_id,
17
18#if LDAPMAP
19# include <sm/ldap.h>
20#endif /* LDAPMAP */
21
22#if NDBM
23# include <ndbm.h>
24# ifdef R_FIRST

--- 3404 unchanged lines hidden (view full) ---

3429
3430 /* No connection yet, connect */
3431 if (!sm_ldap_start(map->map_mname, lmap))
3432 {
3433 if (errno == ETIMEDOUT)
3434 {
3435 if (LogLevel > 1)
3436 sm_syslog(LOG_NOTICE, CurEnv->e_id,
3437 "timeout conning to LDAP server %.100s",
3437 "timeout connecting to LDAP server %.100s",
3438 id);
3439 }
3440
3441 if (!bitset(MF_OPTIONAL, map->map_mflags))
3442 {
3443 if (bitset(MF_NODEFER, map->map_mflags))
3444 {
3445 syserr("%s failed to %s in map %s",

--- 312 unchanged lines hidden (view full) ---

3758 }
3759
3760 errno = save_errno;
3761 if (*statp != EX_OK && *statp != EX_NOTFOUND)
3762 {
3763 if (!bitset(MF_OPTIONAL, map->map_mflags))
3764 {
3765 if (bitset(MF_NODEFER, map->map_mflags))
3438 id);
3439 }
3440
3441 if (!bitset(MF_OPTIONAL, map->map_mflags))
3442 {
3443 if (bitset(MF_NODEFER, map->map_mflags))
3444 {
3445 syserr("%s failed to %s in map %s",

--- 312 unchanged lines hidden (view full) ---

3758 }
3759
3760 errno = save_errno;
3761 if (*statp != EX_OK && *statp != EX_NOTFOUND)
3762 {
3763 if (!bitset(MF_OPTIONAL, map->map_mflags))
3764 {
3765 if (bitset(MF_NODEFER, map->map_mflags))
3766 syserr("Error getting LDAP results in map %s",
3767 map->map_mname);
3766 syserr("Error getting LDAP results, map=%s, name=%s",
3767 map->map_mname, name);
3768 else
3768 else
3769 syserr("451 4.3.5 Error getting LDAP results in map %s",
3770 map->map_mname);
3769 syserr("451 4.3.5 Error getting LDAP results, map=%s, name=%s",
3770 map->map_mname, name);
3771 }
3772 errno = save_errno;
3773 return NULL;
3774 }
3775
3776 /* Did we match anything? */
3777 if (vp == NULL && !bitset(MF_MATCHONLY, map->map_mflags))
3778 return NULL;
3779
3780 if (*statp == EX_OK)
3781 {
3782 if (LogLevel > 9)
3783 sm_syslog(LOG_INFO, CurEnv->e_id,
3771 }
3772 errno = save_errno;
3773 return NULL;
3774 }
3775
3776 /* Did we match anything? */
3777 if (vp == NULL && !bitset(MF_MATCHONLY, map->map_mflags))
3778 return NULL;
3779
3780 if (*statp == EX_OK)
3781 {
3782 if (LogLevel > 9)
3783 sm_syslog(LOG_INFO, CurEnv->e_id,
3784 "ldap %.100s => %s", name,
3784 "ldap=%s, %.100s=>%s", map->map_mname, name,
3785 vp == NULL ? "<NULL>" : vp);
3786 if (bitset(MF_MATCHONLY, map->map_mflags))
3787 result = map_rewrite(map, name, strlen(name), NULL);
3788 else
3789 {
3790 /* vp != NULL according to test above */
3791 result = map_rewrite(map, vp, strlen(vp), av);
3792 }

--- 4221 unchanged lines hidden ---
3785 vp == NULL ? "<NULL>" : vp);
3786 if (bitset(MF_MATCHONLY, map->map_mflags))
3787 result = map_rewrite(map, name, strlen(name), NULL);
3788 else
3789 {
3790 /* vp != NULL according to test above */
3791 result = map_rewrite(map, vp, strlen(vp), av);
3792 }

--- 4221 unchanged lines hidden ---