1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

Some progress towards gums and tdbsam2

genparser works fine, and it is a marvelous tool to store objects in tdb :)
This commit is contained in:
Simo Sorce 0001-01-01 00:00:00 +00:00
parent 0ebccc0dbe
commit 4c6d461a85
10 changed files with 1188 additions and 308 deletions

View File

@ -21,8 +21,8 @@
#ifndef _GUMS_H
#define _GUMS_H
#define GUMS_VERSION_MAJOR 0
#define GUMS_VERSION_MINOR 1
#define GUMS_VERSION_MAJOR 0
#define GUMS_VERSION_MINOR 1
#define GUMS_OBJECT_VERSION 1
#define GUMS_OBJ_DOMAIN 1
@ -74,10 +74,17 @@ typedef struct gums_group
} GUMS_GROUP;
typedef struct gums_domain
{
uint32 next_rid;
} GUMS_DOMAIN;
union gums_obj_p {
gums_user *user;
gums_group *group;
}
GUMS_USER *user;
GUMS_GROUP *group;
GUMS_DOMAIN *domain;
};
typedef struct gums_object
{
@ -112,6 +119,7 @@ typedef struct gums_commit_set
DOM_SID sid; /* Object Sid */
uint32 count; /* number of changes */
GUMS_DATA_SET **data;
} GUMS_COMMIT_SET;
typedef struct gums_privilege
@ -145,7 +153,7 @@ typedef struct gums_functions
NTSTATUS (*delete_object) (const DOM_SID *sid);
NTSTATUS (*get_object_from_sid) (GUMS_OBJECT **object, const DOM_SID *sid, const int obj_type);
NTSTATUS (*get_sid_from_name) (GUMS_OBJECT **object, const char *name);
NTSTATUS (*get_object_from_name) (GUMS_OBJECT **object, const char *name, const int onj_type);
/* This function is used to get the list of all objects changed since b_time, it is
used to support PDC<->BDC synchronization */
NTSTATUS (*get_updated_objects) (GUMS_OBJECT **objects, const NTTIME base_time);
@ -159,10 +167,10 @@ typedef struct gums_functions
NTSTATUS (*set_object) (const GUMS_OBJECT *object);
/* set object values function */
NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET *data_set);
NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET **data_set);
/* Group related functions */
NTSTATUS (*add_memberss_to_group) (const DOM_SID *group, const DOM_SID **members);
NTSTATUS (*add_members_to_group) (const DOM_SID *group, const DOM_SID **members);
NTSTATUS (*delete_members_from_group) (const DOM_SID *group, const DOM_SID **members);
NTSTATUS (*enumerate_group_members) (DOM_SID **members, const DOM_SID *sid, const int type);
@ -177,54 +185,56 @@ typedef struct gums_functions
NTSTATUS (*delete_members_from_privilege) (const LUID_ATTR *priv, const DOM_SID **members);
NTSTATUS (*enumerate_privilege_members) (DOM_SID **members, const LUID_ATTR *priv);
NTSTATUS (*get_sid_privileges) (DOM_SID **privs, const DOM_SID *sid);
/* warning!: set_privilege will overwrite a prior existing privilege if such exist */
NTSTATUS (*set_privilege) (GUMS_PRIVILEGE *priv);
} GUMS_FUNCTIONS;
/* define value types */
#define GUMS_SET_PRIMARY_GROUP 0x1
#define GUMS_SET_SEC_DESC 0x2
#define GUMS_SET_PRIMARY_GROUP 1
#define GUMS_SET_SEC_DESC 2
#define GUMS_SET_NAME 0x10
#define GUMS_SET_DESCRIPTION 0x11
#define GUMS_SET_FULL_NAME 0x12
/* user specific type values */
#define GUMS_SET_LOGON_TIME 10 /* keep NTTIME consecutive */
#define GUMS_SET_LOGOFF_TIME 11 /* too ease checking */
#define GUMS_SET_KICKOFF_TIME 13
#define GUMS_SET_PASS_LAST_SET_TIME 14
#define GUMS_SET_PASS_CAN_CHANGE_TIME 15
#define GUMS_SET_PASS_MUST_CHANGE_TIME 16 /* NTTIME end */
#define GUMS_SET_LOGON_TIME 0x20
#define GUMS_SET_LOGOFF_TIME 0x21
#define GUMS_SET_KICKOFF_TIME 0x23
#define GUMS_SET_PASS_LAST_SET_TIME 0x24
#define GUMS_SET_PASS_CAN_CHANGE_TIME 0x25
#define GUMS_SET_PASS_MUST_CHANGE_TIME 0x26
#define GUMS_SET_NAME 20 /* keep strings consecutive */
#define GUMS_SET_DESCRIPTION 21 /* too ease checking */
#define GUMS_SET_FULL_NAME 22
#define GUMS_SET_HOME_DIRECTORY 23
#define GUMS_SET_DRIVE 24
#define GUMS_SET_LOGON_SCRIPT 25
#define GUMS_SET_PROFILE_PATH 26
#define GUMS_SET_WORKSTATIONS 27
#define GUMS_SET_UNKNOWN_STRING 28
#define GUMS_SET_MUNGED_DIAL 29 /* strings end */
#define GUMS_SET_LM_PASSWORD 40
#define GUMS_SET_NT_PASSWORD 41
#define GUMS_SET_PLAINTEXT_PASSWORD 42
#define GUMS_SET_UNKNOWN_3 43
#define GUMS_SET_LOGON_DIVS 44
#define GUMS_SET_HOURS_LEN 45
#define GUMS_SET_HOURS 46
#define GUMS_SET_UNKNOWN_5 47
#define GUMS_SET_UNKNOWN_6 48
#define GUMS_SET_HOME_DIRECTORY 0x31
#define GUMS_SET_DRIVE 0x32
#define GUMS_SET_LOGON_SCRIPT 0x33
#define GUMS_SET_PROFILE_PATH 0x34
#define GUMS_SET_WORKSTATIONS 0x35
#define GUMS_SET_UNKNOWN_STRING 0x36
#define GUMS_SET_MUNGED_DIAL 0x37
#define GUMS_SET_MUST_CHANGE_PASS 50
#define GUMS_SET_CANNOT_CHANGE_PASS 51
#define GUMS_SET_PASS_NEVER_EXPIRE 52
#define GUMS_SET_ACCOUNT_DISABLED 53
#define GUMS_SET_ACCOUNT_LOCKOUT 54
#define GUMS_SET_LM_PASSWORD 0x40
#define GUMS_SET_NT_PASSWORD 0x41
#define GUMS_SET_PLAINTEXT_PASSWORD 0x42
#define GUMS_SET_UNKNOWN_3 0x43
#define GUMS_SET_LOGON_DIVS 0x44
#define GUMS_SET_HOURS_LEN 0x45
#define GUMS_SET_HOURS 0x46
#define GUMS_SET_UNKNOWN_5 0x47
#define GUMS_SET_UNKNOWN_6 0x48
#define GUMS_SET_MUST_CHANGE_PASS 0x50
#define GUMS_SET_CANNOT_CHANGE_PASS 0x51
#define GUMS_SET_PASS_NEVER_EXPIRE 0x52
#define GUMS_SET_ACCOUNT_DISABLED 0x53
#define GUMS_SET_ACCOUNT_LOCKOUT 0x54
/*group specific type values */
#define GUMS_ADD_SID_LIST 60
#define GUMS_DEL_SID_LIST 61
#define GUMS_SET_SID_LIST 62
#define GUMS_ADD_SID_LIST 0x60
#define GUMS_DEL_SID_LIST 0x61
#define GUMS_SET_SID_LIST 0x62
#endif /* _GUMS_H */

