diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-11-04 17:21:04 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-11-04 17:21:04 -0800 |
commit | e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2 (patch) | |
tree | ce4c73521220fbb751c2be6a42e85ff6a6cbff97 /example/getpassck | |
download | expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.gz expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.bz2 expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.zip |
Imported Upstream version 5.45upstream/5.45
Diffstat (limited to 'example/getpassck')
-rw-r--r-- | example/getpassck | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/example/getpassck b/example/getpassck new file mode 100644 index 0000000..9730e39 --- /dev/null +++ b/example/getpassck @@ -0,0 +1,37 @@ +#!/bin/sh +# \ +exec expect "$0" ${1+"$@"} +# +# Name: getpassck +# +# Description: +# This script demonstrates when programs using getpass sometimes +# fail. The reason is that some implementations of getpass prompt +# before the pty/tty has completed the switch to no-echo. This may +# not be obvious from examination of the implementation of getpass +# itself because the driver itself may cut corners and be +# responsible for allowing the call to return prematurely. +# +# Directions: +# Simply run this script. It will loop 100 times attempting to +# generate the getpass problem. If the bug cannot be reproduced, +# you will see 100 failed attempts to su. If the bug can be +# reproduced, the script exits as soon as it is detected. +# +# Author: Don Libes <don@libes.com> +# Version: 1.0, Wed Mar 9 12:36:12 EST 2005 +# + +for {set i 0} {$i < 100} {incr i} { + spawn -noecho su + expect ": " ;# get password prompt as quickly as possible + send "X\r" ;# send password + expect X { + puts "Password was echoed! This system has the getpass problem." + exit + } "orry" { + close + wait + } +} +puts "Failed to reproduce getpass problem." |