svn commit: samba r8395 - in trunk/source: lib passdb utils

gd at samba.org gd at samba.org
Tue Jul 12 22:35:04 GMT 2005


Author: gd
Date: 2005-07-12 22:35:02 +0000 (Tue, 12 Jul 2005)
New Revision: 8395

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8395

Log:
more work on account-policies:
* rename comment to description
* make each policy have its own timestamp

Guenther

Modified:
   trunk/source/lib/account_pol.c
   trunk/source/lib/smbldap_util.c
   trunk/source/passdb/pdb_ldap.c
   trunk/source/utils/pdbedit.c


Changeset:
Modified: trunk/source/lib/account_pol.c
===================================================================
--- trunk/source/lib/account_pol.c	2005-07-12 22:22:59 UTC (rev 8394)
+++ trunk/source/lib/account_pol.c	2005-07-12 22:35:02 UTC (rev 8395)
@@ -37,7 +37,7 @@
 	int field;
 	const char *string;
 	uint32 default_val;
-	const char *comment;
+	const char *description;
 };
 
 static const struct ap_table account_policy_names[] = {
@@ -104,15 +104,15 @@
 }
 
 /****************************************************************************
-Get the account policy comment as a string from its #define'ed number
+Get the account policy description as a string from its #define'ed number
 ****************************************************************************/
 
-const char *account_policy_get_comment(int field)
+const char *account_policy_get_desc(int field)
 {
 	int i;
 	for (i=0; account_policy_names[i].string; i++) {
 		if (field == account_policy_names[i].field)
-			return account_policy_names[i].comment;
+			return account_policy_names[i].description;
 	}
 	return NULL;
 
@@ -137,13 +137,17 @@
 Update LAST-Set counter inside the cache
 *****************************************************************************/
 
-static BOOL account_policy_cache_timestamp(uint32 *value, BOOL update)
+static BOOL account_policy_cache_timestamp(uint32 *value, BOOL update, 
+					   const char *ap_name)
 {
 	pstring key;
 	uint32 val = 0;
 	time_t now;
 
-	slprintf(key, sizeof(key)-1, "%s", AP_LASTSET);
+	if (ap_name == NULL)
+		return False;
+		
+	slprintf(key, sizeof(key)-1, "%s/%s", ap_name, AP_LASTSET);
 
 	if (!init_account_policy())
 		return False;
@@ -366,7 +370,7 @@
 	if (value)
 		*value = regval;
 
-	DEBUG(10,("account_policy_get: %s:%d\n", name, regval));
+	DEBUG(10,("account_policy_get: name: %s, val: %d\n", name, regval));
 	return True;
 }
 
@@ -393,7 +397,7 @@
 		return False;
 	}
 
-	DEBUG(10,("account_policy_set: %s:%d\n", name, value));
+	DEBUG(10,("account_policy_set: name: %s, value: %d\n", name, value));
 	
 	return True;
 }
@@ -416,7 +420,9 @@
 				return False;
 			}
 
-			if (!account_policy_cache_timestamp(&lastset, True)) {
+			if (!account_policy_cache_timestamp(&lastset, True, 
+							    decode_account_policy_name(field))) 
+			{
 				DEBUG(10,("cache_account_policy_set: failed to get lastest cache update timestamp\n"));
 				return False;
 			}
@@ -436,7 +442,9 @@
 {
 	uint32 lastset, i;
 
-	if (!account_policy_cache_timestamp(&lastset, False)) {
+	if (!account_policy_cache_timestamp(&lastset, False, 
+					    decode_account_policy_name(field))) 
+	{
 		DEBUG(10,("cache_account_policy_get: failed to get latest cache update timestamp\n"));
 		return False;
 	}

Modified: trunk/source/lib/smbldap_util.c
===================================================================
--- trunk/source/lib/smbldap_util.c	2005-07-12 22:22:59 UTC (rev 8394)
+++ trunk/source/lib/smbldap_util.c	2005-07-12 22:35:02 UTC (rev 8395)
@@ -36,7 +36,7 @@
 	int i, ldap_op, rc;
 	uint32 policy_default;
 	const char *policy_string = NULL;
-	const char *policy_comment = NULL;
+	const char *policy_description = NULL;
 	pstring dn;
 	fstring policy_default_str;
 
@@ -52,8 +52,8 @@
 			return ntstatus;
 		}
 
-		policy_comment = account_policy_get_comment(i);
-		if (!policy_comment) {
+		policy_description = account_policy_get_desc(i);
+		if (!policy_description) {
 			DEBUG(0,("add_new_domain_account_policies: no description for policy found\n"));
 			return ntstatus;
 		}
@@ -80,7 +80,7 @@
 			get_attr_key2string(acctpol_attr_list, LDAP_ATTR_ACCOUNT_POLICY_VAL), 
 			policy_default_str);
 
-		smbldap_set_mod( &mods, ldap_op, "description", policy_comment);
+		smbldap_set_mod( &mods, ldap_op, "description", policy_description);
 
 		rc = smbldap_add(ldap_state, dn, mods);
 

Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c	2005-07-12 22:22:59 UTC (rev 8394)
+++ trunk/source/passdb/pdb_ldap.c	2005-07-12 22:35:02 UTC (rev 8395)
@@ -3420,7 +3420,7 @@
 		return ntstatus;
 	}
 
-	policy_description = account_policy_get_comment(policy_index);
+	policy_description = account_policy_get_desc(policy_index);
 	if (!policy_description) {
 		DEBUG(0,("ldapsam_set_account_policy: no description for policy found\n"));
 		return ntstatus;

Modified: trunk/source/utils/pdbedit.c
===================================================================
--- trunk/source/utils/pdbedit.c	2005-07-12 22:22:59 UTC (rev 8394)
+++ trunk/source/utils/pdbedit.c	2005-07-12 22:35:02 UTC (rev 8395)
@@ -820,7 +820,7 @@
 			if (!account_policy_value_set)
 				exit(1);
 		}
-		printf("account policy \"%s\" description: %s\n", account_policy, account_policy_get_comment(field));
+		printf("account policy \"%s\" description: %s\n", account_policy, account_policy_get_desc(field));
 		if (account_policy_value_set) {
 			printf("account policy \"%s\" value was: %u\n", account_policy, value);
 			if (!pdb_set_account_policy(field, account_policy_value)) {



More information about the samba-cvs mailing list