diff options
author | Günther Deschner <gd@samba.org> | 2006-11-01 10:38:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:40 -0500 |
commit | 8a9c4331a30ad6fd012d291e2e3e935a13cb5cd6 (patch) | |
tree | 7fc080f49f7955b0d43b571aa76ea4509d03f7fd /source3/utils | |
parent | 2c14cf3b2b74c5696145efdfecb134e6091eee89 (diff) | |
download | samba-8a9c4331a30ad6fd012d291e2e3e935a13cb5cd6.tar.gz samba-8a9c4331a30ad6fd012d291e2e3e935a13cb5cd6.tar.bz2 samba-8a9c4331a30ad6fd012d291e2e3e935a13cb5cd6.zip |
r19524: Stop "net ads user delete" from doing funny things.
Guenther
(This used to be commit a20e7c0315f9a06ce2139f99d035b409b066d722)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 97b64a271c..a4ed3d50ea 100644 --- a/source3/utils/net_ads.c +++ b/source3/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; |