View File

@ -775,6 +775,8 @@ extern int errno;
#include "sam.h"
#include "gums.h"
#include "session.h"
#include "asn_1.h"

View File

@ -18,16 +18,17 @@
* Mass Ave, Cambridge, MA 02139, USA.
*/
/* ALL strings assumes UTF8 as encoding */
GENSTRUCT struct tdbsam2_domain_data {
uint32 xcounter; /* counter to be updated at any change */
SEC_DESC *sec_desc; /* Security Descriptor */
DOM_SID *user_sid; /* The User SID */
char *name; _NULLTERM /* NT User Name */
DOM_SID *dom_sid; /* The Domain SID */
char *name; _NULLTERM /* NT Domain Name */
char *description; _NULLTERM /* Descritpion (Gecos) */
uint32 next_rid; /* The Next free RID */
};
GENSTRUCT struct tdbsam2_user_data {
@ -67,14 +68,14 @@ GENSTRUCT struct tdbsam2_user_data {
uint32 unknown_3; /* 0x00ff ffff */
uint32 unknown_5; /* 0x0002 0000 */
uint32 unknown_6; /* 0x0000 04ec */
};
};
GENSTRUCT struct tdbsam2_group_data {
uint32 xcounter; /* counter to be updated at any change */
SEC_DESC *sec_desc; /* Security Descriptor */
DOM_SID *group_sid; /* The Group SID */
char *name; _NULLTERM /* NT User Name */
char *name; _NULLTERM /* NT Group Name */
char *description; _NULLTERM /* Descritpion (Gecos) */
uint32 count; /* number of sids */

View File

@ -629,3 +629,21 @@ void print_guid(GUID *guid)
d_printf("%02x", guid->info[i]);
d_printf("\n");
}
/*******************************************************************
Tallocs a duplicate SID.
********************************************************************/
DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, DOM_SID *src)
{
DOM_SID *dst;
if(!src)
return NULL;
if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) {
sid_copy( dst, src);
}
return dst;
}

View File

