Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
6659cf3e
Commit
6659cf3e
authored
Aug 14, 2003
by
Jong Hyuk Choi
Browse files
LDAP Sync protocol change : state mode (add+present) and log mode (add+delete)
parent
fcc59c64
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/ldap.h
View file @
6659cf3e
...
...
@@ -209,8 +209,14 @@ typedef struct ldapcontrol {
#define LDAP_CONTROL_SYNC_DONE "1.3.6.1.4.1.4203.666.5.8"
#define LDAP_SYNC_INFO "1.3.6.1.4.1.4203.666.10.2"
#define LDAP_SYNC_REFRESH_DONE 0
#define LDAP_SYNC_NEW_COOKIE 1
#define LDAP_SYNC_NEW_COOKIE 0
#define LDAP_SYNC_STATE_MODE_DONE 1
#define LDAP_SYNC_LOG_MODE_DONE 2
#define LDAP_SYNC_REFRESH_DONE 3
#define LDAP_SYNC_STATE_MODE 0
#define LDAP_SYNC_LOG_MODE 1
#define LDAP_SYNC_PERSIST_MODE 2
#define LDAP_SYNC_PRESENT 0
#define LDAP_SYNC_ADD 1
...
...
servers/slapd/back-bdb/search.c
View file @
6659cf3e
...
...
@@ -380,8 +380,8 @@ int bdb_search( Operation *op, SlapReply *rs )
AttributeName
*
attrs
;
#ifdef LDAP_SYNC
Filter
cookief
,
csnfnot
,
csnfeq
,
csnfand
,
csnfge
;
AttributeAssertion
aa_ge
,
aa_eq
;
Filter
cookief
,
csnfnot
,
csnfeq
,
csnfand
,
csnfge
,
omitcsnf
,
omitcsnfle
;
AttributeAssertion
aa_ge
,
aa_eq
,
aa_le
;
int
entry_count
=
0
;
#if 0
struct berval entrycsn_bv = { 0, NULL };
...
...
@@ -1230,13 +1230,18 @@ loop_continue:
if
(
!
IS_PSEARCH
)
{
#ifdef LDAP_SYNC
if
(
sop
->
o_sync_mode
&
SLAP_SYNC_REFRESH
)
{
rs
->
sr_err
=
LDAP_SUCCESS
;
rs
->
sr_rspoid
=
LDAP_SYNC_INFO
;
rs
->
sr_ctrls
=
NULL
;
bdb_send_ldap_intermediate
(
sop
,
rs
,
LDAP_SYNC_STATE_MODE_DONE
,
&
latest_entrycsn_bv
);
/* If changelog is supported, this is where to process it */
if
(
sop
->
o_sync_mode
&
SLAP_SYNC_PERSIST
)
{
/* refreshAndPersist mode */
rs
->
sr_err
=
LDAP_SUCCESS
;
rs
->
sr_rspoid
=
LDAP_SYNC_INFO
;
rs
->
sr_ctrls
=
NULL
;
bdb_send_ldap_intermediate
(
sop
,
rs
,
LDAP_SYNC_
REFRESH
_DONE
,
&
latest_entrycsn_bv
);
LDAP_SYNC_
LOG_MODE
_DONE
,
&
latest_entrycsn_bv
);
}
else
{
/* refreshOnly mode */
bdb_build_sync_done_ctrl
(
sop
,
rs
,
ctrls
,
...
...
servers/slapd/config.c
View file @
6659cf3e
...
...
@@ -2767,6 +2767,7 @@ add_syncrepl(
si
->
slimit
=
-
1
;
si
->
syncUUID
=
NULL
;
si
->
syncUUID_ndn
=
NULL
;
si
->
sync_mode
=
LDAP_SYNC_STATE_MODE
;
si
->
presentlist
=
NULL
;
LDAP_LIST_INIT
(
&
si
->
nonpresentlist
);
...
...
servers/slapd/slap.h
View file @
6659cf3e
...
...
@@ -1337,6 +1337,7 @@ typedef struct syncinfo_s {
struct
berval
*
syncUUID
;
struct
berval
*
syncUUID_ndn
;
Avlnode
*
presentlist
;
int
sync_mode
;
LDAP_LIST_HEAD
(
np
,
nonpresent_entry
)
nonpresentlist
;
}
syncinfo_t
;
...
...
servers/slapd/syncrepl.c
View file @
6659cf3e
...
...
@@ -247,6 +247,8 @@ do_syncrepl(
return
NULL
;
}
si
->
sync_mode
=
LDAP_SYNC_STATE_MODE
;
/* Init connection to master */
rc
=
ldap_initialize
(
&
ld
,
si
->
provideruri
);
...
...
@@ -538,7 +540,8 @@ do_syncrepl(
if
(
syncCookie
.
bv_len
)
{
syncrepl_updateCookie
(
si
,
ld
,
&
op
,
&
psub
,
&
syncCookie
);
}
syncrepl_del_nonpresent
(
ld
,
&
op
);
if
(
si
->
sync_mode
==
LDAP_SYNC_STATE_MODE
)
syncrepl_del_nonpresent
(
ld
,
&
op
);
if
(
ctrl_ber
)
ber_free
(
ctrl_ber
,
1
);
goto
done
;
...
...
@@ -553,9 +556,15 @@ do_syncrepl(
res_ber
=
ber_init
(
retdata
);
ber_scanf
(
res_ber
,
"{e"
/*"}"*/
,
&
syncstate
);
if
(
syncstate
==
LDAP_SYNC_
REFRESH
_DONE
)
{
if
(
syncstate
==
LDAP_SYNC_
STATE_MODE
_DONE
)
{
syncrepl_del_nonpresent
(
ld
,
&
op
);
}
else
if
(
syncstate
!=
LDAP_SYNC_NEW_COOKIE
)
{
si
->
sync_mode
=
LDAP_SYNC_LOG_MODE
;
}
else
if
(
syncstate
==
LDAP_SYNC_LOG_MODE_DONE
)
{
si
->
sync_mode
=
LDAP_SYNC_PERSIST_MODE
;
}
else
if
(
syncstate
==
LDAP_SYNC_REFRESH_DONE
)
{
si
->
sync_mode
=
LDAP_SYNC_PERSIST_MODE
;
}
else
if
(
syncstate
!=
LDAP_SYNC_NEW_COOKIE
||
syncstate
!=
LDAP_SYNC_LOG_MODE_DONE
)
{
#ifdef NEW_LOGGING
LDAP_LOG
(
OPERATION
,
ERR
,
"do_syncrepl : unknown sync info
\n
"
,
0
,
0
,
0
);
...
...
@@ -986,7 +995,7 @@ syncrepl_entry(
cb
.
sc_response
=
null_callback
;
cb
.
sc_private
=
si
;
if
(
rc
==
LDAP_SUCCESS
&&
si
->
syncUUID_ndn
)
{
if
(
rc
==
LDAP_SUCCESS
&&
si
->
syncUUID_ndn
&&
si
->
sync_mode
!=
LDAP_SYNC_LOG_MODE
)
{
op
->
o_req_dn
=
*
si
->
syncUUID_ndn
;
op
->
o_req_ndn
=
*
si
->
syncUUID_ndn
;
op
->
o_tag
=
LDAP_REQ_DELETE
;
...
...
@@ -1062,7 +1071,13 @@ syncrepl_entry(
}
case
LDAP_SYNC_DELETE
:
/* Already deleted */
if
(
si
->
sync_mode
==
LDAP_SYNC_LOG_MODE
)
{
op
->
o_req_dn
=
*
si
->
syncUUID_ndn
;
op
->
o_req_ndn
=
*
si
->
syncUUID_ndn
;
op
->
o_tag
=
LDAP_REQ_DELETE
;
rc
=
be
->
be_delete
(
op
,
&
rs
);
}
/* Already deleted otherwise */
return
1
;
default
:
...
...
tests/scripts/test020-syncreplication-cascading
View file @
6659cf3e
...
...
@@ -205,8 +205,8 @@ if test $RC != 0 ; then
exit
$RC
fi
echo
"Waiting
3
0 seconds for syncrepl to receive changes..."
sleep
3
0
echo
"Waiting
6
0 seconds for syncrepl to receive changes..."
sleep
6
0
echo
"Using ldapmodify to modify master directory..."
...
...
@@ -287,8 +287,8 @@ changetype: delete
EOMODS
echo
"Waiting
3
0 seconds for syncrepl to receive changes..."
sleep
3
0
echo
"Waiting
6
0 seconds for syncrepl to receive changes..."
sleep
6
0
echo
"Using ldapsearch to read all the entries from the master..."
$LDAPSEARCH
-S
""
-b
"
$BASEDN
"
-h
$LOCALHOST
-p
$PORT
\
...
...
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