summaryrefslogtreecommitdiff
path: root/source3/libads/ads_ldap.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-19 12:31:16 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-19 12:31:16 +0000
commit251ea1e6776401005e302addd56a689c01924426 (patch)
treed36c5d4ffc7b2c77264e7f60aa52e8330835e1db /source3/libads/ads_ldap.c
parent96cafdd7c735338da0616e0ad638282095f4c4d7 (diff)
downloadsamba-251ea1e6776401005e302addd56a689c01924426.tar.gz
samba-251ea1e6776401005e302addd56a689c01924426.tar.bz2
samba-251ea1e6776401005e302addd56a689c01924426.zip
Merge minor library fixes from HEAD to 3.0.
- setenv() replacement - mimir's ASN1/SPNEGO typo fixes - (size_t)-1 fixes for push_* returns - function argument signed/unsigned correction - ASN1 error handling (ensure we don't use initiailsed data) - extra net ads join error checking - allow 'set security discriptor' to fail - escape ldap strings in libads. - getgrouplist() correctness fixes (include primary gid) Andrew Bartlett (This used to be commit e9d6e2ea9a3dc01d3849b925c50702cda6ddf225)
Diffstat (limited to 'source3/libads/ads_ldap.c')
-rw-r--r--source3/libads/ads_ldap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/libads/ads_ldap.c b/source3/libads/ads_ldap.c
index 05b016539e..97f12de0f7 100644
--- a/source3/libads/ads_ldap.c
+++ b/source3/libads/ads_ldap.c
@@ -37,9 +37,16 @@ NTSTATUS ads_name_to_sid(ADS_STRUCT *ads,
char *exp;
uint32 t;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ char *escaped_name = escape_ldap_string_alloc(name);
+ char *escaped_realm = escape_ldap_string_alloc(ads->config.realm);
+
+ if (!escaped_name || !escaped_realm) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
if (asprintf(&exp, "(|(sAMAccountName=%s)(userPrincipalName=%s@%s))",
- name, name, ads->config.realm) == -1) {
+ escaped_name, escaped_name, escaped_realm) == -1) {
DEBUG(1,("ads_name_to_sid: asprintf failed!\n"));
status = NT_STATUS_NO_MEMORY;
goto done;
@@ -77,6 +84,9 @@ NTSTATUS ads_name_to_sid(ADS_STRUCT *ads,
done:
if (res) ads_msgfree(ads, res);
+ SAFE_FREE(escaped_name);
+ SAFE_FREE(escaped_realm);
+
return status;
}