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

« back to all changes in this revision

Viewing changes to debian/patches/corrupt-contextcsn

  • 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.orig/servers/slapd/ctxcsn.c        2009/01/22 00:01:01     1.40.2.11
 
2
+++ openldap/servers/slapd/ctxcsn.c     2009/02/17 00:06:01     1.40.2.12
 
3
@@ -1,5 +1,5 @@
 
4
 /* ctxcsn.c -- Context CSN Management Routines */
 
5
-/* $OpenLDAP: pkg/ldap/servers/slapd/ctxcsn.c,v 1.40.2.11 2009/01/22 00:01:01 kurt Exp $ */
 
6
+/* $OpenLDAP: pkg/ldap/servers/slapd/ctxcsn.c,v 1.40.2.12 2009/02/17 00:06:01 quanah Exp $ */
 
7
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 
8
  *
 
9
  * Copyright 2003-2009 The OpenLDAP Foundation.
 
10
@@ -30,6 +30,7 @@
 
11
 const struct berval slap_ldapsync_cn_bv = BER_BVC("cn=ldapsync");
 
12
 int slap_serverID;
 
13
 
 
14
+/* maxcsn->bv_val must point to a char buf[LDAP_LUTIL_CSNSTR_BUFSIZE] */
 
15
 void
 
16
 slap_get_commit_csn(
 
17
        Operation *op,
 
18
@@ -41,7 +42,8 @@
 
19
        BackendDB *be = op->o_bd->bd_self;
 
20
 
 
21
        if ( maxcsn ) {
 
22
-               BER_BVZERO( maxcsn );
 
23
+               assert( maxcsn->bv_val != NULL );
 
24
+               assert( maxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE );
 
25
        }
 
26
        if ( foundit ) {
 
27
                *foundit = 0;
 
28
@@ -62,7 +64,17 @@
 
29
                if ( csne->ce_state == SLAP_CSN_PENDING ) break;
 
30
        }
 
31
 
 
32
-       if ( committed_csne && maxcsn ) *maxcsn = committed_csne->ce_csn;
 
33
+       if ( maxcsn ) {
 
34
+               if ( committed_csne ) {
 
35
+                       if ( committed_csne->ce_csn.bv_len < maxcsn->bv_len )
 
36
+                               maxcsn->bv_len = committed_csne->ce_csn.bv_len;
 
37
+                       AC_MEMCPY( maxcsn->bv_val, committed_csne->ce_csn.bv_val,
 
38
+                               maxcsn->bv_len+1 );
 
39
+               } else {
 
40
+                       maxcsn->bv_len = 0;
 
41
+                       maxcsn->bv_val[0] = 0;
 
42
+               }
 
43
+       }
 
44
        ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex );
 
45
 }
 
46
 
 
47
--- openldap.orig/servers/slapd/syncrepl.c      2009/02/10 16:43:11     1.254.2.61
 
48
+++ openldap/servers/slapd/syncrepl.c   2009/02/17 00:06:01     1.254.2.62
 
49
@@ -1,5 +1,5 @@
 
50
 /* syncrepl.c -- Replication Engine which uses the LDAP Sync protocol */
 
51
-/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.254.2.61 2009/02/10 16:43:11 quanah Exp $ */
 
52
+/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.254.2.62 2009/02/17 00:06:01 quanah Exp $ */
 
53
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 
54
  *
 
55
  * Copyright 2003-2009 The OpenLDAP Foundation.
 
56
@@ -2876,6 +2876,9 @@
 
57
        Backend *be = op->o_bd;
 
58
        Modifications mod;
 
59
        struct berval first = BER_BVNULL;
 
60
+#ifdef CHECK_CSN
 
61
+       Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
 
62
+#endif
 
63
 
 
64
        int rc, i, j;
 
65
        ber_len_t len;
 
66
@@ -2892,6 +2895,15 @@
 
67
 
 
68
        ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
 
69
 
 
70
+#ifdef CHECK_CSN
 
71
+       for ( i=0; i<syncCookie->numcsns; i++ ) {
 
72
+               assert( !syn->ssyn_validate( syn, syncCookie->ctxcsn+i ));
 
73
+       }
 
74
+       for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
 
75
+               assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
 
76
+       }
 
77
+#endif
 
78
+
 
79
        /* clone the cookieState CSNs so we can Replace the whole thing */
 
80
        mod.sml_numvals = si->si_cookieState->cs_num;
 
81
        mod.sml_values = op->o_tmpalloc(( mod.sml_numvals+1 )*sizeof(struct berval), op->o_tmpmemctx );
 
82
@@ -2993,6 +3005,12 @@
 
83
        BER_BVZERO( &op->o_csn );
 
84
        if ( mod.sml_next ) slap_mods_free( mod.sml_next, 1 );
 
85
        op->o_tmpfree( mod.sml_values, op->o_tmpmemctx );
 
86
+
 
87
+#ifdef CHECK_CSN
 
88
+       for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
 
89
+               assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
 
90
+       }
 
91
+#endif
 
92
 
 
93
        return rc;
 
94
 }
 
95
--- openldap.orig/servers/slapd/overlays/syncprov.c     2009/01/30 18:49:57     1.147.2.44
 
96
+++ openldap/servers/slapd/overlays/syncprov.c  2009/02/17 00:06:01     1.147.2.45
 
97
@@ -1,4 +1,4 @@
 
98
-/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.147.2.44 2009/01/30 18:49:57 quanah Exp $ */
 
99
+/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.147.2.45 2009/02/17 00:06:01 quanah Exp $ */
 
