summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-13 11:26:49 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-13 12:59:14 +0100
commit60df3c06790d2b4f6e3006123bd883fd842dfb41 (patch)
tree18d3ecaf27a1f5b584541cc258aa6b9f0329f541 /source3
parent26051b8aaaf1fd359997dbc71f617ea3e7b71d8a (diff)
downloadsamba-60df3c06790d2b4f6e3006123bd883fd842dfb41.tar.gz
samba-60df3c06790d2b4f6e3006123bd883fd842dfb41.tar.bz2
samba-60df3c06790d2b4f6e3006123bd883fd842dfb41.zip
s3: Make "net sam list [users|workstations]" list only the right things
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Feb 13 12:59:14 CET 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ads.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index 89151588db..b60615fafe 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -1902,9 +1902,28 @@ static bool pdb_ads_search_users(struct pdb_methods *m,
uint32 acct_flags)
{
struct pdb_ads_search_state *sstate;
+ char *filter;
bool ret;
- ret = pdb_ads_search_filter(m, search, "(objectclass=user)", &sstate);
+ if (acct_flags & ACB_NORMAL) {
+ filter = talloc_asprintf(
+ talloc_tos(),
+ "(&(objectclass=user)(sAMAccountType=%d))",
+ ATYPE_NORMAL_ACCOUNT);
+ } else if (acct_flags & ACB_WSTRUST) {
+ filter = talloc_asprintf(
+ talloc_tos(),
+ "(&(objectclass=user)(sAMAccountType=%d))",
+ ATYPE_WORKSTATION_TRUST);
+ } else {
+ filter = talloc_strdup(talloc_tos(), "(objectclass=user)");
+ }
+ if (filter == NULL) {
+ return false;
+ }
+
+ ret = pdb_ads_search_filter(m, search, filter, &sstate);
+ TALLOC_FREE(filter);
if (!ret) {
return false;
}