summaryrefslogtreecommitdiff
path: root/source3/auth/server_info.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-11 15:08:41 +0100
committerStefan Metzmacher <metze@samba.org>2011-02-04 16:57:32 +0100
commitac4127a9f432f762cb728c161d7fbf80de31b60e (patch)
treeb2892724d0da0266ff526071dc6746d45aac0b4c /source3/auth/server_info.c
parente9c45a3973c85fbe40c017724c7909fefa05b656 (diff)
downloadsamba-ac4127a9f432f762cb728c161d7fbf80de31b60e.tar.gz
samba-ac4127a9f432f762cb728c161d7fbf80de31b60e.tar.bz2
samba-ac4127a9f432f762cb728c161d7fbf80de31b60e.zip
s3-auth: add copy_netr_SamBaseInfo().
Guenther Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/auth/server_info.c')
-rw-r--r--source3/auth/server_info.c62
1 files changed, 6 insertions, 56 deletions
diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c
index 01c7a96cdc..0f62983560 100644
--- a/source3/auth/server_info.c
+++ b/source3/auth/server_info.c
@@ -21,6 +21,7 @@
#include "../lib/crypto/arcfour.h"
#include "../librpc/gen_ndr/netlogon.h"
#include "../libcli/security/security.h"
+#include "rpc_client/util_netlogon.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_AUTH
@@ -490,66 +491,15 @@ struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
{
struct netr_SamInfo3 *info3;
unsigned int i;
+ NTSTATUS status;
info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
if (!info3) return NULL;
- /* first copy all, then realloc pointers */
- info3->base = orig->base;
-
- if (orig->base.account_name.string) {
- info3->base.account_name.string =
- talloc_strdup(info3, orig->base.account_name.string);
- RET_NOMEM(info3->base.account_name.string);
- }
- if (orig->base.full_name.string) {
- info3->base.full_name.string =
- talloc_strdup(info3, orig->base.full_name.string);
- RET_NOMEM(info3->base.full_name.string);
- }
- if (orig->base.logon_script.string) {
- info3->base.logon_script.string =
- talloc_strdup(info3, orig->base.logon_script.string);
- RET_NOMEM(info3->base.logon_script.string);
- }
- if (orig->base.profile_path.string) {
- info3->base.profile_path.string =
- talloc_strdup(info3, orig->base.profile_path.string);
- RET_NOMEM(info3->base.profile_path.string);
- }
- if (orig->base.home_directory.string) {
- info3->base.home_directory.string =
- talloc_strdup(info3, orig->base.home_directory.string);
- RET_NOMEM(info3->base.home_directory.string);
- }
- if (orig->base.home_drive.string) {
- info3->base.home_drive.string =
- talloc_strdup(info3, orig->base.home_drive.string);
- RET_NOMEM(info3->base.home_drive.string);
- }
-
- if (orig->base.groups.count) {
- info3->base.groups.rids = (struct samr_RidWithAttribute *)
- talloc_memdup(info3, orig->base.groups.rids,
- (sizeof(struct samr_RidWithAttribute) *
- orig->base.groups.count));
- RET_NOMEM(info3->base.groups.rids);
- }
-
- if (orig->base.logon_server.string) {
- info3->base.logon_server.string =
- talloc_strdup(info3, orig->base.logon_server.string);
- RET_NOMEM(info3->base.logon_server.string);
- }
- if (orig->base.domain.string) {
- info3->base.domain.string =
- talloc_strdup(info3, orig->base.domain.string);
- RET_NOMEM(info3->base.domain.string);
- }
-
- if (orig->base.domain_sid) {
- info3->base.domain_sid = dom_sid_dup(info3, orig->base.domain_sid);
- RET_NOMEM(info3->base.domain_sid);
+ status = copy_netr_SamBaseInfo(info3, &orig->base, &info3->base);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(info3);
+ return NULL;
}
if (orig->sidcount) {