Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
Christopher Ng
OpenLDAP
Commits
fc784ad8
Commit
fc784ad8
authored
19 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
ITS#2757 remove isroot checks, simplify
parent
262c4477
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
servers/slapd/back-ldbm/modrdn.c
+51
-99
51 additions, 99 deletions
servers/slapd/back-ldbm/modrdn.c
with
51 additions
and
99 deletions
servers/slapd/back-ldbm/modrdn.c
+
51
−
99
View file @
fc784ad8
...
...
@@ -49,7 +49,6 @@ ldbm_back_modrdn(
/* LDAP v2 supporting correct attribute handling. */
LDAPRDN
new_rdn
=
NULL
;
LDAPRDN
old_rdn
=
NULL
;
int
isroot
=
-
1
;
int
rc_id
=
0
;
ID
id
=
NOID
;
char
textbuf
[
SLAP_TEXT_BUFLEN
];
...
...
@@ -159,79 +158,40 @@ ldbm_back_modrdn(
goto
return_results
;
}
}
else
{
p
=
(
Entry
*
)
&
slap_entry_root
;
}
/* check parent for "children" acl */
if
(
!
access_allowed
(
op
,
p
,
children
,
NULL
,
op
->
oq_modrdn
.
rs_newSup
!=
NULL
?
ACL_WDEL
:
ACL_WRITE
,
NULL
)
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"no access to parent
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
/* check parent for "children" acl */
if
(
!
access_allowed
(
op
,
p
,
children
,
NULL
,
op
->
oq_modrdn
.
rs_newSup
!=
NULL
?
ACL_WDEL
:
ACL_WRITE
,
NULL
)
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"no access to parent
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: wr to children of entry %s OK
\n
"
,
p_ndn
.
bv_val
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
if
(
p_ndn
.
bv_val
==
slap_empty_bv
.
bv_val
)
{
p_dn
=
slap_empty_bv
;
}
else
{
dnParent
(
&
e
->
e_name
,
&
p_dn
);
}
if
(
BER_BVISEMPTY
(
&
p_ndn
))
p
=
NULL
;
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: parent dn=%s
\n
"
,
p_dn
.
bv_val
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: wr to children of entry %s OK
\n
"
,
p_ndn
.
bv_val
,
0
,
0
);
if
(
p_ndn
.
bv_val
==
slap_empty_bv
.
bv_val
)
{
p_dn
=
slap_empty_bv
;
}
else
{
/* no parent, must be root to modify rdn */
isroot
=
be_isroot
(
op
);
if
(
!
isroot
)
{
if
(
be_issuffix
(
op
->
o_bd
,
(
struct
berval
*
)
&
slap_empty_bv
)
||
be_shadow_update
(
op
)
)
{
int
can_access
;
p
=
(
Entry
*
)
&
slap_entry_root
;
can_access
=
access_allowed
(
op
,
p
,
children
,
NULL
,
op
->
oq_modrdn
.
rs_newSup
?
ACL_WDEL
:
ACL_WRITE
,
NULL
);
p
=
NULL
;
/* check parent for "children" acl */
if
(
!
can_access
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn: no "
"access to parent
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
}
else
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn: no parent & "
"not root
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
}
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: no parent, locked root
\n
"
,
0
,
0
,
0
);
dnParent
(
&
e
->
e_name
,
&
p_dn
);
}
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: parent dn=%s
\n
"
,
p_dn
.
bv_val
,
0
,
0
);
new_parent_dn
=
&
p_dn
;
/* New Parent unless newSuperior given */
if
(
op
->
oq_modrdn
.
rs_newSup
!=
NULL
)
{
...
...
@@ -262,7 +222,7 @@ ldbm_back_modrdn(
"ldbm_back_modrdn: newSup(ndn=%s) not here!
\n
"
,
np_ndn
->
bv_val
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_
OTHER
,
send_ldap_error
(
op
,
rs
,
LDAP_
NO_SUCH_OBJECT
,
"newSuperior not found"
);
goto
return_results
;
}
...
...
@@ -306,27 +266,20 @@ ldbm_back_modrdn(
}
}
else
{
/* no parent, must be root to modify newSuperior */
if
(
isroot
==
-
1
)
{
isroot
=
be_isroot
(
op
);
}
if
(
!
isroot
)
{
if
(
be_issuffix
(
op
->
o_bd
,
(
struct
berval
*
)
&
slap_empty_bv
)
||
be_shadow_update
(
op
)
)
{
int
can_access
;
np
=
(
Entry
*
)
&
slap_entry_root
;
can_access
=
access_allowed
(
op
,
np
,
children
,
NULL
,
ACL_WADD
,
NULL
);
np
=
NULL
;
/* check parent for "children" acl */
if
(
!
can_access
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn: no "
"access to new superior
\n
"
,
0
,
0
,
0
);
if
(
be_issuffix
(
op
->
o_bd
,
(
struct
berval
*
)
&
slap_empty_bv
)
||
be_shadow_update
(
op
)
)
{
int
can_access
;
np
=
(
Entry
*
)
&
slap_entry_root
;
can_access
=
access_allowed
(
op
,
np
,
children
,
NULL
,
ACL_WADD
,
NULL
);
np
=
NULL
;
/* check parent for "children" acl */
if
(
!
can_access
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn: no "
"access to new superior
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
...
...
@@ -334,17 +287,16 @@ ldbm_back_modrdn(
goto
return_results
;
}
}
else
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn:
\"\"
"
"not allowed as new superior
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
}
else
{
Debug
(
LDAP_DEBUG_TRACE
,
"<=- ldbm_back_modrdn:
\"\"
"
"not allowed as new superior
\n
"
,
0
,
0
,
0
);
send_ldap_error
(
op
,
rs
,
LDAP_INSUFFICIENT_ACCESS
,
NULL
);
goto
return_results
;
}
}
...
...
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