s3: Slightly simpify samr_ValidatePassword_Change
authorVolker Lendecke <vl@samba.org>
Fri, 16 Apr 2010 13:06:03 +0000 (15:06 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 17 Apr 2010 10:01:18 +0000 (12:01 +0200)
source3/rpc_server/srv_samr_nt.c

index 3626cbdf2a04c2e90afc5c7705f91a7ecc939d62..c739de2acdba73493fa5ff511c209165f8b0cd01 100644 (file)
@@ -6697,19 +6697,20 @@ static enum samr_ValidationStatus samr_ValidatePassword_Change(TALLOC_CTX *mem_c
 {
        NTSTATUS status;
 
-       if (req->password.string) {
-               if (strlen(req->password.string) < dom_pw_info->min_password_length) {
+       if (req->password.string == NULL) {
+               SAMR_VALIDATION_STATUS_SUCCESS;
+       }
+       if (strlen(req->password.string) < dom_pw_info->min_password_length) {
+               ZERO_STRUCT(rep->info);
+               return SAMR_VALIDATION_STATUS_PWD_TOO_SHORT;
+       }
+       if (dom_pw_info->password_properties & DOMAIN_PASSWORD_COMPLEX) {
+               status = check_password_complexity(req->account.string,
+                                                  req->password.string,
+                                                  NULL);
+               if (!NT_STATUS_IS_OK(status)) {
                        ZERO_STRUCT(rep->info);
-                       return SAMR_VALIDATION_STATUS_PWD_TOO_SHORT;
-               }
-               if (dom_pw_info->password_properties & DOMAIN_PASSWORD_COMPLEX) {
-                       status = check_password_complexity(req->account.string,
-                                                          req->password.string,
-                                                          NULL);
-                       if (!NT_STATUS_IS_OK(status)) {
-                               ZERO_STRUCT(rep->info);
-                               return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH;
-                       }
+                       return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH;
                }
        }