-
/*
* Unix SMB/Netbios implementation.
* Version 1.9.
*/
#include "includes.h"
-#include "nterr.h"
extern int DEBUGLEVEL;
uint8 attr = mem[count].attr;
char *name = mem[count].name;
- become_root(True);
+ become_root();
status = lookup_grp_rid(name, &rid, &type);
- unbecome_root(True);
+ unbecome_root();
if (status == 0x0)
{
/*******************************************************************
lookup_builtin_names
********************************************************************/
-uint32 lookup_builtin_names(DOM_SID *sid, char *name, uint8 *type)
+uint32 lookup_builtin_names(uint32 rid, char *name, uint8 *type)
{
uint32 status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
- status = (status != 0x0) ? lookup_wk_user_name (sid, name, type) : status;
- status = (status != 0x0) ? lookup_wk_group_name(sid, name, type) : status;
- status = (status != 0x0) ? lookup_wk_alias_name(sid, name, type) : status;
+ status = (status != 0x0) ? lookup_wk_user_name (rid, name, type) : status;
+ status = (status != 0x0) ? lookup_wk_group_name(rid, name, type) : status;
+ status = (status != 0x0) ? lookup_wk_alias_name(rid, name, type) : status;
return status;
}
/*******************************************************************
lookup_added_name - names that have been added to the SAM database by admins.
********************************************************************/
-uint32 lookup_added_name(DOM_SID *sid, char *name, uint8 *type)
+uint32 lookup_added_name(uint32 rid, char *name, uint8 *type)
{
uint32 status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
- status = (status != 0x0) ? lookup_user_name (sid, name, type) : status;
- status = (status != 0x0) ? lookup_group_name(sid, name, type) : status;
- status = (status != 0x0) ? lookup_alias_name(sid, name, type) : status;
+ status = (status != 0x0) ? lookup_user_name (rid, name, type) : status;
+ status = (status != 0x0) ? lookup_group_name(rid, name, type) : status;
+ status = (status != 0x0) ? lookup_alias_name(rid, name, type) : status;
return status;
}
/*******************************************************************
lookup_name
********************************************************************/
-uint32 lookup_name(DOM_SID *sid, char *name, uint8 *type)
+uint32 lookup_name(uint32 rid, char *name, uint8 *type)
{
uint32 status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
- status = (status != 0x0) ? lookup_builtin_names(sid, name, type) : status;
- status = (status != 0x0) ? lookup_added_name (sid, name, type) : status;
+ status = (status != 0x0) ? lookup_builtin_names(rid, name, type) : status;
+ status = (status != 0x0) ? lookup_added_name (rid, name, type) : status;
return status;
}
/*******************************************************************
lookup_wk_group_name
********************************************************************/
-uint32 lookup_wk_group_name(DOM_SID *sid, char *group_name, uint8 *type)
+uint32 lookup_wk_group_name(uint32 rid, char *group_name, uint8 *type)
{
int i = 0;
- uint32 rid;
- DOM_SID tmp;
-
(*type) = SID_NAME_WKN_GRP;
- sid_copy(&tmp, sid);
- sid_split_rid(&tmp, &rid);
-
- if (!sid_equal(&global_sid_S_1_5_20, &tmp))
- {
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
- }
-
DEBUG(5,("lookup_wk_group_name: rid: %d", rid));
while (domain_group_rids[i].rid != rid && domain_group_rids[i].rid != 0)
/*******************************************************************
lookup_group_name
********************************************************************/
-uint32 lookup_group_name(DOM_SID *sid, char *group_name, uint8 *type)
+uint32 lookup_group_name(uint32 rid, char *group_name, uint8 *type)
{
uint32 status = 0xC0000000 | NT_STATUS_NONE_MAPPED;
- uint32 rid;
- DOM_SID tmp;
-
- (*type) = SID_NAME_DOM_GRP;
+ DOM_SID sid;
- sid_copy(&tmp, sid);
- sid_split_rid(&tmp, &rid);
+ DEBUG(5,("lookup_group_name: rid: 0x%x", rid));
- if (!sid_equal(&global_sid_S_1_5_20, &tmp))
- {
- return status;
- }
+ sid_copy (&sid, &global_sam_sid);
+ sid_append_rid(&sid, rid);
- DEBUG(5,("lookup_group_name: rid: 0x%x", rid));
+ (*type) = SID_NAME_DOM_GRP;
- if (map_group_sid_to_name(sid, group_name, NULL))
+ if (map_group_sid_to_name(&sid, group_name, NULL))
{
status = 0x0;
}
/*******************************************************************
lookup_wk_alias_name
********************************************************************/
-uint32 lookup_wk_alias_name(DOM_SID *sid, char *alias_name, uint8 *type)
+uint32 lookup_wk_alias_name(uint32 rid, char *alias_name, uint8 *type)
{
int i = 0;
- uint32 rid;
- DOM_SID tmp;
-
(*type) = SID_NAME_ALIAS;
- sid_copy(&tmp, sid);
- sid_split_rid(&tmp, &rid);
-
- if (!sid_equal(&global_sid_S_1_5_20, &tmp))
- {
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
- }
-
DEBUG(5,("lookup_wk_alias_name: rid: %d", rid));
while (builtin_alias_rids[i].rid != rid && builtin_alias_rids[i].rid != 0)
/*******************************************************************
lookup_alias_name
********************************************************************/
-uint32 lookup_alias_name(DOM_SID *sid, char *alias_name, uint8 *type)
+uint32 lookup_alias_name(uint32 rid, char *alias_name, uint8 *type)
{
- fstring sid_str;
(*type) = SID_NAME_ALIAS;
- sid_to_string(sid_str, sid);
-
- DEBUG(2,("lookup_alias_name: sid: %d\n", sid_str));
+ DEBUG(2,("lookup_alias_name: rid: %d\n", rid));
DEBUG(2,(" NOT IMPLEMENTED\n"));
return 0xC0000000 | NT_STATUS_NONE_MAPPED;
/*******************************************************************
lookup well-known user name
********************************************************************/
-uint32 lookup_wk_user_name(DOM_SID *sid, char *user_name, uint8 *type)
+uint32 lookup_wk_user_name(uint32 rid, char *user_name, uint8 *type)
{
int i = 0;
- uint32 rid;
- DOM_SID tmp;
-
(*type) = SID_NAME_USER;
- sid_copy(&tmp, sid);
- sid_split_rid(&tmp, &rid);
-
- if (!sid_equal(&global_sid_S_1_5_20, &tmp))
- {
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
- }
-
DEBUG(5,("lookup_wk_user_name: rid: %d", rid));
/* look up the well-known domain user rids first */
/*******************************************************************
lookup user name
********************************************************************/
-uint32 lookup_user_name(DOM_SID *sid, char *user_name, uint8 *type)
+uint32 lookup_user_name(uint32 rid, char *user_name, uint8 *type)
{
struct sam_disp_info *disp_info;
- uint32 rid;
- DOM_SID tmp;
-
(*type) = SID_NAME_USER;
- sid_copy(&tmp, sid);
- sid_split_rid(&tmp, &rid);
-
- if (sid_equal(&global_sam_sid, &tmp))
- {
- DEBUG(5,("lookup_user_name in SAM %s: rid: %d",
- global_sam_name, rid));
-
- /* find the user account */
- become_root(True);
- disp_info = getsamdisprid(rid);
- unbecome_root(True);
+ DEBUG(5,("lookup_user_name: rid: %d", rid));
- if (disp_info != NULL)
- {
- fstrcpy(user_name, disp_info->smb_name);
- DEBUG(5,(" = %s\n", user_name));
- return 0x0;
- }
+ /* find the user account */
+ become_root();
+ disp_info = getsamdisprid(rid);
+ unbecome_root();
- DEBUG(5,(" none mapped\n"));
+ if (disp_info != NULL)
+ {
+ fstrcpy(user_name, disp_info->smb_name);
+ DEBUG(5,(" = %s\n", user_name));
+ return 0x0;
}
+ DEBUG(5,(" none mapped\n"));
return 0xC0000000 | NT_STATUS_NONE_MAPPED;
}
(*grp_rid) = 0;
/* find the user account */
- become_root(True);
+ become_root();
sam_pass = getsam21pwnam(user_name);
- unbecome_root(True);
+ unbecome_root();
if (sam_pass != NULL)
{
(*type) = SID_NAME_USER;
/* find the user account */
- become_root(True);
+ become_root();
sam_pass = getsam21pwnam(user_name);
- unbecome_root(True);
+ unbecome_root();
if (sam_pass != NULL)
{