summaryrefslogtreecommitdiffstats
path: root/source/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-11-01 10:38:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:40 -0500
commita20e7c0315f9a06ce2139f99d035b409b066d722 (patch)
treedd12ca55d7479962623a16baa12e77c9c6cf4154 /source/utils
parent7c0ea791d21d914e882b56a849766d966ce8ed1a (diff)
downloadsamba-a20e7c0315f9a06ce2139f99d035b409b066d722.tar.gz
samba-a20e7c0315f9a06ce2139f99d035b409b066d722.tar.xz
samba-a20e7c0315f9a06ce2139f99d035b409b066d722.zip
r19524: Stop "net ads user delete" from doing funny things.
Guenther
Diffstat (limited to 'source/utils')
-rw-r--r--source/utils/net_ads.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c
index 97b64a271c7..a4ed3d50eaa 100644
--- a/source/utils/net_ads.c
+++ b/source/utils/net_ads.c
@@ -574,7 +574,7 @@ static int ads_user_delete(int argc, const char **argv)
{
ADS_STRUCT *ads;
ADS_STATUS rc;
- LDAPMessage *res;
+ LDAPMessage *res = NULL;
char *userdn;
if (argc < 1) {
@@ -586,8 +586,9 @@ static int ads_user_delete(int argc, const char **argv)
}
rc = ads_find_user_acct(ads, &res, argv[0]);
- if (!ADS_ERR_OK(rc)) {
+ if (!ADS_ERR_OK(rc) || ads_count_replies(ads, res) != 1) {
d_printf("User %s does not exist.\n", argv[0]);
+ ads_msgfree(ads, res);
ads_destroy(&ads);
return -1;
}
@@ -595,7 +596,7 @@ static int ads_user_delete(int argc, const char **argv)
ads_msgfree(ads, res);
rc = ads_del_dn(ads, userdn);
ads_memfree(ads, userdn);
- if (!ADS_ERR_OK(rc)) {
+ if (ADS_ERR_OK(rc)) {
d_printf("User %s deleted\n", argv[0]);
ads_destroy(&ads);
return 0;