summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-12 12:16:02 +0100
committerGünther Deschner <gd@samba.org>2008-02-12 12:30:51 +0100
commit6aa84ad8c5a535fc45cc9014fdc36867b6c76be9 (patch)
tree5ea37daae8e9a9c2397f09eaab455678a3ca8d17
parentc3f68ad29fa482df95be92d76071cff8bf9f384a (diff)
downloadsamba-6aa84ad8c5a535fc45cc9014fdc36867b6c76be9.tar.gz
samba-6aa84ad8c5a535fc45cc9014fdc36867b6c76be9.tar.bz2
samba-6aa84ad8c5a535fc45cc9014fdc36867b6c76be9.zip
Move some samr init functions around (to allow easier identification of new
calls). Guenther (This used to be commit c51c126049bd251a04dfae7ca6c3d0d3f823a503)
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/rpc_client/init_samr.c262
-rw-r--r--source3/rpc_parse/parse_samr.c448
-rw-r--r--source3/rpc_server/srv_samr_nt.c237
4 files changed, 485 insertions, 464 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 5c1beb519b..9c16213e6c 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -396,7 +396,7 @@ RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o
LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
$(RPC_CLIENT_OBJ1) rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \
rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o \
- rpc_client/cli_svcctl.o
+ rpc_client/cli_svcctl.o rpc_client/init_samr.o
LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
librpc/gen_ndr/cli_dfs.o \
diff --git a/source3/rpc_client/init_samr.c b/source3/rpc_client/init_samr.c
new file mode 100644
index 0000000000..db8f4aa37f
--- /dev/null
+++ b/source3/rpc_client/init_samr.c
@@ -0,0 +1,262 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * RPC Pipe client / server routines
+ * Copyright (C) Guenther Deschner 2008.
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+ name->string = s;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo1(struct samr_DomInfo1 *r,
+ uint16_t min_password_length,
+ uint16_t password_history_length,
+ uint32_t password_properties,
+ int64_t max_password_age,
+ int64_t min_password_age)
+{
+ r->min_password_length = min_password_length;
+ r->password_history_length = password_history_length;
+ r->password_properties = password_properties;
+ r->max_password_age = max_password_age;
+ r->min_password_age = min_password_age;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo2(struct samr_DomInfo2 *r,
+ NTTIME force_logoff_time,
+ const char *comment,
+ const char *domain_name,
+ const char *primary,
+ uint64_t sequence_num,
+ uint32_t unknown2,
+ enum samr_Role role,
+ uint32_t unknown3,
+ uint32_t num_users,
+ uint32_t num_groups,
+ uint32_t num_aliases)
+{
+ r->force_logoff_time = force_logoff_time;
+ init_lsa_String(&r->comment, comment);
+ init_lsa_String(&r->domain_name, domain_name);
+ init_lsa_String(&r->primary, primary);
+ r->sequence_num = sequence_num;
+ r->unknown2 = unknown2;
+ r->role = role;
+ r->unknown3 = unknown3;
+ r->num_users = num_users;
+ r->num_groups = num_groups;
+ r->num_aliases = num_aliases;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo3(struct samr_DomInfo3 *r,
+ NTTIME force_logoff_time)
+{
+ r->force_logoff_time = force_logoff_time;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo4(struct samr_DomInfo4 *r,
+ const char *comment)
+{
+ init_lsa_String(&r->comment, comment);
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo5(struct samr_DomInfo5 *r,
+ const char *domain_name)
+{
+ init_lsa_String(&r->domain_name, domain_name);
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo6(struct samr_DomInfo6 *r,
+ const char *primary)
+{
+ init_lsa_String(&r->primary, primary);
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo7(struct samr_DomInfo7 *r,
+ enum samr_Role role)
+{
+ r->role = role;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo8(struct samr_DomInfo8 *r,
+ uint64_t sequence_num,
+ NTTIME domain_create_time)
+{
+ r->sequence_num = sequence_num;
+ r->domain_create_time = domain_create_time;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo9(struct samr_DomInfo9 *r,
+ uint32_t unknown)
+{
+ r->unknown = unknown;
+}
+
+/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+void init_samr_DomInfo12(struct samr_DomInfo12 *r,
+ uint64_t lockout_duration,
+ uint64_t lockout_window,
+ uint16_t lockout_threshold)
+{
+ r->lockout_duration = lockout_duration;
+ r->lockout_window = lockout_window;
+ r->lockout_threshold = lockout_threshold;
+}
+
+/*******************************************************************
+ inits a samr_GroupInfoAll structure.
+********************************************************************/
+
+void init_samr_group_info1(struct samr_GroupInfoAll *r,
+ const char *name,
+ uint32_t attributes,
+ uint32_t num_members,
+ const char *description)
+{
+ DEBUG(5, ("init_samr_group_info1\n"));
+
+ init_lsa_String(&r->name, name);
+ r->attributes = attributes;
+ r->num_members = num_members;
+ init_lsa_String(&r->description, description);
+}
+
+/*******************************************************************
+ inits a lsa_String structure
+********************************************************************/
+
+void init_samr_group_info2(struct lsa_String *r, const char *group_name)
+{
+ DEBUG(5, ("init_samr_group_info2\n"));
+
+ init_lsa_String(r, group_name);
+}
+
+/*******************************************************************
+ inits a samr_GroupInfoAttributes structure.
+********************************************************************/
+
+void init_samr_group_info3(struct samr_GroupInfoAttributes *r,
+ uint32_t attributes)
+{
+ DEBUG(5, ("init_samr_group_info3\n"));
+
+ r->attributes = attributes;
+}
+
+/*******************************************************************
+ inits a lsa_String structure
+********************************************************************/
+
+void init_samr_group_info4(struct lsa_String *r, const char *description)
+{
+ DEBUG(5, ("init_samr_group_info4\n"));
+
+ init_lsa_String(r, description);
+}
+
+/*******************************************************************
+ inits a samr_GroupInfoAll structure.
+********************************************************************/
+
+void init_samr_group_info5(struct samr_GroupInfoAll *r,
+ const char *name,
+ uint32_t attributes,
+ uint32_t num_members,
+ const char *description)
+{
+ DEBUG(5, ("init_samr_group_info5\n"));
+
+ init_lsa_String(&r->name, name);
+ r->attributes = attributes;
+ r->num_members = num_members;
+ init_lsa_String(&r->description, description);
+}
+
+/*******************************************************************
+ inits a samr_AliasInfoAll structure.
+********************************************************************/
+
+void init_samr_alias_info1(struct samr_AliasInfoAll *r,
+ const char *name,
+ uint32_t num_members,
+ const char *description)
+{
+ DEBUG(5, ("init_samr_alias_info1\n"));
+
+ init_lsa_String(&r->name, name);
+ r->num_members = num_members;
+ init_lsa_String(&r->description, description);
+}
+
+/*******************************************************************
+inits a lsa_String structure.
+********************************************************************/
+
+void init_samr_alias_info3(struct lsa_String *r,
+ const char *description)
+{
+ DEBUG(5, ("init_samr_alias_info3\n"));
+
+ init_lsa_String(r, description);
+}
+
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 5225bcb5ca..a991037a6f 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -29,158 +29,6 @@
#define DBGC_CLASS DBGC_RPC_PARSE
/*******************************************************************
- inits a structure.
-********************************************************************/
-
-static void init_lsa_String(struct lsa_String *name, const char *s)
-{
- name->string = s;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-static void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s)
-{
- name->string = s;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo1(struct samr_DomInfo1 *r,
- uint16_t min_password_length,
- uint16_t password_history_length,
- uint32_t password_properties,
- int64_t max_password_age,
- int64_t min_password_age)
-{
- r->min_password_length = min_password_length;
- r->password_history_length = password_history_length;
- r->password_properties = password_properties;
- r->max_password_age = max_password_age;
- r->min_password_age = min_password_age;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo2(struct samr_DomInfo2 *r,
- NTTIME force_logoff_time,
- const char *comment,
- const char *domain_name,
- const char *primary,
- uint64_t sequence_num,
- uint32_t unknown2,
- enum samr_Role role,
- uint32_t unknown3,
- uint32_t num_users,
- uint32_t num_groups,
- uint32_t num_aliases)
-{
- r->force_logoff_time = force_logoff_time;
- init_lsa_String(&r->comment, comment);
- init_lsa_String(&r->domain_name, domain_name);
- init_lsa_String(&r->primary, primary);
- r->sequence_num = sequence_num;
- r->unknown2 = unknown2;
- r->role = role;
- r->unknown3 = unknown3;
- r->num_users = num_users;
- r->num_groups = num_groups;
- r->num_aliases = num_aliases;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo3(struct samr_DomInfo3 *r,
- NTTIME force_logoff_time)
-{
- r->force_logoff_time = force_logoff_time;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo4(struct samr_DomInfo4 *r,
- const char *comment)
-{
- init_lsa_String(&r->comment, comment);
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo5(struct samr_DomInfo5 *r,
- const char *domain_name)
-{
- init_lsa_String(&r->domain_name, domain_name);
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo6(struct samr_DomInfo6 *r,
- const char *primary)
-{
- init_lsa_String(&r->primary, primary);
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo7(struct samr_DomInfo7 *r,
- enum samr_Role role)
-{
- r->role = role;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo8(struct samr_DomInfo8 *r,
- uint64_t sequence_num,
- NTTIME domain_create_time)
-{
- r->sequence_num = sequence_num;
- r->domain_create_time = domain_create_time;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo9(struct samr_DomInfo9 *r,
- uint32_t unknown)
-{
- r->unknown = unknown;
-}
-
-/*******************************************************************
- inits a structure.
-********************************************************************/
-
-void init_samr_DomInfo12(struct samr_DomInfo12 *r,
- uint64_t lockout_duration,
- uint64_t lockout_window,
- uint16_t lockout_threshold)
-{
- r->lockout_duration = lockout_duration;
- r->lockout_window = lockout_window;
- r->lockout_threshold = lockout_threshold;
-}
-
-/*******************************************************************
inits a SAM_ENTRY structure.
********************************************************************/
@@ -216,274 +64,6 @@ static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
}
/*******************************************************************
- inits a samr_DispInfoGeneral structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx,
- struct samr_DispInfoGeneral *r,
- uint32_t num_entries,
- uint32_t start_idx,
- struct samr_displayentry *entries)
-{
- uint32 i;
-
- DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
-
- if (num_entries == 0) {
- return NT_STATUS_OK;
- }
-
- r->count = num_entries;
-
- r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries);
- if (!r->entries) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < num_entries ; i++) {
-
- init_lsa_String(&r->entries[i].account_name,
- entries[i].account_name);
-
- init_lsa_String(&r->entries[i].description,
- entries[i].description);
-
- init_lsa_String(&r->entries[i].full_name,
- entries[i].fullname);
-
- r->entries[i].rid = entries[i].rid;
- r->entries[i].acct_flags = entries[i].acct_flags;
- r->entries[i].idx = start_idx+i+1;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
- inits a samr_DispInfoFull structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx,
- struct samr_DispInfoFull *r,
- uint32_t num_entries,
- uint32_t start_idx,
- struct samr_displayentry *entries)
-{
- uint32_t i;
-
- DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
-
- if (num_entries == 0) {
- return NT_STATUS_OK;
- }
-
- r->count = num_entries;
-
- r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries);
- if (!r->entries) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < num_entries ; i++) {
-
- init_lsa_String(&r->entries[i].account_name,
- entries[i].account_name);
-
- init_lsa_String(&r->entries[i].description,
- entries[i].description);
-
- r->entries[i].rid = entries[i].rid;
- r->entries[i].acct_flags = entries[i].acct_flags;
- r->entries[i].idx = start_idx+i+1;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
- inits a samr_DispInfoFullGroups structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx,
- struct samr_DispInfoFullGroups *r,
- uint32_t num_entries,
- uint32_t start_idx,
- struct samr_displayentry *entries)
-{
- uint32_t i;
-
- DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
-
- if (num_entries == 0) {
- return NT_STATUS_OK;
- }
-
- r->count = num_entries;
-
- r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries);
- if (!r->entries) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < num_entries ; i++) {
-
- init_lsa_String(&r->entries[i].account_name,
- entries[i].account_name);
-
- init_lsa_String(&r->entries[i].description,
- entries[i].description);
-
- r->entries[i].rid = entries[i].rid;
- r->entries[i].acct_flags = entries[i].acct_flags;
- r->entries[i].idx = start_idx+i+1;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
- inits a samr_DispInfoAscii structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx,
- struct samr_DispInfoAscii *r,
- uint32_t num_entries,
- uint32_t start_idx,
- struct samr_displayentry *entries)
-{
- uint32_t i;
-
- DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
-
- if (num_entries == 0) {
- return NT_STATUS_OK;
- }
-
- r->count = num_entries;
-
- r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
- if (!r->entries) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < num_entries ; i++) {
-
- init_lsa_AsciiString(&r->entries[i].account_name,
- entries[i].account_name);
-
- r->entries[i].idx = start_idx+i+1;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
- inits a samr_DispInfoAscii structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx,
- struct samr_DispInfoAscii *r,
- uint32_t num_entries,
- uint32_t start_idx,
- struct samr_displayentry *entries)
-{
- uint32_t i;
-
- DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
-
- if (num_entries == 0) {
- return NT_STATUS_OK;
- }
-
- r->count = num_entries;
-
- r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
- if (!r->entries) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < num_entries ; i++) {
-
- init_lsa_AsciiString(&r->entries[i].account_name,
- entries[i].account_name);
-
- r->entries[i].idx = start_idx+i+1;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
- inits a samr_GroupInfoAll structure.
-********************************************************************/
-
-void init_samr_group_info1(struct samr_GroupInfoAll *r,
- const char *name,
- uint32_t attributes,
- uint32_t num_members,
- const char *description)
-{
- DEBUG(5, ("init_samr_group_info1\n"));
-
- init_lsa_String(&r->name, name);
- r->attributes = attributes;
- r->num_members = num_members;
- init_lsa_String(&r->description, description);
-}
-
-/*******************************************************************
- inits a lsa_String structure
-********************************************************************/
-
-void init_samr_group_info2(struct lsa_String *r, const char *group_name)
-{
- DEBUG(5, ("init_samr_group_info2\n"));
-
- init_lsa_String(r, group_name);
-}
-
-/*******************************************************************
- inits a samr_GroupInfoAttributes structure.
-********************************************************************/
-
-void init_samr_group_info3(struct samr_GroupInfoAttributes *r,
- uint32_t attributes)
-{
- DEBUG(5, ("init_samr_group_info3\n"));
-
- r->attributes = attributes;
-}
-
-/*******************************************************************
- inits a lsa_String structure
-********************************************************************/
-
-void init_samr_group_info4(struct lsa_String *r, const char *description)
-{
- DEBUG(5, ("init_samr_group_info4\n"));
-
- init_lsa_String(r, description);
-}
-
-/*******************************************************************
- inits a samr_GroupInfoAll structure.
-********************************************************************/
-
-void init_samr_group_info5(struct samr_GroupInfoAll *r,
- const char *name,
- uint32_t attributes,
- uint32_t num_members,
- const char *description)
-{
- DEBUG(5, ("init_samr_group_info5\n"));
-
- init_lsa_String(&r->name, name);
- r->attributes = attributes;
- r->num_members = num_members;
- init_lsa_String(&r->description, description);
-}
-
-/*******************************************************************
inits a SAMR_Q_ENUM_DOM_GROUPS structure.
********************************************************************/
@@ -753,34 +333,6 @@ bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
}
/*******************************************************************
- inits a samr_AliasInfoAll structure.
-********************************************************************/
-
-void init_samr_alias_info1(struct samr_AliasInfoAll *r,
- const char *name,
- uint32_t num_members,
- const char *description)
-{
- DEBUG(5, ("init_samr_alias_info1\n"));
-
- init_lsa_String(&r->name, name);
- r->num_members = num_members;
- init_lsa_String(&r->description, description);
-}
-
-/*******************************************************************
-inits a lsa_String structure.
-********************************************************************/
-
-void init_samr_alias_info3(struct lsa_String *r,
- const char *description)
-{
- DEBUG(5, ("init_samr_alias_info3\n"));
-
- init_lsa_String(r, description);
-}
-
-/*******************************************************************
inits a SAMR_Q_LOOKUP_RIDS structure.
********************************************************************/
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index e493496720..e87d43dec4 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1172,6 +1172,213 @@ NTSTATUS _samr_EnumDomainAliases(pipes_struct *p,
}
/*******************************************************************
+ inits a structure.
+********************************************************************/
+
+static void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s)
+{
+ name->string = s;
+}
+
+/*******************************************************************
+ inits a samr_DispInfoGeneral structure.
+********************************************************************/
+
+static NTSTATUS init_samr_dispinfo_1(TALLOC_CTX *ctx,
+ struct samr_DispInfoGeneral *r,
+ uint32_t num_entries,
+ uint32_t start_idx,
+ struct samr_displayentry *entries)
+{
+ uint32 i;
+
+ DEBUG(10, ("init_samr_dispinfo_1: num_entries: %d\n", num_entries));
+
+ if (num_entries == 0) {
+ return NT_STATUS_OK;
+ }
+
+ r->count = num_entries;
+
+ r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries);
+ if (!r->entries) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < num_entries ; i++) {
+
+ init_lsa_String(&r->entries[i].account_name,
+ entries[i].account_name);
+
+ init_lsa_String(&r->entries[i].description,
+ entries[i].description);
+
+ init_lsa_String(&r->entries[i].full_name,
+ entries[i].fullname);
+
+ r->entries[i].rid = entries[i].rid;
+ r->entries[i].acct_flags = entries[i].acct_flags;
+ r->entries[i].idx = start_idx+i+1;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*******************************************************************
+ inits a samr_DispInfoFull structure.
+********************************************************************/
+
+static NTSTATUS init_samr_dispinfo_2(TALLOC_CTX *ctx,
+ struct samr_DispInfoFull *r,
+ uint32_t num_entries,
+ uint32_t start_idx,
+ struct samr_displayentry *entries)
+{
+ uint32_t i;
+
+ DEBUG(10, ("init_samr_dispinfo_2: num_entries: %d\n", num_entries));
+
+ if (num_entries == 0) {
+ return NT_STATUS_OK;
+ }
+
+ r->count = num_entries;
+
+ r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries);
+ if (!r->entries) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < num_entries ; i++) {
+
+ init_lsa_String(&r->entries[i].account_name,
+ entries[i].account_name);
+
+ init_lsa_String(&r->entries[i].description,
+ entries[i].description);
+
+ r->entries[i].rid = entries[i].rid;
+ r->entries[i].acct_flags = entries[i].acct_flags;
+ r->entries[i].idx = start_idx+i+1;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*******************************************************************
+ inits a samr_DispInfoFullGroups structure.
+********************************************************************/
+
+static NTSTATUS init_samr_dispinfo_3(TALLOC_CTX *ctx,
+ struct samr_DispInfoFullGroups *r,
+ uint32_t num_entries,
+ uint32_t start_idx,
+ struct samr_displayentry *entries)
+{
+ uint32_t i;
+
+ DEBUG(5, ("init_samr_dispinfo_3: num_entries: %d\n", num_entries));
+
+ if (num_entries == 0) {
+ return NT_STATUS_OK;
+ }
+
+ r->count = num_entries;
+
+ r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries);
+ if (!r->entries) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < num_entries ; i++) {
+
+ init_lsa_String(&r->entries[i].account_name,
+ entries[i].account_name);
+
+ init_lsa_String(&r->entries[i].description,
+ entries[i].description);
+
+ r->entries[i].rid = entries[i].rid;
+ r->entries[i].acct_flags = entries[i].acct_flags;
+ r->entries[i].idx = start_idx+i+1;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*******************************************************************
+ inits a samr_DispInfoAscii structure.
+********************************************************************/
+
+static NTSTATUS init_samr_dispinfo_4(TALLOC_CTX *ctx,
+ struct samr_DispInfoAscii *r,
+ uint32_t num_entries,
+ uint32_t start_idx,
+ struct samr_displayentry *entries)
+{
+ uint32_t i;
+
+ DEBUG(5, ("init_samr_dispinfo_4: num_entries: %d\n", num_entries));
+
+ if (num_entries == 0) {
+ return NT_STATUS_OK;
+ }
+
+ r->count = num_entries;
+
+ r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
+ if (!r->entries) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < num_entries ; i++) {
+
+ init_lsa_AsciiString(&r->entries[i].account_name,
+ entries[i].account_name);
+
+ r->entries[i].idx = start_idx+i+1;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*******************************************************************
+ inits a samr_DispInfoAscii structure.
+********************************************************************/
+
+static NTSTATUS init_samr_dispinfo_5(TALLOC_CTX *ctx,
+ struct samr_DispInfoAscii *r,
+ uint32_t num_entries,
+ uint32_t start_idx,
+ struct samr_displayentry *entries)
+{
+ uint32_t i;
+
+ DEBUG(5, ("init_samr_dispinfo_5: num_entries: %d\n", num_entries));
+
+ if (num_entries == 0) {
+ return NT_STATUS_OK;
+ }
+
+ r->count = num_entries;
+
+ r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
+ if (!r->entries) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < num_entries ; i++) {
+
+ init_lsa_AsciiString(&r->entries[i].account_name,
+ entries[i].account_name);
+
+ r->entries[i].idx = start_idx+i+1;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*******************************************************************
_samr_QueryDisplayInfo
********************************************************************/
@@ -1327,29 +1534,29 @@ NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p,
/* Now create reply structure */
switch (r->in.level) {
case 0x1:
- disp_ret = init_sam_dispinfo_1(p->mem_ctx, &disp_info->info1,
- num_account, enum_context,
- entries);
+ disp_ret = init_samr_dispinfo_1(p->mem_ctx, &disp_info->info1,
+ num_account, enum_context,
+ entries);
break;
case 0x2:
- disp_ret = init_sam_dispinfo_2(p->mem_ctx, &disp_info->info2,
- num_account, enum_context,
- entries);
+ disp_ret = init_samr_dispinfo_2(p->mem_ctx, &disp_info->info2,
+ num_account, enum_context,
+ entries);
break;
case 0x3:
- disp_ret = init_sam_dispinfo_3(p->mem_ctx, &disp_info->info3,
- num_account, enum_context,
- entries);
+ disp_ret = init_samr_dispinfo_3(p->mem_ctx, &disp_info->info3,
+ num_account, enum_context,
+ entries);
break;
case 0x4:
- disp_ret = init_sam_dispinfo_4(p->mem_ctx, &disp_info->info4,
- num_account, enum_context,
- entries);
+ disp_ret = init_samr_dispinfo_4(p->mem_ctx, &disp_info->info4,
+ num_account, enum_context,
+ entries);
break;
case 0x5:
- disp_ret = init_sam_dispinfo_5(p->mem_ctx, &disp_info->info5,
- num_account, enum_context,
- entries);
+ disp_ret = init_samr_dispinfo_5(p->mem_ctx, &disp_info->info5,
+ num_account, enum_context,
+ entries);
break;
default:
smb_panic("info class changed");