mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r19524: Stop "net ads user delete" from doing funny things.
Guenther
This commit is contained in:
parent
7c0ea791d2
commit
a20e7c0315
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user