diff options
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 a4ed3d50ea..b425ecf7c2 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -701,7 +701,7 @@ static int ads_group_delete(int argc, const char **argv) { ADS_STRUCT *ads; ADS_STATUS rc; - LDAPMessage *res; + LDAPMessage *res = NULL; char *groupdn; if (argc < 1) { @@ -713,8 +713,9 @@ static int ads_group_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("Group %s does not exist.\n", argv[0]); + ads_msgfree(ads, res); ads_destroy(&ads); return -1; } @@ -722,7 +723,7 @@ static int ads_group_delete(int argc, const char **argv) ads_msgfree(ads, res); rc = ads_del_dn(ads, groupdn); ads_memfree(ads, groupdn); - if (!ADS_ERR_OK(rc)) { + if (ADS_ERR_OK(rc)) { d_printf("Group %s deleted\n", argv[0]); ads_destroy(&ads); return 0; |