summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-05-19 17:48:40 +0000
committerLuke Leighton <lkcl@samba.org>1998-05-19 17:48:40 +0000
commit0a36b8d8a959c18c670a7e41e3f5a728f3ea88c3 (patch)
tree196e17410cdfc8c8427eb6424c51b1a48add1926 /source3/rpc_server
parent643e16be620b920f72f59a037e0d0d4940016a29 (diff)
downloadsamba-0a36b8d8a959c18c670a7e41e3f5a728f3ea88c3.tar.gz
samba-0a36b8d8a959c18c670a7e41e3f5a728f3ea88c3.tar.bz2
samba-0a36b8d8a959c18c670a7e41e3f5a728f3ea88c3.zip
ldap.c :
- added support for some of the new passdb_ops functions. - removed functions that are supported "indirectly" through passdb.c nisppass.c : - modified make_nisname_from_xxx() functions to take a "file" arg. - turned getnisp21pwuid() into getnisp21pwrid(). getnisp21pwuid() functionality is available through "indirect" support in passdb.c - removed functions that are supported "indirectly" through passdb.c - added support for some of the new passdb_ops functions. passdb.c : - created getsam21pwrid() function to go alongside getsam21pwuid. it is not expected that getsam21pwuid ever be used, certainly not from the lib/rpc code. - created getsamdisprid() and getsamdispent(). these are primarily for support of SamrQueryDisplayInfo, however given that they [struct sam_disp_info] return username, rid and fullname, there may be further instances where these functions will be useful. - added support where either the get/add/mod-smb or get/add/mod-sam21 functions are optional. this can be done very easily by checking whether the struct passdb_ops table functions are NULL or not. documented this capability in the notes at the top of the module. - where unix uid was referenced, use uid_t. - where unix gid was referenced, use gid_t. smb.h : - added sam_disp_info functions to passdb_ops. - added getsam21pwrid() function. smbpass.c : - added reference to iterate_getsam21pwrid(). lib/rpc/server/srv_samr.c : - removed group rid code added to get_user_info_21() code: this had been added in the wrong place. the client / server should already know whether it wants to do a lookup by user rid or by group rid. the test of whether the rid is a user or group rid has been left in because this may become useful consistency-check code. - converted back to getsam21pwrid() not getsam21pwuid(pdb_user_rid_to_uid()). this is because the unix uid to user rid mapping can be non-monotonic in some password database systems, and monotonic in others. imposing the restriction by converting immediately from rid to uid at this point is inadviseable, and will place this potential restriction on _all_ password database systems, not just some which, for whatever reason, do not support user rids. it should be up to the individual password database writer to convert from user rid to unix uid, should that module not support rids. lib/rpc/server/srv_util.c : - got lookup_user_name() to call getsamdisprid() not getsmbpwuid(). a bug was introduced (or at least the bug already there was not fixed) whereby the nt user rid was converted to a unix uid, and then not used. (This used to be commit 0193dd21c3c44e0611add742c6f92b92474de6b8)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr.c38
-rw-r--r--source3/rpc_server/srv_util.c12
2 files changed, 13 insertions, 37 deletions
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index adc16fa5c8..d1503a762e 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -860,41 +860,21 @@ static void api_samr_open_user( int uid, prs_struct *data, prs_struct *rdata)
/*************************************************************************
get_user_info_21
*************************************************************************/
-static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
+static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 user_rid)
{
NTTIME dummy_time;
struct sam_passwd *sam_pass;
LOGON_HRS hrs;
int i;
- /*
- * Convert from rid to either a uid or gid as soon as
- * possible. JRA.
- */
-
- if(pdb_rid_is_user(rid))
- {
- uint32 uid = pdb_user_rid_to_uid(rid);
- become_root(True);
- sam_pass = getsam21pwuid(uid);
- unbecome_root(True);
- }
- else
- {
- struct group *grent;
- uint32 gid;
- gid = pdb_group_rid_to_gid(rid);
- if((grent = getgrgid(gid)) == NULL)
- {
- DEBUG(0,("get_user_info_21: Unable to get group info.\n"));
- return False;
- }
- /* TODO - at this point we need to convert from
- a UNIX struct group into a user info 21 structure.
- Punt for now. JRA.
- */
- return False;
- }
+ if (!pdb_rid_is_user(user_rid))
+ {
+ return False;
+ }
+
+ become_root(True);
+ sam_pass = getsam21pwrid(user_rid);
+ unbecome_root(True);
if (sam_pass == NULL)
{
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index 15c06d18bd..fca37db717 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -394,8 +394,7 @@ uint32 lookup_alias_name(uint32 rid, char *alias_name, uint32 *type)
********************************************************************/
uint32 lookup_user_name(uint32 rid, char *user_name, uint32 *type)
{
- struct smb_passwd *smb_pass;
- uint32 unix_uid;
+ struct sam_disp_info *disp_info;
int i = 0;
(*type) = SID_NAME_USER;
@@ -414,17 +413,14 @@ uint32 lookup_user_name(uint32 rid, char *user_name, uint32 *type)
return 0x0;
}
- unix_uid = pdb_uid_to_user_rid(rid);
- DEBUG(5,(" uid: %d", unix_uid));
-
/* ok, it's a user. find the user account */
become_root(True);
- smb_pass = getsmbpwuid(rid); /* lkclXXXX SHOULD use rid mapping here! */
+ disp_info = getsamdisprid(rid);
unbecome_root(True);
- if (smb_pass != NULL)
+ if (disp_info != NULL)
{
- fstrcpy(user_name, smb_pass->smb_name);
+ fstrcpy(user_name, disp_info->smb_name);
DEBUG(5,(" = %s\n", user_name));
return 0x0;
}