mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
- use accountype not accountcontrol
- better debug code
(This used to be commit 01f63b9c92
)
This commit is contained in:
parent
b6c618467d
commit
0b33cb1a7b
@ -43,7 +43,11 @@ int ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope,
|
|||||||
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
rc = ads_do_search(ads, bind_path, scope, exp, attrs, res);
|
rc = ads_do_search(ads, bind_path, scope, exp, attrs, res);
|
||||||
if (rc == 0) return rc;
|
if (rc == 0) {
|
||||||
|
DEBUG(5,("Search for %s gave %d replies\n",
|
||||||
|
exp, ads_count_replies(ads, *res)));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
if (*res) ads_msgfree(ads, *res);
|
if (*res) ads_msgfree(ads, *res);
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
@ -144,7 +148,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
|
|||||||
{
|
{
|
||||||
ADS_STRUCT *ads = NULL;
|
ADS_STRUCT *ads = NULL;
|
||||||
const char *attrs[] = {"sAMAccountName", "name", "objectSid", "primaryGroupID",
|
const char *attrs[] = {"sAMAccountName", "name", "objectSid", "primaryGroupID",
|
||||||
"userAccountControl", NULL};
|
"sAMAccountType", NULL};
|
||||||
int rc, i, count;
|
int rc, i, count;
|
||||||
void *res = NULL;
|
void *res = NULL;
|
||||||
void *msg = NULL;
|
void *msg = NULL;
|
||||||
@ -185,11 +189,13 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
|
|||||||
char *name, *gecos;
|
char *name, *gecos;
|
||||||
DOM_SID sid;
|
DOM_SID sid;
|
||||||
uint32 rid, group;
|
uint32 rid, group;
|
||||||
uint32 account_control;
|
uint32 atype;
|
||||||
|
|
||||||
if (!ads_pull_uint32(ads, msg, "userAccountControl",
|
if (!ads_pull_uint32(ads, msg, "sAMAccountType", &atype) ||
|
||||||
&account_control) ||
|
ads_atype_map(atype) != SID_NAME_USER) {
|
||||||
!(account_control & UF_NORMAL_ACCOUNT)) continue;
|
DEBUG(1,("Not a user account? atype=0x%x\n", atype));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
|
name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
|
||||||
gecos = ads_pull_string(ads, mem_ctx, msg, "name");
|
gecos = ads_pull_string(ads, mem_ctx, msg, "name");
|
||||||
@ -217,6 +223,8 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
|
|||||||
(*num_entries) = i;
|
(*num_entries) = i;
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
|
||||||
|
DEBUG(3,("ads query_user_list gave %d entries\n", (*num_entries)));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (res) ads_msgfree(ads, res);
|
if (res) ads_msgfree(ads, res);
|
||||||
|
|
||||||
@ -300,6 +308,8 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
|
|||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
|
||||||
|
DEBUG(3,("ads enum_dom_groups gave %d entries\n", (*num_entries)));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (res) ads_msgfree(ads, res);
|
if (res) ads_msgfree(ads, res);
|
||||||
|
|
||||||
@ -360,6 +370,8 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
|
|||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
|
||||||
|
DEBUG(3,("ads name_to_sid mapped %s\n", name));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (res) ads_msgfree(ads, res);
|
if (res) ads_msgfree(ads, res);
|
||||||
|
|
||||||
@ -407,6 +419,9 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
|
|||||||
*type = ads_atype_map(atype);
|
*type = ads_atype_map(atype);
|
||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
|
||||||
|
DEBUG(3,("ads sid_to_name mapped %s\n", *name));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (msg) ads_msgfree(ads, msg);
|
if (msg) ads_msgfree(ads, msg);
|
||||||
|
|
||||||
@ -421,8 +436,8 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
|
|||||||
WINBIND_USERINFO *info)
|
WINBIND_USERINFO *info)
|
||||||
{
|
{
|
||||||
ADS_STRUCT *ads = NULL;
|
ADS_STRUCT *ads = NULL;
|
||||||
const char *attrs[] = {"sAMAccountName", "name", "objectSid", "primaryGroupID",
|
const char *attrs[] = {"sAMAccountName", "name", "objectSid",
|
||||||
"userAccountControl", NULL};
|
"primaryGroupID", NULL};
|
||||||
int rc, count;
|
int rc, count;
|
||||||
void *msg = NULL;
|
void *msg = NULL;
|
||||||
char *exp;
|
char *exp;
|
||||||
@ -471,6 +486,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
|
|||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
|
||||||
|
DEBUG(3,("ads query_user gave %s\n", info->acct_name));
|
||||||
done:
|
done:
|
||||||
if (msg) ads_msgfree(ads, msg);
|
if (msg) ads_msgfree(ads, msg);
|
||||||
|
|
||||||
@ -544,6 +560,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
DEBUG(3,("ads lookup_usergroups for rid=%d\n", user_rid));
|
||||||
done:
|
done:
|
||||||
if (msg) ads_msgfree(ads, msg);
|
if (msg) ads_msgfree(ads, msg);
|
||||||
|
|
||||||
@ -616,6 +633,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
|
DEBUG(3,("ads lookup_groupmem for rid=%d\n", group_rid));
|
||||||
done:
|
done:
|
||||||
if (res) ads_msgfree(ads, res);
|
if (res) ads_msgfree(ads, res);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user