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
Dragoș Haiduc
OpenLDAP
Commits
13c1e77a
Commit
13c1e77a
authored
15 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
add in-scope helper
parent
bc13ead2
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/dn.c
+64
-0
64 additions, 0 deletions
servers/slapd/dn.c
servers/slapd/proto-slap.h
+6
-0
6 additions, 0 deletions
servers/slapd/proto-slap.h
with
70 additions
and
0 deletions
servers/slapd/dn.c
+
64
−
0
View file @
13c1e77a
...
...
@@ -1197,6 +1197,70 @@ dnIsSuffix(
return
(
strcmp
(
dn
->
bv_val
+
d
,
suffix
->
bv_val
)
==
0
);
}
/*
* In place; assumes:
* - ndn is normalized
* - nbase is normalized
* - dnIsSuffix( ndn, nbase ) == TRUE
* - LDAP_SCOPE_DEFAULT == LDAP_SCOPE_SUBTREE
*/
int
dnIsWithinScope
(
struct
berval
*
ndn
,
struct
berval
*
nbase
,
int
scope
)
{
assert
(
ndn
!=
NULL
);
assert
(
nbase
!=
NULL
);
assert
(
!
BER_BVISNULL
(
ndn
)
);
assert
(
!
BER_BVISNULL
(
nbase
)
);
switch
(
scope
)
{
case
LDAP_SCOPE_DEFAULT
:
case
LDAP_SCOPE_SUBTREE
:
break
;
case
LDAP_SCOPE_BASE
:
if
(
ndn
->
bv_len
!=
nbase
->
bv_len
)
{
return
0
;
}
break
;
case
LDAP_SCOPE_ONELEVEL
:
{
struct
berval
pndn
;
dnParent
(
ndn
,
&
pndn
);
if
(
pndn
.
bv_len
!=
nbase
->
bv_len
)
{
return
0
;
}
}
break
;
case
LDAP_SCOPE_SUBORDINATE
:
if
(
ndn
->
bv_len
==
nbase
->
bv_len
)
{
return
0
;
}
break
;
/* unknown scope */
default:
return
-
1
;
}
return
1
;
}
/*
* In place; assumes:
* - ndn is normalized
* - nbase is normalized
* - LDAP_SCOPE_DEFAULT == LDAP_SCOPE_SUBTREE
*/
int
dnIsSuffixScope
(
struct
berval
*
ndn
,
struct
berval
*
nbase
,
int
scope
)
{
if
(
!
dnIsSuffix
(
ndn
,
nbase
)
)
{
return
0
;
}
return
dnIsWithinScope
(
ndn
,
nbase
,
scope
);
}
int
dnIsOneLevelRDN
(
struct
berval
*
rdn
)
{
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/proto-slap.h
+
6
−
0
View file @
13c1e77a
...
...
@@ -922,6 +922,12 @@ LDAP_SLAPD_F (int) rdnMatch LDAP_P((
LDAP_SLAPD_F
(
int
)
dnIsSuffix
LDAP_P
((
const
struct
berval
*
dn
,
const
struct
berval
*
suffix
));
LDAP_SLAPD_F
(
int
)
dnIsWithinScope
LDAP_P
((
struct
berval
*
ndn
,
struct
berval
*
nbase
,
int
scope
));
LDAP_SLAPD_F
(
int
)
dnIsSuffixScope
LDAP_P
((
struct
berval
*
ndn
,
struct
berval
*
nbase
,
int
scope
));
LDAP_SLAPD_F
(
int
)
dnIsOneLevelRDN
LDAP_P
((
struct
berval
*
rdn
));
LDAP_SLAPD_F
(
int
)
dnExtractRdn
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