Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
84143dc5
Commit
84143dc5
authored
10 years ago
by
Steve Holme
Browse files
Options
Downloads
Patches
Plain Diff
ldap: Fixed support for Unicode filter in Win32 search call
parent
747bad7c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ldap.c
+43
-15
43 additions, 15 deletions
lib/ldap.c
with
43 additions
and
15 deletions
lib/ldap.c
+
43
−
15
View file @
84143dc5
...
...
@@ -90,7 +90,12 @@ typedef struct {
char
**
lud_attrs
;
#endif
int
lud_scope
;
#if defined(CURL_LDAP_WIN) && \
(defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
TCHAR
*
lud_filter
;
#else
char
*
lud_filter
;
#endif;
char
**
lud_exts
;
size_t
lud_attrs_dups
;
/* how many were dup'ed, this field is not in the
"real" struct so can only be used in code
...
...
@@ -681,12 +686,6 @@ static bool split_str(char *str, char ***out, size_t *count)
*/
static
bool
unescape_elements
(
void
*
data
,
LDAPURLDesc
*
ludp
)
{
if
(
ludp
->
lud_filter
)
{
ludp
->
lud_filter
=
curl_easy_unescape
(
data
,
ludp
->
lud_filter
,
0
,
NULL
);
if
(
!
ludp
->
lud_filter
)
return
FALSE
;
}
return
(
TRUE
);
}
...
...
@@ -841,13 +840,12 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
if
(
!
p
)
goto
success
;
/* parse scope. skip "??"
*/
/* Parse the scope. skip "??" */
q
=
strchr
(
p
,
'?'
);
if
(
q
)
*
q
++
=
'\0'
;
if
(
*
p
&&
*
p
!=
'?'
)
{
if
(
*
p
)
{
ludp
->
lud_scope
=
str2scope
(
p
);
if
(
ludp
->
lud_scope
==
-
1
)
{
rc
=
LDAP_INVALID_SYNTAX
;
...
...
@@ -861,20 +859,50 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
if
(
!
p
)
goto
success
;
/* parse filter
*/
/* Parse the filter */
q
=
strchr
(
p
,
'?'
);
if
(
q
)
*
q
++
=
'\0'
;
if
(
!*
p
)
{
if
(
*
p
)
{
char
*
filter
=
p
;
char
*
unescapped
;
LDAP_TRACE
((
"filter '%s'
\n
"
,
filter
));
/* Unescape the filter */
unescapped
=
curl_easy_unescape
(
conn
->
data
,
filter
,
0
,
NULL
);
if
(
!
unescapped
)
{
rc
=
LDAP_NO_MEMORY
;
goto
quit
;
}
#if defined(CURL_LDAP_WIN) && \
(defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
/* Convert the unescapped string to a tchar */
ludp
->
lud_filter
=
Curl_convert_UTF8_to_tchar
(
unescapped
);
/* Free the unescapped string as we are done with it */
Curl_unicodefree
(
unescapped
);
if
(
!
ludp
->
lud_filter
)
{
rc
=
LDAP_NO_MEMORY
;
goto
quit
;
}
#else
ludp
->
lud_filter
=
unescapped
;
#endif
}
p
=
q
;
if
(
p
&&
!*
p
)
{
rc
=
LDAP_INVALID_SYNTAX
;
goto
quit
;
}
ludp
->
lud_filter
=
p
;
LDAP_TRACE
((
"filter '%s'
\n
"
,
ludp
->
lud_filter
));
success:
if
(
!
unescape_elements
(
conn
->
data
,
ludp
))
rc
=
LDAP_NO_MEMORY
;
...
...
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