Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Lowden
OpenLDAP
Commits
249422aa
Commit
249422aa
authored
13 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
ITS#6716 Keep CSN lists sorted by SID
parent
ceefe132
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
servers/slapd/ldapsync.c
+64
-0
64 additions, 0 deletions
servers/slapd/ldapsync.c
servers/slapd/proto-slap.h
+2
-0
2 additions, 0 deletions
servers/slapd/proto-slap.h
with
66 additions
and
0 deletions
servers/slapd/ldapsync.c
+
64
−
0
View file @
249422aa
...
...
@@ -166,6 +166,68 @@ slap_parse_csn_sids( BerVarray csns, int numcsns, void *memctx )
return
ret
;
}
static
slap_mr_match_func
sidsort_cmp
;
static
const
MatchingRule
sidsort_mr
=
{
{},
NULL
,
{},
{},
0
,
NULL
,
NULL
,
NULL
,
sidsort_cmp
};
static
const
AttributeType
sidsort_at
=
{
{},
{},
NULL
,
NULL
,
(
MatchingRule
*
)
&
sidsort_mr
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
SLAP_AT_SORTED_VAL
};
static
const
AttributeDescription
sidsort_ad
=
{
NULL
,
(
AttributeType
*
)
&
sidsort_at
};
static
int
sidsort_cmp
(
int
*
matchp
,
slap_mask_t
flags
,
Syntax
*
syntax
,
MatchingRule
*
mr
,
struct
berval
*
b1
,
void
*
v2
)
{
struct
berval
*
b2
=
v2
;
*
matchp
=
b1
->
bv_len
-
b2
->
bv_len
;
return
LDAP_SUCCESS
;
}
/* sort CSNs by SID. Use a fake Attribute with our own
* syntax and matching rule, which sorts the nvals by
* bv_len order. Stuff our sids into the bv_len.
*/
int
slap_sort_csn_sids
(
BerVarray
csns
,
int
*
sids
,
int
numcsns
,
void
*
memctx
)
{
Attribute
a
;
const
char
*
text
;
int
i
,
rc
;
a
.
a_desc
=
(
AttributeDescription
*
)
&
sidsort_ad
;
a
.
a_nvals
=
slap_sl_malloc
(
numcsns
*
sizeof
(
struct
berval
),
memctx
);
for
(
i
=
0
;
i
<
numcsns
;
i
++
)
{
a
.
a_nvals
[
i
].
bv_len
=
sids
[
i
];
a
.
a_nvals
[
i
].
bv_val
=
NULL
;
}
a
.
a_vals
=
csns
;
a
.
a_numvals
=
numcsns
;
a
.
a_flags
=
0
;
rc
=
slap_sort_vals
(
(
Modifications
*
)
&
a
,
&
text
,
&
i
,
memctx
);
for
(
i
=
0
;
i
<
numcsns
;
i
++
)
sids
[
i
]
=
a
.
a_nvals
[
i
].
bv_len
;
slap_sl_free
(
a
.
a_nvals
,
memctx
);
return
rc
;
}
int
slap_parse_sync_cookie
(
struct
sync_cookie
*
cookie
,
...
...
@@ -280,6 +342,8 @@ slap_parse_sync_cookie(
if
(
cookie
->
numcsns
)
{
cookie
->
sids
=
slap_parse_csn_sids
(
cookie
->
ctxcsn
,
cookie
->
numcsns
,
memctx
);
if
(
cookie
->
numcsns
>
1
)
slap_sort_csn_sids
(
cookie
->
ctxcsn
,
cookie
->
sids
,
cookie
->
numcsns
,
memctx
);
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/proto-slap.h
+
2
−
0
View file @
249422aa
...
...
@@ -1177,6 +1177,8 @@ LDAP_SLAPD_F (int) slap_parse_csn_sid LDAP_P((
struct
berval
*
));
LDAP_SLAPD_F
(
int
*
)
slap_parse_csn_sids
LDAP_P
((
BerVarray
,
int
,
void
*
memctx
));
LDAP_SLAPD_F
(
int
)
slap_sort_csn_sids
LDAP_P
((
BerVarray
,
int
*
,
int
,
void
*
memctx
));
LDAP_SLAPD_F
(
int
)
slap_parse_sync_cookie
LDAP_P
((
struct
sync_cookie
*
,
void
*
memctx
));
LDAP_SLAPD_F
(
int
)
slap_init_sync_cookie_ctxcsn
LDAP_P
((
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment