~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to servers/slapd/daemon.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-02-18 18:44:00 UTC
  • mfrom: (1.1.2 upstream) (0.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090218184400-zw4mjse9eywt5566
Tags: 2.4.14-0ubuntu1
[ Steve Langasek ]
* New upstream version
  - Fixes a bug with the pcache overlay not returning cached entries
    (closes: #497697)
  - Update evolution-ntlm patch to apply to current Makefiles.
  - (tentatively) drop gnutls-ciphers, since this bug was reported to be
    fixed upstream in 2.4.8.  The fix applied in 2.4.8 didn't match the
    patch from the bug report, so this should be watched for regressions.
* Build against db4.7 instead of db4.2 at last!  Closes: #421946.
* Build with --disable-ndb, to avoid a misbuild when libmysqlclient is
  installed in the build environment.
* New patch, no-crlcheck-for-gnutls, to fix a build failure when using
  --with-tls=gnutls.

[ Mathias Gug ]
* Merge from debian unstable, remaining changes:
  - debian/apparmor-profile: add AppArmor profile
  - debian/slapd.postinst: Reload AA profile on configuration
  - updated debian/slapd.README.Debian for note on AppArmor
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
  - debian/control: Conflicts with apparmor-profiles << 2.1+1075-0ubuntu4
    to make sure that if earlier version of apparmour-profiles gets
    installed it won't overwrite our profile.
  - Modify Maintainer value to match the DebianMaintainerField
    speficication.
  - follow ApparmorProfileMigration and force apparmor compalin mode on 
    some upgrades (LP: #203529)
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - debian/slapd.preinst: create symlink for force-complain on pre-feisty
    upgrades, upgrades where apparmor-profiles profile is unchanged (ie
    non-enforcing) and upgrades where apparmor profile does not exist.
  - debian/slapd.postrm: remove symlink in force-complain/ on purge
  - debian/patches/fix-ucred-libc due to changes how newer glibc handle
    the ucred struct now.
  - debian/control:
    - Build-depend on libltdl7-dev rather then libltdl3-dev.
  - debian/patches/autogen.sh:
    - Call libtoolize with the --install option to install config.{guess,sub}
      files.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash (LP: #286063).
  - Disable the testsuite on hppa. Allows building of packages on this
    architecture again, once this package is in the archive.
    LP: #288908.
  - debian/slapd.postinst, debian/slapd.script-common: set correct ownership
    and permissions on /var/lib/ldap, /etc/ldap/slapd.d (group readable) and
    /var/run/slapd (world readable). (LP: #257667).
  - debian/patches/nssov-build, debian/rules: 
    Build and package the nss overlay.
    debian/schema/misc.ldif: add ldif file for the misc schema, which defines
    rfc822MailMember (required by the nss overlay).
  - debian/{control,rules}: enable PIE hardening
  - Use cn=config as the default configuration backend instead of 
    slapd.conf. Migrate slapd.conf  file to /etc/ldap/slapd.d/ on upgrade
    asking the end user to enter a new password to control the access to the
    cn=config tree.
* debian/patches/corrupt-contextCSN: The contextCSN can get corrupted at
  times. (ITS: #5947)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenLDAP: pkg/ldap/servers/slapd/daemon.c,v 1.380.2.12 2008/05/27 20:12:44 quanah Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/servers/slapd/daemon.c,v 1.380.2.22 2009/02/13 02:35:39 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
 
 * Copyright 1998-2008 The OpenLDAP Foundation.
 
4
 * Copyright 1998-2009 The OpenLDAP Foundation.
5
5
 * Portions Copyright 2007 by Howard Chu, Symas Corporation.
6
6
 * All rights reserved.
7
7
 *
79
79
#define SLAPD_LISTEN_BACKLOG 1024
80
80
#endif /* ! SLAPD_LISTEN_BACKLOG */
81
81
 
82
 
static ber_socket_t wake_sds[2];
 
82
static ber_socket_t wake_sds[2]
 
83
#ifdef HAVE_WINSOCK
 
84
        = { INVALID_SOCKET, INVALID_SOCKET }
 
85
#endif /* HAVE_WINSOCK */
 
86
        ;
83
87
static int emfile;
84
88
 
85
89
static volatile int waking;
1641
1645
slapd_daemon_destroy( void )
1642
1646
{
1643
1647
        connections_destroy();
1644
 
        tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
1645
 
        tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
 
1648
#ifdef HAVE_WINSOCK
 
1649
        if ( wake_sds[1] != INVALID_SOCKET && wake_sds[1] != wake_sds[0] )
 
1650
#endif /* HAVE_WINSOCK */
 
1651
                tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
 
1652
#ifdef HAVE_WINSOCK
 
1653
        if ( wake_sds[0] != INVALID_SOCKET )
 
1654
#endif /* HAVE_WINSOCK */
 
1655
                tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
1646
1656
        sockdestroy();
1647
1657
 
1648
1658
#ifdef HAVE_SLP
2291
2301
                                                Debug( LDAP_DEBUG_ANY,
2292
2302
                                                        "daemon: "
2293
2303
                                                        SLAP_EVENT_FNAME
2294
 
                                                        "failed count %d "
 
2304
                                                        " failed count %d "
2295
2305
                                                        "err (%d): %s\n",
2296
2306
                                                        ebadf, err,
2297
2307
                                                        sock_errstr( err ) );
2485
2495
#endif /* LDAP_DEBUG */
2486
2496
 
2487
2497
                for ( i = 0; i < ns; i++ ) {
2488
 
                        int rc = 1, fd;
 
2498
                        int rc = 1, fd, w = 0;
2489
2499
 
2490
2500
                        if ( SLAP_EVENT_IS_LISTENER( i ) ) {
2491
2501
                                rc = slap_listener_activate( SLAP_EVENT_LISTENER( i ) );
2503
2513
                                        char c[BUFSIZ];
2504
2514
                                        waking = 0;
2505
2515
                                        tcp_read( SLAP_FD2SOCK(wake_sds[0]), c, sizeof(c) );
2506
 
                                        break;
 
2516
                                        continue;
2507
2517
                                }
2508
2518
 
2509
2519
                                if ( SLAP_EVENT_IS_WRITE( i ) ) {
2512
2522
                                                fd, 0, 0 );
2513
2523
 
2514
2524
                                        SLAP_EVENT_CLR_WRITE( i );
 
2525
                                        w = 1;
2515
2526
 
2516
2527
                                        /*
2517
2528
                                         * NOTE: it is possible that the connection was closed
2531
2542
 
2532
2543
                                        SLAP_EVENT_CLR_READ( i );
2533
2544
                                        connection_read_activate( fd );
2534
 
                                } else {
 
2545
                                } else if ( !w ) {
2535
2546
                                        Debug( LDAP_DEBUG_CONNS,
2536
2547
                                                "daemon: hangup on %d\n", fd, 0, 0 );
 
2548
                                        if ( SLAP_SOCK_IS_ACTIVE( fd )) {
 
2549
#ifdef HAVE_EPOLL
 
2550
                                                /* Don't keep reporting the hangup
 
2551
                                                 */
 
2552
                                                SLAP_EPOLL_SOCK_SET( fd, EPOLLET );
 
2553
#endif
 
2554
                                                connection_hangup( fd );
 
2555
                                        }
2537
2556
                                }
2538
2557
                        }
2539
2558
                }
2572
2591
                connections_shutdown();
2573
2592
        }
2574
2593
 
2575
 
        Debug( LDAP_DEBUG_ANY,
2576
 
                "slapd shutdown: waiting for %d threads to terminate\n",
2577
 
                ldap_pvt_thread_pool_backload( &connection_pool ), 0, 0 );
 
2594
        if ( LogTest( LDAP_DEBUG_ANY )) {
 
2595
                int t = ldap_pvt_thread_pool_backload( &connection_pool );
 
2596
                Debug( LDAP_DEBUG_ANY,
 
2597
                        "slapd shutdown: waiting for %d operations/tasks to finish\n",
 
2598
                        t, 0, 0 );
 
2599
        }
2578
2600
        ldap_pvt_thread_pool_destroy( &connection_pool, 1 );
2579
2601
 
2580
2602
        free( slap_listeners );