mirror of
https://github.com/samba-team/samba.git
synced 2025-11-07 12:23:51 +03:00
r6745: - escape spaces in binary ldap blobs
- expose the ldap filter string parsing outside of ldap.c
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
992858e1b9
commit
b644ff6fe1
@@ -150,7 +150,7 @@ static const char *ldap_binary_encode(TALLOC_CTX *mem_ctx, DATA_BLOB blob)
|
|||||||
char *ret;
|
char *ret;
|
||||||
int len = blob.length;
|
int len = blob.length;
|
||||||
for (i=0;i<blob.length;i++) {
|
for (i=0;i<blob.length;i++) {
|
||||||
if (!isprint(blob.data[i]) || blob.data[i] == '\\') {
|
if (!isprint(blob.data[i]) || strchr(" *()\\&|!", blob.data[i])) {
|
||||||
len += 2;
|
len += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ static const char *ldap_binary_encode(TALLOC_CTX *mem_ctx, DATA_BLOB blob)
|
|||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
for (i=0;i<blob.length;i++) {
|
for (i=0;i<blob.length;i++) {
|
||||||
if (!isprint(blob.data[i]) || blob.data[i] == '\\') {
|
if (!isprint(blob.data[i]) || strchr(" *()\\&|!", blob.data[i])) {
|
||||||
snprintf(ret+len, 4, "\\%02X", blob.data[i]);
|
snprintf(ret+len, 4, "\\%02X", blob.data[i]);
|
||||||
len += 3;
|
len += 3;
|
||||||
} else {
|
} else {
|
||||||
@@ -318,7 +318,7 @@ static struct ldap_parse_tree *ldap_parse_filtercomp(TALLOC_CTX *mem_ctx,
|
|||||||
<filter> ::= '(' <filtercomp> ')'
|
<filter> ::= '(' <filtercomp> ')'
|
||||||
*/
|
*/
|
||||||
static struct ldap_parse_tree *ldap_parse_filter(TALLOC_CTX *mem_ctx,
|
static struct ldap_parse_tree *ldap_parse_filter(TALLOC_CTX *mem_ctx,
|
||||||
const char **s)
|
const char **s)
|
||||||
{
|
{
|
||||||
char *l, *s2;
|
char *l, *s2;
|
||||||
const char *p, *p2;
|
const char *p, *p2;
|
||||||
@@ -1335,3 +1335,13 @@ BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
externally callable version of filter string parsing - used in the
|
||||||
|
cldap server
|
||||||
|
*/
|
||||||
|
struct ldap_parse_tree *ldap_parse_filter_string(TALLOC_CTX *mem_ctx,
|
||||||
|
const char *s)
|
||||||
|
{
|
||||||
|
return ldap_parse_filter(mem_ctx, &s);
|
||||||
|
}
|
||||||
|
|||||||
@@ -323,6 +323,8 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result);
|
|||||||
BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg);
|
BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg);
|
||||||
BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
|
BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
|
||||||
char **host, uint16_t *port, BOOL *ldaps);
|
char **host, uint16_t *port, BOOL *ldaps);
|
||||||
|
struct ldap_parse_tree *ldap_parse_filter_string(TALLOC_CTX *mem_ctx,
|
||||||
|
const char *s);
|
||||||
|
|
||||||
/* The following definitions come from libcli/ldap/ldap_client.c */
|
/* The following definitions come from libcli/ldap/ldap_client.c */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user