summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-11-24 20:18:44 +0000
committerJeremy Allison <jra@samba.org>2003-11-24 20:18:44 +0000
commit9ce8270a8699e36e81fbb02666e24c57454de7e3 (patch)
tree4fa2dc01a52955c04c2c3d4978fdafc4c6b7bfb9 /source3
parent3500dfdcdc4b0e1a1f5071597fff98369dc122d0 (diff)
downloadsamba-9ce8270a8699e36e81fbb02666e24c57454de7e3.tar.gz
samba-9ce8270a8699e36e81fbb02666e24c57454de7e3.tar.bz2
samba-9ce8270a8699e36e81fbb02666e24c57454de7e3.zip
Added "passwd chat timeout" parameter. Docs to follow.
Jeremy. (This used to be commit 4d49fb806db6868f97069a603a28a85dc31cfe21)
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/smbd/chgpasswd.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index b124c6fd3b..949fc0237c 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -264,6 +264,7 @@ typedef struct
BOOL bPamPasswordChange;
BOOL bUnixPasswdSync;
BOOL bPasswdChatDebug;
+ int iPasswdChatTimeout;
BOOL bTimestampLogs;
BOOL bNTSmbSupport;
BOOL bNTPipeSupport;
@@ -801,6 +802,7 @@ static struct parm_struct parm_table[] = {
{"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, FLAG_ADVANCED},
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED},
{"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED},
+ {"passwd chat timeout", P_INTEGER, P_GLOBAL, &Globals.iPasswdChatTimeout, NULL, NULL, FLAG_ADVANCED},
{"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED},
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED},
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, FLAG_ADVANCED},
@@ -1418,6 +1420,7 @@ static void init_globals(void)
Globals.bUnixPasswdSync = False;
Globals.bPamPasswordChange = False;
Globals.bPasswdChatDebug = False;
+ Globals.iPasswdChatTimeout = 2; /* 2 second default. */
Globals.bUnicode = True; /* Do unicode on the wire by default */
Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
Globals.bNTStatusSupport = True; /* Use NT status by default. */
@@ -1734,6 +1737,7 @@ FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
+FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
FN_GLOBAL_BOOL(lp_unicode, &Globals.bUnicode)
FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index d99570ff7c..5caf78e41a 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -245,7 +245,8 @@ static int expect(int master, char *issue, char *expected)
if (strequal(expected, "."))
return True;
- timeout = 2000;
+ /* Initial timeout. */
+ timeout = lp_passwd_chat_timeout() * 1000;
nread = 0;
buffer[nread] = 0;
@@ -261,8 +262,10 @@ static int expect(int master, char *issue, char *expected)
pstrcpy( str, buffer);
trim_char( str, ' ', ' ');
- if ((match = (unix_wild_match(expected, str) == 0)))
- timeout = 200;
+ if ((match = (unix_wild_match(expected, str) == 0))) {
+ /* Now data has started to return, lower timeout. */
+ timeout = lp_passwd_chat_timeout() * 100;
+ }
}
}