[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Thu Apr 19 06:16:04 MDT 2012


The branch, master has been updated
       via  84ad848 s3-xattr_tdb: Remove dead code: talloc_stackframe() cannot fail
       via  00d493b s3-dbwrap: Remove dead code: talloc_stackframe() cannot fail
       via  4471778 s3-passdb: Remove unused sampass->pass_must_change_time
      from  cf39ef3 s4-kcc: avoid a false alarm with rodc

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 84ad848c86f6c36cb7ceab25609710acbc57893b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Apr 19 16:31:52 2012 +1000

    s3-xattr_tdb: Remove dead code: talloc_stackframe() cannot fail
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Thu Apr 19 14:15:42 CEST 2012 on sn-devel-104

commit 00d493b00ced40f3a5dd39d9f1386ff5694872a3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Apr 19 16:31:40 2012 +1000

    s3-dbwrap: Remove dead code: talloc_stackframe() cannot fail

commit 4471778d7846e0c5d5989e522ee214a3b4ded153
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Apr 19 10:39:56 2012 +1000

    s3-passdb: Remove unused sampass->pass_must_change_time
    
    There is no need to call pdb_set_pass_must_change_time() because
    nothing ever consults that value.  It is always calculated from the
    domain policy.
    
    Also, this means we no longer store the value in LDAP.  The value
    would only ever be set when migrating from tdbsam or smbpasswd, not on
    password changes, so would become incorrect over time.
    
    Andrew Bartlett

-----------------------------------------------------------------------

Summary of changes:
 source3/include/passdb.h        |    3 ---
 source3/lib/dbwrap/dbwrap.c     |   11 +----------
 source3/lib/xattr_tdb.c         |   12 ------------
 source3/modules/vfs_xattr_tdb.c |    8 --------
 source3/passdb/passdb.c         |    5 -----
 source3/passdb/pdb_get_set.c    |    6 ------
 source3/passdb/pdb_ldap.c       |   20 --------------------
 source3/passdb/pdb_samba4.c     |    1 -
 source3/passdb/py_passdb.c      |    7 +++----
 source3/torture/pdbtest.c       |    6 ------
 10 files changed, 4 insertions(+), 75 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 2a3844d..905a5d1 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -183,7 +183,6 @@ enum pdb_elements {
 	PDB_KICKOFFTIME,
 	PDB_BAD_PASSWORD_TIME,
 	PDB_CANCHANGETIME,
-	PDB_MUSTCHANGETIME,
 	PDB_PLAINTEXT_PW,
 	PDB_USERNAME,
 	PDB_FULLNAME,
@@ -267,7 +266,6 @@ struct samu {
 	time_t bad_password_time;     /* last bad password entered */
 	time_t pass_last_set_time;    /* password last set time */
 	time_t pass_can_change_time;  /* password can change time */
-	time_t pass_must_change_time; /* password must change time */
 
 	const char *username;     /* UNIX username string */
 	const char *domain;       /* Windows Domain name */
@@ -752,7 +750,6 @@ bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_sta
 bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
 bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
 bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
-bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
 bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
 bool pdb_set_hours_len(struct samu *sampass, uint32_t len, enum pdb_value_state flag);
 bool pdb_set_logon_divs(struct samu *sampass, uint16_t hours, enum pdb_value_state flag);
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c
index 80bd09b..c78ee74 100644
--- a/source3/lib/dbwrap/dbwrap.c
+++ b/source3/lib/dbwrap/dbwrap.c
@@ -149,9 +149,6 @@ static struct db_record *dbwrap_fetch_locked_internal(
 	struct db_record *rec;
 	struct dbwrap_lock_order_state *lock_order;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		return NULL;
-	}
 
 	lock_order = dbwrap_check_lock_order(db, frame);
 	if (lock_order == NULL) {
@@ -242,9 +239,6 @@ NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,
 	struct db_record *rec;
 	NTSTATUS status;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		return NT_STATUS_NO_MEMORY;
-	}
 
 	rec = dbwrap_fetch_locked(db, frame, key);
 	if (rec == NULL) {
@@ -262,11 +256,8 @@ NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key)
 	struct db_record *rec;
 	NTSTATUS status;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		return NT_STATUS_NO_MEMORY;
-	}
 
-	rec = dbwrap_fetch_locked(db, talloc_tos(), key);
+	rec = dbwrap_fetch_locked(db, frame, key);
 	if (rec == NULL) {
 		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
diff --git a/source3/lib/xattr_tdb.c b/source3/lib/xattr_tdb.c
index 2bc71df..be4f3b2 100644
--- a/source3/lib/xattr_tdb.c
+++ b/source3/lib/xattr_tdb.c
@@ -178,10 +178,6 @@ ssize_t xattr_tdb_getattr(struct db_context *db_ctx,
 	ssize_t result = -1;
 	NTSTATUS status;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		errno = ENOMEM;
-		return -1;
-	}
 
 	DEBUG(10, ("xattr_tdb_getattr called for file %s, name %s\n",
 		   file_id_string(frame, id), name));
@@ -230,10 +226,6 @@ int xattr_tdb_setattr(struct db_context *db_ctx,
 	uint32_t i;
 	TDB_DATA data;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		errno = ENOMEM;
-		return -1;
-	}
 
 	DEBUG(10, ("xattr_tdb_setattr called for file %s, name %s\n",
 		   file_id_string(frame, id), name));
@@ -321,10 +313,6 @@ ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
 	uint32_t i;
 	size_t len = 0;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		errno = ENOMEM;
-		return -1;
-	}
 
 	status = xattr_tdb_load_attrs(frame, db_ctx, id, &attribs);
 
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 5c105b5..ee3199d 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -37,10 +37,6 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
 	ssize_t xattr_size;
 	DATA_BLOB blob;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		errno = ENOMEM;
-		return -1;
-	}
 
 	SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
@@ -75,10 +71,6 @@ static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle,
 	ssize_t xattr_size;
 	DATA_BLOB blob;
 	TALLOC_CTX *frame = talloc_stackframe();
-	if (!frame) {
-		errno = ENOMEM;
-		return -1;
-	}
 
 	SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 276e031..6d3f42e 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -93,7 +93,6 @@ struct samu *samu_new( TALLOC_CTX *ctx )
 	user->pass_can_change_time  = (time_t)0;
 	user->logoff_time           = get_time_t_max();
 	user->kickoff_time          = get_time_t_max();
-	user->pass_must_change_time = get_time_t_max();
 	user->fields_present        = 0x00ffffff;
 	user->logon_divs = 168; 	/* hours per week */
 	user->hours_len = 21; 		/* 21 times 8 bits = 168 */
@@ -1028,7 +1027,6 @@ static bool init_samu_from_buffer_v0(struct samu *sampass, uint8_t *buf, uint32_
 	pdb_set_logoff_time(sampass, logoff_time, PDB_SET);
 	pdb_set_kickoff_time(sampass, kickoff_time, PDB_SET);
 	pdb_set_pass_can_change_time(sampass, pass_can_change_time, PDB_SET);
-	pdb_set_pass_must_change_time(sampass, pass_must_change_time, PDB_SET);
 	pdb_set_pass_last_set_time(sampass, pass_last_set_time, PDB_SET);
 
 	pdb_set_username(sampass, username, PDB_SET); 
@@ -1219,7 +1217,6 @@ static bool init_samu_from_buffer_v1(struct samu *sampass, uint8_t *buf, uint32_
 	/* Change from V0 is addition of bad_password_time field. */
 	pdb_set_bad_password_time(sampass, bad_password_time, PDB_SET);
 	pdb_set_pass_can_change_time(sampass, pass_can_change_time, PDB_SET);
-	pdb_set_pass_must_change_time(sampass, pass_must_change_time, PDB_SET);
 	pdb_set_pass_last_set_time(sampass, pass_last_set_time, PDB_SET);
 
 	pdb_set_username(sampass, username, PDB_SET); 
@@ -1410,7 +1407,6 @@ static bool init_samu_from_buffer_v2(struct samu *sampass, uint8_t *buf, uint32_
 	pdb_set_kickoff_time(sampass, kickoff_time, PDB_SET);
 	pdb_set_bad_password_time(sampass, bad_password_time, PDB_SET);
 	pdb_set_pass_can_change_time(sampass, pass_can_change_time, PDB_SET);
-	pdb_set_pass_must_change_time(sampass, pass_must_change_time, PDB_SET);
 	pdb_set_pass_last_set_time(sampass, pass_last_set_time, PDB_SET);
 
 	pdb_set_username(sampass, username, PDB_SET); 
@@ -1646,7 +1642,6 @@ static bool init_samu_from_buffer_v3(struct samu *sampass, uint8_t *buf, uint32_
 	pdb_set_kickoff_time(sampass, convert_uint32_t_to_time_t(kickoff_time), PDB_SET);
 	pdb_set_bad_password_time(sampass, convert_uint32_t_to_time_t(bad_password_time), PDB_SET);
 	pdb_set_pass_can_change_time(sampass, convert_uint32_t_to_time_t(pass_can_change_time), PDB_SET);
-	pdb_set_pass_must_change_time(sampass, convert_uint32_t_to_time_t(pass_must_change_time), PDB_SET);
 	pdb_set_pass_last_set_time(sampass, convert_uint32_t_to_time_t(pass_last_set_time), PDB_SET);
 
 	pdb_set_username(sampass, username, PDB_SET); 
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 7575af2..a9b22bb 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -400,12 +400,6 @@ bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_
 	return pdb_set_init_flags(sampass, PDB_CANCHANGETIME, flag);
 }
 
-bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag)
-{
-	sampass->pass_must_change_time = mytime;
-	return pdb_set_init_flags(sampass, PDB_MUSTCHANGETIME, flag);
-}
-
 bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag)
 {
 	sampass->pass_last_set_time = mytime;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 04541e8..6b911d2 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -662,18 +662,6 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 				pass_can_change_time, PDB_SET);
 	}
 
-	temp = smbldap_talloc_single_attribute(
-			ldap_state->smbldap_state->ldap_struct,
-			entry,
-			get_userattr_key2string(ldap_state->schema_ver,
-				LDAP_ATTR_PWD_MUST_CHANGE),
-			ctx);
-	if (temp) {
-		pass_must_change_time = (time_t) atol(temp);
-		pdb_set_pass_must_change_time(sampass,
-				pass_must_change_time, PDB_SET);
-	}
-
 	/* recommend that 'gecos' and 'displayName' should refer to the same
 	 * attribute OID.  userFullName depreciated, only used by Samba
 	 * primary rules of LDAP: don't make a new attribute when one is already defined
@@ -1338,14 +1326,6 @@ static bool init_ldap_from_sam (struct ldapsam_privates *ldap_state,
 			get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_PWD_CAN_CHANGE), temp);
 	SAFE_FREE(temp);
 
-	if (asprintf(&temp, "%li", (long int)pdb_get_pass_must_change_time(sampass)) < 0) {
-		return false;
-	}
-	if (need_update(sampass, PDB_MUSTCHANGETIME))
-		smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
-			get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_PWD_MUST_CHANGE), temp);
-	SAFE_FREE(temp);
-
 	if ((pdb_get_acct_ctrl(sampass)&(ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST))
 			|| (lp_ldap_passwd_sync()!=LDAP_PASSWD_SYNC_ONLY)) {
 
diff --git a/source3/passdb/pdb_samba4.c b/source3/passdb/pdb_samba4.c
index 2b785fa..024c293 100644
--- a/source3/passdb/pdb_samba4.c
+++ b/source3/passdb/pdb_samba4.c
@@ -564,7 +564,6 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
 	PDB_LOGOFFTIME,
 	PDB_BAD_PASSWORD_TIME,
 	PDB_CANCHANGETIME, - these are calculated per policy, not stored
-	PDB_MUSTCHANGETIME, - these are calculated per policy, not stored
 	PDB_DOMAIN,
 	PDB_NTUSERNAME, - this makes no sense, and never really did
 	PDB_LOGONDIVS,
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index 46f2e90..d0ef567 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -198,10 +198,9 @@ static int py_samu_set_pass_must_change_time(PyObject *obj, PyObject *value, voi
 	struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
 	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
-	if (!pdb_set_pass_must_change_time(sam_acct, PyInt_AsLong(value), PDB_CHANGED)) {
-		return -1;
-	}
-	return 0;
+
+	/* TODO: make this not a get/set or give a better exception */
+	return -1;
 }
 
 static PyObject *py_samu_get_username(PyObject *obj, void *closure)
diff --git a/source3/torture/pdbtest.c b/source3/torture/pdbtest.c
index 9f9ca0c..1257eff 100644
--- a/source3/torture/pdbtest.c
+++ b/source3/torture/pdbtest.c
@@ -409,12 +409,6 @@ int main(int argc, char **argv)
 	pdb_get_account_policy(PDB_POLICY_MIN_PASSWORD_AGE, &min_age);
 	pdb_set_pass_last_set_time(out, time(NULL), PDB_SET);
 
-	if (expire == 0 || expire == (uint32)-1) {
-		pdb_set_pass_must_change_time(out, get_time_t_max(), PDB_SET);
-	} else {
-		pdb_set_pass_must_change_time(out, time(NULL)+expire, PDB_SET);
-	}
-
 	if (min_age == (uint32)-1) {
 		pdb_set_pass_can_change_time(out, 0, PDB_SET);
 	} else {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list