summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-08-26 15:48:50 +0200
committerGünther Deschner <gd@samba.org>2010-09-20 14:04:37 -0700
commit4dbd743e467096624961533335afccadc67af0e6 (patch)
tree221fd5ed097893d3e48f07c926d7ef9bd8313276 /source3/passdb
parent400616017974f057c8a2e817b62b90b1490d4129 (diff)
downloadsamba-4dbd743e467096624961533335afccadc67af0e6.tar.gz
samba-4dbd743e467096624961533335afccadc67af0e6.tar.bz2
samba-4dbd743e467096624961533335afccadc67af0e6.zip
s3-util_sid: use shared dom_sid_compare_auth and dom_sid_equal_X functions.
Guenther
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/lookup_sid.c7
-rw-r--r--source3/passdb/machine_sid.c5
-rw-r--r--source3/passdb/pdb_get_set.c3
-rw-r--r--source3/passdb/pdb_interface.c3
-rw-r--r--source3/passdb/pdb_ldap.c9
-rw-r--r--source3/passdb/pdb_smbpasswd.c3
-rw-r--r--source3/passdb/util_builtin.c3
-rw-r--r--source3/passdb/util_unixsids.c5
-rw-r--r--source3/passdb/util_wellknown.c5
9 files changed, 26 insertions, 17 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index 0e2385f43f..fa855f3467 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -24,6 +24,7 @@
#include "secrets.h"
#include "memcache.h"
#include "idmap_cache.h"
+#include "../libcli/security/dom_sid.h"
/*****************************************************************
Dissect a user-provided name into domain, name, sid and type.
@@ -655,7 +656,7 @@ static bool lookup_as_domain(const struct dom_sid *sid, TALLOC_CTX *mem_ctx,
}
for (i=0; i<num_domains; i++) {
- if (sid_equal(sid, &domains[i]->sid)) {
+ if (dom_sid_equal(sid, &domains[i]->sid)) {
*name = talloc_strdup(mem_ctx,
domains[i]->name);
return true;
@@ -834,7 +835,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
if (!dom_infos[j].valid) {
break;
}
- if (sid_equal(&sid, &dom_infos[j].sid)) {
+ if (dom_sid_equal(&sid, &dom_infos[j].sid)) {
break;
}
}
@@ -1581,7 +1582,7 @@ NTSTATUS get_primary_group_sid(TALLOC_CTX *mem_ctx,
/* We need a sid within our domain */
sid_copy(&domain_sid, group_sid);
sid_split_rid(&domain_sid, &rid);
- if (sid_equal(&domain_sid, get_global_sam_sid())) {
+ if (dom_sid_equal(&domain_sid, get_global_sam_sid())) {
/*
* As shortcut for the expensive lookup_sid call
* compare the domain sid part
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c
index c3534f7fa7..6e5a970f4c 100644
--- a/source3/passdb/machine_sid.c
+++ b/source3/passdb/machine_sid.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "secrets.h"
#include "dbwrap.h"
+#include "../libcli/security/dom_sid.h"
/* NOTE! the global_sam_sid is the SID of our local SAM. This is only
equal to the domain SID when we are a DC, otherwise its our
@@ -113,7 +114,7 @@ static struct dom_sid *pdb_generate_sam_sid(void)
return sam_sid;
}
- if (!sid_equal(&domain_sid, sam_sid)) {
+ if (!dom_sid_equal(&domain_sid, sam_sid)) {
/* Domain name sid doesn't match global sam sid. Re-store domain sid as 'local' sid. */
@@ -232,7 +233,7 @@ void reset_global_sam_sid(void)
bool sid_check_is_domain(const struct dom_sid *sid)
{
- return sid_equal(sid, get_global_sam_sid());
+ return dom_sid_equal(sid, get_global_sam_sid());
}
/*****************************************************************
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 3e2510e74c..493e9ed0dd 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "../libcli/auth/libcli_auth.h"
+#include "../libcli/security/dom_sid.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
@@ -509,7 +510,7 @@ bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum p
sid_compose(&dug_sid, get_global_sam_sid(), DOMAIN_RID_USERS);
- if (sid_equal(&dug_sid, g_sid)) {
+ if (dom_sid_equal(&dug_sid, g_sid)) {
sid_copy(sampass->group_sid, &dug_sid);
} else if (sid_to_gid( g_sid, &gid ) ) {
sid_copy(sampass->group_sid, g_sid);
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 4f93b33a54..9f3a1725a4 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -25,6 +25,7 @@
#include "../librpc/gen_ndr/samr.h"
#include "memcache.h"
#include "nsswitch/winbind_client.h"
+#include "../libcli/security/dom_sid.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
@@ -890,7 +891,7 @@ static bool pdb_user_in_group(TALLOC_CTX *mem_ctx, struct samu *account,
}
for (i=0; i<num_groups; i++) {
- if (sid_equal(group_sid, &sids[i])) {
+ if (dom_sid_equal(group_sid, &sids[i])) {
return True;
}
}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 658d774fef..d046a527a6 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -47,6 +47,7 @@
#include "../libcli/auth/libcli_auth.h"
#include "secrets.h"
#include "idmap_cache.h"
+#include "../libcli/security/dom_sid.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
@@ -1106,7 +1107,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
gid_to_sid(&mapped_gsid, sampass->unix_pw->pw_gid);
primary_gsid = pdb_get_group_sid(sampass);
- if (primary_gsid && sid_equal(primary_gsid, &mapped_gsid)) {
+ if (primary_gsid && dom_sid_equal(primary_gsid, &mapped_gsid)) {
store_gid_sid_cache(primary_gsid,
sampass->unix_pw->pw_gid);
idmap_cache_set_sid2gid(primary_gsid,
@@ -2682,7 +2683,7 @@ static bool ldapsam_extract_rid_from_entry(LDAP *ldap_struct,
return False;
}
- if (sid_compare_domain(&sid, domain_sid) != 0) {
+ if (dom_sid_compare_domain(&sid, domain_sid) != 0) {
DEBUG(10, ("SID %s is not in expected domain %s\n",
str, sid_string_dbg(domain_sid)));
return False;
@@ -3055,7 +3056,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
}
}
- if (sid_compare(&global_sid_NULL, &(*pp_sids)[0]) == 0) {
+ if (dom_sid_compare(&global_sid_NULL, &(*pp_sids)[0]) == 0) {
DEBUG(3, ("primary group of [%s] not found\n",
pdb_get_username(user)));
goto done;
@@ -6668,7 +6669,7 @@ NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location)
}
found_sid = secrets_fetch_domain_sid(ldap_state->domain_name,
&secrets_domain_sid);
- if (!found_sid || !sid_equal(&secrets_domain_sid,
+ if (!found_sid || !dom_sid_equal(&secrets_domain_sid,
&ldap_domain_sid)) {
DEBUG(1, ("pdb_init_ldapsam: Resetting SID for domain "
"%s based on pdb_ldap results %s -> %s\n",
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index dd89c8e10b..9369726988 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "../librpc/gen_ndr/samr.h"
+#include "../libcli/security/dom_sid.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
@@ -1372,7 +1373,7 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, struct sam
return nt_status;
/* build_sam_account might change the SID on us, if the name was for the guest account */
- if (NT_STATUS_IS_OK(nt_status) && !sid_equal(pdb_get_user_sid(sam_acct), sid)) {
+ if (NT_STATUS_IS_OK(nt_status) && !dom_sid_equal(pdb_get_user_sid(sam_acct), sid)) {
DEBUG(1, ("looking for user with sid %s instead returned %s "
"for account %s!?!\n", sid_string_dbg(sid),
sid_string_dbg(pdb_get_user_sid(sam_acct)),
diff --git a/source3/passdb/util_builtin.c b/source3/passdb/util_builtin.c
index 05a46371b3..cf483bbb96 100644
--- a/source3/passdb/util_builtin.c
+++ b/source3/passdb/util_builtin.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "../libcli/security/dom_sid.h"
struct rid_name_map {
uint32 rid;
@@ -104,7 +105,7 @@ const char *builtin_domain_name(void)
bool sid_check_is_builtin(const struct dom_sid *sid)
{
- return sid_equal(sid, &global_sid_Builtin);
+ return dom_sid_equal(sid, &global_sid_Builtin);
}
/*****************************************************************
diff --git a/source3/passdb/util_unixsids.c b/source3/passdb/util_unixsids.c
index 0894804c5b..1bd07c7a2f 100644
--- a/source3/passdb/util_unixsids.c
+++ b/source3/passdb/util_unixsids.c
@@ -18,10 +18,11 @@
*/
#include "includes.h"
+#include "../libcli/security/dom_sid.h"
bool sid_check_is_unix_users(const struct dom_sid *sid)
{
- return sid_equal(sid, &global_sid_Unix_Users);
+ return dom_sid_equal(sid, &global_sid_Unix_Users);
}
bool sid_check_is_in_unix_users(const struct dom_sid *sid)
@@ -79,7 +80,7 @@ bool lookup_unix_user_name(const char *name, struct dom_sid *sid)
bool sid_check_is_unix_groups(const struct dom_sid *sid)
{
- return sid_equal(sid, &global_sid_Unix_Groups);
+ return dom_sid_equal(sid, &global_sid_Unix_Groups);
}
bool sid_check_is_in_unix_groups(const struct dom_sid *sid)
diff --git a/source3/passdb/util_wellknown.c b/source3/passdb/util_wellknown.c
index 7f670f9225..4f6f3f308d 100644
--- a/source3/passdb/util_wellknown.c
+++ b/source3/passdb/util_wellknown.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "../libcli/security/dom_sid.h"
struct rid_name_map {
uint32 rid;
@@ -75,7 +76,7 @@ bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name)
int i;
for (i=0; special_domains[i].sid != NULL; i++) {
- if (sid_equal(sid, special_domains[i].sid)) {
+ if (dom_sid_equal(sid, special_domains[i].sid)) {
if (name != NULL) {
*name = special_domains[i].name;
}
@@ -115,7 +116,7 @@ bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
}
for (i=0; special_domains[i].sid != NULL; i++) {
- if (sid_equal(&dom_sid, special_domains[i].sid)) {
+ if (dom_sid_equal(&dom_sid, special_domains[i].sid)) {
*domain = talloc_strdup(mem_ctx,
special_domains[i].name);
users = special_domains[i].known_users;