Deleted Added
full compact
mbdb.c (98121) mbdb.c (110560)
1/*
2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
9
10#include <sm/gen.h>
1/*
2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
9
10#include <sm/gen.h>
11SM_RCSID("@(#)$Id: mbdb.c,v 1.38 2002/04/05 22:59:56 gshapiro Exp $")
11SM_RCSID("@(#)$Id: mbdb.c,v 1.38.2.1 2002/11/20 22:59:06 gshapiro Exp $")
12
13#include <sys/param.h>
14
15#include <ctype.h>
16#include <errno.h>
17#include <pwd.h>
18#include <stdlib.h>
19#include <setjmp.h>
12
13#include <sys/param.h>
14
15#include <ctype.h>
16#include <errno.h>
17#include <pwd.h>
18#include <stdlib.h>
19#include <setjmp.h>
20#include <unistd.h>
20
21#include <sm/limits.h>
22#include <sm/conf.h>
23#include <sm/assert.h>
24#include <sm/bitops.h>
25#include <sm/errstring.h>
26#include <sm/heap.h>
27#include <sm/mbdb.h>

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

461 sep = strrchr(new, '@');
462 if (sep != NULL)
463 {
464 *sep++ = '\0';
465 LDAPLMAP.ldap_target = sep;
466 }
467 LDAPLMAP.ldap_base = new;
468 }
21
22#include <sm/limits.h>
23#include <sm/conf.h>
24#include <sm/assert.h>
25#include <sm/bitops.h>
26#include <sm/errstring.h>
27#include <sm/heap.h>
28#include <sm/mbdb.h>

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

462 sep = strrchr(new, '@');
463 if (sep != NULL)
464 {
465 *sep++ = '\0';
466 LDAPLMAP.ldap_target = sep;
467 }
468 LDAPLMAP.ldap_base = new;
469 }
469
470 /* No connection yet, connect */
471 if (!sm_ldap_start(MBDB_LDAP_LABEL, &LDAPLMAP))
472 return EX_UNAVAILABLE;
473 return EX_OK;
474}
475
476
477/*
478** MBDB_LDAP_LOOKUP -- look up a local mail recipient, given name
479**
480** Parameters:

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

513
514 if (LDAPLMAP.ldap_filter == NULL)
515 {
516 /* map not initialized, but don't have arg here */
517 errno = EFAULT;
518 return EX_TEMPFAIL;
519 }
520
470 return EX_OK;
471}
472
473
474/*
475** MBDB_LDAP_LOOKUP -- look up a local mail recipient, given name
476**
477** Parameters:

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

510
511 if (LDAPLMAP.ldap_filter == NULL)
512 {
513 /* map not initialized, but don't have arg here */
514 errno = EFAULT;
515 return EX_TEMPFAIL;
516 }
517
518 if (LDAPLMAP.ldap_pid != getpid())
519 {
520 /* re-open map in this child process */
521 LDAPLMAP.ldap_ld = NULL;
522 }
523
521 if (LDAPLMAP.ldap_ld == NULL)
522 {
523 /* map not open, try to open now */
524 if (!sm_ldap_start(MBDB_LDAP_LABEL, &LDAPLMAP))
525 return EX_TEMPFAIL;
526 }
527
528 sm_ldap_setopts(LDAPLMAP.ldap_ld, &LDAPLMAP);

--- 243 unchanged lines hidden ---
524 if (LDAPLMAP.ldap_ld == NULL)
525 {
526 /* map not open, try to open now */
527 if (!sm_ldap_start(MBDB_LDAP_LABEL, &LDAPLMAP))
528 return EX_TEMPFAIL;
529 }
530
531 sm_ldap_setopts(LDAPLMAP.ldap_ld, &LDAPLMAP);

--- 243 unchanged lines hidden ---