Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tero Saarni
OpenLDAP
Commits
889f6325
Commit
889f6325
authored
Feb 17, 2009
by
Quanah Gibson-Mount
Browse files
ITS#5947
parent
634d042a
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
889f6325
OpenLDAP 2.4 Change Log
OpenLDAP 2.4.15 Engineering
Fixed slapd corrupt contextCSN (ITS#5947)
OpenLDAP 2.4.14 Release (2009/02/14)
Added libldap option to disable SASL host canonicalization (ITS#5812)
...
...
servers/slapd/ctxcsn.c
View file @
889f6325
...
...
@@ -30,6 +30,7 @@ const struct berval slap_ldapsync_bv = BER_BVC("ldapsync");
const
struct
berval
slap_ldapsync_cn_bv
=
BER_BVC
(
"cn=ldapsync"
);
int
slap_serverID
;
/* maxcsn->bv_val must point to a char buf[LDAP_LUTIL_CSNSTR_BUFSIZE] */
void
slap_get_commit_csn
(
Operation
*
op
,
...
...
@@ -41,7 +42,8 @@ slap_get_commit_csn(
BackendDB
*
be
=
op
->
o_bd
->
bd_self
;
if
(
maxcsn
)
{
BER_BVZERO
(
maxcsn
);
assert
(
maxcsn
->
bv_val
!=
NULL
);
assert
(
maxcsn
->
bv_len
>=
LDAP_LUTIL_CSNSTR_BUFSIZE
);
}
if
(
foundit
)
{
*
foundit
=
0
;
...
...
@@ -62,7 +64,17 @@ slap_get_commit_csn(
if
(
csne
->
ce_state
==
SLAP_CSN_PENDING
)
break
;
}
if
(
committed_csne
&&
maxcsn
)
*
maxcsn
=
committed_csne
->
ce_csn
;
if
(
maxcsn
)
{
if
(
committed_csne
)
{
if
(
committed_csne
->
ce_csn
.
bv_len
<
maxcsn
->
bv_len
)
maxcsn
->
bv_len
=
committed_csne
->
ce_csn
.
bv_len
;
AC_MEMCPY
(
maxcsn
->
bv_val
,
committed_csne
->
ce_csn
.
bv_val
,
maxcsn
->
bv_len
+
1
);
}
else
{
maxcsn
->
bv_len
=
0
;
maxcsn
->
bv_val
[
0
]
=
0
;
}
}
ldap_pvt_thread_mutex_unlock
(
&
be
->
be_pcl_mutex
);
}
...
...
servers/slapd/overlays/syncprov.c
View file @
889f6325
...
...
@@ -28,6 +28,10 @@
#include
"config.h"
#include
"ldap_rq.h"
#ifdef LDAP_DEVEL
#define CHECK_CSN 1
#endif
/* A modify request on a particular entry */
typedef
struct
modinst
{
struct
modinst
*
mi_next
;
...
...
@@ -704,6 +708,10 @@ again:
switch
(
mode
)
{
case
FIND_MAXCSN
:
if
(
ber_bvcmp
(
&
si
->
si_ctxcsn
[
maxid
],
&
maxcsn
))
{
#ifdef CHECK_CSN
Syntax
*
syn
=
slap_schema
.
si_ad_contextCSN
->
ad_type
->
sat_syntax
;
assert
(
!
syn
->
ssyn_validate
(
syn
,
&
maxcsn
));
#endif
ber_bvreplace
(
&
si
->
si_ctxcsn
[
maxid
],
&
maxcsn
);
si
->
si_numops
++
;
/* ensure a checkpoint */
}
...
...
@@ -1339,7 +1347,14 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on )
SlapReply
rsm
=
{
0
};
slap_callback
cb
=
{
0
};
BackendDB
be
;
#ifdef CHECK_CSN
Syntax
*
syn
=
slap_schema
.
si_ad_contextCSN
->
ad_type
->
sat_syntax
;
int
i
;
for
(
i
=
0
;
i
<
si
->
si_numcsns
;
i
++
)
{
assert
(
!
syn
->
ssyn_validate
(
syn
,
si
->
si_ctxcsn
+
i
));
}
#endif
mod
.
sml_numvals
=
si
->
si_numcsns
;
mod
.
sml_values
=
si
->
si_ctxcsn
;
mod
.
sml_nvalues
=
NULL
;
...
...
@@ -1367,6 +1382,11 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on )
if
(
mod
.
sml_next
!=
NULL
)
{
slap_mods_free
(
mod
.
sml_next
,
1
);
}
#ifdef CHECK_CSN
for
(
i
=
0
;
i
<
si
->
si_numcsns
;
i
++
)
{
assert
(
!
syn
->
ssyn_validate
(
syn
,
si
->
si_ctxcsn
+
i
));
}
#endif
}
static
void
...
...
@@ -1608,15 +1628,17 @@ syncprov_op_response( Operation *op, SlapReply *rs )
if
(
rs
->
sr_err
==
LDAP_SUCCESS
)
{
struct
berval
maxcsn
=
BER_BVNULL
;
struct
berval
maxcsn
;
char
cbuf
[
LDAP_LUTIL_CSNSTR_BUFSIZE
];
int
do_check
=
0
,
have_psearches
,
foundit
;
/* Update our context CSN */
cbuf
[
0
]
=
'\0'
;
maxcsn
.
bv_val
=
cbuf
;
maxcsn
.
bv_len
=
sizeof
(
cbuf
);
ldap_pvt_thread_rdwr_wlock
(
&
si
->
si_csn_rwlock
);
slap_get_commit_csn
(
op
,
&
maxcsn
,
&
foundit
);
if
(
BER_BVIS
NULL
(
&
maxcsn
)
&&
SLAP_GLUE_SUBORDINATE
(
op
->
o_bd
))
{
if
(
BER_BVIS
EMPTY
(
&
maxcsn
)
&&
SLAP_GLUE_SUBORDINATE
(
op
->
o_bd
))
{
/* syncrepl queues the CSN values in the db where
* it is configured , not where the changes are made.
* So look for a value in the glue db if we didn't
...
...
@@ -1624,12 +1646,17 @@ syncprov_op_response( Operation *op, SlapReply *rs )
*/
BackendDB
*
be
=
op
->
o_bd
;
op
->
o_bd
=
select_backend
(
&
be
->
be_nsuffix
[
0
],
1
);
maxcsn
.
bv_val
=
cbuf
;
maxcsn
.
bv_len
=
sizeof
(
cbuf
);
slap_get_commit_csn
(
op
,
&
maxcsn
,
&
foundit
);
op
->
o_bd
=
be
;
}
if
(
!
BER_BVIS
NULL
(
&
maxcsn
)
)
{
if
(
!
BER_BVIS
EMPTY
(
&
maxcsn
)
)
{
int
i
,
sid
;
strcpy
(
cbuf
,
maxcsn
.
bv_val
);
#ifdef CHECK_CSN
Syntax
*
syn
=
slap_schema
.
si_ad_contextCSN
->
ad_type
->
sat_syntax
;
assert
(
!
syn
->
ssyn_validate
(
syn
,
&
maxcsn
));
#endif
sid
=
slap_parse_csn_sid
(
&
maxcsn
);
for
(
i
=
0
;
i
<
si
->
si_numcsns
;
i
++
)
{
if
(
sid
==
si
->
si_sids
[
i
]
)
{
...
...
@@ -1685,8 +1712,7 @@ syncprov_op_response( Operation *op, SlapReply *rs )
/* only update consumer ctx if this is the greatest csn */
if
(
bvmatch
(
&
maxcsn
,
&
op
->
o_csn
))
{
opc
->
sctxcsn
.
bv_len
=
maxcsn
.
bv_len
;
opc
->
sctxcsn
.
bv_val
=
cbuf
;
opc
->
sctxcsn
=
maxcsn
;
}
/* Handle any persistent searches */
...
...
@@ -1750,6 +1776,7 @@ syncprov_op_compare( Operation *op, SlapReply *rs )
a
.
a_vals
=
si
->
si_ctxcsn
;
a
.
a_nvals
=
a
.
a_vals
;
a
.
a_numvals
=
si
->
si_numcsns
;
rs
->
sr_err
=
access_allowed
(
op
,
&
e
,
op
->
oq_compare
.
rs_ava
->
aa_desc
,
&
op
->
oq_compare
.
rs_ava
->
aa_value
,
ACL_COMPARE
,
NULL
);
...
...
servers/slapd/syncrepl.c
View file @
889f6325
...
...
@@ -2876,6 +2876,9 @@ syncrepl_updateCookie(
Backend
*
be
=
op
->
o_bd
;
Modifications
mod
;
struct
berval
first
=
BER_BVNULL
;
#ifdef CHECK_CSN
Syntax
*
syn
=
slap_schema
.
si_ad_contextCSN
->
ad_type
->
sat_syntax
;
#endif
int
rc
,
i
,
j
;
ber_len_t
len
;
...
...
@@ -2892,6 +2895,15 @@ syncrepl_updateCookie(
ldap_pvt_thread_mutex_lock
(
&
si
->
si_cookieState
->
cs_mutex
);
#ifdef CHECK_CSN
for
(
i
=
0
;
i
<
syncCookie
->
numcsns
;
i
++
)
{
assert
(
!
syn
->
ssyn_validate
(
syn
,
syncCookie
->
ctxcsn
+
i
));
}
for
(
i
=
0
;
i
<
si
->
si_cookieState
->
cs_num
;
i
++
)
{
assert
(
!
syn
->
ssyn_validate
(
syn
,
si
->
si_cookieState
->
cs_vals
+
i
));
}
#endif
/* clone the cookieState CSNs so we can Replace the whole thing */
mod
.
sml_numvals
=
si
->
si_cookieState
->
cs_num
;
mod
.
sml_values
=
op
->
o_tmpalloc
((
mod
.
sml_numvals
+
1
)
*
sizeof
(
struct
berval
),
op
->
o_tmpmemctx
);
...
...
@@ -2994,6 +3006,12 @@ syncrepl_updateCookie(
if
(
mod
.
sml_next
)
slap_mods_free
(
mod
.
sml_next
,
1
);
op
->
o_tmpfree
(
mod
.
sml_values
,
op
->
o_tmpmemctx
);
#ifdef CHECK_CSN
for
(
i
=
0
;
i
<
si
->
si_cookieState
->
cs_num
;
i
++
)
{
assert
(
!
syn
->
ssyn_validate
(
syn
,
si
->
si_cookieState
->
cs_vals
+
i
));
}
#endif
return
rc
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment