svn commit: samba r18748 - in branches: SAMBA_3_0/source/utils SAMBA_3_0_23/source/utils

jmcd at samba.org jmcd at samba.org
Wed Sep 20 22:55:45 GMT 2006


Author: jmcd
Date: 2006-09-20 22:55:44 +0000 (Wed, 20 Sep 2006)
New Revision: 18748

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

Log:
Eliminate set of computed time values

Modified:
   branches/SAMBA_3_0/source/utils/pdbedit.c
   branches/SAMBA_3_0_23/source/utils/pdbedit.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/pdbedit.c
===================================================================
--- branches/SAMBA_3_0/source/utils/pdbedit.c	2006-09-20 22:49:02 UTC (rev 18747)
+++ branches/SAMBA_3_0/source/utils/pdbedit.c	2006-09-20 22:55:44 UTC (rev 18748)
@@ -407,8 +407,7 @@
 			  const char *drive, const char *script, 
 			  const char *profile, const char *account_control,
 			  const char *user_sid, const char *user_domain,
-			  const BOOL badpw, const BOOL hours,
-			  time_t pwd_can_change, time_t pwd_must_change)
+			  const BOOL badpw, const BOOL hours)
 {
 	BOOL updated_autolock = False, updated_badpw = False;
 	struct samu *sam_pwent=NULL;
@@ -435,14 +434,6 @@
 		pdb_set_hours(sam_pwent, hours_array, PDB_CHANGED);
 	}
 
-	if (pwd_can_change != -1) {
-		pdb_set_pass_can_change_time(sam_pwent, pwd_can_change, PDB_CHANGED);
-	}
-
-	if (pwd_must_change != -1) {
-		pdb_set_pass_must_change_time(sam_pwent, pwd_must_change, PDB_CHANGED);
-	}
-
 	if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock)) {
 		DEBUG(2,("pdb_update_autolock_flag failed.\n"));
 	}
@@ -766,8 +757,6 @@
 	BOOL account_policy_value_set = False;
 	static BOOL badpw_reset = False;
 	static BOOL hours_reset = False;
-	static char *pwd_can_change_time = NULL;
-	static char *pwd_must_change_time = NULL;
 	static char *pwd_time_format = NULL;
 	static BOOL pw_from_stdin = False;
 	struct pdb_methods *bin, *bout, *bdef;
@@ -802,8 +791,6 @@
 		{"force-initialized-passwords", 0, POPT_ARG_NONE, &force_initialised_password, 0, "Force initialization of corrupt password strings in a passdb backend", NULL},
 		{"bad-password-count-reset", 'z', POPT_ARG_NONE, &badpw_reset, 0, "reset bad password count", NULL},
 		{"logon-hours-reset", 'Z', POPT_ARG_NONE, &hours_reset, 0, "reset logon hours", NULL},
-		{"pwd-can-change-time", 0, POPT_ARG_STRING, &pwd_can_change_time, 0, "Set password can change time (unix time in seconds since 1970 if time format not provided)", NULL },
-		{"pwd-must-change-time", 0, POPT_ARG_STRING, &pwd_must_change_time, 0, "Set password must change time (unix time in seconds since 1970 if time format not provided)", NULL },
 		{"time-format", 0, POPT_ARG_STRING, &pwd_time_format, 0, "The time format for time parameters", NULL },
 		{"password-from-stdin", 't', POPT_ARG_NONE, &pw_from_stdin, 0, "get password from standard in", NULL},
 		POPT_COMMON_SAMBA
@@ -866,9 +853,7 @@
 			(backend_in ? BIT_IMPORT : 0) +
 			(backend_out ? BIT_EXPORT : 0) +
 			(badpw_reset ? BIT_BADPWRESET : 0) +
-			(hours_reset ? BIT_LOGONHOURS : 0) +
-			(pwd_can_change_time ? BIT_CAN_CHANGE: 0) +
-			(pwd_must_change_time ? BIT_MUST_CHANGE: 0);
+			(hours_reset ? BIT_LOGONHOURS : 0);
 
 	if (setparms & BIT_BACKEND) {
 		if (!NT_STATUS_IS_OK(make_pdb_method_name( &bdef, backend ))) {
@@ -1040,67 +1025,9 @@
 
 		/* account modification operations */
 		if (!(checkparms & ~(BIT_MODIFY + BIT_USER))) {
-			time_t pwd_can_change = -1;
-			time_t pwd_must_change = -1;
-			const char *errstr;
-
-			if (pwd_can_change_time) {
-				errstr = "can";
-				if (pwd_time_format) {
-					struct tm tm;
-					char *ret;
-
-					memset(&tm, 0, sizeof(struct tm));
-					ret = strptime(pwd_can_change_time, pwd_time_format, &tm);
-					if (ret == NULL || *ret != '\0') {
-						goto error;
-					}
-
-					pwd_can_change = mktime(&tm);
-
-					if (pwd_can_change == -1) {
-						goto error;
-					}
-				} else { /* assume it is unix time */
-					errno = 0;
-					pwd_can_change = strtol(pwd_can_change_time, NULL, 10);
-					if (errno) {
-						goto error;
-					}
-				}	
-			}
-			if (pwd_must_change_time) {
-				errstr = "must";
-				if (pwd_time_format) {
-					struct tm tm;
-					char *ret;
-
-					memset(&tm, 0, sizeof(struct tm));
-					ret = strptime(pwd_must_change_time, pwd_time_format, &tm);
-					if (ret == NULL || *ret != '\0') {
-						goto error;
-					}
-
-					pwd_must_change = mktime(&tm);
-
-					if (pwd_must_change == -1) {
-						goto error;
-					}
-				} else { /* assume it is unix time */
-					errno = 0;
-					pwd_must_change = strtol(pwd_must_change_time, NULL, 10);
-					if (errno) {
-						goto error;
-					}
-				}	
-			}
 			return set_user_info (bdef, user_name, full_name, home_dir,
 				acct_desc, home_drive, logon_script, profile_path, account_control,
-				user_sid, user_domain, badpw_reset, hours_reset, pwd_can_change, 
-				pwd_must_change);
-error:
-			fprintf (stderr, "Error parsing the time in pwd-%s-change-time!\n", errstr);
-			return -1;
+				user_sid, user_domain, badpw_reset, hours_reset);
 		}
 	}
 

Modified: branches/SAMBA_3_0_23/source/utils/pdbedit.c
===================================================================
--- branches/SAMBA_3_0_23/source/utils/pdbedit.c	2006-09-20 22:49:02 UTC (rev 18747)
+++ branches/SAMBA_3_0_23/source/utils/pdbedit.c	2006-09-20 22:55:44 UTC (rev 18748)
@@ -419,8 +419,7 @@
 			  const char *drive, const char *script, 
 			  const char *profile, const char *account_control,
 			  const char *user_sid, const char *user_domain,
-			  const BOOL badpw, const BOOL hours,
-			  time_t pwd_can_change, time_t pwd_must_change)
+			  const BOOL badpw, const BOOL hours)
 {
 	BOOL updated_autolock = False, updated_badpw = False;
 	struct samu *sam_pwent=NULL;
@@ -447,14 +446,6 @@
 		pdb_set_hours(sam_pwent, hours_array, PDB_CHANGED);
 	}
 
-	if (pwd_can_change != -1) {
-		pdb_set_pass_can_change_time(sam_pwent, pwd_can_change, PDB_CHANGED);
-	}
-
-	if (pwd_must_change != -1) {
-		pdb_set_pass_must_change_time(sam_pwent, pwd_must_change, PDB_CHANGED);
-	}
-
 	if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock)) {
 		DEBUG(2,("pdb_update_autolock_flag failed.\n"));
 	}
@@ -778,8 +769,6 @@
 	BOOL account_policy_value_set = False;
 	static BOOL badpw_reset = False;
 	static BOOL hours_reset = False;
-	static char *pwd_can_change_time = NULL;
-	static char *pwd_must_change_time = NULL;
 	static char *pwd_time_format = NULL;
 	static BOOL pw_from_stdin = False;
 	struct pdb_methods *bin, *bout, *bdef;
@@ -814,8 +803,6 @@
 		{"force-initialized-passwords", 0, POPT_ARG_NONE, &force_initialised_password, 0, "Force initialization of corrupt password strings in a passdb backend", NULL},
 		{"bad-password-count-reset", 'z', POPT_ARG_NONE, &badpw_reset, 0, "reset bad password count", NULL},
 		{"logon-hours-reset", 'Z', POPT_ARG_NONE, &hours_reset, 0, "reset logon hours", NULL},
-		{"pwd-can-change-time", 0, POPT_ARG_STRING, &pwd_can_change_time, 0, "Set password can change time (unix time in seconds since 1970 if time format not provided)", NULL },
-		{"pwd-must-change-time", 0, POPT_ARG_STRING, &pwd_must_change_time, 0, "Set password must change time (unix time in seconds since 1970 if time format not provided)", NULL },
 		{"time-format", 0, POPT_ARG_STRING, &pwd_time_format, 0, "The time format for time parameters", NULL },
 		{"password-from-stdin", 't', POPT_ARG_NONE, &pw_from_stdin, 0, "get password from standard in", NULL},
 		POPT_COMMON_SAMBA
@@ -878,9 +865,7 @@
 			(backend_in ? BIT_IMPORT : 0) +
 			(backend_out ? BIT_EXPORT : 0) +
 			(badpw_reset ? BIT_BADPWRESET : 0) +
-			(hours_reset ? BIT_LOGONHOURS : 0) +
-			(pwd_can_change_time ? BIT_CAN_CHANGE: 0) +
-			(pwd_must_change_time ? BIT_MUST_CHANGE: 0);
+			(hours_reset ? BIT_LOGONHOURS : 0);
 
 	if (setparms & BIT_BACKEND) {
 		if (!NT_STATUS_IS_OK(make_pdb_method_name( &bdef, backend ))) {
@@ -1052,67 +1037,9 @@
 
 		/* account modification operations */
 		if (!(checkparms & ~(BIT_MODIFY + BIT_USER))) {
-			time_t pwd_can_change = -1;
-			time_t pwd_must_change = -1;
-			const char *errstr;
-
-			if (pwd_can_change_time) {
-				errstr = "can";
-				if (pwd_time_format) {
-					struct tm tm;
-					char *ret;
-
-					memset(&tm, 0, sizeof(struct tm));
-					ret = strptime(pwd_can_change_time, pwd_time_format, &tm);
-					if (ret == NULL || *ret != '\0') {
-						goto error;
-					}
-
-					pwd_can_change = mktime(&tm);
-
-					if (pwd_can_change == -1) {
-						goto error;
-					}
-				} else { /* assume it is unix time */
-					errno = 0;
-					pwd_can_change = strtol(pwd_can_change_time, NULL, 10);
-					if (errno) {
-						goto error;
-					}
-				}	
-			}
-			if (pwd_must_change_time) {
-				errstr = "must";
-				if (pwd_time_format) {
-					struct tm tm;
-					char *ret;
-
-					memset(&tm, 0, sizeof(struct tm));
-					ret = strptime(pwd_must_change_time, pwd_time_format, &tm);
-					if (ret == NULL || *ret != '\0') {
-						goto error;
-					}
-
-					pwd_must_change = mktime(&tm);
-
-					if (pwd_must_change == -1) {
-						goto error;
-					}
-				} else { /* assume it is unix time */
-					errno = 0;
-					pwd_must_change = strtol(pwd_must_change_time, NULL, 10);
-					if (errno) {
-						goto error;
-					}
-				}	
-			}
 			return set_user_info (bdef, user_name, full_name, home_dir,
 				acct_desc, home_drive, logon_script, profile_path, account_control,
-				user_sid, user_domain, badpw_reset, hours_reset, pwd_can_change, 
-				pwd_must_change);
-error:
-			fprintf (stderr, "Error parsing the time in pwd-%s-change-time!\n", errstr);
-			return -1;
+				user_sid, user_domain, badpw_reset, hours_reset);
 		}
 	}
 



More information about the samba-cvs mailing list