summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2002-05-26 19:11:52 +0000
committerSimo Sorce <idra@samba.org>2002-05-26 19:11:52 +0000
commita27a0e01e2f0c48a4a8d84b17693390a268310f8 (patch)
tree36a97084026b6bfe9528313ae4970d07a5ec0603 /source3/passdb
parent069e6fb9eb4a0bf6720cbbf493d0cb36baac9580 (diff)
downloadsamba-a27a0e01e2f0c48a4a8d84b17693390a268310f8.tar.gz
samba-a27a0e01e2f0c48a4a8d84b17693390a268310f8.tar.bz2
samba-a27a0e01e2f0c48a4a8d84b17693390a268310f8.zip
change: pdb_getsampwrid() ->pdb_getsampwsid()
passdb interface change, now the passdb modules will be asked for SID not for rid, the modules have been updated with a passthrough function that calls the old getsampwrid() functions. srv_samr_nt.c functions that made use of the pdb_getsampwrid funcion has been updated to use the SID one. (This used to be commit f5c6496c33fa7f5c2826540ffb4a49d8a5790fb3)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c4
-rw-r--r--source3/passdb/pdb_interface.c10
-rw-r--r--source3/passdb/pdb_ldap.c9
-rw-r--r--source3/passdb/pdb_nisplus.c10
-rw-r--r--source3/passdb/pdb_smbpasswd.c10
-rw-r--r--source3/passdb/pdb_tdb.c11
-rw-r--r--source3/passdb/pdb_unix.c9
7 files changed, 49 insertions, 14 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 32d6731a9e..aa7672731a 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -618,7 +618,7 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use
}
/* This now does the 'generic' mapping in pdb_unix */
- if (pdb_getsampwrid(sam_account, rid)) {
+ if (pdb_getsampwsid(sam_account, sid)) {
fstrcpy(name, pdb_get_username(sam_account));
*psid_name_use = SID_NAME_USER;
@@ -852,7 +852,7 @@ BOOL local_sid_to_uid(uid_t *puid, DOM_SID *psid, enum SID_NAME_USE *name_type)
if (NT_STATUS_IS_ERR(pdb_init_sam(&sam_user)))
return False;
- if (pdb_getsampwrid(sam_user, rid)) {
+ if (pdb_getsampwsid(sam_user, psid)) {
*puid = pdb_get_uid(sam_user);
if (*puid == -1) {
pdb_free_sam(&sam_user);
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index e57944cda7..d8f69e56b1 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -122,7 +122,7 @@ static BOOL context_getsampwnam(struct pdb_context *context, SAM_ACCOUNT *sam_ac
return False;
}
-static BOOL context_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_acct, uint32 rid)
+static BOOL context_getsampwsid(struct pdb_context *context, SAM_ACCOUNT *sam_acct, DOM_SID *sid)
{
struct pdb_methods *curmethods;
if ((!context)) {
@@ -133,7 +133,7 @@ static BOOL context_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_ac
curmethods = context->pdb_methods;
while (curmethods){
- if (curmethods->getsampwrid && curmethods->getsampwrid(curmethods, sam_acct, rid) == True){
+ if (curmethods->getsampwsid && curmethods->getsampwsid(curmethods, sam_acct, sid) == True){
sam_acct->methods = curmethods;
return True;
}
@@ -299,7 +299,7 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
(*context)->pdb_endsampwent = context_endsampwent;
(*context)->pdb_getsampwent = context_getsampwent;
(*context)->pdb_getsampwnam = context_getsampwnam;
- (*context)->pdb_getsampwrid = context_getsampwrid;
+ (*context)->pdb_getsampwsid = context_getsampwsid;
(*context)->pdb_add_sam_account = context_add_sam_account;
(*context)->pdb_update_sam_account = context_update_sam_account;
(*context)->pdb_delete_sam_account = context_delete_sam_account;
@@ -431,7 +431,7 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, const char *username)
return pdb_context->pdb_getsampwnam(pdb_context, sam_acct, username);
}
-BOOL pdb_getsampwrid(SAM_ACCOUNT *sam_acct, uint32 rid)
+BOOL pdb_getsampwsid(SAM_ACCOUNT *sam_acct, DOM_SID *sid)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
@@ -439,7 +439,7 @@ BOOL pdb_getsampwrid(SAM_ACCOUNT *sam_acct, uint32 rid)
return False;
}
- return pdb_context->pdb_getsampwrid(pdb_context, sam_acct, rid);
+ return pdb_context->pdb_getsampwsid(pdb_context, sam_acct, sid);
}
BOOL pdb_add_sam_account(SAM_ACCOUNT *sam_acct)
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 70f130c0a3..28c08e0f63 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1270,6 +1270,13 @@ static BOOL ldapsam_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT * us
}
}
+static BOOL ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, DOM_SID *sid)
+{
+ uint32 rid;
+ sid_peek_rid(sid, &rid);
+ return ldapsam_getsampwrid(my_methods, user, rid);
+}
+
/**********************************************************************
Delete entry from LDAP for username
*********************************************************************/
@@ -1537,7 +1544,7 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
(*pdb_method)->endsampwent = ldapsam_endsampwent;
(*pdb_method)->getsampwent = ldapsam_getsampwent;
(*pdb_method)->getsampwnam = ldapsam_getsampwnam;
- (*pdb_method)->getsampwrid = ldapsam_getsampwrid;
+ (*pdb_method)->getsampwsid = ldapsam_getsampwsid;
(*pdb_method)->add_sam_account = ldapsam_add_sam_account;
(*pdb_method)->update_sam_account = ldapsam_update_sam_account;
(*pdb_method)->delete_sam_account = ldapsam_delete_sam_account;
diff --git a/source3/passdb/pdb_nisplus.c b/source3/passdb/pdb_nisplus.c
index 145e1d4f0c..0c4c2c5bb3 100644
--- a/source3/passdb/pdb_nisplus.c
+++ b/source3/passdb/pdb_nisplus.c
@@ -1030,7 +1030,15 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT * user, const char *sname)
/*************************************************************************
Routine to search the nisplus passwd file for an entry matching the username
*************************************************************************/
-BOOL pdb_getsampwrid(SAM_ACCOUNT * user, uint32 rid)
+
+BOOL pdb_getsampwsid(SAM_ACCOUNT * user, DOM_SID *sid)
+{
+ uint32 rid;
+ sid_peek_rid(sid, &rid);
+ return pdb_getsampwrid(user, rid);
+}
+
+static BOOL pdb_getsampwrid(SAM_ACCOUNT * user, uint32 rid)
{
nis_result *result;
char *nisname;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index f6214220ea..a6bd66eace 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1411,7 +1411,6 @@ static BOOL smbpasswd_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT *s
return True;
}
-
static BOOL smbpasswd_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_acct,uint32 rid)
{
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1456,6 +1455,13 @@ static BOOL smbpasswd_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT *s
return True;
}
+static BOOL smbpasswd_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, DOM_SID *sid)
+{
+ uint32 rid;
+ sid_peek_rid(sid, &rid);
+ return smbpasswd_getsampwrid(my_methods, user, rid);
+}
+
static BOOL smbpasswd_add_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT *sampass)
{
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1529,7 +1535,7 @@ NTSTATUS pdb_init_smbpasswd(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
(*pdb_method)->endsampwent = smbpasswd_endsampwent;
(*pdb_method)->getsampwent = smbpasswd_getsampwent;
(*pdb_method)->getsampwnam = smbpasswd_getsampwnam;
- (*pdb_method)->getsampwrid = smbpasswd_getsampwrid;
+ (*pdb_method)->getsampwsid = smbpasswd_getsampwsid;
(*pdb_method)->add_sam_account = smbpasswd_add_sam_account;
(*pdb_method)->update_sam_account = smbpasswd_update_sam_account;
(*pdb_method)->delete_sam_account = smbpasswd_delete_sam_account;
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index cda9d68c10..2341210e39 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -277,7 +277,7 @@ done:
Intialize a BYTE buffer from a SAM_ACCOUNT struct
*********************************************************************/
static uint32 init_buffer_from_sam (struct tdbsam_privates *tdb_state,
- uint8 **buf, SAM_ACCOUNT *sampass)
+ uint8 **buf, const SAM_ACCOUNT *sampass)
{
size_t len, buflen;
@@ -668,6 +668,13 @@ static BOOL tdbsam_getsampwrid (struct pdb_methods *my_methods, SAM_ACCOUNT *use
return tdbsam_getsampwnam (my_methods, user, name);
}
+static BOOL tdbsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, DOM_SID *sid)
+{
+ uint32 rid;
+ sid_peek_rid(sid, &rid);
+ return tdbsam_getsampwrid(my_methods, user, rid);
+}
+
/***************************************************************************
Delete a SAM_ACCOUNT
****************************************************************************/
@@ -910,7 +917,7 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
(*pdb_method)->endsampwent = tdbsam_endsampwent;
(*pdb_method)->getsampwent = tdbsam_getsampwent;
(*pdb_method)->getsampwnam = tdbsam_getsampwnam;
- (*pdb_method)->getsampwrid = tdbsam_getsampwrid;
+ (*pdb_method)->getsampwsid = tdbsam_getsampwsid;
(*pdb_method)->add_sam_account = tdbsam_add_sam_account;
(*pdb_method)->update_sam_account = tdbsam_update_sam_account;
(*pdb_method)->delete_sam_account = tdbsam_delete_sam_account;
diff --git a/source3/passdb/pdb_unix.c b/source3/passdb/pdb_unix.c
index 1c0ede76d3..85ff5bd933 100644
--- a/source3/passdb/pdb_unix.c
+++ b/source3/passdb/pdb_unix.c
@@ -65,6 +65,13 @@ static BOOL unixsam_getsampwrid (struct pdb_methods *methods,
return ret;
}
+static BOOL unixsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, DOM_SID *sid)
+{
+ uint32 rid;
+ sid_peek_rid(sid, &rid);
+ return unixsam_getsampwrid(my_methods, user, rid);
+}
+
/***************************************************************************
Adds an existing SAM_ACCOUNT
****************************************************************************/
@@ -109,7 +116,7 @@ NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
(*pdb_method)->endsampwent = NULL;
(*pdb_method)->getsampwent = NULL;
(*pdb_method)->getsampwnam = unixsam_getsampwnam;
- (*pdb_method)->getsampwrid = unixsam_getsampwrid;
+ (*pdb_method)->getsampwsid = unixsam_getsampwsid;
(*pdb_method)->add_sam_account = unixsam_add_sam_account;
(*pdb_method)->update_sam_account = unixsam_update_sam_account;
(*pdb_method)->delete_sam_account = NULL;