@ -569,24 +569,6 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU
return(return_sdb);
}
/*******************************************************************
Tallocs a duplicate SID.
********************************************************************/
static DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, DOM_SID *src)
{
DOM_SID *dst;
if(!src)
return NULL;
if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) {
sid_copy( dst, src);
}
return dst;
}
/*******************************************************************
Creates a SEC_DESC structure
********************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -26,10 +26,40 @@
#define GMV_MAJOR 0
#define GMV_MINOR 1
#define PRIV_NONE 0
#define PRIV_CREATE_TOKEN 1
#define PRIV_ASSIGNPRIMARYTOKEN 2
#define PRIV_LOCK_MEMORY 3
#define PRIV_INCREASE_QUOTA 4
#define PRIV_MACHINE_ACCOUNT 5
#define PRIV_TCB 6
#define PRIV_SECURITY 7
#define PRIV_TAKE_OWNERSHIP 8
#define PRIV_LOAD_DRIVER 9
#define PRIV_SYSTEM_PROFILE 10
#define PRIV_SYSTEMTIME 11
#define PRIV_PROF_SINGLE_PROCESS 12
#define PRIV_INC_BASE_PRIORITY 13
#define PRIV_CREATE_PAGEFILE 14
#define PRIV_CREATE_PERMANENT 15
#define PRIV_BACKUP 16
#define PRIV_RESTORE 17
#define PRIV_SHUTDOWN 18
#define PRIV_DEBUG 19
#define PRIV_AUDIT 20
#define PRIV_SYSTEM_ENVIRONMENT 21
#define PRIV_CHANGE_NOTIFY 22
#define PRIV_REMOTE_SHUTDOWN 23
#define PRIV_UNDOCK 24
#define PRIV_SYNC_AGENT 25
#define PRIV_ENABLE_DELEGATION 26
#define PRIV_ALL 255
GUMS_FUNCTIONS *gums_storage;
static void *dl_handle;
PRIVS privs[] = {
static PRIVS gums_privs[] = {
{PRIV_NONE, "no_privs", "No privilege"}, /* this one MUST be first */
{PRIV_CREATE_TOKEN, "SeCreateToken", "Create Token"},
{PRIV_ASSIGNPRIMARYTOKEN, "SeAssignPrimaryToken", "Assign Primary Token"},
@ -110,19 +140,19 @@ done:
NTSTATUS gums_unload(void)
{
NSTATUS ret;
NTSTATUS ret;
NTSTATUS (*module_finalize)();
if (!dl_handle)
return NT_STATUS_UNSUCCESSFUL;
module_close = sys_dlsym(dl_handle, "gumm_finalize");
module_finalize = sys_dlsym(dl_handle, "gumm_finalize");
if (!module_finalize) {
DEBUG(0, ("ERROR: Failed to find gums module's init function!\n"));
return NT_STATUS_UNSUCCESSFUL;
}
DEBUG(5, ("Finalizing module %s\n", module_name));
DEBUG(5, ("Finalizing module"));
ret = module_finalize();
sys_dlclose(dl_handle);

View File

@ -20,6 +20,182 @@
#include "includes.h"
/*******************************************************************
Create a SEC_ACL structure.
********************************************************************/
static SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list)
{
SEC_ACL *dst;
int i;
if((dst = (SEC_ACL *)talloc_zero(ctx,sizeof(SEC_ACL))) == NULL)
return NULL;
dst->revision = revision;
dst->num_aces = num_aces;
dst->size = SEC_ACL_HEADER_SIZE;
/* Now we need to return a non-NULL address for the ace list even
if the number of aces required is zero. This is because there
is a distinct difference between a NULL ace and an ace with zero
entries in it. This is achieved by checking that num_aces is a
positive number. */
if ((num_aces) &&
((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces))
== NULL)) {
return NULL;
}
for (i = 0; i < num_aces; i++) {
dst->ace[i] = ace_list[i]; /* Structure copy. */
dst->size += ace_list[i].size;
}
return dst;
}
/*******************************************************************
Duplicate a SEC_ACL structure.
********************************************************************/
static SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src)
{
if(src == NULL)
return NULL;
return make_sec_acl(ctx, src->revision, src->num_aces, src->ace);
}
/*******************************************************************
Creates a SEC_DESC structure
********************************************************************/
static SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision,
DOM_SID *owner_sid, DOM_SID *grp_sid,
SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size)
{
SEC_DESC *dst;
uint32 offset = 0;
uint32 offset_sid = SEC_DESC_HEADER_SIZE;
uint32 offset_acl = 0;
*sd_size = 0;
if(( dst = (SEC_DESC *)talloc_zero(ctx, sizeof(SEC_DESC))) == NULL)
return NULL;
dst->revision = revision;
dst->type = SEC_DESC_SELF_RELATIVE;
if (sacl) dst->type |= SEC_DESC_SACL_PRESENT;
if (dacl) dst->type |= SEC_DESC_DACL_PRESENT;
dst->off_owner_sid = 0;
dst->off_grp_sid = 0;
dst->off_sacl = 0;
dst->off_dacl = 0;
if(owner_sid && ((dst->owner_sid = sid_dup_talloc(ctx,owner_sid)) == NULL))
goto error_exit;
if(grp_sid && ((dst->grp_sid = sid_dup_talloc(ctx,grp_sid)) == NULL))
goto error_exit;
if(sacl && ((dst->sacl = dup_sec_acl(ctx, sacl)) == NULL))
goto error_exit;
if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL))
goto error_exit;
offset = 0;
/*
* Work out the linearization sizes.
*/
if (dst->owner_sid != NULL) {
if (offset == 0)
offset = SEC_DESC_HEADER_SIZE;
offset += sid_size(dst->owner_sid);
}
if (dst->grp_sid != NULL) {
if (offset == 0)
offset = SEC_DESC_HEADER_SIZE;
offset += sid_size(dst->grp_sid);
}
if (dst->sacl != NULL) {
offset_acl = SEC_DESC_HEADER_SIZE;
dst->off_sacl = offset_acl;
offset_acl += dst->sacl->size;
offset += dst->sacl->size;
offset_sid += dst->sacl->size;
}
if (dst->dacl != NULL) {
if (offset_acl == 0)
offset_acl = SEC_DESC_HEADER_SIZE;
dst->off_dacl = offset_acl;
offset_acl += dst->dacl->size;
offset += dst->dacl->size;
offset_sid += dst->dacl->size;
}
*sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset);
if (dst->owner_sid != NULL)
dst->off_owner_sid = offset_sid;
/* sid_size() returns 0 if the sid is NULL so this is ok */
if (dst->grp_sid != NULL)
dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid);
return dst;
error_exit:
*sd_size = 0;
return NULL;
}
/*******************************************************************
Duplicate a SEC_DESC structure.
********************************************************************/
static SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src)
{
size_t dummy;
if(src == NULL)
return NULL;
return make_sec_desc( ctx, src->revision,
src->owner_sid, src->grp_sid, src->sacl,
src->dacl, &dummy);
}
extern GUMS_FUNCTIONS *gums_storage;
/* Functions to get/set info from a GUMS object */
@ -37,7 +213,7 @@ NTSTATUS gums_create_object(GUMS_OBJECT **obj, uint32 type)
{
TALLOC_CTX *mem_ctx = talloc_init("gums_create_object");
GUMS_OBJECT *go;
NT_STATUS ret;
NTSTATUS ret;
go = talloc_zero(mem_ctx, sizeof(GUMS_OBJECT));
go->mem_ctx = mem_ctx;
@ -54,12 +230,12 @@ NTSTATUS gums_create_object(GUMS_OBJECT **obj, uint32 type)
case GUMS_OBJ_DOMAIN_TRUST:
*/
case GUMS_OBJ_NORMAL_USER:
go->data = (GUMS_USER *)talloc_zero(mem_ctx, sizeof(GUMS_USER));
go->data.user = (GUMS_USER *)talloc_zero(mem_ctx, sizeof(GUMS_USER));
break;
case GUMS_OBJ_GROUP:
case GUMS_OBJ_ALIAS:
go->data = (GUMS_GROUP *)talloc_zero(mem_ctx, sizeof(GUMS_GROUP));
go->data.group = (GUMS_GROUP *)talloc_zero(mem_ctx, sizeof(GUMS_GROUP));
break;
default:
@ -68,7 +244,7 @@ NTSTATUS gums_create_object(GUMS_OBJECT **obj, uint32 type)
goto error;
}
if (!(go->data)) {
if (!(go->data.user)) {
ret = NT_STATUS_NO_MEMORY;
DEBUG(0, ("gums_create_object: Out of memory!\n"));
goto error;
@ -190,6 +366,30 @@ NTSTATUS gums_get_object_privileges(PRIVILEGE_SET **priv_set, const GUMS_OBJECT
}
*/
NTSTATUS gums_get_domain_next_rid(uint32 *rid, const GUMS_OBJECT *obj)
{
if (!obj)
return NT_STATUS_INVALID_PARAMETER;
if (obj->type != GUMS_OBJ_DOMAIN)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
*rid = obj->data.domain->next_rid;
return NT_STATUS_OK;
}
NTSTATUS gums_set_domain_next_rid(GUMS_OBJECT *obj, uint32 rid)
{
if (!obj)
return NT_STATUS_INVALID_PARAMETER;
if (obj->type != GUMS_OBJ_DOMAIN)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
obj->data.domain->next_rid = rid;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_pri_group(DOM_SID **sid, const GUMS_OBJECT *obj)
{
if (!sid || !obj)
@ -223,19 +423,19 @@ NTSTATUS gums_get_user_nt_pwd(DATA_BLOB **nt_pwd, const GUMS_OBJECT *obj)
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
*nt_pwd = obj->data.user->nt_pw;
*nt_pwd = &(obj->data.user->nt_pw);
return NT_STATUS_OK;
}
NTSTATUS gums_set_user_nt_pwd(GUMS_OBJECT *obj, const DATA_BLOB nt_pwd)
{
if (!obj || !nt_pwd || nt_pwd != NT_HASH_LEN)
if (!obj || nt_pwd.length != NT_HASH_LEN)
return NT_STATUS_INVALID_PARAMETER;
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
obj->data.user->nt_pwd = data_blob_talloc(obj->mem_ctx, nt_pwd.data, nt_pwd.lenght);
obj->data.user->nt_pw = data_blob_talloc(obj->mem_ctx, nt_pwd.data, nt_pwd.length);
return NT_STATUS_OK;
}
@ -247,19 +447,19 @@ NTSTATUS gums_get_user_lm_pwd(DATA_BLOB **lm_pwd, const GUMS_OBJECT *obj)
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
*lm_pwd = obj->data.user->lm_pw;
*lm_pwd = &(obj->data.user->lm_pw);
return NT_STATUS_OK;
}
NTSTATUS gums_set_user_lm_pwd(GUMS_OBJECT *obj, const DATA_BLOB lm_pwd)
{
if (!obj || !lm_pwd || lm_pwd != LM_HASH_LEN)
if (!obj || lm_pwd.length != LM_HASH_LEN)
return NT_STATUS_INVALID_PARAMETER;
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
obj->data.user->lm_pwd = data_blob_talloc(obj->mem_ctx, lm_pwd.data, lm_pwd.lenght);
obj->data.user->lm_pw = data_blob_talloc(obj->mem_ctx, lm_pwd.data, lm_pwd.length);
return NT_STATUS_OK;
}
@ -591,7 +791,7 @@ NTSTATUS gums_get_user_pass_must_change_time(NTTIME *pass_must_change_time, cons
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
*pass_must_change_time = obj->data-user->pass_must_change_time;
*pass_must_change_time = obj->data.user->pass_must_change_time;
return NT_STATUS_OK;
}
@ -768,7 +968,7 @@ NTSTATUS gums_get_group_members(uint32 *count, DOM_SID **members, const GUMS_OBJ
return NT_STATUS_OBJECT_TYPE_MISMATCH;
*count = obj->data.group->count;
*members = obj->data.group->members;
*members = *(obj->data.group->members);
return NT_STATUS_OK;
}
@ -786,7 +986,7 @@ NTSTATUS gums_set_group_members(GUMS_OBJECT *obj, uint32 count, DOM_SID **member
obj->data.group->count = count;
n = 0;
do {
obj->data.group->members[n] = dup_sec_desc(obj->mem_ctx, members[n]);
obj->data.group->members[n] = sid_dup_talloc(obj->mem_ctx, members[n]);
if (!(obj->data.group->members[n])) return NT_STATUS_NO_MEMORY;
n++;
} while (n < count);
@ -836,8 +1036,8 @@ NTSTATUS gums_cs_set_sec_desc(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, SEC
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_SET_SEC_DESC;
new_sec_desc = dup_sec_desc(mem_ctx, sec_desc);
@ -849,6 +1049,7 @@ NTSTATUS gums_cs_set_sec_desc(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, SEC
return NT_STATUS_OK;
}
/*
NTSTATUS gums_cs_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_ATTR priv)
{
GUMS_DATA_SET *data_set;
@ -858,7 +1059,7 @@ NTSTATUS gums_cs_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LU
return NT_STATUS_INVALID_PARAMETER;
com_set->count = com_set->count + 1;
if (com_set->count == 1) { /* first data set */
if (com_set->count == 1) {
data_set = (GUMS_DATA_SET *)talloc(mem_ctx, sizeof(GUMS_DATA_SET));
} else {
data_set = (GUMS_DATA_SET *)talloc_realloc(mem_ctx, com_set->data, sizeof(GUMS_DATA_SET) * com_set->count);
@ -866,8 +1067,8 @@ NTSTATUS gums_cs_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LU
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_ADD_PRIVILEGE;
if (NT_STATUS_IS_ERR(dupalloc_luid_attr(mem_ctx, &new_priv, priv)))
@ -887,7 +1088,7 @@ NTSTATUS gums_cs_del_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LU
return NT_STATUS_INVALID_PARAMETER;
com_set->count = com_set->count + 1;
if (com_set->count == 1) { /* first data set */
if (com_set->count == 1) {
data_set = (GUMS_DATA_SET *)talloc(mem_ctx, sizeof(GUMS_DATA_SET));
} else {
data_set = (GUMS_DATA_SET *)talloc_realloc(mem_ctx, com_set->data, sizeof(GUMS_DATA_SET) * com_set->count);
@ -895,8 +1096,8 @@ NTSTATUS gums_cs_del_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LU
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_DEL_PRIVILEGE;
if (NT_STATUS_IS_ERR(dupalloc_luid_attr(mem_ctx, &new_priv, priv)))
@ -916,7 +1117,7 @@ NTSTATUS gums_cs_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
return NT_STATUS_INVALID_PARAMETER;
com_set->count = com_set->count + 1;
if (com_set->count == 1) { /* first data set */
if (com_set->count == 1) {
data_set = (GUMS_DATA_SET *)talloc(mem_ctx, sizeof(GUMS_DATA_SET));
} else {
data_set = (GUMS_DATA_SET *)talloc_realloc(mem_ctx, com_set->data, sizeof(GUMS_DATA_SET) * com_set->count);
@ -924,10 +1125,10 @@ NTSTATUS gums_cs_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_SET_SEC_DESC;
data_set->type = GUMS_SET_PRIVILEGE;
if (NT_STATUS_IS_ERR(dup_priv_set(&new_priv_set, mem_ctx, priv_set)))
return NT_STATUS_NO_MEMORY;
@ -935,6 +1136,7 @@ NTSTATUS gums_cs_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
return NT_STATUS_OK;
}
*/
NTSTATUS gums_cs_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, char *str)
{
@ -953,8 +1155,8 @@ NTSTATUS gums_cs_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint3
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = type;
new_str = talloc_strdup(mem_ctx, str);
@ -968,12 +1170,12 @@ NTSTATUS gums_cs_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint3
NTSTATUS gums_cs_set_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *name)
{
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, name);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, name);
}
NTSTATUS gums_cs_set_description(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *desc)
{
return gums_set_string(mem_ctx, com_set, GUMS_SET_DESCRIPTION, desc);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_DESCRIPTION, desc);
}
NTSTATUS gums_cs_set_full_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *full_name)
@ -981,7 +1183,7 @@ NTSTATUS gums_cs_set_full_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, ch
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, full_name);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, full_name);
}
NTSTATUS gums_cs_set_home_directory(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *home_dir)
@ -989,7 +1191,7 @@ NTSTATUS gums_cs_set_home_directory(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_se
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, home_dir);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, home_dir);
}
NTSTATUS gums_cs_set_drive(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *drive)
@ -997,7 +1199,7 @@ NTSTATUS gums_cs_set_drive(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, drive);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, drive);
}
NTSTATUS gums_cs_set_logon_script(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *logon_script)
@ -1005,7 +1207,7 @@ NTSTATUS gums_cs_set_logon_script(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, logon_script);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, logon_script);
}
NTSTATUS gums_cs_set_profile_path(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *prof_path)
@ -1013,7 +1215,7 @@ NTSTATUS gums_cs_set_profile_path(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, prof_path);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, prof_path);
}
NTSTATUS gums_cs_set_workstations(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *wks)
@ -1021,7 +1223,7 @@ NTSTATUS gums_cs_set_workstations(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, wks);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, wks);
}
NTSTATUS gums_cs_set_unknown_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *unkn_str)
@ -1029,7 +1231,7 @@ NTSTATUS gums_cs_set_unknown_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_se
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, unkn_str);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, unkn_str);
}
NTSTATUS gums_cs_set_munged_dial(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *munged_dial)
@ -1037,7 +1239,7 @@ NTSTATUS gums_cs_set_munged_dial(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, munged_dial);
return gums_cs_set_string(mem_ctx, com_set, GUMS_SET_NAME, munged_dial);
}
NTSTATUS gums_cs_set_nttime(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, NTTIME *nttime)
@ -1057,8 +1259,8 @@ NTSTATUS gums_cs_set_nttime(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint3
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = type;
new_time = talloc(mem_ctx, sizeof(NTTIME));
@ -1077,7 +1279,7 @@ NTSTATUS gums_cs_set_logon_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, N
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, logon_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, logon_time);
}
NTSTATUS gums_cs_set_logoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *logoff_time)
@ -1085,7 +1287,7 @@ NTSTATUS gums_cs_set_logoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGOFF_TIME, logoff_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_LOGOFF_TIME, logoff_time);
}
NTSTATUS gums_cs_set_kickoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *kickoff_time)
@ -1093,7 +1295,7 @@ NTSTATUS gums_cs_set_kickoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_KICKOFF_TIME, kickoff_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_KICKOFF_TIME, kickoff_time);
}
NTSTATUS gums_cs_set_pass_last_set_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pls_time)
@ -1101,7 +1303,7 @@ NTSTATUS gums_cs_set_pass_last_set_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *co
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pls_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pls_time);
}
NTSTATUS gums_cs_set_pass_can_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pcc_time)
@ -1109,7 +1311,7 @@ NTSTATUS gums_cs_set_pass_can_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pcc_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pcc_time);
}
NTSTATUS gums_cs_set_pass_must_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pmc_time)
@ -1117,7 +1319,7 @@ NTSTATUS gums_cs_set_pass_must_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pmc_time);
return gums_cs_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pmc_time);
}
NTSTATUS gums_cs_add_sids_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
@ -1138,8 +1340,8 @@ NTSTATUS gums_cs_add_sids_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_ADD_SID_LIST;
new_sids = (DOM_SID **)talloc(mem_ctx, (sizeof(void *) * count));
@ -1163,7 +1365,7 @@ NTSTATUS gums_cs_add_users_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_se
if (com_set->type != GUMS_OBJ_GROUP || com_set->type != GUMS_OBJ_ALIAS)
return NT_STATUS_INVALID_PARAMETER;
return gums_add_sids_to_group(mem_ctx, com_set, sids, count);
return gums_cs_add_sids_to_group(mem_ctx, com_set, sids, count);
}
NTSTATUS gums_cs_add_groups_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
@ -1173,7 +1375,7 @@ NTSTATUS gums_cs_add_groups_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_s
if (com_set->type != GUMS_OBJ_ALIAS)
return NT_STATUS_INVALID_PARAMETER;
return gums_add_sids_to_group(mem_ctx, com_set, sids, count);
return gums_cs_add_sids_to_group(mem_ctx, com_set, sids, count);
}
NTSTATUS gums_cs_del_sids_from_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
@ -1196,8 +1398,8 @@ NTSTATUS gums_cs_del_sids_from_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_s
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_DEL_SID_LIST;
new_sids = (DOM_SID **)talloc(mem_ctx, (sizeof(void *) * count));
@ -1234,8 +1436,8 @@ NTSTATUS gums_ds_set_sids_in_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
if (data_set == NULL)
return NT_STATUS_NO_MEMORY;
com_set->data = data_set;
data_set = &((com_set->data)[com_set->count - 1]);
com_set->data[0] = data_set;
data_set = ((com_set->data)[com_set->count - 1]);
data_set->type = GUMS_SET_SID_LIST;
new_sids = (DOM_SID **)talloc(mem_ctx, (sizeof(void *) * count));
@ -1255,7 +1457,7 @@ NTSTATUS gums_ds_set_sids_in_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set
NTSTATUS gums_commit_data(GUMS_COMMIT_SET *set)
{
return gums_storage->set_object_values(set->sid, set->count, set->data);
return gums_storage->set_object_values(&(set->sid), set->count, set->data);
}
NTSTATUS gums_destroy_commit_set(GUMS_COMMIT_SET **com_set)

