summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-09-20 22:55:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:54 -0500
commitd75003bf6e601ffa2200e1251bc7bc2d149cf1db (patch)
treeb8ad6b91af331f5f60240955a6fb8ca910f090a6 /source3/utils
parent05ba38f7549f91670761928f1c959b65eb4bcec1 (diff)
downloadsamba-d75003bf6e601ffa2200e1251bc7bc2d149cf1db.tar.gz
samba-d75003bf6e601ffa2200e1251bc7bc2d149cf1db.tar.bz2
samba-d75003bf6e601ffa2200e1251bc7bc2d149cf1db.zip
r18748: Eliminate set of computed time values
(This used to be commit c53d4a8151f3105efa4c0bc340f35ee5c9c97aaf)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c79
1 files changed, 3 insertions, 76 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 0ebe022e18..013eab18ce 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -407,8 +407,7 @@ static int set_user_info (struct pdb_methods *in, const char *username,
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 @@ static int set_user_info (struct pdb_methods *in, const char *username,
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 @@ int main (int argc, char **argv)
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 @@ int main (int argc, char **argv)
{"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 @@ int main (int argc, char **argv)
(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 @@ int main (int argc, char **argv)
/* 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);
}
}