summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2002-12-16 12:11:02 +0000
committerSimo Sorce <idra@samba.org>2002-12-16 12:11:02 +0000
commit48fb7b090ef227b225ae4e67a08088d0f75e59cd (patch)
tree2956d5fa9762980476cce49737542029abf76cc0 /source3
parentf35c421f5b47a190c679326a08d37f7c138b6cdc (diff)
downloadsamba-48fb7b090ef227b225ae4e67a08088d0f75e59cd.tar.gz
samba-48fb7b090ef227b225ae4e67a08088d0f75e59cd.tar.bz2
samba-48fb7b090ef227b225ae4e67a08088d0f75e59cd.zip
updates to the gums
introduce genparser will be used by tdbsam2 (This used to be commit 831d3d1ec751f23481f26b31d22b09f3d9c0709a)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in16
-rw-r--r--source3/include/gums.h26
-rw-r--r--source3/include/tdbsam2.h94
-rw-r--r--source3/lib/genparser.c775
-rw-r--r--source3/lib/genparser_samba.c200
-rw-r--r--source3/sam/gums.c2
-rw-r--r--source3/sam/gums_api.c627
7 files changed, 1633 insertions, 107 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 5044609d13..8617bdeed6 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -156,7 +156,7 @@ LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \
nsswitch/wb_client.o nsswitch/wb_common.o \
lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o \
lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \
- lib/module.o
+ lib/module.o lib/genparser.o lib/genparser_samba.o
LIB_SMBD_OBJ = lib/system_smbd.o lib/util_smbd.o
@@ -1053,7 +1053,8 @@ clean: delheaders python_clean
# afterwards.
proto_exists: include/proto.h include/wrepld_proto.h include/build_env.h \
nsswitch/winbindd_proto.h web/swat_proto.h \
- client/client_proto.h utils/net_proto.h
+ client/client_proto.h utils/net_proto.h \
+ include/tdbsam2_parse_info.h
delheaders:
@echo Removing prototype headers
@@ -1061,10 +1062,12 @@ delheaders:
@/bin/rm -f $(srcdir)/include/wrepld_proto.h $(srcdir)/nsswitch/winbindd_proto.h
@/bin/rm -f $(srcdir)/web/swat_proto.h
@/bin/rm -f $(srcdir)/client/client_proto.h $(srcdir)/utils/net_proto.h
+ @/bin/rm -f $(srcdir)/include/tdbsam2_parse_info.h
@/bin/rm -f include/proto.h include/build_env.h include/wrepld_proto.h \
nsswitch/winbindd_proto.h web/swat_proto.h \
- client/client_proto.h utils/net_proto.h
+ client/client_proto.h utils/net_proto.h \
+ include/tdbsam2_parse_info.h
include/proto.h:
@echo Building include/proto.h
@@ -1102,6 +1105,11 @@ utils/net_proto.h:
-h _CLIENT_PROTO_H_ utils/net_proto.h \
$(NET_OBJ1)
+include/tdbsam2_parse_info.h:
+ @cd $(srcdir) && script/genstruct.pl \
+ -o include/tdbsam2_parse_info.h $(CC) -E -O2 -g \
+ include/tdbsam2.h
+
# "make headers" or "make proto" calls a subshell because we need to
# make sure these commands are executed in sequence even for a
# parallel make.
@@ -1109,7 +1117,7 @@ headers:
$(MAKE) delheaders include/proto.h include/build_env.h \
include/wrepld_proto.h nsswitch/winbindd_proto.h \
web/swat_proto.h client/client_proto.h \
- utils/net_proto.h
+ utils/net_proto.h include/tdbsam2_parse_info.h
proto: headers
diff --git a/source3/include/gums.h b/source3/include/gums.h
index a44dadc883..ca124d7442 100644
--- a/source3/include/gums.h
+++ b/source3/include/gums.h
@@ -23,6 +23,7 @@
#define GUMS_VERSION_MAJOR 0
#define GUMS_VERSION_MINOR 1
+#define GUMS_OBJECT_VERSION 1
#define GUMS_OBJ_DOMAIN 1
#define GUMS_OBJ_NORMAL_USER 2
@@ -36,12 +37,12 @@ typedef struct gums_user
{
DOM_SID *group_sid; /* Primary Group SID */
- NTTIME *logon_time; /* logon time */
- NTTIME *logoff_time; /* logoff time */
- NTTIME *kickoff_time; /* kickoff time */
- NTTIME *pass_last_set_time; /* password last set time */
- NTTIME *pass_can_change_time; /* password can change time */
- NTTIME *pass_must_change_time; /* password must change time */
+ NTTIME logon_time; /* logon time */
+ NTTIME logoff_time; /* logoff time */
+ NTTIME kickoff_time; /* kickoff time */
+ NTTIME pass_last_set_time; /* password last set time */
+ NTTIME pass_can_change_time; /* password can change time */
+ NTTIME pass_must_change_time; /* password must change time */
char *full_name; /* user's full name string */
char *home_dir; /* home directory string */
@@ -52,14 +53,14 @@ typedef struct gums_user
char *unknown_str; /* don't know what this is, yet. */
char *munged_dial; /* munged path name and dial-back tel number */
- DATA_BLOB *lm_pw; /* .data is Null if no password */
- DATA_BLOB *nt_pw; /* .data is Null if no password */
+ DATA_BLOB lm_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw; /* .data is Null if no password */
uint32 unknown_3; /* 0x00ff ffff */
uint16 logon_divs; /* 168 - number of hours in a week */
uint32 hours_len; /* normally 21 bytes */
- uint8 hours[MAX_HOURS_LEN];
+ uint8 *hours;
uint32 unknown_5; /* 0x0002 0000 */
uint32 unknown_6; /* 0x0000 04ec */
@@ -69,14 +70,13 @@ typedef struct gums_user
typedef struct gums_group
{
uint32 count; /* Number of SIDs */
- DOM_SID *members; /* SID array */
+ DOM_SID **members; /* SID array */
} GUMS_GROUP;
union gums_obj_p {
gums_user *user;
gums_group *group;
- gums_group *alias;
}
typedef struct gums_object
@@ -111,7 +111,7 @@ typedef struct gums_commit_set
uint32 type; /* Object type */
DOM_SID sid; /* Object Sid */
uint32 count; /* number of changes */
- GUMS_DATA_SET *data;
+ GUMS_DATA_SET **data;
} GUMS_COMMIT_SET;
typedef struct gums_privilege
@@ -127,7 +127,7 @@ typedef struct gums_privilege
char *description; /* Object Description */
uint32 count;
- DOM_SID *members;
+ DOM_SID **members;
} GUMS_PRIVILEGE;
diff --git a/source3/include/tdbsam2.h b/source3/include/tdbsam2.h
new file mode 100644
index 0000000000..0ca9d34618
--- /dev/null
+++ b/source3/include/tdbsam2.h
@@ -0,0 +1,94 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * tdbsam2 genstruct enabled header file
+ * Copyright (C) Simo Sorce 2002
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 675
+ * 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 */
+ char *description; _NULLTERM /* Descritpion (Gecos) */
+};
+
+GENSTRUCT struct tdbsam2_user_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 */
+ char *description; _NULLTERM /* Descritpion (Gecos) */
+
+ DOM_SID *group_sid; /* The Primary Group SID */
+
+ NTTIME *logon_time;
+ NTTIME *logoff_time;
+ NTTIME *kickoff_time;
+ NTTIME *pass_last_set_time;
+ NTTIME *pass_can_change_time;
+ NTTIME *pass_must_change_time;
+
+ char *full_name; _NULLTERM /* The Full Name */
+ char *home_dir; _NULLTERM /* Home Directory */
+ char *dir_drive; _NULLTERM /* Drive Letter the home should be mapped to */
+ char *logon_script; _NULLTERM /* Logon script path */
+ char *profile_path; _NULLTERM /* Profile is stored here */
+ char *workstations; _NULLTERM /* List of Workstation names the user is allowed to LogIn */
+ char *unknown_str; _NULLTERM /* Guess ... Unknown */
+ char *munged_dial; _NULLTERM /* Callback Number */
+
+ /* passwords are 16 byte leght, pointer is null if no password */
+ uint8 *lm_pw_ptr; _LEN(16) /* Lanman hashed password */
+ uint8 *nt_pw_ptr; _LEN(16) /* NT hashed password */
+
+ uint16 logon_divs; /* 168 - num of hours in a week */
+ uint32 hours_len; /* normally 21 */
+ uint8 *hours; _LEN(hours_len) /* normally 21 bytes (depends on hours_len) */
+
+ 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 *description; _NULLTERM /* Descritpion (Gecos) */
+
+ uint32 count; /* number of sids */
+ DOM_SID **members; _LEN(count) /* SID array */
+};
+
+GENSTRUCT struct tdbsam2_privilege_data {
+ uint32 xcounter; /* counter to be updated at any change */
+
+ LUID_ATTR *privilege; /* Privilege */
+ char *name; _NULLTERM /* NT User Name */
+ char *description; _NULLTERM /* Descritpion (Gecos) */
+
+ uint32 count; /* number of sids */
+ DOM_SID **members; _LEN(count) /* SID array */
+};
+
diff --git a/source3/lib/genparser.c b/source3/lib/genparser.c
new file mode 100644
index 0000000000..9fa9dbd33b
--- /dev/null
+++ b/source3/lib/genparser.c
@@ -0,0 +1,775 @@
+/*
+ Copyright (C) Andrew Tridgell <genstruct@tridgell.net> 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ automatic marshalling/unmarshalling system for C structures
+*/
+
+#include "includes.h"
+
+/* see if a range of memory is all zero. Used to prevent dumping of zero elements */
+static int all_zero(const char *ptr, unsigned size)
+{
+ int i;
+ if (!ptr) return 1;
+ for (i=0;i<size;i++) {
+ if (ptr[i]) return 0;
+ }
+ return 1;
+}
+
+/* encode a buffer of bytes into a escaped string */
+static char *encode_bytes(const char *ptr, unsigned len)
+{
+ const char *hexdig = "0123456789abcdef";
+ char *ret, *p;
+ unsigned i;
+ ret = malloc(len*3 + 1); /* worst case size */
+ if (!ret) return NULL;
+ for (p=ret,i=0;i<len;i++) {
+ if (isalnum(ptr[i]) || isspace(ptr[i]) ||
+ (ispunct(ptr[i]) && !strchr("\\{}", ptr[i]))) {
+ *p++ = ptr[i];
+ } else {
+ unsigned char c = *(unsigned char *)(ptr+i);
+ if (c == 0 && all_zero(ptr+i, len-i)) break;
+ p[0] = '\\';
+ p[1] = hexdig[c>>4];
+ p[2] = hexdig[c&0xF];
+ p += 3;
+ }
+ }
+
+ *p = 0;
+
+ return ret;
+}
+
+/* decode an escaped string from encode_bytes() into a buffer */
+static char *decode_bytes(const char *s, unsigned *len)
+{
+ char *ret, *p;
+ unsigned i;
+ ret = calloc(1, strlen(s)+1); /* worst case length */
+
+ if (*s == '{') s++;
+
+ for (p=ret,i=0;s[i];i++) {
+ if (s[i] == '}') {
+ break;
+ } else if (s[i] == '\\') {
+ unsigned v;
+ if (sscanf(&s[i+1], "%02x", &v) != 1 || v > 255) {
+ free(ret);
+ return NULL;
+ }
+ *(unsigned char *)p = v;
+ p++;
+ i += 2;
+ } else {
+ *p++ = s[i];
+ }
+ }
+ *p = 0;
+
+ (*len) = (unsigned)(p - ret);
+
+ return ret;
+}
+
+/* the add*() functions deal with adding things to a struct
+ parse_string */
+
+/* allocate more space if needed */
+static int addgen_alloc(struct parse_string *p, int n)
+{
+ if (p->length + n <= p->allocated) return 0;
+ p->allocated = p->length + n + 200;
+ p->s = realloc(p->s, p->allocated);
+ if (!p->s) {
+ errno = ENOMEM;
+ return -1;
+ }
+ return 0;
+}
+
+/* add a character to the buffer */
+static int addchar(struct parse_string *p, char c)
+{
+ if (addgen_alloc(p, 2) != 0) {
+ return -1;
+ }
+ p->s[p->length++] = c;
+ p->s[p->length] = 0;
+ return 0;
+}
+
+/* add a string to the buffer */
+int addstr(struct parse_string *p, const char *s)
+{
+ int len = strlen(s);
+ if (addgen_alloc(p, len+1) != 0) {
+ return -1;
+ }
+ memcpy(p->s + p->length, s, len+1);
+ p->length += len;
+ return 0;
+}
+
+/* add a string to the buffer with a tab prefix */
+static int addtabbed(struct parse_string *p, const char *s, unsigned indent)
+{
+ int len = strlen(s);
+ if (addgen_alloc(p, indent+len+1) != 0) {
+ return -1;
+ }
+ while (indent--) {
+ p->s[p->length++] = '\t';
+ }
+ memcpy(p->s + p->length, s, len+1);
+ p->length += len;
+ return 0;
+}
+
+/* note! this can only be used for results up to 60 chars wide! */
+int addshort(struct parse_string *p, const char *fmt, ...)
+{
+ char buf[60];
+ int n;
+ va_list ap;
+ va_start(ap, fmt);
+ n = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ if (addgen_alloc(p, n + 1) != 0) {
+ return -1;
+ }
+ if (n != 0) {
+ memcpy(p->s + p->length, buf, n);
+ }
+ p->length += n;
+ p->s[p->length] = 0;
+ return 0;
+}
+
+/*
+ this is here to make it easier for people to write dump functions
+ for their own types
+ */
+int gen_addgen(struct parse_string *p, const char *fmt, ...)
+{
+ char *buf = NULL;
+ int n;
+ va_list ap;
+ va_start(ap, fmt);
+ n = vasprintf(&buf, fmt, ap);
+ va_end(ap);
+ if (addgen_alloc(p, n + 1) != 0) {
+ if (buf) free(buf);
+ return -1;
+ }
+ if (n != 0) {
+ memcpy(p->s + p->length, buf, n);
+ }
+ p->length += n;
+ p->s[p->length] = 0;
+ if (buf) free(buf);
+ return 0;
+}
+
+/* dump a enumerated type */
+int gen_dump_enum(const struct enum_struct *einfo,
+ struct parse_string *p,
+ const char *ptr,
+ unsigned indent)
+{
+ unsigned v = *(unsigned *)ptr;
+ int i;
+ for (i=0;einfo[i].name;i++) {
+ if (v == einfo[i].value) {
+ addstr(p, einfo[i].name);
+ return 0;
+ }
+ }
+ /* hmm, maybe we should just fail? */
+ return gen_dump_unsigned(p, ptr, indent);
+}
+
+/* dump a single non-array element, hanlding struct and enum */
+static int gen_dump_one(struct parse_string *p,
+ const struct parse_struct *pinfo,
+ const char *ptr,
+ unsigned indent)
+{
+ if (pinfo->dump_fn == gen_dump_char && pinfo->ptr_count == 1) {
+ char *s = encode_bytes(ptr, strlen(ptr));
+ if (addchar(p,'{') ||
+ addstr(p, s) ||
+ addstr(p, "}")) {
+ free(s);
+ return -1;
+ }
+ return 0;
+ }
+
+ return pinfo->dump_fn(p, ptr, indent);
+}
+
+/* handle dumping of an array of arbitrary type */
+static int gen_dump_array(struct parse_string *p,
+ const struct parse_struct *pinfo,
+ const char *ptr,
+ int array_len,
+ int indent)
+{
+ int i, count=0;
+
+ /* special handling of fixed length strings */
+ if (array_len != 0 &&
+ pinfo->ptr_count == 0 &&
+ pinfo->dump_fn == gen_dump_char) {
+ char *s = encode_bytes(ptr, array_len);
+ if (!s) return -1;
+ if (addtabbed(p, pinfo->name, indent) ||
+ addstr(p, " = {") ||
+ addstr(p, s) ||
+ addstr(p, "}\n")) {
+ free(s);
+ return -1;
+ }
+ free(s);
+ return 0;
+ }
+
+ for (i=0;i<array_len;i++) {
+ const char *p2 = ptr;
+ unsigned size = pinfo->size;
+
+ /* generic pointer dereference */
+ if (pinfo->ptr_count) {
+ p2 = *(const char **)ptr;
+ size = sizeof(void *);
+ }
+
+ if ((count || pinfo->ptr_count) &&
+ !(pinfo->flags & FLAG_ALWAYS) &&
+ all_zero(ptr, size)) {
+ ptr += size;
+ continue;
+ }
+ if (count == 0) {
+ if (addtabbed(p, pinfo->name, indent) ||
+ addshort(p, " = %u:", i)) {
+ return -1;
+ }
+ } else {
+ if (addshort(p, ", %u:", i) != 0) {
+ return -1;
+ }
+ }
+ if (gen_dump_one(p, pinfo, p2, indent) != 0) {
+ return -1;
+ }
+ ptr += size;
+ count++;
+ }
+ if (count) {
+ return addstr(p, "\n");
+ }
+ return 0;
+}
+
+/* find a variable by name in a loaded structure and return its value
+ as an integer. Used to support dynamic arrays */
+static int find_var(const struct parse_struct *pinfo,
+ const char *data,
+ const char *var)
+{
+ int i;
+ const char *ptr;
+
+ /* this allows for constant lengths */
+ if (isdigit(*var)) {
+ return atoi(var);
+ }
+
+ for (i=0;pinfo[i].name;i++) {
+ if (strcmp(pinfo[i].name, var) == 0) break;
+ }
+ if (!pinfo[i].name) return -1;
+
+ ptr = data + pinfo[i].offset;
+
+ switch (pinfo[i].size) {
+ case sizeof(int):
+ return *(int *)ptr;
+ case sizeof(char):
+ return *(char *)ptr;
+ }
+
+ return -1;
+}
+
+
+int gen_dump_struct(const struct parse_struct *pinfo,
+ struct parse_string *p,
+ const char *ptr,
+ unsigned indent)
+{
+ char *s = gen_dump(pinfo, ptr, indent+1);
+ if (!s) return -1;
+ if (addstr(p, "{\n") ||
+ addstr(p,s) ||
+ addtabbed(p,"}", indent)) {
+ free(s);
+ return -1;
+ }
+ free(s);
+ return 0;
+}
+
+static int gen_dump_string(struct parse_string *p,
+ const struct parse_struct *pinfo,
+ const char *data,
+ unsigned indent)
+{
+ const char *ptr = *(char **)data;
+ char *s = encode_bytes(ptr, strlen(ptr));
+ if (addtabbed(p, pinfo->name, indent) ||
+ addstr(p, " = ") ||
+ addchar(p,'{') ||
+ addstr(p, s) ||
+ addstr(p, "}\n")) {
+ free(s);
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ find the length of a nullterm array
+*/
+static int len_nullterm(const char *ptr, int size, int array_len)
+{
+ int len;
+
+ if (size == 1) {
+ len = strnlen(ptr, array_len);
+ } else {
+ for (len=0;len<array_len;len++) {
+ if (all_zero(ptr+len*size, size)) break;
+ }
+ }
+
+ if (len == 0) len = 1;
+
+ return len;
+}
+
+
+/* the generic dump routine. Scans the parse information for this structure
+ and processes it recursively */
+char *gen_dump(const struct parse_struct *pinfo,
+ const char *data,
+ unsigned indent)
+{
+ struct parse_string p;
+ int i;
+
+ p.length = 0;
+ p.allocated = 0;
+ p.s = NULL;
+
+ if (addstr(&p, "") != 0) {
+ return NULL;
+ }
+
+ for (i=0;pinfo[i].name;i++) {
+ const char *ptr = data + pinfo[i].offset;
+ unsigned size = pinfo[i].size;
+
+ if (pinfo[i].ptr_count) {
+ size = sizeof(void *);
+ }
+
+ /* special handling for array types */
+ if (pinfo[i].array_len) {
+ unsigned len = pinfo[i].array_len;
+ if (pinfo[i].flags & FLAG_NULLTERM) {
+ len = len_nullterm(ptr, size, len);
+ }
+ if (gen_dump_array(&p, &pinfo[i], ptr,
+ len, indent)) {
+ goto failed;
+ }
+ continue;
+ }
+
+ /* and dynamically sized arrays */
+ if (pinfo[i].dynamic_len) {
+ int len = find_var(pinfo, data, pinfo[i].dynamic_len);
+ struct parse_struct p2 = pinfo[i];
+ if (len < 0) {
+ goto failed;
+ }
+ if (len > 0) {
+ if (pinfo[i].flags & FLAG_NULLTERM) {
+ len = len_nullterm(*(char **)ptr,
+ pinfo[i].size, len);
+ }
+ p2.ptr_count--;
+ p2.dynamic_len = NULL;
+ if (gen_dump_array(&p, &p2, *(char **)ptr,
+ len, indent) != 0) {
+ goto failed;
+ }
+ }
+ continue;
+ }
+
+ /* don't dump zero elements */
+ if (!(pinfo[i].flags & FLAG_ALWAYS) && all_zero(ptr, size)) continue;
+
+ /* assume char* is a null terminated string */
+ if (pinfo[i].size == 1 && pinfo[i].ptr_count == 1 &&
+ pinfo[i].dump_fn == gen_dump_char) {
+ if (gen_dump_string(&p, &pinfo[i], ptr, indent) != 0) {
+ goto failed;
+ }
+ continue;
+ }
+
+ /* generic pointer dereference */
+ if (pinfo[i].ptr_count) {
+ ptr = *(const char **)ptr;
+ }
+
+ if (addtabbed(&p, pinfo[i].name, indent) ||
+ addstr(&p, " = ") ||
+ gen_dump_one(&p, &pinfo[i], ptr, indent) ||
+ addstr(&p, "\n")) {
+ goto failed;
+ }
+ }
+ return p.s;
+
+failed:
+ free(p.s);
+ return NULL;
+}
+
+/* search for a character in a string, skipping over sections within
+ matching braces */
+static char *match_braces(char *s, char c)
+{
+ int depth = 0;
+ while (*s) {
+ switch (*s) {
+ case '}':
+ depth--;
+ break;
+ case '{':
+ depth++;
+ break;
+ }
+ if (depth == 0 && *s == c) {
+ return s;
+ }
+ s++;
+ }
+ return s;
+}
+
+/* parse routine for enumerated types */
+int gen_parse_enum(const struct enum_struct *einfo,
+ char *ptr,
+ const char *str)
+{
+ unsigned v;
+ int i;
+
+ if (isdigit(*str)) {
+ if (sscanf(str, "%u", &v) != 1) {
+ errno = EINVAL;
+ return -1;
+ }
+ *(unsigned *)ptr = v;
+ return 0;
+ }
+
+ for (i=0;einfo[i].name;i++) {
+ if (strcmp(einfo[i].name, str) == 0) {
+ *(unsigned *)ptr = einfo[i].value;
+ return 0;
+ }
+ }
+
+ /* unknown enum value?? */
+ return -1;
+}
+
+
+/* parse all base types */
+static int gen_parse_base(const struct parse_struct *pinfo,
+ char *ptr,
+ const char *str)
+{
+ if (pinfo->parse_fn == gen_parse_char && pinfo->ptr_count==1) {
+ unsigned len;
+ char *s = decode_bytes(str, &len);
+ if (!s) return -1;
+ *(char **)ptr = s;
+ return 0;
+ }
+
+ if (pinfo->ptr_count) {
+ struct parse_struct p2 = *pinfo;
+ *(void **)ptr = calloc(1, pinfo->ptr_count>1?sizeof(void *):pinfo->size);
+ if (! *(void **)ptr) {
+ return -1;
+ }
+ ptr = *(char **)ptr;
+ p2.ptr_count--;
+ return gen_parse_base(&p2, ptr, str);
+ }
+
+ return pinfo->parse_fn(ptr, str);
+}
+
+/* parse a generic array */
+static int gen_parse_array(const struct parse_struct *pinfo,
+ char *ptr,
+ const char *str,
+ int array_len)
+{
+ char *p, *p2;
+ unsigned size = pinfo->size;
+
+ /* special handling of fixed length strings */
+ if (array_len != 0 &&
+ pinfo->ptr_count == 0 &&
+ pinfo->dump_fn == gen_dump_char) {
+ unsigned len = 0;
+ char *s = decode_bytes(str, &len);
+ if (!s) return -1;
+ memset(ptr, 0, array_len);
+ memcpy(ptr, s, len);
+ free(s);
+ return 0;
+ }
+
+ if (pinfo->ptr_count) {
+ size = sizeof(void *);
+ }
+
+ while (*str) {
+ unsigned idx;
+ int done;
+
+ idx = atoi(str);
+ p = strchr(str,':');
+ if (!p) break;
+ p++;
+ p2 = match_braces(p, ',');
+ done = (*p2 != ',');
+ *p2 = 0;
+
+ if (*p == '{') {
+ p++;
+ p[strlen(p)-1] = 0;
+ }
+
+ if (gen_parse_base(pinfo, ptr + idx*size, p) != 0) {
+ return -1;
+ }
+
+ if (done) break;
+ str = p2+1;
+ }
+
+ return 0;
+}
+
+/* parse one element, hanlding dynamic and static arrays */
+static int gen_parse_one(const struct parse_struct *pinfo,
+ const char *name,
+ char *data,
+ const char *str)
+{
+ int i;
+ for (i=0;pinfo[i].name;i++) {
+ if (strcmp(pinfo[i].name, name) == 0) {
+ break;
+ }
+ }
+ if (pinfo[i].name == NULL) {
+ return 0;
+ }
+
+ if (pinfo[i].array_len) {
+ return gen_parse_array(&pinfo[i], data+pinfo[i].offset,
+ str, pinfo[i].array_len);
+ }
+
+ if (pinfo[i].dynamic_len) {
+ int len = find_var(pinfo, data, pinfo[i].dynamic_len);
+ if (len < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (len > 0) {
+ unsigned size;
+ struct parse_struct p2 = pinfo[i];
+ char *ptr;
+ size = pinfo[i].ptr_count>1?sizeof(void*):pinfo[i].size;
+ ptr = calloc(len, size);
+ if (!ptr) {
+ errno = ENOMEM;
+ return -1;
+ }
+ *((char **)(data + pinfo[i].offset)) = ptr;
+ p2.ptr_count--;
+ p2.dynamic_len = NULL;
+ return gen_parse_array(&p2, ptr, str, len);
+ }
+ return 0;
+ }
+
+ return gen_parse_base(&pinfo[i], data + pinfo[i].offset, str);
+}
+
+int gen_parse_struct(const struct parse_struct *pinfo, char *ptr, const char *str)
+{
+ return gen_parse(pinfo, ptr, str);
+}
+
+/* the main parse routine */
+int gen_parse(const struct parse_struct *pinfo, char *data, const char *s)
+{
+ char *str, *s0;
+
+ s0 = strdup(s);
+ str = s0;
+
+ while (*str) {
+ char *p;
+ char *name;
+ char *value;
+
+ /* skip leading whitespace */
+ while (isspace(*str)) str++;
+
+ p = strchr(str, '=');
+ if (!p) break;
+ value = p+1;
+ while (p > str && isspace(*(p-1))) {
+ p--;
+ }
+
+ *p = 0;
+ name = str;
+
+ while (isspace(*value)) value++;
+
+ if (*value == '{') {
+ str = match_braces(value, '}');
+ value++;
+ } else {
+ str = match_braces(value, '\n');
+ }
+
+ *str++ = 0;
+
+ if (gen_parse_one(pinfo, name, data, value) != 0) {
+ free(s0);
+ return -1;
+ }
+ }
+
+ free(s0);
+ return 0;
+}
+
+
+
+/* for convenience supply some standard dumpers and parsers here */
+
+int gen_parse_char(char *ptr, const char *str)
+{
+ *(unsigned char *)ptr = atoi(str);
+ return 0;
+}
+
+int gen_parse_int(char *ptr, const char *str)
+{
+ *(int *)ptr = atoi(str);
+ return 0;
+}
+
+int gen_parse_unsigned(char *ptr, const char *str)
+{
+ *(unsigned *)ptr = strtoul(str, NULL, 10);
+ return 0;
+}
+
+int gen_parse_time_t(char *ptr, const char *str)
+{
+ *(time_t *)ptr = strtoul(str, NULL, 10);
+ return 0;
+}
+
+int gen_parse_double(char *ptr, const char *str)
+{
+ *(double *)ptr = atof(str);
+ return 0;
+}
+
+int gen_parse_float(char *ptr, const char *str)
+{
+ *(float *)ptr = atof(str);
+ return 0;
+}
+
+int gen_dump_char(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(unsigned char *)(ptr));
+}
+
+int gen_dump_int(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%d", *(int *)(ptr));
+}
+
+int gen_dump_unsigned(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(unsigned *)(ptr));
+}
+
+int gen_dump_time_t(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(time_t *)(ptr));
+}
+
+int gen_dump_double(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%lg", *(double *)(ptr));
+}
+
+int gen_dump_float(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%g", *(float *)(ptr));
+}
diff --git a/source3/lib/genparser_samba.c b/source3/lib/genparser_samba.c
new file mode 100644
index 0000000000..6c700d1094
--- /dev/null
+++ b/source3/lib/genparser_samba.c
@@ -0,0 +1,200 @@
+/*
+ Copyright (C) Andrew Tridgell <genstruct@tridgell.net> 2002
+ Copyright (C) Simo Sorce <idra@samba.org> 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "genparser_samba.h"
+
+/* PARSE functions */
+
+int gen_parse_uint8(char *ptr, const char *str)
+{
+ *(uint8 *)ptr = atoi(str);
+ return 0;
+}
+
+int gen_parse_uint16(char *ptr, const char *str)
+{
+ *(uint16 *)ptr = atoi(str);
+ return 0;
+}
+
+int gen_parse_uint32(char *ptr, const char *str)
+{
+ *(uint32 *)ptr = strtoul(str, NULL, 10);
+ return 0;
+}
+
+int gen_parse_NTTIME(char *ptr, const char *str)
+{
+ if(sscanf(str, "%u,%u", &(((NTTIME *)(ptr))->high), &(((NTTIME *)(ptr))->low)) != 2) {
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
+
+int gen_parse_DOM_SID(char *ptr, const char *str)
+{
+ if(!string_to_sid((DOM_SID *)ptr, str)) return -1;
+ return 0;
+}
+
+int gen_parse_SEC_ACCESS(char *ptr, const char *str)
+{
+ ((SEC_ACCESS *)ptr)->mask = strtoul(str, NULL, 10);
+ return 0;
+}
+
+int gen_parse_GUID(char *ptr, const char *str)
+{
+ int info[GUID_SIZE];
+ int i;
+ char *sc;
+ char *p;
+ char *m;
+
+ m = strdup(str);
+ if (!m) return -1;
+ sc = m;
+
+ memset(info, 0, sizeof(info));
+ for (i = 0; i < GUID_SIZE; i++) {
+ p = strchr(sc, ',');
+ if (p != NULL) p = '\0';
+ info[i] = atoi(sc);
+ if (p != NULL) sc = p + 1;
+ }
+ free(m);
+
+ for (i = 0; i < GUID_SIZE; i++) {
+ ((GUID *)ptr)->info[i] = info[i];
+ }
+
+ return 0;
+}
+
+int gen_parse_SEC_ACE(char *ptr, const char *str)
+{
+ return gen_parse_struct(pinfo_security_ace_info, ptr, str);
+}
+
+int gen_parse_SEC_ACL(char *ptr, const char *str)
+{
+ return gen_parse_struct(pinfo_security_acl_info, ptr, str);
+}
+
+int gen_parse_SEC_DESC(char *ptr, const char *str)
+{
+ return gen_parse_struct(pinfo_security_descriptor_info, ptr, str);
+}
+
+int gen_parse_LUID_ATTR(char *ptr, const char *str)
+{
+ return gen_parse_struct(pinfo_luid_attr_info, ptr, str);
+}
+
+int gen_parse_LUID(char *ptr, const char *str)
+{
+ if(sscanf(str, "%u,%u", &(((LUID *)(ptr))->high), &(((LUID *)(ptr))->low)) != 2) {
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
+
+
+
+/* DUMP functions */
+
+int gen_dump_uint8(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(uint8 *)(ptr));
+}
+
+int gen_dump_uint16(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(uint16 *)(ptr));
+}
+
+int gen_dump_uint32(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", *(uint32 *)(ptr));
+}
+
+int gen_dump_NTTIME(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ uint32 low, high;
+
+ high = ((NTTIME *)(ptr))->high;
+ low = ((NTTIME *)(ptr))->low;
+ return addshort(p, "%u,%u", high, low);
+}
+
+int gen_dump_DOM_SID(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ fstring sidstr;
+
+ sid_to_string(sidstr, (DOM_SID *)ptr);
+ return addstr(p, sidstr);
+}
+
+int gen_dump_SEC_ACCESS(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return addshort(p, "%u", ((SEC_ACCESS *)ptr)->mask);
+}
+
+int gen_dump_GUID(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ int i, r;
+
+ for (i = 0; i < (GUID_SIZE - 1); i++) {
+ if (!(r = addshort(p, "%d,", ((GUID *)ptr)->info[i]))) return r;
+ }
+ return addshort(p, "%d", ((GUID *)ptr)->info[i]);
+}
+
+int gen_dump_SEC_ACE(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return gen_dump_struct(pinfo_security_ace_info, p, ptr, indent);
+}
+
+int gen_dump_SEC_ACL(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return gen_dump_struct(pinfo_security_acl_info, p, ptr, indent);
+}
+
+int gen_dump_SEC_DESC(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return gen_dump_struct(pinfo_security_descriptor_info, p, ptr, indent);
+}
+
+int gen_dump_LUID_ATTR(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ return gen_dump_struct(pinfo_luid_attr_info, p, ptr, indent);
+}
+
+int gen_dump_LUID(struct parse_string *p, const char *ptr, unsigned indent)
+{
+ uint32 low, high;
+
+ high = ((LUID *)(ptr))->high;
+ low = ((LUID *)(ptr))->low;
+ return addshort(p, "%u,%u", high, low);
+}
+
diff --git a/source3/sam/gums.c b/source3/sam/gums.c
index 41218cee36..c0376d6a1f 100644
--- a/source3/sam/gums.c
+++ b/source3/sam/gums.c
@@ -126,6 +126,6 @@ NTSTATUS gums_unload(void)
ret = module_finalize();
sys_dlclose(dl_handle);
-3
+
return ret;
}
diff --git a/source3/sam/gums_api.c b/source3/sam/gums_api.c
index c6c8402c93..1d67467b2b 100644
--- a/source3/sam/gums_api.c
+++ b/source3/sam/gums_api.c
@@ -22,46 +22,163 @@
extern GUMS_FUNCTIONS *gums_storage;
-/* Functions to get info from a GUMS object */
+/* Functions to get/set info from a GUMS object */
NTSTATUS gums_get_object_type(uint32 *type, const GUMS_OBJECT *obj)
{
+ if (!obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*type = obj->type;
return NT_STATUS_OK;
}
+NTSTATUS gums_create_object(GUMS_OBJECT **obj, uint32 type)
+{
+ TALLOC_CTX *mem_ctx = talloc_init();
+ GUMS_OBJECT *go;
+ NT_STATUS ret;
+
+ go = talloc_zero(mem_ctx, sizeof(GUMS_OBJECT));
+ go->mem_ctx = mem_ctx;
+ go->type = type;
+ go->version = GUMS_OBJECT_VERSION;
+
+ switch(type) {
+ case GUMS_OBJ_DOMAIN:
+ break;
+
+/*
+ case GUMS_OBJ_WORKSTATION_TRUST:
+ case GUMS_OBJ_SERVER_TRUST:
+ case GUMS_OBJ_DOMAIN_TRUST:
+*/
+ case GUMS_OBJ_NORMAL_USER:
+ go->data = (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));
+ break;
+
+ default:
+ /* TODO: throw error */
+ ret = NT_STATUS_OBJECT_TYPE_MISMATCH;
+ goto error;
+ }
+
+ if (!(go->data)) {
+ ret = NT_STATUS_NO_MEMORY;
+ goto error;
+ }
+
+ *obj = go;
+ return NT_STATUS_OK;
+
+error:
+ talloc_destroy(go->mem_ctx);
+ *obj = NULL;
+ return ret;
+}
+
NTSTATUS gums_get_object_seq_num(uint32 *version, const GUMS_OBJECT *obj)
{
+ if (!version || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*version = obj->version;
return NT_STATUS_OK;
}
+NTSTATUS gums_set_object_seq_num(GUMS_OBJECT *obj, uint32 version)
+{
+ if (!obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ obj->version = version;
+ return NT_STATUS_OK;
+}
+
NTSTATUS gums_get_sec_desc(SEC_DESC **sec_desc, const GUMS_OBJECT *obj)
{
+ if (!sec_desc || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*sec_desc = obj->sec_desc;
return NT_STATUS_OK;
}
+NTSTATUS gums_set_sec_desc(GUMS_OBJECT *obj, const SEC_DESC *sec_desc)
+{
+ if (!obj || !sec_desc)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ obj->sec_desc = dup_sec_desc(obj->mem_ctx, sec_desc);
+ if (!(obj->sec_desc)) return NT_STATUS_UNSUCCESSFUL;
+ return NT_STATUS_OK;
+}
+
NTSTATUS gums_get_object_sid(DOM_SID **sid, const GUMS_OBJECT *obj)
{
+ if (!sid || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*sid = obj->sid;
return NT_STATUS_OK;
}
+NTSTATUS gums_set_object_sid(GUMS_OBJECT *obj, const DOM_SID *sid)
+{
+ if (!obj || !sid)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ obj->sid = sid_dup_talloc(obj->mem_ctx, sid);
+ if (!(obj->sid)) return NT_STATUS_UNSUCCESSFUL;
+ return NT_STATUS_OK;
+}
+
NTSTATUS gums_get_object_name(char **name, const GUMS_OBJECT *obj)
{
+ if (!name || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*name = obj->name;
return NT_STATUS_OK;
}
+NTSTATUS gums_set_object_name(GUMS_OBJECT *obj, const char *name)
+{
+ if (!obj || !name)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ obj->name = (char *)talloc_strdup(obj->mem_ctx, name);
+ if (!(obj->name)) return NT_STATUS_UNSUCCESSFUL;
+ return NT_STATUS_OK;
+}
+
NTSTATUS gums_get_object_description(char **description, const GUMS_OBJECT *obj)
{
+ if (!description || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
*description = obj->description;
return NT_STATUS_OK;
}
+NTSTATUS gums_set_object_description(GUMS_OBJECT *obj, const char *description)
+{
+ if (!obj || !description)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ obj->description = (char *)talloc_strdup(obj->mem_ctx, description);
+ if (!(obj->description)) return NT_STATUS_UNSUCCESSFUL;
+ return NT_STATUS_OK;
+}
+
/* User specific functions */
+/*
NTSTATUS gums_get_object_privileges(PRIVILEGE_SET **priv_set, const GUMS_OBJECT *obj)
{
if (!priv_set)
@@ -70,257 +187,567 @@ NTSTATUS gums_get_object_privileges(PRIVILEGE_SET **priv_set, const GUMS_OBJECT
*priv_set = obj->priv_set;
return NT_STATUS_OK;
}
+*/
NTSTATUS gums_get_user_pri_group(DOM_SID **sid, const GUMS_OBJECT *obj)
{
+ if (!sid || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!sid)
+
+ *sid = obj->data.user->group_sid;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_pri_group(GUMS_OBJECT *obj, const DOM_SID *sid)
+{
+ if (!obj || !sid)
return NT_STATUS_INVALID_PARAMETER;
- *sid = ((GUMS_USER *)(obj->data))->group_sid;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->group_sid = sid_dup_talloc(obj->mem_ctx, sid);
+ if (!(obj->data.user->group_sid)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_nt_pwd(DATA_BLOB **nt_pwd, const GUMS_OBJECT *obj)
{
+ if (!nt_pwd || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!nt_pwd)
+
+ *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)
return NT_STATUS_INVALID_PARAMETER;
- *nt_pwd = ((GUMS_USER *)(obj->data))->nt_pw;
+ 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);
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_lm_pwd(DATA_BLOB **lm_pwd, const GUMS_OBJECT *obj)
{
+ if (!lm_pwd || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!lm_pwd)
+
+ *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)
return NT_STATUS_INVALID_PARAMETER;
- *lm_pwd = ((GUMS_USER *)(obj->data))->lm_pw;
+ 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);
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_fullname(char **fullname, const GUMS_OBJECT *obj)
{
+ if (!fullname || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!fullname)
+
+ *fullname = obj->data.user->full_name;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_fullname(GUMS_OBJECT *obj, const char *fullname)
+{
+ if (!obj || !fullname)
return NT_STATUS_INVALID_PARAMETER;
- *fullname = ((GUMS_USER *)(obj->data))->full_name;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->full_name = (char *)talloc_strdup(obj->mem_ctx, fullname);
+ if (!(obj->data.user->full_name)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_homedir(char **homedir, const GUMS_OBJECT *obj)
{
+ if (!homedir || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!homedir)
+
+ *homedir = obj->data.user->home_dir;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_homedir(GUMS_OBJECT *obj, const char *homedir)
+{
+ if (!obj || !homedir)
return NT_STATUS_INVALID_PARAMETER;
- *homedir = ((GUMS_USER *)(obj->data))->home_dir;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->home_dir = (char *)talloc_strdup(obj->mem_ctx, homedir);
+ if (!(obj->data.user->home_dir)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_dir_drive(char **dirdrive, const GUMS_OBJECT *obj)
{
+ if (!dirdrive || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!dirdrive)
+
+ *dirdrive = obj->data.user->dir_drive;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_dir_drive(GUMS_OBJECT *obj, const char *dir_drive)
+{
+ if (!obj || !dir_drive)
return NT_STATUS_INVALID_PARAMETER;
- *dirdrive = ((GUMS_USER *)(obj->data))->dir_drive;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->dir_drive = (char *)talloc_strdup(obj->mem_ctx, dir_drive);
+ if (!(obj->data.user->dir_drive)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_logon_script(char **logon_script, const GUMS_OBJECT *obj)
{
+ if (!logon_script || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!logon_script)
+
+ *logon_script = obj->data.user->logon_script;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_logon_script(GUMS_OBJECT *obj, const char *logon_script)
+{
+ if (!obj || !logon_script)
return NT_STATUS_INVALID_PARAMETER;
- *logon_script = ((GUMS_USER *)(obj->data))->logon_script;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->logon_script = (char *)talloc_strdup(obj->mem_ctx, logon_script);
+ if (!(obj->data.user->logon_script)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_profile_path(char **profile_path, const GUMS_OBJECT *obj)
{
+ if (!profile_path || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!profile_path)
+
+ *profile_path = obj->data.user->profile_path;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_profile_path(GUMS_OBJECT *obj, const char *profile_path)
+{
+ if (!obj || !profile_path)
return NT_STATUS_INVALID_PARAMETER;
- *profile_path = ((GUMS_USER *)(obj->data))->profile_path;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->profile_path = (char *)talloc_strdup(obj->mem_ctx, profile_path);
+ if (!(obj->data.user->profile_path)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_workstations(char **workstations, const GUMS_OBJECT *obj)
{
+ if (!workstations || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!workstations)
+
+ *workstations = obj->data.user->workstations;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_workstations(GUMS_OBJECT *obj, const char *workstations)
+{
+ if (!obj || !workstations)
return NT_STATUS_INVALID_PARAMETER;
- *workstations = ((GUMS_USER *)(obj->data))->workstations;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->workstations = (char *)talloc_strdup(obj->mem_ctx, workstations);
+ if (!(obj->data.user->workstations)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_unknown_str(char **unknown_str, const GUMS_OBJECT *obj)
{
+ if (!unknown_str || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!unknown_str)
+
+ *unknown_str = obj->data.user->unknown_str;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_unknown_str(GUMS_OBJECT *obj, const char *unknown_str)
+{
+ if (!obj || !unknown_str)
return NT_STATUS_INVALID_PARAMETER;
- *unknown_str = ((GUMS_USER *)(obj->data))->unknown_str;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->unknown_str = (char *)talloc_strdup(obj->mem_ctx, unknown_str);
+ if (!(obj->data.user->unknown_str)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_munged_dial(char **munged_dial, const GUMS_OBJECT *obj)
{
+ if (!munged_dial || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!munged_dial)
+
+ *munged_dial = obj->data.user->munged_dial;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_munged_dial(GUMS_OBJECT *obj, const char *munged_dial)
+{
+ if (!obj || !munged_dial)
return NT_STATUS_INVALID_PARAMETER;
- *munged_dial = ((GUMS_USER *)(obj->data))->munged_dial;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->munged_dial = (char *)talloc_strdup(obj->mem_ctx, munged_dial);
+ if (!(obj->data.user->munged_dial)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_logon_time(NTTIME **logon_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_logon_time(NTTIME *logon_time, const GUMS_OBJECT *obj)
{
+ if (!logon_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!logon_time)
+
+ *logon_time = obj->data.user->logon_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_logon_time(GUMS_OBJECT *obj, NTTIME logon_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *logon_time = ((GUMS_USER *)(obj->data))->logon_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->logon_time = logon_time;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_logoff_time(NTTIME **logoff_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_logoff_time(NTTIME *logoff_time, const GUMS_OBJECT *obj)
{
+ if (!logoff_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!logoff_time)
+
+ *logoff_time = obj->data.user->logoff_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_logoff_time(GUMS_OBJECT *obj, NTTIME logoff_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *logoff_time = ((GUMS_USER *)(obj->data))->logoff_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->logoff_time = logoff_time;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_kickoff_time(NTTIME **kickoff_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_kickoff_time(NTTIME *kickoff_time, const GUMS_OBJECT *obj)
{
+ if (!kickoff_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!kickoff_time)
+
+ *kickoff_time = obj->data.user->kickoff_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_kickoff_time(GUMS_OBJECT *obj, NTTIME kickoff_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *kickoff_time = ((GUMS_USER *)(obj->data))->kickoff_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->kickoff_time = kickoff_time;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_pass_last_set_time(NTTIME **pass_last_set_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_pass_last_set_time(NTTIME *pass_last_set_time, const GUMS_OBJECT *obj)
{
+ if (!pass_last_set_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!pass_last_set_time)
+
+ *pass_last_set_time = obj->data.user->pass_last_set_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_pass_last_set_time(GUMS_OBJECT *obj, NTTIME pass_last_set_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *pass_last_set_time = ((GUMS_USER *)(obj->data))->pass_last_set_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->pass_last_set_time = pass_last_set_time;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_pass_can_change_time(NTTIME **pass_can_change_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_pass_can_change_time(NTTIME *pass_can_change_time, const GUMS_OBJECT *obj)
{
+ if (!pass_can_change_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!pass_can_change_time)
+
+ *pass_can_change_time = obj->data.user->pass_can_change_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_pass_can_change_time(GUMS_OBJECT *obj, NTTIME pass_can_change_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *pass_can_change_time = ((GUMS_USER *)(obj->data))->pass_can_change_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->pass_can_change_time = pass_can_change_time;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_pass_must_change_time(NTTIME **pass_must_change_time, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_pass_must_change_time(NTTIME *pass_must_change_time, const GUMS_OBJECT *obj)
{
+ if (!pass_must_change_time || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!pass_must_change_time)
+
+ *pass_must_change_time = obj->data-user->pass_must_change_time;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_pass_must_change_time(GUMS_OBJECT *obj, NTTIME pass_must_change_time)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *pass_must_change_time = ((GUMS_USER *)(obj->data))->pass_must_change_time;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->pass_must_change_time = pass_must_change_time;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_logon_divs(uint16 *logon_divs, const GUMS_OBJECT *obj)
{
+ if (!logon_divs || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!logon_divs)
+
+ *logon_divs = obj->data.user->logon_divs;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_logon_divs(GUMS_OBJECT *obj, uint16 logon_divs)
+{
+ if (!obj || !logon_divs)
return NT_STATUS_INVALID_PARAMETER;
- *logon_divs = ((GUMS_USER *)(obj->data))->logon_divs;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->logon_divs = logon_divs;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_hours_len(uint32 *hours_len, const GUMS_OBJECT *obj)
{
+ if (!hours_len || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!hours_len)
+
+ *hours_len = obj->data.user->hours_len;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_hours_len(GUMS_OBJECT *obj, uint32 hours_len)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *hours_len = ((GUMS_USER *)(obj->data))->hours_len;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->hours_len = hours_len;
return NT_STATUS_OK;
}
NTSTATUS gums_get_user_hours(uint8 **hours, const GUMS_OBJECT *obj)
{
+ if (!hours || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!hours)
+
+ *hours = obj->data.user->hours;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_hours(GUMS_OBJECT *obj, const uint8 *hours)
+{
+ if (!obj || !hours)
return NT_STATUS_INVALID_PARAMETER;
- *hours = ((GUMS_USER *)(obj->data))->hours;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->hours = (uint8 *)talloc_memdup(obj->mem_ctx, hours, obj->data.user->hours_len);
+ if (!(obj->data.user->hours) & (obj->data.user->hours_len != 0)) return NT_STATUS_NO_MEMORY;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_unknown_3(uint32 *unknown3, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_unknown_3(uint32 *unknown_3, const GUMS_OBJECT *obj)
{
+ if (!unknown_3 || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!unknown3)
+
+ *unknown_3 = obj->data.user->unknown_3;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_unknown_3(GUMS_OBJECT *obj, uint32 unknown_3)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *unknown3 = ((GUMS_USER *)(obj->data))->unknown_3;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->unknown_3 = unknown_3;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_unknown_5(uint32 *unknown5, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_unknown_5(uint32 *unknown_5, const GUMS_OBJECT *obj)
{
+ if (!unknown_5 || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!unknown5)
+
+ *unknown_5 = obj->data.user->unknown_5;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_unknown_5(GUMS_OBJECT *obj, uint32 unknown_5)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *unknown5 = ((GUMS_USER *)(obj->data))->unknown_5;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->unknown_5 = unknown_5;
return NT_STATUS_OK;
}
-NTSTATUS gums_get_user_unknown_6(uint32 *unknown6, const GUMS_OBJECT *obj)
+NTSTATUS gums_get_user_unknown_6(uint32 *unknown_6, const GUMS_OBJECT *obj)
{
+ if (!unknown_6 || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!unknown6)
+
+ *unknown_6 = obj->data.user->unknown_6;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_user_unknown_6(GUMS_OBJECT *obj, uint32 unknown_6)
+{
+ if (!obj)
return NT_STATUS_INVALID_PARAMETER;
- *unknown6 = ((GUMS_USER *)(obj->data))->unknown_6;
+ if (obj->type != GUMS_OBJ_NORMAL_USER)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.user->unknown_6 = unknown_6;
return NT_STATUS_OK;
}
@@ -328,20 +755,42 @@ NTSTATUS gums_get_user_unknown_6(uint32 *unknown6, const GUMS_OBJECT *obj)
NTSTATUS gums_get_group_members(uint32 *count, DOM_SID **members, const GUMS_OBJECT *obj)
{
+ if (!count || !members || !obj)
+ return NT_STATUS_INVALID_PARAMETER;
+
if (obj->type != GUMS_OBJ_GROUP &&
obj->type != GUMS_OBJ_ALIAS)
return NT_STATUS_OBJECT_TYPE_MISMATCH;
- if (!members)
+
+ *count = obj->data.group->count;
+ *members = obj->data.group->members;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS gums_set_group_members(GUMS_OBJECT *obj, uint32 count, const DOM_SID **members)
+{
+ uint32 n;
+
+ if (!obj || !members)
return NT_STATUS_INVALID_PARAMETER;
- *count = ((GUMS_GROUP *)(obj->data))->count;
- *members = ((GUMS_GROUP *)(obj->data))->members;
+ if (obj->type != GUMS_OBJ_GROUP &&
+ obj->type != GUMS_OBJ_ALIAS)
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
+
+ obj->data.group->count = count;
+ n = 0;
+ do {
+ obj->data.group->members[n] = dup_sec_desc(obj->mem_ctx, members[n]);
+ if (!(obj->data.group->members[n])) return NT_STATUS_NO_MEMORY;
+ n++;
+ } while (n < count);
return NT_STATUS_OK;
}
-/* set functions */
+/* data_store set functions */
-NTSTATUS gums_create_data_set(GUMS_COMMIT_SET **com_set, TALLOC_CTX *ctx, DOM_SID *sid, uint32 type)
+NTSTATUS gums_create_commit_set(GUMS_COMMIT_SET **com_set, TALLOC_CTX *ctx, DOM_SID *sid, uint32 type)
{
TALLOC_CTX *mem_ctx;
GUMS_COMMIT_SET *set;
@@ -365,7 +814,7 @@ NTSTATUS gums_create_data_set(GUMS_COMMIT_SET **com_set, TALLOC_CTX *ctx, DOM_SI
return NT_STATUS_OK;
}
-NTSTATUS gums_set_sec_desc(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, SEC_DESC *sec_desc)
+NTSTATUS gums_cs_set_sec_desc(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, SEC_DESC *sec_desc)
{
GUMS_DATA_SET *data_set;
SEC_DESC *new_sec_desc;
@@ -395,7 +844,7 @@ NTSTATUS gums_set_sec_desc(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, SEC_DE
return NT_STATUS_OK;
}
-NTSTATUS gums_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_ATTR priv)
+NTSTATUS gums_cs_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_ATTR priv)
{
GUMS_DATA_SET *data_set;
LUID_ATTR *new_priv;
@@ -424,7 +873,7 @@ NTSTATUS gums_add_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_
return NT_STATUS_OK;
}
-NTSTATUS gums_del_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_ATTR priv)
+NTSTATUS gums_cs_del_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_ATTR priv)
{
GUMS_DATA_SET *data_set;
LUID_ATTR *new_priv;
@@ -453,7 +902,7 @@ NTSTATUS gums_del_privilege(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, LUID_
return NT_STATUS_OK;
}
-NTSTATUS gums_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, PRIVILEGE_SET *priv_set)
+NTSTATUS gums_cs_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, PRIVILEGE_SET *priv_set)
{
GUMS_DATA_SET *data_set;
PRIVILEGE_SET *new_priv_set;
@@ -482,7 +931,7 @@ NTSTATUS gums_set_privilege_set(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, P
return NT_STATUS_OK;
}
-NTSTATUS gums_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, char *str)
+NTSTATUS gums_cs_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, char *str)
{
GUMS_DATA_SET *data_set;
char *new_str;
@@ -512,17 +961,17 @@ NTSTATUS gums_set_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 t
return NT_STATUS_OK;
}
-NTSTATUS gums_set_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *name)
+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);
}
-NTSTATUS gums_set_description(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *desc)
+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);
}
-NTSTATUS gums_set_full_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *full_name)
+NTSTATUS gums_cs_set_full_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *full_name)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -530,7 +979,7 @@ NTSTATUS gums_set_full_name(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, full_name);
}
-NTSTATUS gums_set_home_directory(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *home_dir)
+NTSTATUS gums_cs_set_home_directory(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *home_dir)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -538,7 +987,7 @@ NTSTATUS gums_set_home_directory(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, home_dir);
}
-NTSTATUS gums_set_drive(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *drive)
+NTSTATUS gums_cs_set_drive(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *drive)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -546,7 +995,7 @@ NTSTATUS gums_set_drive(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *dri
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, drive);
}
-NTSTATUS gums_set_logon_script(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *logon_script)
+NTSTATUS gums_cs_set_logon_script(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *logon_script)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -554,7 +1003,7 @@ NTSTATUS gums_set_logon_script(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, ch
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, logon_script);
}
-NTSTATUS gums_set_profile_path(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *prof_path)
+NTSTATUS gums_cs_set_profile_path(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *prof_path)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -562,7 +1011,7 @@ NTSTATUS gums_set_profile_path(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, ch
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, prof_path);
}
-NTSTATUS gums_set_workstations(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *wks)
+NTSTATUS gums_cs_set_workstations(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *wks)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -570,7 +1019,7 @@ NTSTATUS gums_set_workstations(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, ch
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, wks);
}
-NTSTATUS gums_set_unknown_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *unkn_str)
+NTSTATUS gums_cs_set_unknown_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *unkn_str)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -578,7 +1027,7 @@ NTSTATUS gums_set_unknown_string(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, unkn_str);
}
-NTSTATUS gums_set_munged_dial(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *munged_dial)
+NTSTATUS gums_cs_set_munged_dial(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, char *munged_dial)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -586,7 +1035,7 @@ NTSTATUS gums_set_munged_dial(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, cha
return gums_set_string(mem_ctx, com_set, GUMS_SET_NAME, munged_dial);
}
-NTSTATUS gums_set_nttime(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, NTTIME *time)
+NTSTATUS gums_cs_set_nttime(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 type, NTTIME *time)
{
GUMS_DATA_SET *data_set;
NTTIME *new_time;
@@ -618,7 +1067,7 @@ NTSTATUS gums_set_nttime(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, uint32 t
return NT_STATUS_OK;
}
-NTSTATUS gums_set_logon_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *logon_time)
+NTSTATUS gums_cs_set_logon_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *logon_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -626,7 +1075,7 @@ NTSTATUS gums_set_logon_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTI
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, logon_time);
}
-NTSTATUS gums_set_logoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *logoff_time)
+NTSTATUS gums_cs_set_logoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *logoff_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -634,7 +1083,7 @@ NTSTATUS gums_set_logoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTT
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGOFF_TIME, logoff_time);
}
-NTSTATUS gums_set_kickoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *kickoff_time)
+NTSTATUS gums_cs_set_kickoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *kickoff_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -642,7 +1091,7 @@ NTSTATUS gums_set_kickoff_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NT
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_KICKOFF_TIME, kickoff_time);
}
-NTSTATUS gums_set_pass_last_set_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pls_time)
+NTSTATUS gums_cs_set_pass_last_set_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pls_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -650,7 +1099,7 @@ NTSTATUS gums_set_pass_last_set_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_s
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pls_time);
}
-NTSTATUS gums_set_pass_can_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pcc_time)
+NTSTATUS gums_cs_set_pass_can_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pcc_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -658,7 +1107,7 @@ NTSTATUS gums_set_pass_can_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pcc_time);
}
-NTSTATUS gums_set_pass_must_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pmc_time)
+NTSTATUS gums_cs_set_pass_must_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, NTTIME *pmc_time)
{
if (com_set->type != GUMS_OBJ_NORMAL_USER)
return NT_STATUS_INVALID_PARAMETER;
@@ -666,7 +1115,7 @@ NTSTATUS gums_set_pass_must_change_time(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *co
return gums_set_nttime(mem_ctx, com_set, GUMS_SET_LOGON_TIME, pmc_time);
}
-NTSTATUS gums_add_sids_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
+NTSTATUS gums_cs_add_sids_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
{
GUMS_DATA_SET *data_set;
DOM_SID **new_sids;
@@ -702,7 +1151,7 @@ NTSTATUS gums_add_sids_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, c
return NT_STATUS_OK;
}
-NTSTATUS gums_add_users_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
+NTSTATUS gums_cs_add_users_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
{
if (!mem_ctx || !com_set || !sids)
return NT_STATUS_INVALID_PARAMETER;
@@ -712,7 +1161,7 @@ NTSTATUS gums_add_users_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
return gums_add_sids_to_group(mem_ctx, com_set, sids, count);
}
-NTSTATUS gums_add_groups_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
+NTSTATUS gums_cs_add_groups_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
{
if (!mem_ctx || !com_set || !sids)
return NT_STATUS_INVALID_PARAMETER;
@@ -722,7 +1171,7 @@ NTSTATUS gums_add_groups_to_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
return gums_add_sids_to_group(mem_ctx, com_set, sids, count);
}
-NTSTATUS gums_del_sids_from_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
+NTSTATUS gums_cs_del_sids_from_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
{
GUMS_DATA_SET *data_set;
DOM_SID **new_sids;
@@ -760,7 +1209,7 @@ NTSTATUS gums_del_sids_from_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set,
return NT_STATUS_OK;
}
-NTSTATUS gums_set_sids_in_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
+NTSTATUS gums_ds_set_sids_in_group(TALLOC_CTX *mem_ctx, GUMS_COMMIT_SET *com_set, const DOM_SID **sids, const uint32 count)
{
GUMS_DATA_SET *data_set;
DOM_SID **new_sids;
@@ -804,7 +1253,7 @@ NTSTATUS gums_commit_data(GUMS_COMMIT_SET *set)
return gums_storage->set_object_values(set->sid, set->count, set->data);
}
-NTSTATUS gums_destroy_data_set(GUMS_COMMIT_SET **com_set)
+NTSTATUS gums_destroy_commit_set(GUMS_COMMIT_SET **com_set)
{
talloc_destroy((*com_set)->mem_ctx);
*com_set = NULL;