summaryrefslogtreecommitdiffstats
path: root/source4/auth
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-13 18:08:56 +1300
committerAndreas Schneider <asn@cryptomilk.org>2014-03-05 16:33:21 +0100
commitd2beff59ecd50ef2e77684bd0043c3d943a3b245 (patch)
treeba1c9f49b8ec8af484f2a3139c849f3e6280d2a1 /source4/auth
parent952bc3cad05467959ba5aa08682d754bd80d543b (diff)
downloadsamba-d2beff59ecd50ef2e77684bd0043c3d943a3b245.tar.gz
samba-d2beff59ecd50ef2e77684bd0043c3d943a3b245.tar.xz
samba-d2beff59ecd50ef2e77684bd0043c3d943a3b245.zip
Remove the remaining uses of the macro NT_STATUS_HAVE_NO_MEMORY_AND_FREE in the codebase.
Following the current coding guidelines, it is considered bad practice to return from within a macro and change control flow as they look like normal function calls. Change-Id: Id1b540cde127395a7b27385a7c0fe79f3a145c73 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/sam.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index 1b563ee115..ac1986230a 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -390,8 +390,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
ldb_msg_find_attr_as_string(msg, "sAMAccountName", NULL));
info->domain_name = talloc_strdup(info, domain_name);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->domain_name,
- user_info_dc);
+ if (info->domain_name == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
str = ldb_msg_find_attr_as_string(msg, "displayName", "");
info->full_name = talloc_strdup(info, str);
@@ -402,18 +404,24 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
str = ldb_msg_find_attr_as_string(msg, "scriptPath", "");
info->logon_script = talloc_strdup(info, str);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->logon_script,
- user_info_dc);
+ if (info->logon_script == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
str = ldb_msg_find_attr_as_string(msg, "profilePath", "");
info->profile_path = talloc_strdup(info, str);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->profile_path,
- user_info_dc);
+ if (info->profile_path == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
str = ldb_msg_find_attr_as_string(msg, "homeDirectory", "");
info->home_directory = talloc_strdup(info, str);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->home_directory,
- user_info_dc);
+ if (info->home_directory == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
str = ldb_msg_find_attr_as_string(msg, "homeDrive", "");
info->home_drive = talloc_strdup(info, str);
@@ -423,8 +431,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
}
info->logon_server = talloc_strdup(info, netbios_name);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->logon_server,
- user_info_dc);
+ if (info->logon_server == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
info->last_logon = samdb_result_nttime(msg, "lastLogon", 0);
info->last_logoff = samdb_result_last_logoff(msg);
@@ -448,15 +458,19 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
user_sess_key.data,
user_sess_key.length);
if (user_sess_key.data) {
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->user_session_key.data,
- user_info_dc);
+ if (user_info_dc->user_session_key.data == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
}
user_info_dc->lm_session_key = data_blob_talloc(user_info_dc,
lm_sess_key.data,
lm_sess_key.length);
if (lm_sess_key.data) {
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->lm_session_key.data,
- user_info_dc);
+ if (user_info_dc->lm_session_key.data == NULL) {
+ TALLOC_FREE(user_info_dc);
+ return NT_STATUS_NO_MEMORY;
+ }
}
if (info->acct_flags & ACB_SVRTRUST) {