s4:password_hash LDB module - fix wrong error codes
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 14 Aug 2010 09:19:29 +0000 (11:19 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 14 Aug 2010 16:48:19 +0000 (18:48 +0200)
To match the passwords.py test

source4/dsdb/samdb/ldb_modules/password_hash.c

index 0f078b5c76fcf28dac12b56f903f1516e4e39adb..30f55d636028c833868a8b0289d3d9954adb5969 100644 (file)
@@ -1452,7 +1452,7 @@ static int check_password_restrictions(struct setup_password_fields_io *io)
                                        "check_password_restrictions: "
                                        "There's no old nt_hash, which is needed "
                                        "in order to change your password!");
-                               return LDB_ERR_UNWILLING_TO_PERFORM;
+                               return LDB_ERR_CONSTRAINT_VIOLATION;
                        }
 
                        /* The password modify through the NT hash is encouraged
@@ -1461,7 +1461,7 @@ static int check_password_restrictions(struct setup_password_fields_io *io)
                                ldb_asprintf_errstring(ldb,
                                        "check_password_restrictions: "
                                        "The old password specified doesn't match!");
-                               return LDB_ERR_UNWILLING_TO_PERFORM;
+                               return LDB_ERR_CONSTRAINT_VIOLATION;
                        }
                } else if (io->og.lm_hash) {
                        if (!io->o.lm_hash) {
@@ -1469,14 +1469,14 @@ static int check_password_restrictions(struct setup_password_fields_io *io)
                                        "check_password_restrictions: "
                                        "There's no old lm_hash, which is needed "
                                        "in order to change your password!");
-                               return LDB_ERR_UNWILLING_TO_PERFORM;
+                               return LDB_ERR_CONSTRAINT_VIOLATION;
                        }
 
                        if (memcmp(io->og.lm_hash->hash, io->o.lm_hash->hash, 16) != 0) {
                                ldb_asprintf_errstring(ldb,
                                        "check_password_restrictions: "
                                        "The old password specified doesn't match!");
-                               return LDB_ERR_UNWILLING_TO_PERFORM;
+                               return LDB_ERR_CONSTRAINT_VIOLATION;
                        }
                }
        }