[SCM] Samba Shared Repository - branch master updated
Garming Sam
garming at samba.org
Tue Dec 2 22:45:04 MST 2014
The branch, master has been updated
via 816751a s3:idmap_cache: remove unused idmap_cache_set_sid2[u|g]id()
via 3b76b70 pdb: Increase version number to fix ABI
via 58b343b idmap: return the correct id type to *id_to_sid methods
via 7979c6c idmap: unify passdb *id_to_sid methods
from 3b90bfb s3:utils/profiles fix a use after free
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 816751a3a8ed564f2cf880fd1ca3b1e8f9c85471
Author: Stefan Metzmacher <metze at samba.org>
Date: Sat Nov 29 10:52:05 2014 +0100
s3:idmap_cache: remove unused idmap_cache_set_sid2[u|g]id()
Change-Id: I40bcfacb812b0dac7917533c9baf82a79f598efd
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming at samba.org>
Autobuild-Date(master): Wed Dec 3 06:44:29 CET 2014 on sn-devel-104
commit 3b76b705f03b8f639ece2308afdc0962d230c42a
Author: Garming Sam <garming at catalyst.net.nz>
Date: Tue Nov 25 14:56:45 2014 +1300
pdb: Increase version number to fix ABI
In the process, we can also rename pdb to avoid conflicts with libpdb.
We don't depend directly on pdb to avoid duplicate symbols.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10355
Change-Id: I4df6ba2f4ce35d3718dc4198b527cca46a139efe
Pair-programmed-with: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 58b343be4742b3ba1f447701a8254453c21af413
Author: Garming Sam <garming at catalyst.net.nz>
Date: Wed Nov 26 15:33:35 2014 +1300
idmap: return the correct id type to *id_to_sid methods
We have a pointer to a unixid which is sent down instead of a uid or
gid. We can use this as an in-out variable so that pdb_samba_dsdb can be
returned ID_TYPE_BOTH to cache correctly instead of leaving it as
ID_TYPE_UID or ID_TYPE_GID.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10720
Change-Id: I0cef2e419cbb337531244b7b41c708cf2ab883e3
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 7979c6cc50eaa792e5094866878c63df36e715c3
Author: Garming Sam <garming at catalyst.net.nz>
Date: Tue Nov 25 14:45:26 2014 +1300
idmap: unify passdb *id_to_sid methods
Instead of passing down gid or uid, a pointer to a unixid is now sent
down. This acts as an in-out variable so that the idmap functions can
correctly receive ID_TYPE_BOTH, filling in cache details correctly
rather than forcing the cache to store ID_TYPE_UID or ID_TYPE_GID.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10720
Change-Id: I11409a0f498e61a3c0a6ae606dd7af1135e6b066
Pair-programmed-with: Andrew Bartlett <abarlet at samba.org>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/knownfail | 2 -
source3/include/passdb.h | 28 ++++++---
source3/lib/idmap_cache.c | 72 ----------------------
source3/lib/idmap_cache.h | 2 -
.../{pdb-0.1.2.sigs => samba-passdb-0.2.0.sigs} | 3 +-
source3/passdb/lookup_sid.c | 19 +++++-
source3/passdb/pdb_interface.c | 51 +++++++--------
source3/passdb/pdb_ldap.c | 24 +++++++-
source3/passdb/pdb_samba_dsdb.c | 46 +++++---------
source3/passdb/pdb_wbc_sam.c | 23 ++++---
source3/passdb/py_passdb.c | 13 +++-
source3/utils/net_sam.c | 6 +-
source3/winbindd/idmap_passdb.c | 16 +----
source3/winbindd/wscript_build | 2 +-
source3/wscript_build | 30 +++++----
source4/winbind/idmap.c | 20 +++++-
16 files changed, 167 insertions(+), 190 deletions(-)
copy source3/passdb/ABI/{pdb-0.1.2.sigs => samba-passdb-0.2.0.sigs} (99%)
Changeset truncated at 500 lines:
diff --git a/selftest/knownfail b/selftest/knownfail
index e9e6239..1c4f446 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -230,8 +230,6 @@
^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping?
^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env
^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
-^samba.wbinfo_sids2xids.\(plugin_s4_dc:local\)
-^samba.wbinfo_sids2xids.\(s4member:local\)
#
# The following tests fail against plugin_s4_dc (aka s3fs) currently.
# These need to be examined and either fixed or correctly categorised.
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 86cb16e..16e3bef 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -415,9 +415,10 @@ enum pdb_policy_type {
* Changed to 21, set/enum_upn_suffixes. AB.
* Changed to 22, idmap control functions
* Changed to 23, new idmap control functions
+ * Changed to 24, removed uid_to_sid and gid_to_sid, replaced with id_to_sid
*/
-#define PASSDB_INTERFACE_VERSION 23
+#define PASSDB_INTERFACE_VERSION 24
struct pdb_methods
{
@@ -560,10 +561,16 @@ struct pdb_methods
struct pdb_search *search,
const struct dom_sid *sid);
- bool (*uid_to_sid)(struct pdb_methods *methods, uid_t uid,
- struct dom_sid *sid);
- bool (*gid_to_sid)(struct pdb_methods *methods, gid_t gid,
- struct dom_sid *sid);
+ /*
+ * Instead of passing down a gid or uid, this function sends down a pointer
+ * to a unixid.
+ *
+ * This acts as an in-out variable so that the idmap functions can correctly
+ * receive ID_TYPE_BOTH, filling in cache details correctly rather than forcing
+ * the cache to store ID_TYPE_UID or ID_TYPE_GID.
+ */
+ bool (*id_to_sid)(struct pdb_methods *methods, struct unixid *id,
+ struct dom_sid *sid);
bool (*sid_to_id)(struct pdb_methods *methods, const struct dom_sid *sid,
struct unixid *id);
@@ -889,8 +896,15 @@ NTSTATUS pdb_lookup_names(const struct dom_sid *domain_sid,
bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
bool pdb_get_seq_num(time_t *seq_num);
-bool pdb_uid_to_sid(uid_t uid, struct dom_sid *sid);
-bool pdb_gid_to_sid(gid_t gid, struct dom_sid *sid);
+/*
+ * Instead of passing down a gid or uid, this function sends down a pointer
+ * to a unixid.
+ *
+ * This acts as an in-out variable so that the idmap functions can correctly
+ * receive ID_TYPE_BOTH, filling in cache details correctly rather than forcing
+ * the cache to store ID_TYPE_UID or ID_TYPE_GID.
+ */
+bool pdb_id_to_sid(struct unixid *id, struct dom_sid *sid);
bool pdb_sid_to_id(const struct dom_sid *sid, struct unixid *id);
uint32_t pdb_capabilities(void);
bool pdb_new_rid(uint32_t *rid);
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 8844171..11bda39 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -346,78 +346,6 @@ void idmap_cache_set_sid2unixid(const struct dom_sid *sid, struct unixid *unix_i
}
}
-/**
- * Store a mapping in the idmap cache
- * @param[in] sid the sid to map
- * @param[in] uid the uid to map
- *
- * If both parameters are valid values, then a positive mapping in both
- * directions is stored. If "is_null_sid(sid)" is true, then this will be a
- * negative mapping of uid, we want to cache that for this uid we could not
- * find anything. Likewise if "uid==-1", then we want to cache that we did not
- * find a mapping for the sid passed here.
- */
-
-void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid)
-{
- struct unixid id;
- id.type = ID_TYPE_UID;
- id.id = uid;
-
- if (uid == -1) {
- uid_t tmp_gid;
- bool expired;
- /* If we were asked to invalidate this SID -> UID
- * mapping, it was because we found out that this was
- * not a UID at all. Do not overwrite a valid GID or
- * BOTH mapping */
- if (idmap_cache_find_sid2gid(sid, &tmp_gid, &expired)) {
- if (!expired) {
- return;
- }
- }
- }
-
- idmap_cache_set_sid2unixid(sid, &id);
- return;
-}
-
-/**
- * Store a mapping in the idmap cache
- * @param[in] sid the sid to map
- * @param[in] gid the gid to map
- *
- * If both parameters are valid values, then a positive mapping in both
- * directions is stored. If "is_null_sid(sid)" is true, then this will be a
- * negative mapping of gid, we want to cache that for this gid we could not
- * find anything. Likewise if "gid==-1", then we want to cache that we did not
- * find a mapping for the sid passed here.
- */
-
-void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid)
-{
- struct unixid id;
- id.type = ID_TYPE_GID;
- id.id = gid;
-
- if (gid == -1) {
- uid_t tmp_uid;
- bool expired;
- /* If we were asked to invalidate this SID -> GID
- * mapping, it was because we found out that this was
- * not a GID at all. Do not overwrite a valid UID or
- * BOTH mapping */
- if (idmap_cache_find_sid2uid(sid, &tmp_uid, &expired)) {
- if (!expired) {
- return;
- }
- }
- }
-
- idmap_cache_set_sid2unixid(sid, &id);
- return;
-}
-
static char* key_xid2sid_str(TALLOC_CTX* mem_ctx, char t, const char* id) {
return talloc_asprintf(mem_ctx, "IDMAP/%cID2SID/%s", t, id);
}
diff --git a/source3/lib/idmap_cache.h b/source3/lib/idmap_cache.h
index 0885266..5b8586f 100644
--- a/source3/lib/idmap_cache.h
+++ b/source3/lib/idmap_cache.h
@@ -32,8 +32,6 @@ bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid,
bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired);
bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired);
void idmap_cache_set_sid2unixid(const struct dom_sid *sid, struct unixid *unix_id);
-void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid);
-void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid);
bool idmap_cache_del_uid(uid_t uid);
bool idmap_cache_del_gid(gid_t gid);
diff --git a/source3/passdb/ABI/pdb-0.1.2.sigs b/source3/passdb/ABI/samba-passdb-0.2.0.sigs
similarity index 99%
copy from source3/passdb/ABI/pdb-0.1.2.sigs
copy to source3/passdb/ABI/samba-passdb-0.2.0.sigs
index 8b97bac..e2246f6 100644
--- a/source3/passdb/ABI/pdb-0.1.2.sigs
+++ b/source3/passdb/ABI/samba-passdb-0.2.0.sigs
@@ -173,8 +173,8 @@ pdb_gethexhours: bool (const char *, unsigned char *)
pdb_gethexpwd: bool (const char *, unsigned char *)
pdb_getsampwnam: bool (struct samu *, const char *)
pdb_getsampwsid: bool (struct samu *, const struct dom_sid *)
-pdb_gid_to_sid: bool (gid_t, struct dom_sid *)
pdb_group_rid_to_gid: gid_t (uint32_t)
+pdb_id_to_sid: bool (struct unixid *, struct dom_sid *)
pdb_increment_bad_password_count: bool (struct samu *)
pdb_is_password_change_time_max: bool (time_t)
pdb_is_responsible_for_builtin: bool (void)
@@ -249,7 +249,6 @@ pdb_sethexhours: void (char *, const unsigned char *)
pdb_sethexpwd: void (char *, const unsigned char *, uint32_t)
pdb_sid_to_id: bool (const struct dom_sid *, struct unixid *)
pdb_sid_to_id_unix_users_and_groups: bool (const struct dom_sid *, struct unixid *)
-pdb_uid_to_sid: bool (uid_t, struct dom_sid *)
pdb_update_autolock_flag: bool (struct samu *, bool *)
pdb_update_bad_password_count: bool (struct samu *, bool *)
pdb_update_group_mapping_entry: NTSTATUS (GROUP_MAP *)
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index d541719..494a840 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1029,11 +1029,15 @@ bool lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
static void legacy_uid_to_sid(struct dom_sid *psid, uid_t uid)
{
bool ret;
+ struct unixid id;
ZERO_STRUCTP(psid);
+ id.id = uid;
+ id.type = ID_TYPE_UID;
+
become_root();
- ret = pdb_uid_to_sid(uid, psid);
+ ret = pdb_id_to_sid(&id, psid);
unbecome_root();
if (ret) {
@@ -1059,11 +1063,15 @@ static void legacy_uid_to_sid(struct dom_sid *psid, uid_t uid)
static void legacy_gid_to_sid(struct dom_sid *psid, gid_t gid)
{
bool ret;
+ struct unixid id;
ZERO_STRUCTP(psid);
+ id.id = gid;
+ id.type = ID_TYPE_GID;
+
become_root();
- ret = pdb_gid_to_sid(gid, psid);
+ ret = pdb_id_to_sid(&id, psid);
unbecome_root();
if (ret) {
@@ -1527,8 +1535,13 @@ NTSTATUS get_primary_group_sid(TALLOC_CTX *mem_ctx,
}
} else {
/* Try group mapping */
+ struct unixid id;
+
+ id.id = pwd->pw_gid;
+ id.type = ID_TYPE_GID;
+
ZERO_STRUCTP(group_sid);
- if (pdb_gid_to_sid(pwd->pw_gid, group_sid)) {
+ if (pdb_id_to_sid(&id, group_sid)) {
need_lookup_sid = true;
}
}
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index ed42961..9dee9d2 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1204,35 +1204,23 @@ bool pdb_get_seq_num(time_t *seq_num)
return NT_STATUS_IS_OK(pdb->get_seq_num(pdb, seq_num));
}
-bool pdb_uid_to_sid(uid_t uid, struct dom_sid *sid)
-{
- struct pdb_methods *pdb = pdb_get_methods();
- bool ret;
-
- ret = pdb->uid_to_sid(pdb, uid, sid);
-
- if (ret == true) {
- struct unixid id;
- id.id = uid;
- id.type = ID_TYPE_UID;
- idmap_cache_set_sid2unixid(sid, &id);
- }
-
- return ret;
-}
-
-bool pdb_gid_to_sid(gid_t gid, struct dom_sid *sid)
+/*
+ * Instead of passing down a gid or uid, this function sends down a pointer
+ * to a unixid.
+ *
+ * This acts as an in-out variable so that the idmap functions can correctly
+ * receive ID_TYPE_BOTH, filling in cache details correctly rather than forcing
+ * the cache to store ID_TYPE_UID or ID_TYPE_GID.
+ */
+bool pdb_id_to_sid(struct unixid *id, struct dom_sid *sid)
{
struct pdb_methods *pdb = pdb_get_methods();
bool ret;
- ret = pdb->gid_to_sid(pdb, gid, sid);
+ ret = pdb->id_to_sid(pdb, id, sid);
if (ret == true) {
- struct unixid id;
- id.id = gid;
- id.type = ID_TYPE_GID;
- idmap_cache_set_sid2unixid(sid, &id);
+ idmap_cache_set_sid2unixid(sid, id);
}
return ret;
@@ -1458,6 +1446,20 @@ static bool pdb_default_gid_to_sid(struct pdb_methods *methods, gid_t gid,
return true;
}
+static bool pdb_default_id_to_sid(struct pdb_methods *methods, struct unixid *id,
+ struct dom_sid *sid)
+{
+ switch (id->type) {
+ case ID_TYPE_UID:
+ return pdb_default_uid_to_sid(methods, id->id, sid);
+
+ case ID_TYPE_GID:
+ return pdb_default_gid_to_sid(methods, id->id, sid);
+
+ default:
+ return false;
+ }
+}
/**
* The "Unix User" and "Unix Group" domains have a special
* id mapping that is a rid-algorithm with range starting at 0.
@@ -2614,8 +2616,7 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
(*methods)->get_account_policy = pdb_default_get_account_policy;
(*methods)->set_account_policy = pdb_default_set_account_policy;
(*methods)->get_seq_num = pdb_default_get_seq_num;
- (*methods)->uid_to_sid = pdb_default_uid_to_sid;
- (*methods)->gid_to_sid = pdb_default_gid_to_sid;
+ (*methods)->id_to_sid = pdb_default_id_to_sid;
(*methods)->sid_to_id = pdb_default_sid_to_id;
(*methods)->search_groups = pdb_default_search_groups;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 0458e56..0d2c302 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -3017,6 +3017,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
NTSTATUS result;
struct dom_sid sid;
+ struct unixid id;
int rc;
@@ -3082,7 +3083,10 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
goto done;
}
- if (pdb_gid_to_sid(map->gid, &sid)) {
+ id.id = map->gid;
+ id.type = ID_TYPE_GID;
+
+ if (pdb_id_to_sid(&id, &sid)) {
DEBUG(3, ("Gid %u is already mapped to SID %s, refusing to "
"add\n", (unsigned int)map->gid, sid_string_dbg(&sid)));
result = NT_STATUS_GROUP_EXISTS;
@@ -5128,6 +5132,21 @@ static bool ldapsam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
return ret;
}
+static bool ldapsam_id_to_sid(struct pdb_methods *methods, struct unixid *id,
+ struct dom_sid *sid)
+{
+ switch (id->type) {
+ case ID_TYPE_UID:
+ return ldapsam_uid_to_sid(methods, id->id, sid);
+
+ case ID_TYPE_GID:
+ return ldapsam_gid_to_sid(methods, id->id, sid);
+
+ default:
+ return false;
+ }
+}
+
/*
* The following functions are called only if
@@ -6487,8 +6506,7 @@ NTSTATUS pdb_ldapsam_init_common(struct pdb_methods **pdb_method,
ldapsam_enum_group_memberships;
(*pdb_method)->lookup_rids = ldapsam_lookup_rids;
(*pdb_method)->sid_to_id = ldapsam_sid_to_id;
- (*pdb_method)->uid_to_sid = ldapsam_uid_to_sid;
- (*pdb_method)->gid_to_sid = ldapsam_gid_to_sid;
+ (*pdb_method)->id_to_sid = ldapsam_id_to_sid;
if (lp_parm_bool(-1, "ldapsam", "editposix", False)) {
(*pdb_method)->create_user = ldapsam_create_user;
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index 465cc24..5fa2c2f 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -2042,8 +2042,16 @@ static bool pdb_samba_dsdb_search_aliases(struct pdb_methods *m,
return true;
}
-static bool pdb_samba_dsdb_uid_to_sid(struct pdb_methods *m, uid_t uid,
- struct dom_sid *sid)
+/*
+ * Instead of taking a gid or uid, this function takes a pointer to a
+ * unixid.
+ *
+ * This acts as an in-out variable so that the idmap functions can correctly
+ * receive ID_TYPE_BOTH, and this function ensures cache details are filled
+ * correctly rather than forcing the cache to store ID_TYPE_UID or ID_TYPE_GID.
+ */
+static bool pdb_samba_dsdb_id_to_sid(struct pdb_methods *m, struct unixid *id,
+ struct dom_sid *sid)
{
struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
m->private_data, struct pdb_samba_dsdb_state);
@@ -2055,8 +2063,7 @@ static bool pdb_samba_dsdb_uid_to_sid(struct pdb_methods *m, uid_t uid,
return false;
}
- id_map.xid.id = uid;
- id_map.xid.type = ID_TYPE_UID;
+ id_map.xid = *id;
id_maps[0] = &id_map;
id_maps[1] = NULL;
@@ -2065,33 +2072,9 @@ static bool pdb_samba_dsdb_uid_to_sid(struct pdb_methods *m, uid_t uid,
talloc_free(tmp_ctx);
return false;
}
- *sid = *id_map.sid;
- talloc_free(tmp_ctx);
- return true;
-}
-static bool pdb_samba_dsdb_gid_to_sid(struct pdb_methods *m, gid_t gid,
- struct dom_sid *sid)
-{
- struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
- m->private_data, struct pdb_samba_dsdb_state);
- NTSTATUS status;
- struct id_map id_map;
- struct id_map *id_maps[2];
- TALLOC_CTX *tmp_ctx = talloc_stackframe();
- if (!tmp_ctx) {
- return false;
- }
-
- id_map.xid.id = gid;
- id_map.xid.type = ID_TYPE_GID;
- id_maps[0] = &id_map;
- id_maps[1] = NULL;
-
- status = idmap_xids_to_sids(state->idmap_ctx, tmp_ctx, id_maps);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tmp_ctx);
- return false;
+ if (id_map.xid.type != ID_TYPE_NOT_SPECIFIED) {
+ id->type = id_map.xid.type;
}
*sid = *id_map.sid;
talloc_free(tmp_ctx);
@@ -2341,8 +2324,7 @@ static void pdb_samba_dsdb_init_methods(struct pdb_methods *m)
m->search_users = pdb_samba_dsdb_search_users;
m->search_groups = pdb_samba_dsdb_search_groups;
m->search_aliases = pdb_samba_dsdb_search_aliases;
- m->uid_to_sid = pdb_samba_dsdb_uid_to_sid;
- m->gid_to_sid = pdb_samba_dsdb_gid_to_sid;
+ m->id_to_sid = pdb_samba_dsdb_id_to_sid;
m->sid_to_id = pdb_samba_dsdb_sid_to_id;
m->capabilities = pdb_samba_dsdb_capabilities;
m->new_rid = pdb_samba_dsdb_new_rid;
diff --git a/source3/passdb/pdb_wbc_sam.c b/source3/passdb/pdb_wbc_sam.c
index 2343649..b20a35a 100644
--- a/source3/passdb/pdb_wbc_sam.c
+++ b/source3/passdb/pdb_wbc_sam.c
@@ -40,6 +40,7 @@
#include "passdb.h"
#include "lib/winbind_util.h"
#include "passdb/pdb_wbc_sam.h"
+#include "idmap.h"
/***************************************************************************
Default implementations of some functions.
@@ -72,16 +73,19 @@ static NTSTATUS pdb_wbc_sam_getsampwsid(struct pdb_methods *methods, struct samu
return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwsid(sid));
}
-static bool pdb_wbc_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
- struct dom_sid *sid)
+static bool pdb_wbc_sam_id_to_sid(struct pdb_methods *methods, struct unixid *id,
+ struct dom_sid *sid)
{
- return winbind_uid_to_sid(sid, uid);
-}
+ switch (id->type) {
+ case ID_TYPE_UID:
+ return winbind_uid_to_sid(sid, id->id);
-static bool pdb_wbc_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
- struct dom_sid *sid)
-{
- return winbind_gid_to_sid(sid, gid);
+ case ID_TYPE_GID:
+ return winbind_gid_to_sid(sid, id->id);
+
+ default:
+ return false;
+ }
}
static NTSTATUS pdb_wbc_sam_enum_group_members(struct pdb_methods *methods,
@@ -426,8 +430,7 @@ static NTSTATUS pdb_init_wbc_sam(struct pdb_methods **pdb_method, const char *lo
--
Samba Shared Repository
More information about the samba-cvs
mailing list