Revert "TODO error message s4:dsdb/password_hash: restrict updates to "pwdLastSet...
authorStefan Metzmacher <metze@samba.org>
Wed, 30 Jun 2010 12:43:56 +0000 (14:43 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 5 Jul 2010 16:00:21 +0000 (18:00 +0200)
This reverts commit 0916434dfa051cc72ddba48f45ffd828ae469dfd.

source4/dsdb/samdb/ldb_modules/password_hash.c

index 8e90ada196f44339c95df57b3a3e5f4374c83c61..505f2c26f74bc8663b1c74bfe51f23dbecf2e538 100644 (file)
@@ -97,7 +97,6 @@ struct ph_context {
        struct dsdb_control_password_change_status *status;
 
        bool pwd_reset;
-       bool pwd_last_set_zero;
 
        bool change_status;
        bool hash_values;
@@ -1304,12 +1303,8 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
 
 static int setup_last_set_field(struct setup_password_fields_io *io)
 {
-       if (io->ac->pwd_last_set_zero) {
-               io->g.last_set = 0;
-       } else {
-               /* set it as now */
-               unix_to_nt_time(&io->g.last_set, time(NULL));
-       }
+       /* set it as now */
+       unix_to_nt_time(&io->g.last_set, time(NULL));
 
        return LDB_SUCCESS;
 }
@@ -2190,7 +2185,7 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
        struct ldb_context *ldb;
        struct ph_context *ac;
        struct ldb_message_element *userPasswordAttr, *clearTextPasswordAttr,
-               *ntAttr, *lmAttr, *pwdLastSetAttr;
+               *ntAttr, *lmAttr;
        int ret;
        struct ldb_control *bypass = NULL;
 
@@ -2227,13 +2222,6 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
        if (ldb_msg_find_element(req->op.add.message, "supplementalCredentials")) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
-       pwdLastSetAttr = ldb_msg_find_element(req->op.add.message, "pwdLastSet");
-       if (pwdLastSetAttr) {
-               if (!ldb_msg_check_string_attribute(req->op.add.message, "pwdLastSet", "0")) {
-                       /* invalid parameter */
-                       return LDB_ERR_OTHER;
-               }
-       }
 
        /* If no part of this touches the 'userPassword' OR 'clearTextPassword'
         * OR 'unicodePwd' OR 'dBCSPwd' we don't need to make any changes. */
@@ -2269,10 +2257,6 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
        }
        ph_apply_controls(ac);
 
-       if (pwdLastSetAttr) {
-               ac->pwd_last_set_zero = true;
-       }
-
        /* get user domain data */
        ret = build_domain_data_request(ac);
        if (ret != LDB_SUCCESS) {
@@ -2385,7 +2369,7 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
        const char *passwordAttrs[] = { "userPassword", "clearTextPassword",
                "unicodePwd", "dBCSPwd", NULL }, **l;
        unsigned int attr_cnt, del_attr_cnt, add_attr_cnt, rep_attr_cnt;
-       struct ldb_message_element *passwordAttr, *pwdLastSetAttr;
+       struct ldb_message_element *passwordAttr;
        struct ldb_message *msg;
        struct ldb_request *down_req;
        int ret;
@@ -2424,13 +2408,6 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
        if (ldb_msg_find_element(req->op.mod.message, "supplementalCredentials")) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
-       pwdLastSetAttr = ldb_msg_find_element(req->op.add.message, "pwdLastSet");
-       if (pwdLastSetAttr) {
-               if (!ldb_msg_check_string_attribute(req->op.add.message, "pwdLastSet", "0")) {
-                       /* invalid parameter */
-                       return LDB_ERR_OTHER;
-               }
-       }
 
        /* If no part of this touches the 'userPassword' OR 'clearTextPassword'
         * OR 'unicodePwd' OR 'dBCSPwd' we don't need to make any changes.
@@ -2453,10 +2430,6 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
        }
        ph_apply_controls(ac);
 
-       if (pwdLastSetAttr) {
-               ac->pwd_last_set_zero = true;
-       }
-
        /* use a new message structure so that we can modify it */
        msg = ldb_msg_copy_shallow(ac, req->op.mod.message);
        if (msg == NULL) {