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

« back to all changes in this revision

Viewing changes to servers/slapd/slapadd.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/slapadd.c,v 1.36.2.7 2008/04/14 21:15:47 quanah Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/servers/slapd/slapadd.c,v 1.36.2.11 2009/02/05 20:11:00 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 1998-2003 Kurt D. Zeilenga.
6
6
 * Portions Copyright 2003 IBM Corporation.
7
7
 * All rights reserved.
35
35
#include <lber.h>
36
36
#include <ldif.h>
37
37
#include <lutil.h>
 
38
#include <lutil_meter.h>
 
39
#include <sys/stat.h>
38
40
 
39
41
#include "slapcommon.h"
40
42
 
67
69
        int rc = EXIT_SUCCESS;
68
70
        int manage = 0; 
69
71
 
 
72
        int enable_meter = 0;
 
73
        lutil_meter_t meter;
 
74
        struct stat stat_buf;
 
75
 
70
76
        /* default "000" */
71
77
        csnsid = 0;
72
78
 
 
79
        if ( isatty (2) ) enable_meter = 1;
73
80
        slap_tool_init( progname, SLAPADD, argc, argv );
74
81
 
75
82
        memset( &opbuf, 0, sizeof(opbuf) );
118
125
                }
119
126
        }
120
127
 
 
128
        if ( enable_meter 
 
129
#ifdef LDAP_DEBUG
 
130
                /* tools default to "none" */
 
131
                && slap_debug == LDAP_DEBUG_NONE
 
132
#endif
 
133
                && !fstat ( fileno ( ldiffp->fp ), &stat_buf )
 
134
                && S_ISREG(stat_buf.st_mode) ) {
 
135
                enable_meter = !lutil_meter_open(
 
136
                        &meter,
 
137
                        &lutil_meter_text_display,
 
138
                        &lutil_meter_linear_estimator,
 
139
                        stat_buf.st_size);
 
140
        } else {
 
141
                enable_meter = 0;
 
142
        }
 
143
 
121
144
        /* nextline is the line number of the end of the current entry */
122
145
        for( lineno=1; ldif_read_record( ldiffp, &nextline, &buf, &lmax );
123
146
                lineno=nextline+1 ) {
128
151
 
129
152
                e = str2entry2( buf, checkvals );
130
153
 
 
154
                if ( enable_meter )
 
155
                        lutil_meter_update( &meter,
 
156
                                         ftell( ldiffp->fp ),
 
157
                                         0);
 
158
 
131
159
                /*
132
160
                 * Initialize text buffer
133
161
                 */
192
220
                        op->o_bd = be;
193
221
 
194
222
                        if ( (slapMode & SLAP_TOOL_NO_SCHEMA_CHECK) == 0) {
195
 
                                rc = entry_schema_check( op, e, NULL, manage, 1,
 
223
                                rc = entry_schema_check( op, e, NULL, manage, 1, NULL,
196
224
                                        &text, textbuf, textlen );
197
225
 
198
226
                                if( rc != LDAP_SUCCESS ) {
345
373
        bvtext.bv_val = textbuf;
346
374
        bvtext.bv_val[0] = '\0';
347
375
 
 
376
        if ( enable_meter ) {
 
377
                lutil_meter_update( &meter, ftell( ldiffp->fp ), 1);
 
378
                lutil_meter_close( &meter );
 
379
        }
 
380
 
348
381
        if ( rc == EXIT_SUCCESS && update_ctxcsn && !dryrun && sid != SLAP_SYNC_SID_MAX + 1 ) {
349
382
                ctxcsn_id = be->be_dn2id_get( be, be->be_nsuffix );
350
383
                if ( ctxcsn_id == NOID ) {
438
471
        ch_free( buf );
439
472
 
440
473
        if ( !dryrun ) {
 
474
                if ( enable_meter ) {
 
475
                        fprintf( stderr, "Closing DB..." );
 
476
                }
441
477
                if( be->be_entry_close( be ) ) {
442
478
                        rc = EXIT_FAILURE;
443
479
                }
445
481
                if( be->be_sync ) {
446
482
                        be->be_sync( be );
447
483
                }
 
484
                if ( enable_meter ) {
 
485
                        fprintf( stderr, "\n" );
 
486
                }
448
487
        }
449
488
 
450
 
        slap_tool_destroy();
 
489
        if ( slap_tool_destroy())
 
490
                rc = EXIT_FAILURE;
451
491
 
452
492
        return rc;
453
493
}