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
49400527
Commit
49400527
authored
17 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
ITS#5294
parent
9b0d2785
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGES
+1
-0
1 addition, 0 deletions
CHANGES
clients/tools/ldapdelete.c
+61
-17
61 additions, 17 deletions
clients/tools/ldapdelete.c
doc/devel/args
+1
-1
1 addition, 1 deletion
doc/devel/args
doc/man/man1/ldapdelete.1
+7
-0
7 additions, 0 deletions
doc/man/man1/ldapdelete.1
with
70 additions
and
18 deletions
CHANGES
+
1
−
0
View file @
49400527
...
@@ -4,6 +4,7 @@ OpenLDAP 2.4.8 Engineering
...
@@ -4,6 +4,7 @@ OpenLDAP 2.4.8 Engineering
Fixed ldapmodify verbose logging (ITS#5247)
Fixed ldapmodify verbose logging (ITS#5247)
Fixed libldap ldap_parse_sasl_bind_result (ITS#5263)
Fixed libldap ldap_parse_sasl_bind_result (ITS#5263)
Fixed libldap search timeout crash (ITS#5291)
Fixed libldap search timeout crash (ITS#5291)
Fixed ldapdelete with sizelimit (ITS#5294)
Fixed slapd include handling (ITS#5276)
Fixed slapd include handling (ITS#5276)
Fixed slapd multi-step SASL binds (ITS#5298)
Fixed slapd multi-step SASL binds (ITS#5298)
Fixed slapd non-atomic signal variables (ITS#5248)
Fixed slapd non-atomic signal variables (ITS#5248)
...
...
This diff is collapsed.
Click to expand it.
clients/tools/ldapdelete.c
+
61
−
17
View file @
49400527
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
static
int
prune
=
0
;
static
int
prune
=
0
;
static
int
sizelimit
=
-
1
;
static
int
dodelete
LDAP_P
((
static
int
dodelete
LDAP_P
((
...
@@ -76,11 +77,13 @@ usage( void )
...
@@ -76,11 +77,13 @@ usage( void )
const
char
options
[]
=
"r"
const
char
options
[]
=
"r"
"cd:D:e:f:h:H:IMnO:o:p:P:QR:U:vVw:WxX:y:Y:Z"
;
"cd:D:e:f:h:H:IMnO:o:p:P:QR:U:vVw:WxX:y:Y:
z:
Z"
;
int
int
handle_private_option
(
int
i
)
handle_private_option
(
int
i
)
{
{
int
ival
;
char
*
next
;
switch
(
i
)
{
switch
(
i
)
{
#if 0
#if 0
int crit;
int crit;
...
@@ -115,6 +118,29 @@ handle_private_option( int i )
...
@@ -115,6 +118,29 @@ handle_private_option( int i )
prune
=
1
;
prune
=
1
;
break
;
break
;
case
'z'
:
/* size limit */
if
(
strcasecmp
(
optarg
,
"none"
)
==
0
)
{
sizelimit
=
0
;
}
else
if
(
strcasecmp
(
optarg
,
"max"
)
==
0
)
{
sizelimit
=
LDAP_MAXINT
;
}
else
{
ival
=
strtol
(
optarg
,
&
next
,
10
);
if
(
next
==
NULL
||
next
[
0
]
!=
'\0'
)
{
fprintf
(
stderr
,
_
(
"Unable to parse size limit
\"
%s
\"\n
"
),
optarg
);
exit
(
EXIT_FAILURE
);
}
sizelimit
=
ival
;
}
if
(
sizelimit
<
0
||
sizelimit
>
LDAP_MAXINT
)
{
fprintf
(
stderr
,
_
(
"%s: invalid sizelimit (%d) specified
\n
"
),
prog
,
sizelimit
);
exit
(
EXIT_FAILURE
);
}
break
;
default:
default:
return
0
;
return
0
;
}
}
...
@@ -304,27 +330,31 @@ static int dodelete(
...
@@ -304,27 +330,31 @@ static int dodelete(
*/
*/
static
int
deletechildren
(
static
int
deletechildren
(
LDAP
*
ld
,
LDAP
*
ld
,
const
char
*
dn
)
const
char
*
base
)
{
{
LDAPMessage
*
res
,
*
e
;
LDAPMessage
*
res
,
*
e
;
int
entries
;
int
entries
;
int
rc
;
int
rc
,
srch_
rc
;
static
char
*
attrs
[]
=
{
LDAP_NO_ATTRS
,
NULL
};
static
char
*
attrs
[]
=
{
LDAP_NO_ATTRS
,
NULL
};
LDAPControl
c
,
*
ctrls
[
2
];
LDAPControl
c
,
*
ctrls
[
2
];
BerElement
*
ber
=
NULL
;
BerElement
*
ber
=
NULL
;
LDAPMessage
*
res_se
;
LDAPMessage
*
res_se
;
if
(
verbose
)
printf
(
_
(
"deleting children of: %s
\n
"
),
dn
);
if
(
verbose
)
printf
(
_
(
"deleting children of: %s
\n
"
),
base
);
/*
/*
* Do a one level search at
dn
for children. For each, delete its children.
* Do a one level search at
base
for children. For each, delete its children.
*/
*/
more:
;
rc
=
ldap_search_ext_s
(
ld
,
dn
,
LDAP_SCOPE_ONELEVEL
,
NULL
,
attrs
,
1
,
srch_rc
=
ldap_search_ext_s
(
ld
,
base
,
LDAP_SCOPE_ONELEVEL
,
NULL
,
attrs
,
1
,
NULL
,
NULL
,
NULL
,
-
1
,
&
res
);
NULL
,
NULL
,
NULL
,
sizelimit
,
&
res
);
if
(
rc
!=
LDAP_SUCCESS
)
{
switch
(
srch_rc
)
{
tool_perror
(
"ldap_search"
,
rc
,
NULL
,
NULL
,
NULL
,
NULL
);
case
LDAP_SUCCESS
:
return
(
rc
);
case
LDAP_SIZELIMIT_EXCEEDED
:
break
;
default:
tool_perror
(
"ldap_search"
,
srch_rc
,
NULL
,
NULL
,
NULL
,
NULL
);
return
(
srch_rc
);
}
}
entries
=
ldap_count_entries
(
ld
,
res
);
entries
=
ldap_count_entries
(
ld
,
res
);
...
@@ -373,8 +403,12 @@ static int deletechildren(
...
@@ -373,8 +403,12 @@ static int deletechildren(
ldap_msgfree
(
res
);
ldap_msgfree
(
res
);
if
(
srch_rc
==
LDAP_SIZELIMIT_EXCEEDED
)
{
goto
more
;
}
/*
/*
* Do a one level search at
dn
for subentry children.
* Do a one level search at
base
for subentry children.
*/
*/
if
((
ber
=
ber_alloc_t
(
LBER_USE_DER
))
==
NULL
)
{
if
((
ber
=
ber_alloc_t
(
LBER_USE_DER
))
==
NULL
)
{
...
@@ -394,11 +428,16 @@ static int deletechildren(
...
@@ -394,11 +428,16 @@ static int deletechildren(
ctrls
[
0
]
=
&
c
;
ctrls
[
0
]
=
&
c
;
ctrls
[
1
]
=
NULL
;
ctrls
[
1
]
=
NULL
;
rc
=
ldap_search_ext_s
(
ld
,
dn
,
LDAP_SCOPE_ONELEVEL
,
NULL
,
attrs
,
1
,
more2:
;
ctrls
,
NULL
,
NULL
,
-
1
,
&
res_se
);
srch_rc
=
ldap_search_ext_s
(
ld
,
base
,
LDAP_SCOPE_ONELEVEL
,
NULL
,
attrs
,
1
,
if
(
rc
!=
LDAP_SUCCESS
)
{
ctrls
,
NULL
,
NULL
,
sizelimit
,
&
res_se
);
tool_perror
(
"ldap_search"
,
rc
,
NULL
,
NULL
,
NULL
,
NULL
);
switch
(
srch_rc
)
{
return
(
rc
);
case
LDAP_SUCCESS
:
case
LDAP_SIZELIMIT_EXCEEDED
:
break
;
default:
tool_perror
(
"ldap_search"
,
srch_rc
,
NULL
,
NULL
,
NULL
,
NULL
);
return
(
srch_rc
);
}
}
ber_free
(
ber
,
1
);
ber_free
(
ber
,
1
);
...
@@ -440,5 +479,10 @@ static int deletechildren(
...
@@ -440,5 +479,10 @@ static int deletechildren(
}
}
ldap_msgfree
(
res_se
);
ldap_msgfree
(
res_se
);
if
(
srch_rc
==
LDAP_SIZELIMIT_EXCEEDED
)
{
goto
more2
;
}
return
rc
;
return
rc
;
}
}
This diff is collapsed.
Click to expand it.
doc/devel/args
+
1
−
1
View file @
49400527
Tools ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Tools ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
ldapcompare * DE**HI*K M*OPQR UVWXYZ de *h**k *nop* vwxyz
ldapcompare * DE**HI*K M*OPQR UVWXYZ de *h**k *nop* vwxyz
ldapdelete *CDE**HI*K M*OPQR UVWXYZ cdef*h**k *nop* vwxy
ldapdelete *CDE**HI*K M*OPQR UVWXYZ cdef*h**k *nop* vwxy
z
ldapmodify *CDE**HI*K M*OPQRS UVWXYZabcde *h**k *nop*r t vwxy
ldapmodify *CDE**HI*K M*OPQRS UVWXYZabcde *h**k *nop*r t vwxy
ldapmodrdn *CDE**HI*K M*OPQR UVWXYZ cdef*h**k *nop*rs vwxy
ldapmodrdn *CDE**HI*K M*OPQR UVWXYZ cdef*h**k *nop*rs vwxy
ldappasswd A*CDE**HI* *O QRS UVWXYZa def*h** * o * s vwxy
ldappasswd A*CDE**HI* *O QRS UVWXYZa def*h** * o * s vwxy
...
...
This diff is collapsed.
Click to expand it.
doc/man/man1/ldapdelete.1
+
7
−
0
View file @
49400527
...
@@ -53,6 +53,8 @@ ldapdelete \- LDAP delete entry tool
...
@@ -53,6 +53,8 @@ ldapdelete \- LDAP delete entry tool
[\c
[\c
.BI \-Y \ mech\fR]
.BI \-Y \ mech\fR]
[\c
[\c
.BI \-z \ sizelimit\fR]
[\c
.BR \-Z[Z] ]
.BR \-Z[Z] ]
[\c
[\c
.IR dn ]...
.IR dn ]...
...
@@ -138,6 +140,11 @@ children, and all their children are deleted down the tree. No
...
@@ -138,6 +140,11 @@ children, and all their children are deleted down the tree. No
verification is done, so if you add this switch, ldapdelete will
verification is done, so if you add this switch, ldapdelete will
happily delete large portions of your tree. Use with care.
happily delete large portions of your tree. Use with care.
.TP
.TP
.BI \-z \ sizelimit
Use \fIsizelimit\fP when searching for children DN to delete,
to circumvent any server-side size limit. Only useful in conjunction
with \-r.
.TP
.BI \-O \ security-properties
.BI \-O \ security-properties
Specify SASL security properties.
Specify SASL security properties.
.TP
.TP
...
...
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