summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/rpc_samr.h10
-rw-r--r--source3/rpc_parse/parse_samr.c20
-rw-r--r--source3/rpc_server/srv_samr_nt.c37
-rw-r--r--source3/smbd/uid.c4
4 files changed, 31 insertions, 40 deletions
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index e1fa9c06bc..7d28a0f3a7 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -147,16 +147,6 @@ SamrTestPrivateFunctionsUser
#define SAMR_SET_USERINFO 0x3A
#define SAMR_CONNECT4 0x3E
-
-typedef struct _DISP_USER_INFO {
- SAM_ACCOUNT *sam;
-} DISP_USER_INFO;
-
-typedef struct _DISP_GROUP_INFO {
- DOMAIN_GRP *grp;
-} DISP_GROUP_INFO;
-
-
typedef struct logon_hours_info
{
uint32 len; /* normally 21 bytes */
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 47bf3f390d..45c81deb89 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1500,7 +1500,7 @@ inits a SAM_DISPINFO_1 structure.
********************************************************************/
NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries,
- uint32 start_idx, DISP_USER_INFO *disp_user_info,
+ uint32 start_idx, SAM_ACCOUNT *disp_user_info,
DOM_SID *domain_sid)
{
uint32 len_sam_name, len_sam_full, len_sam_desc;
@@ -1535,7 +1535,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en
DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i));
- pwd=disp_user_info[i+start_idx].sam;
+ pwd=&disp_user_info[i+start_idx];
username = pdb_get_username(pwd);
fullname = pdb_get_fullname(pwd);
@@ -1635,7 +1635,7 @@ inits a SAM_DISPINFO_2 structure.
********************************************************************/
NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries,
- uint32 start_idx, DISP_USER_INFO *disp_user_info,
+ uint32 start_idx, SAM_ACCOUNT *disp_user_info,
DOM_SID *domain_sid )
{
uint32 len_sam_name, len_sam_desc;
@@ -1666,7 +1666,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en
fstring user_sid_string, domain_sid_string;
DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
- pwd=disp_user_info[i+start_idx].sam;
+ pwd=&disp_user_info[i+start_idx];
username = pdb_get_username(pwd);
acct_desc = pdb_get_acct_desc(pwd);
@@ -1754,7 +1754,7 @@ inits a SAM_DISPINFO_3 structure.
********************************************************************/
NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries,
- uint32 start_idx, DISP_GROUP_INFO *disp_group_info)
+ uint32 start_idx, DOMAIN_GRP *disp_group_info)
{
uint32 len_sam_name, len_sam_desc;
uint32 i;
@@ -1776,7 +1776,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en
ZERO_STRUCTP(sam->str);
for (i = 0; i < num_entries; i++) {
- DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp;
+ DOMAIN_GRP *grp = &disp_group_info[i+start_idx];
DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
@@ -1848,7 +1848,7 @@ inits a SAM_DISPINFO_4 structure.
********************************************************************/
NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_entries,
- uint32 start_idx, DISP_USER_INFO *disp_user_info)
+ uint32 start_idx, SAM_ACCOUNT *disp_user_info)
{
uint32 len_sam_name;
uint32 i;
@@ -1872,7 +1872,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en
for (i = 0; i < num_entries; i++) {
DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
- pwd=disp_user_info[i+start_idx].sam;
+ pwd=&disp_user_info[i+start_idx];
len_sam_name = strlen(pdb_get_username(pwd));
@@ -1939,7 +1939,7 @@ inits a SAM_DISPINFO_5 structure.
********************************************************************/
NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_entries,
- uint32 start_idx, DISP_GROUP_INFO *disp_group_info)
+ uint32 start_idx, DOMAIN_GRP *disp_group_info)
{
uint32 len_sam_name;
uint32 i;
@@ -1961,7 +1961,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en
ZERO_STRUCTP(sam->str);
for (i = 0; i < num_entries; i++) {
- DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp;
+ DOMAIN_GRP *grp = &disp_group_info[i+start_idx];
DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 1628a51e53..e43cf4f759 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -44,10 +44,10 @@ extern rid_name builtin_alias_rids[];
typedef struct _disp_info {
BOOL user_dbloaded;
uint32 num_user_account;
- DISP_USER_INFO *disp_user_info;
+ SAM_ACCOUNT *disp_user_info;
BOOL group_dbloaded;
uint32 num_group_account;
- DISP_GROUP_INFO *disp_group_info;
+ DOMAIN_GRP *disp_group_info;
} DISP_INFO;
struct samr_info {
@@ -161,8 +161,9 @@ static void free_samr_users(struct samr_info *info)
if (info->disp_info.user_dbloaded){
for (i=0; i<info->disp_info.num_user_account; i++) {
+ SAM_ACCOUNT *sam = &info->disp_info.disp_user_info[i];
/* Not really a free, actually a 'clear' */
- pdb_free_sam(&info->disp_info.disp_user_info[i].sam);
+ pdb_free_sam(&sam);
}
}
info->disp_info.user_dbloaded=False;
@@ -211,7 +212,7 @@ static void samr_clear_sam_passwd(SAM_ACCOUNT *sam_pass)
static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOOL all_machines)
{
SAM_ACCOUNT *pwd = NULL;
- DISP_USER_INFO *pwd_array = NULL;
+ SAM_ACCOUNT *pwd_array = NULL;
NTSTATUS nt_status = NT_STATUS_OK;
TALLOC_CTX *mem_ctx = info->mem_ctx;
@@ -254,8 +255,8 @@ static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOO
if (info->disp_info.num_user_account % MAX_SAM_ENTRIES == 0) {
DEBUG(10,("load_sampwd_entries: allocating more memory\n"));
- pwd_array=(DISP_USER_INFO *)talloc_realloc(mem_ctx, info->disp_info.disp_user_info,
- (info->disp_info.num_user_account+MAX_SAM_ENTRIES)*sizeof(DISP_USER_INFO));
+ pwd_array=(SAM_ACCOUNT *)talloc_realloc(mem_ctx, info->disp_info.disp_user_info,
+ (info->disp_info.num_user_account+MAX_SAM_ENTRIES)*sizeof(SAM_ACCOUNT));
if (pwd_array==NULL)
return NT_STATUS_NO_MEMORY;
@@ -263,8 +264,8 @@ static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOO
info->disp_info.disp_user_info=pwd_array;
}
- /* link the SAM_ACCOUNT to the array */
- info->disp_info.disp_user_info[info->disp_info.num_user_account].sam=pwd;
+ /* Copy the SAM_ACCOUNT into the array */
+ info->disp_info.disp_user_info[info->disp_info.num_user_account]=*pwd;
DEBUG(10,("load_sampwd_entries: entry: %d\n", info->disp_info.num_user_account));
@@ -287,7 +288,7 @@ static NTSTATUS load_sampwd_entries(struct samr_info *info, uint16 acb_mask, BOO
static NTSTATUS load_group_domain_entries(struct samr_info *info, DOM_SID *sid)
{
GROUP_MAP *map=NULL;
- DISP_GROUP_INFO *grp_array = NULL;
+ DOMAIN_GRP *grp_array = NULL;
uint32 group_entries = 0;
uint32 i;
TALLOC_CTX *mem_ctx = info->mem_ctx;
@@ -312,8 +313,7 @@ static NTSTATUS load_group_domain_entries(struct samr_info *info, DOM_SID *sid)
info->disp_info.num_group_account=group_entries;
- grp_array=(DISP_GROUP_INFO *)talloc(mem_ctx, info->disp_info.num_group_account*sizeof(DISP_GROUP_INFO));
-
+ grp_array=(DOMAIN_GRP *)talloc(mem_ctx, info->disp_info.num_group_account*sizeof(DOMAIN_GRP));
if (group_entries!=0 && grp_array==NULL) {
DEBUG(1, ("load_group_domain_entries: talloc() failed for grp_array!\n"));
SAFE_FREE(map);
@@ -323,13 +323,10 @@ static NTSTATUS load_group_domain_entries(struct samr_info *info, DOM_SID *sid)
info->disp_info.disp_group_info=grp_array;
for (i=0; i<group_entries; i++) {
-
- grp_array[i].grp=(DOMAIN_GRP *)talloc(mem_ctx, sizeof(DOMAIN_GRP));
-
- fstrcpy(grp_array[i].grp->name, map[i].nt_name);
- fstrcpy(grp_array[i].grp->comment, map[i].comment);
- sid_split_rid(&map[i].sid, &grp_array[i].grp->rid);
- grp_array[i].grp->attr=SID_NAME_DOM_GRP;
+ fstrcpy(grp_array[i].name, map[i].nt_name);
+ fstrcpy(grp_array[i].comment, map[i].comment);
+ sid_split_rid(&map[i].sid, &grp_array[i].rid);
+ grp_array[i].attr=SID_NAME_DOM_GRP;
}
SAFE_FREE(map);
@@ -690,7 +687,7 @@ makes a SAM_ENTRY / UNISTR2* structure from a user list.
********************************************************************/
static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, SAM_ENTRY **sam_pp, UNISTR2 **uni_name_pp,
- uint32 num_entries, uint32 start_idx, DISP_USER_INFO *disp_user_info,
+ uint32 num_entries, uint32 start_idx, SAM_ACCOUNT *disp_user_info,
DOM_SID *domain_sid)
{
uint32 i;
@@ -720,7 +717,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, SAM_ENTRY **sam_pp, UN
}
for (i = 0; i < num_entries; i++) {
- pwd = disp_user_info[i+start_idx].sam;
+ pwd = &disp_user_info[i+start_idx];
temp_name = pdb_get_username(pwd);
init_unistr2(&uni_temp_name, temp_name, strlen(temp_name)+1);
user_sid = pdb_get_user_sid(pwd);
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 320f8eb980..6ca2aa336d 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -722,6 +722,8 @@ NTSTATUS uid_to_sid(DOM_SID *psid, uid_t uid)
uid_t low, high;
fstring sid;
+ ZERO_STRUCTP(psid);
+
if (fetch_sid_from_uid_cache(psid, uid))
return ( psid ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL );
@@ -761,6 +763,8 @@ NTSTATUS gid_to_sid(DOM_SID *psid, gid_t gid)
gid_t low, high;
fstring sid;
+ ZERO_STRUCTP(psid);
+
if (fetch_sid_from_gid_cache(psid, gid))
return ( psid ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL );