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
ae8bafea
Commit
ae8bafea
authored
20 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
why scan with {im} when the value need sbe copied? moreover, cookie must be freed after use
parent
706e7f81
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients/tools/ldapsearch.c
+9
-7
9 additions, 7 deletions
clients/tools/ldapsearch.c
with
9 additions
and
7 deletions
clients/tools/ldapsearch.c
+
9
−
7
View file @
ae8bafea
...
...
@@ -203,7 +203,7 @@ static int pagePrompt = 1;
static
ber_int_t
pageSize
=
0
;
static
ber_int_t
entriesLeft
=
0
;
static
ber_int_t
morePagedResults
=
1
;
static
struct
berval
cookie
=
{
0
,
NULL
};
static
struct
berval
page_
cookie
=
{
0
,
NULL
};
static
int
npagedresponses
;
static
int
npagedentries
;
static
int
npagedreferences
;
...
...
@@ -758,10 +758,14 @@ getNextPage:
return
EXIT_FAILURE
;
}
ber_printf
(
prber
,
"{iO}"
,
pageSize
,
&
cookie
);
ber_printf
(
prber
,
"{iO}"
,
pageSize
,
&
page_
cookie
);
if
(
ber_flatten2
(
prber
,
&
c
[
i
].
ldctl_value
,
0
)
==
-
1
)
{
return
EXIT_FAILURE
;
}
if
(
page_cookie
.
bv_val
!=
NULL
)
{
ber_memfree
(
page_cookie
.
bv_val
);
page_cookie
.
bv_val
=
NULL
;
}
c
[
i
].
ldctl_oid
=
LDAP_CONTROL_PAGEDRESULTS
;
c
[
i
].
ldctl_iscritical
=
pagedResults
>
1
;
...
...
@@ -1048,7 +1052,7 @@ static int dosearch(
#ifdef LDAP_CONTROL_PAGEDRESULTS
if
(
pageSize
!=
0
)
{
if
(
rc
==
LDAP_SUCCESS
)
{
rc
=
parse_page_control
(
ld
,
msg
,
&
cookie
);
rc
=
parse_page_control
(
ld
,
msg
,
&
page_
cookie
);
}
else
{
morePagedResults
=
0
;
}
...
...
@@ -1531,7 +1535,6 @@ parse_page_control(
LDAPControl
*
ctrlp
=
NULL
;
BerElement
*
ber
;
ber_tag_t
tag
;
struct
berval
servercookie
=
{
0
,
NULL
};
rc
=
ldap_parse_result
(
ld
,
result
,
&
err
,
NULL
,
NULL
,
NULL
,
&
ctrl
,
0
);
...
...
@@ -1560,8 +1563,7 @@ parse_page_control(
return
EXIT_FAILURE
;
}
tag
=
ber_scanf
(
ber
,
"{im}"
,
&
entriesLeft
,
&
servercookie
);
ber_dupbv
(
cookie
,
&
servercookie
);
tag
=
ber_scanf
(
ber
,
"{io}"
,
&
entriesLeft
,
cookie
);
(
void
)
ber_free
(
ber
,
1
);
if
(
tag
==
LBER_ERROR
)
{
...
...
@@ -1576,7 +1578,7 @@ parse_page_control(
return
EXIT_FAILURE
;
}
if
(
server
cookie
.
bv_len
==
0
)
{
if
(
cookie
->
bv_len
==
0
)
{
morePagedResults
=
0
;
}
...
...
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