summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-01 05:20:11 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-01 05:20:11 +0000
commitc2b134cc3b67d48961226cbfac6ea3a2fc7cc1a6 (patch)
tree3ca8971139282d99baed4a833162fc94c0f98911 /source3/utils
parent1454c1c99ab87e216dea1871b53c51ce7e548ba5 (diff)
downloadsamba-c2b134cc3b67d48961226cbfac6ea3a2fc7cc1a6.tar.gz
samba-c2b134cc3b67d48961226cbfac6ea3a2fc7cc1a6.tar.bz2
samba-c2b134cc3b67d48961226cbfac6ea3a2fc7cc1a6.zip
Always escape ldap filter strings. Escaping code was from pam_ldap, but I'm to
blame for the realloc() stuff. Plus a couple of minor updates to libads. Andrew Bartlett (This used to be commit 34b2e558a4b3cfd753339bb228a9799e27ed8170)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 29abc33fdf..867252c95f 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -308,12 +308,18 @@ static int ads_user_info(int argc, const char **argv)
const char *attrs[] = {"memberOf", NULL};
char *searchstring=NULL;
char **grouplist;
+ char *escaped_user = escape_ldap_string_alloc(argv[0]);
if (argc < 1) return net_ads_user_usage(argc, argv);
if (!(ads = ads_startup())) return -1;
- asprintf(&searchstring, "(sAMAccountName=%s)", argv[0]);
+ if (!escaped_user) {
+ d_printf("ads_user_info: failed to escape user %s\n", argv[0]);
+ return -1;
+ }
+
+ asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user);
rc = ads_search(ads, &res, searchstring, attrs);
safe_free(searchstring);