View File

@ -57,13 +57,13 @@ extern DOM_SID global_sid_Builtin_Guests;
loops with winbind may happen.
****************************************************************************/
/*
#if 0
NTSTATUS is_mapped_group(BOOL *mapped, const DOM_SID *sid)
{
NTSTATUS result;
gid_t id;
/* look if mapping exist, do not make idmap alloc an uid if SID is not found * /
/* look if mapping exist, do not make idmap alloc an uid if SID is not found */
result = idmap_get_gid_from_sid(&id, sid, False);
if (NT_STATUS_IS_OK(result)) {
*mapped = gid_is_in_winbind_range(id);
@ -73,7 +73,7 @@ NTSTATUS is_mapped_group(BOOL *mapped, const DOM_SID *sid)
return result;
}
*/
#endif
/****************************************************************************
duplicate alloc luid_attr
@ -96,7 +96,7 @@ NTSTATUS dupalloc_luid_attr(TALLOC_CTX *ctx, LUID_ATTR **new_la, LUID_ATTR old_l
/****************************************************************************
initialise a privilege list
****************************************************************************/
void init_privilege(PRIVILEGE_SET *priv_set)
void gums_init_privilege(PRIVILEGE_SET *priv_set)
{
priv_set->count=0;
priv_set->control=0;
@ -106,12 +106,12 @@ void init_privilege(PRIVILEGE_SET *priv_set)
/****************************************************************************
add a privilege to a privilege array
****************************************************************************/
NTSTATUS add_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR set)
NTSTATUS gums_add_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR set)
{
LUID_ATTR *new_set;
/* check if the privilege is not already in the list */
if (check_priv_in_privilege(priv_set, set))
if (gums_check_priv_in_privilege(priv_set, set))
return NT_STATUS_UNSUCCESSFUL;
/* we can allocate memory to add the new privilege */
@ -135,7 +135,7 @@ NTSTATUS add_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR set)
/****************************************************************************
add all the privileges to a privilege array
****************************************************************************/
NTSTATUS add_all_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx)
NTSTATUS gums_add_all_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx)
{
NTSTATUS result = NT_STATUS_OK;
LUID_ATTR set;
@ -144,15 +144,15 @@ NTSTATUS add_all_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx)
set.luid.high=0;
set.luid.low=SE_PRIV_ADD_USERS;
result = add_privilege(priv_set, ctx, set);
result = gums_add_privilege(priv_set, ctx, set);
NTSTATUS_CHECK("add_all_privilege", "add_privilege", result, done);
set.luid.low=SE_PRIV_ADD_MACHINES;
result = add_privilege(priv_set, ctx, set);
result = gums_add_privilege(priv_set, ctx, set);
NTSTATUS_CHECK("add_all_privilege", "add_privilege", result, done);
set.luid.low=SE_PRIV_PRINT_OPERATOR;
result = add_privilege(priv_set, ctx, set);
result = gums_add_privilege(priv_set, ctx, set);
NTSTATUS_CHECK("add_all_privilege", "add_privilege", result, done);
done:
@ -162,7 +162,7 @@ done:
/****************************************************************************
check if the privilege list is empty
****************************************************************************/
BOOL check_empty_privilege(PRIVILEGE_SET *priv_set)
BOOL gums_check_empty_privilege(PRIVILEGE_SET *priv_set)
{
return (priv_set->count == 0);
}
@ -170,12 +170,12 @@ BOOL check_empty_privilege(PRIVILEGE_SET *priv_set)
/****************************************************************************
check if the privilege is in the privilege list
****************************************************************************/
BOOL check_priv_in_privilege(PRIVILEGE_SET *priv_set, LUID_ATTR set)
BOOL gums_check_priv_in_privilege(PRIVILEGE_SET *priv_set, LUID_ATTR set)
{
int i;
/* if the list is empty, obviously we can't have it */
if (check_empty_privilege(priv_set))
if (gums_check_empty_privilege(priv_set))
return False;
for (i=0; i<priv_set->count; i++) {
@ -193,19 +193,19 @@ BOOL check_priv_in_privilege(PRIVILEGE_SET *priv_set, LUID_ATTR set)
/****************************************************************************
remove a privilege from a privilege array
****************************************************************************/
NTSTATUS remove_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR set)
NTSTATUS gums_remove_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR set)
{
LUID_ATTR *new_set;
LUID_ATTR *old_set;
int i,j;
/* check if the privilege is in the list */
if (!check_priv_in_privilege(priv_set, set))
if (!gums_check_priv_in_privilege(priv_set, set))
return NT_STATUS_UNSUCCESSFUL;
/* special case if it's the only privilege in the list */
if (priv_set->count==1) {
init_privilege(priv_set);
gums_init_privilege(priv_set);
return NT_STATUS_OK;
}
@ -252,14 +252,14 @@ NTSTATUS remove_privilege(PRIVILEGE_SET *priv_set, TALLOC_CTX *ctx, LUID_ATTR se
/****************************************************************************
duplicates a privilege array
****************************************************************************/
NTSTATUS dup_priv_set(PRIVILEGE_SET **new_priv_set, TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set)
NTSTATUS gums_dup_priv_set(PRIVILEGE_SET **new_priv_set, TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set)
{
LUID_ATTR *new_set;
LUID_ATTR *old_set;
int i;
*new_priv_set = (PRIVILEGE_SET *)talloc(mem_ctx, sizeof(PRIVILEGE_SET));
init_privilege(*new_priv_set);
gums_init_privilege(*new_priv_set);
/* special case if there are no privileges in the list */
if (priv_set->count == 0) {
@ -301,6 +301,8 @@ NTSTATUS dup_priv_set(PRIVILEGE_SET **new_priv_set, TALLOC_CTX *mem_ctx, PRIVILE
#define ALIAS_DEFAULT_SACL_SEC_ACE_FLAG (SEC_ACE_FLAG_FAILED_ACCESS | SEC_ACE_FLAG_SUCCESSFUL_ACCESS) /* 0xc0 */
#if 0
NTSTATUS create_builtin_alias_default_sec_desc(SEC_DESC **sec_desc, TALLOC_CTX *ctx)
{
DOM_SID *world = &global_sid_World;
@ -378,14 +380,14 @@ NTSTATUS gums_init_builtin_groups(void)
return NT_STATUS_NO_MEMORY;
}
/* Administrators */
/* Administrators * /
/* alloc group structure */
g_obj.data = (void *)talloc(g_obj.mem_ctx, sizeof(GUMS_OBJ_GROUP));
ALLOC_CHECK("gums_init_backend", g_obj.data, result, done);
g_obj.data.group = (GUMS_GROUP *)talloc(g_obj.mem_ctx, sizeof(GUMS_GROUP));
ALLOC_CHECK("gums_init_backend", g_obj.data.group, result, done);
/* make admins sid */
g_grp = (GUMS_GROUP *)g_obj.data;
g_grp = (GUMS_GROUP *)g_obj.data.group;
sid_copy(g_obj.sid, &global_sid_Builtin_Administrators);
/* make security descriptor */
@ -604,4 +606,5 @@ done:
talloc_destroy(g_priv.mem_ctx);
return result;
}
#endif

View File

@ -131,12 +131,13 @@ sub parse_elements($$)
print ", $name";
}
print OFILE "int gen_dump_struct_$name(struct parse_string *, const char *, unsigned);\n";
print OFILE "int gen_parse_struct_$name(char *, const char *);\n";
print OFILE "int gen_dump_struct_$name(TALLOC_CTX *mem_ctx, struct parse_string *, const char *, unsigned);\n";
print OFILE "int gen_parse_struct_$name(TALLOC_CTX *mem_ctx, char *, const char *);\n";
print OFILE "static const struct parse_struct pinfo_" . $name . "[] = {\n";
while ($elements =~ /^.*?([a-z].*?);\s*?(\S*?)\s*?\$(.*)/msi) {
while ($elements =~ /^.*?([a-z].*?);\s*?(\S*?)\s*?$(.*)/msi) {
my($element) = $1;
my($flags) = $2;
$elements = $3;
@ -146,11 +147,11 @@ sub parse_elements($$)
print OFILE "{NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL}};\n";
print OFILE "
int gen_dump_struct_$name(struct parse_string *p, const char *ptr, unsigned indent) {
return gen_dump_struct(pinfo_$name, p, ptr, indent);
int gen_dump_struct_$name(TALLOC_CTX *mem_ctx, struct parse_string *p, const char *ptr, unsigned indent) {
return gen_dump_struct(mem_ctx, pinfo_$name, p, ptr, indent);
}
int gen_parse_struct_$name(char *ptr, const char *str) {
return gen_parse_struct(pinfo_$name, ptr, str);
int gen_parse_struct_$name(TALLOC_CTX *mem_ctx, char *ptr, const char *str) {
return gen_parse_struct(mem_ctx, pinfo_$name, ptr, str);
}
";