summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-21 21:11:16 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-21 21:11:16 +0000
commit21e107fd42eb953affac28239588458c6c0ee323 (patch)
treec00689d10ac2147dae1fe035585901e8c46ee0e7 /source3/passdb
parent8c307cee7a687da965c9b03ff19dd9de2eaabe64 (diff)
downloadsamba-21e107fd42eb953affac28239588458c6c0ee323.tar.gz
samba-21e107fd42eb953affac28239588458c6c0ee323.tar.bz2
samba-21e107fd42eb953affac28239588458c6c0ee323.zip
the next dialog: user-groups. it's not very sensible what appears, but hey:
it appears! (This used to be commit 399035098f212e976cc0000a215e0705ebe78c05)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/ldap.c6
-rw-r--r--source3/passdb/nispass.c6
-rw-r--r--source3/passdb/passdb.c27
-rw-r--r--source3/passdb/smbpass.c1
4 files changed, 40 insertions, 0 deletions
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c
index 59b06d7e6f..b673b81683 100644
--- a/source3/passdb/ldap.c
+++ b/source3/passdb/ldap.c
@@ -930,6 +930,11 @@ static struct smb_passwd *getldappwuid(uid_t smb_userid)
return pdb_sam_to_smb(iterate_getsam21pwuid(smb_userid));
}
+static struct smb_passwd *getldappwrid(uint32 user_rid)
+{
+ return pdb_sam_to_smb(iterate_getsam21pwuid(pdb_user_rid_to_uid(user_rid)));
+}
+
static struct smb_passwd *getldappwent(void *vp)
{
return pdb_sam_to_smb(getldap21pwent(vp));
@@ -973,6 +978,7 @@ static struct passdb_ops ldap_ops =
setldappwpos,
getldappwnam,
getldappwuid,
+ getldappwrid,
getldappwent,
add_ldappwd_entry,
mod_ldappwd_entry,
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index 32cf42f95b..e750fec1a1 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -626,6 +626,11 @@ static struct sam_passwd *getnisp21pwuid(uid_t smb_userid)
return getnisp21pwrid(pdb_uid_to_user_rid(smb_userid));
}
+static struct smb_passwd *getnisppwrid(uid_t user_rid)
+{
+ return pdb_sam_to_smb(getnisp21pwuid(pdb_user_rid_to_uid(user_rid)));
+}
+
static struct smb_passwd *getnisppwuid(uid_t smb_userid)
{
return pdb_sam_to_smb(getnisp21pwuid(smb_userid));
@@ -653,6 +658,7 @@ static struct passdb_ops nispasswd_ops = {
setnisppwpos,
getnisppwnam,
getnisppwuid,
+ getnisppwrid,
getnisppwent,
add_nisppwd_entry,
mod_nisppwd_entry,
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index a4bb657e80..0cd2f6ef2e 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -85,6 +85,15 @@ BOOL initialize_password_db(void)
*/
/************************************************************************
+ Utility function to search smb passwd by rid.
+*************************************************************************/
+
+struct smb_passwd *iterate_getsmbpwrid(uint32 user_rid)
+{
+ return iterate_getsmbpwuid(pdb_user_rid_to_uid(user_rid));
+}
+
+/************************************************************************
Utility function to search smb passwd by uid. use this if your database
does not have search facilities.
*************************************************************************/
@@ -223,6 +232,15 @@ struct smb_passwd *getsmbpwnam(char *name)
}
/************************************************************************
+ Routine to search smb passwd by user rid.
+*************************************************************************/
+
+struct smb_passwd *getsmbpwrid(uint32 user_rid)
+{
+ return pdb_ops->getsmbpwrid(user_rid);
+}
+
+/************************************************************************
Routine to search smb passwd by uid.
*************************************************************************/
@@ -966,6 +984,15 @@ Error was %s\n", sid_file, strerror(errno) ));
converts UNIX uid to an NT User RID.
********************************************************************/
+uid_t pdb_user_rid_to_uid(uint32 user_rid)
+{
+ return (uid_t)(((user_rid & (~USER_RID_TYPE))- 1000)/RID_MULTIPLIER);
+}
+
+/*******************************************************************
+ converts UNIX uid to an NT User RID.
+ ********************************************************************/
+
uint32 pdb_uid_to_user_rid(uid_t uid)
{
return (((((uint32)uid)*RID_MULTIPLIER) + 1000) | USER_RID_TYPE);
diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c
index bde696290d..c8d817dc40 100644
--- a/source3/passdb/smbpass.c
+++ b/source3/passdb/smbpass.c
@@ -990,6 +990,7 @@ static struct passdb_ops file_ops = {
setsmbfilepwpos,
iterate_getsmbpwnam, /* In passdb.c */
iterate_getsmbpwuid, /* In passdb.c */
+ iterate_getsmbpwrid, /* In passdb.c */
getsmbfilepwent,
add_smbfilepwd_entry,
mod_smbfilepwd_entry,