summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/passdb.h5
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/passdb/passdb.c2
-rw-r--r--source3/passdb/pdb_ads.c6
-rw-r--r--source3/passdb/pdb_interface.c12
-rw-r--r--source3/passdb/pdb_ldap.c6
-rw-r--r--source3/passdb/pdb_smbpasswd.c6
-rw-r--r--source3/passdb/pdb_tdb.c6
-rw-r--r--source3/utils/net_groupmap.c12
-rw-r--r--source3/utils/net_sam.c6
10 files changed, 33 insertions, 30 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index d67c2842a6..dadb2275d3 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -197,6 +197,8 @@ struct pdb_search {
void (*search_end)(struct pdb_search *search);
};
+#define PDB_CAP_STORE_RIDS 0x0001
+
/*****************************************************************
Functions to be implemented by the new (v2) passdb API
****************************************************************/
@@ -212,6 +214,7 @@ struct pdb_search {
* enum lsa_SidType rather than uint32.
* Changed to 16 for access to the trusted domain passwords (obnox).
* Changed to 17, the sampwent interface is gone.
+ * Changed to 18, pdb_rid_algorithm -> pdb_capabilities
*/
#define PASSDB_INTERFACE_VERSION 17
@@ -361,7 +364,7 @@ struct pdb_methods
bool (*sid_to_id)(struct pdb_methods *methods, const DOM_SID *sid,
union unid_t *id, enum lsa_SidType *type);
- bool (*rid_algorithm)(struct pdb_methods *methods);
+ uint32_t (*capabilities)(struct pdb_methods *methods);
bool (*new_rid)(struct pdb_methods *methods, uint32 *rid);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 07a749d849..1a8a9a9538 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4595,7 +4595,7 @@ bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid);
bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid);
bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
enum lsa_SidType *type);
-bool pdb_rid_algorithm(void);
+uint32_t pdb_capabilities(void);
bool pdb_new_rid(uint32 *rid);
bool initialize_password_db(bool reload, struct event_context *event_ctx);
struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 8efd6592dd..502c3728a3 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -207,7 +207,7 @@ static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *p
initialized and will fill in these fields later (such as from a
netr_SamInfo3 structure) */
- if ( create && !pdb_rid_algorithm() ) {
+ if ( create && (pdb_capabilities() & PDB_CAP_STORE_RIDS)) {
uint32 user_rid;
DOM_SID user_sid;
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index cdde30dcdc..b7c42c58c9 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -1920,9 +1920,9 @@ static bool pdb_ads_sid_to_id(struct pdb_methods *m, const DOM_SID *sid,
return false;
}
-static bool pdb_ads_rid_algorithm(struct pdb_methods *m)
+static uint32_t pdb_ads_capabilities(struct pdb_methods *m)
{
- return false;
+ return PDB_CAP_STORE_RIDS;
}
static bool pdb_ads_new_rid(struct pdb_methods *m, uint32 *rid)
@@ -2005,7 +2005,7 @@ static void pdb_ads_init_methods(struct pdb_methods *m)
m->uid_to_sid = pdb_ads_uid_to_sid;
m->gid_to_sid = pdb_ads_gid_to_sid;
m->sid_to_id = pdb_ads_sid_to_id;
- m->rid_algorithm = pdb_ads_rid_algorithm;
+ m->capabilities = pdb_ads_capabilities;
m->new_rid = pdb_ads_new_rid;
m->get_trusteddom_pw = pdb_ads_get_trusteddom_pw;
m->set_trusteddom_pw = pdb_ads_set_trusteddom_pw;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 6fe0979a50..a72409ea4a 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -574,12 +574,12 @@ static NTSTATUS pdb_default_create_dom_group(struct pdb_methods *methods,
return NT_STATUS_ACCESS_DENIED;
}
- if (pdb_rid_algorithm()) {
- *rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
- } else {
+ if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
if (!pdb_new_rid(rid)) {
return NT_STATUS_ACCESS_DENIED;
}
+ } else {
+ *rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
}
sid_compose(&group_sid, get_global_sam_sid(), *rid);
@@ -1043,10 +1043,10 @@ bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
return pdb->sid_to_id(pdb, sid, id, type);
}
-bool pdb_rid_algorithm(void)
+uint32_t pdb_capabilities(void)
{
struct pdb_methods *pdb = pdb_get_methods();
- return pdb->rid_algorithm(pdb);
+ return pdb->capabilities(pdb);
}
/********************************************************************
@@ -1065,7 +1065,7 @@ bool pdb_new_rid(uint32 *rid)
int i;
TALLOC_CTX *ctx;
- if (pdb_rid_algorithm()) {
+ if ((pdb_capabilities() & PDB_CAP_STORE_RIDS) == 0) {
DEBUG(0, ("Trying to allocate a RID when algorithmic RIDs "
"are active\n"));
return False;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index dddde75a4e..c2230eb982 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -4728,9 +4728,9 @@ static bool ldapsam_search_aliases(struct pdb_methods *methods,
return ldapsam_search_grouptype(methods, search, sid, SID_NAME_ALIAS);
}
-static bool ldapsam_rid_algorithm(struct pdb_methods *methods)
+static uint32_t ldapsam_capabilities(struct pdb_methods *methods)
{
- return False;
+ return PDB_CAP_STORE_RIDS;
}
static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv,
@@ -6154,7 +6154,7 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c
(*pdb_method)->get_seq_num = ldapsam_get_seq_num;
- (*pdb_method)->rid_algorithm = ldapsam_rid_algorithm;
+ (*pdb_method)->capabilities = ldapsam_capabilities;
(*pdb_method)->new_rid = ldapsam_new_rid;
(*pdb_method)->get_trusteddom_pw = ldapsam_get_trusteddom_pw;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 8074b2e3a1..cac95c40a9 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1520,9 +1520,9 @@ done:
return (ret);
}
-static bool smbpasswd_rid_algorithm(struct pdb_methods *methods)
+static uint32_t smbpasswd_capabilities(struct pdb_methods *methods)
{
- return True;
+ return 0;
}
static void free_private_data(void **vp)
@@ -1682,7 +1682,7 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char
(*pdb_method)->rename_sam_account = smbpasswd_rename_sam_account;
(*pdb_method)->search_users = smbpasswd_search_users;
- (*pdb_method)->rid_algorithm = smbpasswd_rid_algorithm;
+ (*pdb_method)->capabilities = smbpasswd_capabilities;
/* Setup private data and free function */
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index dd6e678c99..4d2a1d830a 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -1066,9 +1066,9 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
return NT_STATUS_ACCESS_DENIED;
}
-static bool tdbsam_rid_algorithm(struct pdb_methods *methods)
+static uint32_t tdbsam_capabilities(struct pdb_methods *methods)
{
- return False;
+ return PDB_CAP_STORE_RIDS;
}
static bool tdbsam_new_rid(struct pdb_methods *methods, uint32 *prid)
@@ -1246,7 +1246,7 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
(*pdb_method)->rename_sam_account = tdbsam_rename_sam_account;
(*pdb_method)->search_users = tdbsam_search_users;
- (*pdb_method)->rid_algorithm = tdbsam_rid_algorithm;
+ (*pdb_method)->capabilities = tdbsam_capabilities;
(*pdb_method)->new_rid = tdbsam_new_rid;
/* save the path for later */
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index a00784e133..16c6187664 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -276,12 +276,12 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv)
if ( (rid == 0) && (string_sid[0] == '\0') ) {
d_printf("No rid or sid specified, choosing a RID\n");
- if (pdb_rid_algorithm()) {
- rid = algorithmic_pdb_gid_to_group_rid(gid);
- } else {
+ if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
if (!pdb_new_rid(&rid)) {
d_printf("Could not get new RID\n");
}
+ } else {
+ rid = algorithmic_pdb_gid_to_group_rid(gid);
}
d_printf("Got RID %d\n", rid);
}
@@ -577,13 +577,13 @@ static int net_groupmap_set(struct net_context *c, int argc, const char **argv)
map.gid = grp->gr_gid;
if (c->opt_rid == 0) {
- if ( pdb_rid_algorithm() )
- c->opt_rid = algorithmic_pdb_gid_to_group_rid(map.gid);
- else {
+ if ( pdb_capabilities() & PDB_CAP_STORE_RIDS ) {
if ( !pdb_new_rid((uint32*)&c->opt_rid) ) {
d_fprintf( stderr, "Could not allocate new RID\n");
return -1;
}
+ } else {
+ c->opt_rid = algorithmic_pdb_gid_to_group_rid(map.gid);
}
}
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 787bbdd502..62abef000d 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -817,14 +817,14 @@ static NTSTATUS map_unix_group(const struct group *grp, GROUP_MAP *pmap)
fstrcpy(map.nt_name, grpname);
- if (pdb_rid_algorithm()) {
- rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
- } else {
+ if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
if (!pdb_new_rid(&rid)) {
DEBUG(3, ("Could not get a new RID for %s\n",
grp->gr_name));
return NT_STATUS_ACCESS_DENIED;
}
+ } else {
+ rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
}
sid_compose(&map.sid, get_global_sam_sid(), rid);