100
 /* syncprov.c - syncrepl provider */
 
101
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 
102
  *
 
103
@@ -28,6 +28,10 @@
 
104
 #include "config.h"
 
105
 #include "ldap_rq.h"
 
106
 
 
107
+#ifdef LDAP_DEVEL
 
108
+#define        CHECK_CSN       1
 
109
+#endif
 
110
+
 
111
 /* A modify request on a particular entry */
 
112
 typedef struct modinst {
 
113
        struct modinst *mi_next;
 
114
@@ -704,6 +708,10 @@
 
115
        switch( mode ) {
 
116
        case FIND_MAXCSN:
 
117
                if ( ber_bvcmp( &si->si_ctxcsn[maxid], &maxcsn )) {
 
118
+#ifdef CHECK_CSN
 
119
+                       Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
 
120
+                       assert( !syn->ssyn_validate( syn, &maxcsn ));
 
121
+#endif
 
122
                        ber_bvreplace( &si->si_ctxcsn[maxid], &maxcsn );
 
123
                        si->si_numops++;        /* ensure a checkpoint */
 
124
                }
 
125
@@ -1339,7 +1347,14 @@
 
126
        SlapReply rsm = { 0 };
 
127
        slap_callback cb = {0};
 
128
        BackendDB be;
 
129
+#ifdef CHECK_CSN
 
130
+       Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
 
131
 
 
132
+       int i;
 
133
+       for ( i=0; i<si->si_numcsns; i++ ) {
 
134
+               assert( !syn->ssyn_validate( syn, si->si_ctxcsn+i ));
 
135
+       }
 
136
+#endif
 
137
        mod.sml_numvals = si->si_numcsns;
 
138
        mod.sml_values = si->si_ctxcsn;
 
139
        mod.sml_nvalues = NULL;
 
140
@@ -1367,6 +1382,11 @@
 
141
        if ( mod.sml_next != NULL ) {
 
142
                slap_mods_free( mod.sml_next, 1 );
 
143
        }
 
144
+#ifdef CHECK_CSN
 
145
+       for ( i=0; i<si->si_numcsns; i++ ) {
 
146
+               assert( !syn->ssyn_validate( syn, si->si_ctxcsn+i ));
 
147
+       }
 
148
+#endif
 
149
 }
 
150
 
 
151
 static void
 
152
@@ -1608,15 +1628,17 @@
 
153
 
 
154
        if ( rs->sr_err == LDAP_SUCCESS )
 
155
        {
 
156
-               struct berval maxcsn = BER_BVNULL;
 
157
+               struct berval maxcsn;
 
158
                char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
 
159
                int do_check = 0, have_psearches, foundit;
 
160
 
 
161
                /* Update our context CSN */
 
162
                cbuf[0] = '\0';
 
163
+               maxcsn.bv_val = cbuf;
 
164
+               maxcsn.bv_len = sizeof(cbuf);
 
165
                ldap_pvt_thread_rdwr_wlock( &si->si_csn_rwlock );
 
166
                slap_get_commit_csn( op, &maxcsn, &foundit );
 
167
-               if ( BER_BVISNULL( &maxcsn ) && SLAP_GLUE_SUBORDINATE( op->o_bd )) {
 
168
+               if ( BER_BVISEMPTY( &maxcsn ) && SLAP_GLUE_SUBORDINATE( op->o_bd )) {
 
169
                        /* syncrepl queues the CSN values in the db where
 
170
                         * it is configured , not where the changes are made.
 
171
                         * So look for a value in the glue db if we didn't
 
172
@@ -1624,12 +1646,17 @@
 
173
                         */
 
174
                        BackendDB *be = op->o_bd;
 
175
                        op->o_bd = select_backend( &be->be_nsuffix[0], 1);
 
176
+                       maxcsn.bv_val = cbuf;
 
177
+                       maxcsn.bv_len = sizeof(cbuf);
 
178
                        slap_get_commit_csn( op, &maxcsn, &foundit );
 
179
                        op->o_bd = be;
 
180
                }
 
181
-               if ( !BER_BVISNULL( &maxcsn ) ) {
 
182
+               if ( !BER_BVISEMPTY( &maxcsn ) ) {
 
183
                        int i, sid;
 
184
-                       strcpy( cbuf, maxcsn.bv_val );
 
185
+#ifdef CHECK_CSN
 
186
+                       Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
 
187
+                       assert( !syn->ssyn_validate( syn, &maxcsn ));
 
188
+#endif
 
189
                        sid = slap_parse_csn_sid( &maxcsn );
 
190
                        for ( i=0; i<si->si_numcsns; i++ ) {
 
191
                                if ( sid == si->si_sids[i] ) {
 
192
@@ -1685,8 +1712,7 @@
 
193
 
 
194
                /* only update consumer ctx if this is the greatest csn */
 
195
                if ( bvmatch( &maxcsn, &op->o_csn )) {
 
196
-                       opc->sctxcsn.bv_len = maxcsn.bv_len;
 
197
-                       opc->sctxcsn.bv_val = cbuf;
 
198
+                       opc->sctxcsn = maxcsn;
 
199
                }
 
200
 
 
201
                /* Handle any persistent searches */
 
202
@@ -1750,6 +1776,7 @@
 
203
 
 
204
                a.a_vals = si->si_ctxcsn;
 
205
                a.a_nvals = a.a_vals;
 
206
+               a.a_numvals = si->si_numcsns;
 
207
 
 
208
                rs->sr_err = access_allowed( op, &e, op->oq_compare.rs_ava->aa_desc,
 
209
                        &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL );