summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-18 14:00:14 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-20 09:17:14 +1000
commit7f64ea456be7f653dfb8aa74bbaf29b0d25fb725 (patch)
treebf84a5be12ba0a67e8aca4840a44b43fa3467539 /auth
parent52b28ec813ff3696606fc8f3a6bf4759a1a104e5 (diff)
downloadsamba-7f64ea456be7f653dfb8aa74bbaf29b0d25fb725.tar.gz
samba-7f64ea456be7f653dfb8aa74bbaf29b0d25fb725.tar.bz2
samba-7f64ea456be7f653dfb8aa74bbaf29b0d25fb725.zip
auth: Move make_user_info_SamBaseInfo() to talloc_strdup and out of memory checking
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth_sam_reply.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/auth/auth_sam_reply.c b/auth/auth_sam_reply.c
index 1644278bf0..ee27e966f6 100644
--- a/auth/auth_sam_reply.c
+++ b/auth/auth_sam_reply.c
@@ -192,19 +192,41 @@ NTSTATUS make_user_info_SamBaseInfo(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(info);
if (base->account_name.string) {
- info->account_name = talloc_reference(info, base->account_name.string);
+ info->account_name = talloc_strdup(info, base->account_name.string);
} else {
info->account_name = talloc_strdup(info, account_name);
- NT_STATUS_HAVE_NO_MEMORY(info->account_name);
}
+ NT_STATUS_HAVE_NO_MEMORY(info->account_name);
- info->domain_name = talloc_reference(info, base->domain.string);
- info->full_name = talloc_reference(info, base->full_name.string);
- info->logon_script = talloc_reference(info, base->logon_script.string);
- info->profile_path = talloc_reference(info, base->profile_path.string);
- info->home_directory = talloc_reference(info, base->home_directory.string);
- info->home_drive = talloc_reference(info, base->home_drive.string);
- info->logon_server = talloc_reference(info, base->logon_server.string);
+ if (base->domain.string) {
+ info->domain_name = talloc_strdup(info, base->domain.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->domain_name);
+ }
+
+ if (base->full_name.string) {
+ info->full_name = talloc_strdup(info, base->full_name.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->full_name);
+ }
+ if (base->logon_script.string) {
+ info->logon_script = talloc_strdup(info, base->logon_script.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->logon_script);
+ }
+ if (base->profile_path.string) {
+ info->profile_path = talloc_strdup(info, base->profile_path.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->profile_path);
+ }
+ if (base->home_directory.string) {
+ info->home_directory = talloc_strdup(info, base->home_directory.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->home_directory);
+ }
+ if (base->home_drive.string) {
+ info->home_drive = talloc_strdup(info, base->home_drive.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->home_drive);
+ }
+ if (base->logon_server.string) {
+ info->logon_server = talloc_strdup(info, base->logon_server.string);
+ NT_STATUS_HAVE_NO_MEMORY(info->logon_server);
+ }
info->last_logon = base->last_logon;
info->last_logoff = base->last_logoff;
info->acct_expiry = base->acct_expiry;