r25823: remove unneeded nesting by using error and out logic
authorStefan Metzmacher <metze@samba.org>
Sat, 3 Nov 2007 10:21:04 +0000 (11:21 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:44:13 +0000 (05:44 +0100)
metze
(This used to be commit 86db839382a6cf92e659abb9e8e51ef828e1e422)

source4/libnet/libnet_vampire.c

index dff915df71d865fa0c1f8c4dca8b7b0e7ec71399..09163f6507a8059cead488a0c4ad1f1f0288c856 100644 (file)
@@ -73,31 +73,31 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
                user->user_private_info.DataLength = data.length;
 
                nt_status = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
-               if (NT_STATUS_IS_OK(nt_status)) {
-                       if (keys.keys.keys2.lmpassword.length == 16) {
-                               if (rid_crypt) {
-                                       sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
-                                       user->lmpassword = lm_hash;
-                               } else {
-                                       user->lmpassword = keys.keys.keys2.lmpassword.pwd;
-                               }
-                               user->lm_password_present = true;
-                       }
-                       if (keys.keys.keys2.ntpassword.length == 16) {
-                               if (rid_crypt) {
-                                       sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0);
-                                       user->ntpassword = nt_hash;
-                               } else {
-                                       user->ntpassword = keys.keys.keys2.ntpassword.pwd;
-                               }
-                               user->nt_password_present = true;
-                       }
-                       /* TODO: rid decrypt history fields */
-               } else {
+               if (!NT_STATUS_IS_OK(nt_status)) {
                        *error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username);
                        dump_data(10, data.data, data.length);
                        return nt_status;
                }
+
+               if (keys.keys.keys2.lmpassword.length == 16) {
+                       if (rid_crypt) {
+                               sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
+                               user->lmpassword = lm_hash;
+                       } else {
+                               user->lmpassword = keys.keys.keys2.lmpassword.pwd;
+                       }
+                       user->lm_password_present = true;
+               }
+               if (keys.keys.keys2.ntpassword.length == 16) {
+                       if (rid_crypt) {
+                               sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0);
+                               user->ntpassword = nt_hash;
+                       } else {
+                               user->ntpassword = keys.keys.keys2.ntpassword.pwd;
+                       }
+                       user->nt_password_present = true;
+               }
+               /* TODO: rid decrypt history fields */
        }
        return NT_STATUS_OK;
 }