home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3321 < prev    next >
SHell self-extracting ARchive  |  1991-05-12  |  15.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: 3321

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail text default
99% file C source text default
98% file makefile script, ASCII text default
100% TrID E-Mail message (Var. 2) default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 64 62 | 75 72 72 40 6f 63 66 2e |From: db|urr@ocf.|
|00000010| 62 65 72 6b 65 6c 65 79 | 2e 65 64 75 20 28 44 6f |berkeley|.edu (Do|
|00000020| 6e 61 6c 64 20 42 75 72 | 72 29 0a 4e 65 77 73 67 |nald Bur|r).Newsg|
|00000030| 72 6f 75 70 73 3a 20 61 | 6c 74 2e 73 6f 75 72 63 |roups: a|lt.sourc|
|00000040| 65 73 0a 53 75 62 6a 65 | 63 74 3a 20 4c 6f 63 6b |es.Subje|ct: Lock|
|00000050| 54 54 59 20 68 61 63 6b | 20 66 6f 72 20 53 79 73 |TTY hack| for Sys|
|00000060| 56 20 77 2f 6f 20 6e 65 | 74 77 6f 72 6b 69 6e 67 |V w/o ne|tworking|
|00000070| 0a 4d 65 73 73 61 67 65 | 2d 49 44 3a 20 3c 31 39 |.Message|-ID: <19|
|00000080| 39 31 4d 61 79 31 31 2e | 31 37 35 38 34 37 2e 31 |91May11.|175847.1|
|00000090| 37 37 37 33 40 61 67 61 | 74 65 2e 62 65 72 6b 65 |7773@aga|te.berke|
|000000a0| 6c 65 79 2e 65 64 75 3e | 0a 44 61 74 65 3a 20 31 |ley.edu>|.Date: 1|
|000000b0| 31 20 4d 61 79 20 39 31 | 20 31 37 3a 35 38 3a 34 |1 May 91| 17:58:4|
|000000c0| 37 20 47 4d 54 0a 0a 0a | 52 65 63 65 6e 74 6c 79 |7 GMT...|Recently|
|000000d0| 2c 20 61 20 70 72 6f 67 | 72 61 6d 20 63 61 6d 65 |, a prog|ram came|
|000000e0| 20 6f 76 65 72 20 74 68 | 65 20 6e 65 74 20 63 61 | over th|e net ca|
|000000f0| 6c 6c 65 64 20 4c 6f 63 | 6b 54 54 59 20 74 68 61 |lled Loc|kTTY tha|
|00000100| 74 20 77 69 6c 6c 20 6c | 6f 63 6b 20 79 6f 75 72 |t will l|ock your|
|00000110| 0a 74 65 72 6d 69 6e 61 | 6c 2c 20 73 6f 20 6e 6f |.termina|l, so no|
|00000120| 62 6f 64 79 20 63 6f 75 | 6c 64 20 75 73 65 20 69 |body cou|ld use i|
|00000130| 74 20 77 68 69 6c 65 20 | 79 6f 75 27 72 65 20 61 |t while |you're a|
|00000140| 77 61 79 20 66 72 6f 6d | 20 69 74 2e 20 20 54 68 |way from| it. Th|
|00000150| 69 73 20 70 72 6f 67 72 | 61 6d 0a 77 6f 72 6b 65 |is progr|am.worke|
|00000160| 64 20 67 72 65 61 74 2c | 20 65 78 63 65 70 74 20 |d great,| except |
|00000170| 66 6f 72 20 6f 6e 65 20 | 74 68 69 6e 67 2e 20 20 |for one |thing. |
|00000180| 49 20 72 75 6e 20 61 20 | 43 61 6c 6c 61 6e 20 55 |I run a |Callan U|
|00000190| 6e 69 73 74 61 72 20 33 | 30 30 20 28 72 65 61 6c |nistar 3|00 (real|
|000001a0| 20 6f 6c 64 0a 53 79 73 | 56 20 62 6f 78 20 77 69 | old.Sys|V box wi|
|000001b0| 74 68 6f 75 74 20 6e 65 | 74 77 6f 72 6b 69 6e 67 |thout ne|tworking|
|000001c0| 2c 20 73 61 76 65 20 55 | 55 43 50 29 2c 20 61 6e |, save U|UCP), an|
|000001d0| 64 20 69 74 20 64 6f 65 | 73 6e 27 74 20 68 61 76 |d it doe|sn't hav|
|000001e0| 65 20 67 65 74 68 6f 73 | 74 6e 61 6d 65 28 29 0a |e gethos|tname().|
|000001f0| 66 75 6e 63 74 69 6f 6e | 2e 20 20 53 6f 2c 20 49 |function|. So, I|
|00000200| 20 68 61 63 6b 65 64 20 | 61 20 67 65 74 68 6f 73 | hacked |a gethos|
|00000210| 74 6e 61 6d 65 2e 63 20 | 74 68 61 74 20 75 73 65 |tname.c |that use|
|00000220| 73 20 75 6e 61 6d 65 28 | 29 20 61 6e 64 20 72 65 |s uname(|) and re|
|00000230| 74 75 72 6e 73 20 74 68 | 65 0a 73 79 73 74 65 6d |turns th|e.system|
|00000240| 27 73 20 6e 6f 64 65 6e | 61 6d 65 20 61 73 20 74 |'s noden|ame as t|
|00000250| 68 65 20 72 65 73 75 6c | 74 20 6f 66 20 67 65 74 |he resul|t of get|
|00000260| 68 6f 73 74 6e 61 6d 65 | 28 29 2e 20 20 49 20 68 |hostname|(). I h|
|00000270| 61 76 65 20 69 6e 74 65 | 67 72 61 74 65 64 20 74 |ave inte|grated t|
|00000280| 68 69 73 0a 63 61 6c 6c | 20 69 6e 74 6f 20 4c 6f |his.call| into Lo|
|00000290| 63 6b 54 54 59 2c 20 61 | 6e 64 20 68 65 72 65 20 |ckTTY, a|nd here |
|000002a0| 69 73 20 6d 79 20 6d 6f | 64 69 66 69 65 64 20 76 |is my mo|dified v|
|000002b0| 65 72 73 69 6f 6e 2e 0a | 0a 51 75 65 73 74 69 6f |ersion..|.Questio|
|000002c0| 6e 73 2c 20 62 75 67 20 | 72 65 70 6f 72 74 73 2f |ns, bug |reports/|
|000002d0| 66 69 78 65 73 2c 20 73 | 75 67 67 65 73 74 69 6f |fixes, s|uggestio|
|000002e0| 6e 73 20 66 6f 72 20 69 | 6d 70 72 6f 76 65 6d 65 |ns for i|mproveme|
|000002f0| 6e 74 2c 20 63 6f 64 65 | 20 68 61 63 6b 73 2c 0a |nt, code| hacks,.|
|00000300| 65 74 63 2e 20 61 62 6f | 75 74 20 4c 6f 63 6b 54 |etc. abo|ut LockT|
|00000310| 54 59 20 69 6e 20 67 65 | 6e 65 72 61 6c 20 73 68 |TY in ge|neral sh|
|00000320| 6f 75 6c 64 20 62 65 20 | 64 69 73 74 72 69 62 75 |ould be |distribu|
|00000330| 74 65 64 20 74 6f 20 69 | 74 73 20 61 75 74 68 6f |ted to i|ts autho|
|00000340| 72 2c 0a 6e 69 63 6b 65 | 6c 40 63 73 2e 74 75 2d |r,.nicke|l@cs.tu-|
|00000350| 62 65 72 6c 69 6e 2e 64 | 65 20 28 4a 75 65 72 67 |berlin.d|e (Juerg|
|00000360| 65 6e 20 4e 69 63 6b 65 | 6c 73 65 6e 29 2e 0a 0a |en Nicke|lsen)...|
|00000370| 51 75 65 73 74 69 6f 6e | 73 2c 20 62 75 67 20 72 |Question|s, bug r|
|00000380| 65 70 6f 72 74 73 2f 66 | 69 78 65 73 2c 20 73 75 |eports/f|ixes, su|
|00000390| 67 67 65 73 74 69 6f 6e | 73 20 66 6f 72 20 69 6d |ggestion|s for im|
|000003a0| 70 72 6f 76 65 6d 65 6e | 74 2c 20 63 6f 64 65 20 |provemen|t, code |
|000003b0| 68 61 63 6b 73 2c 0a 65 | 74 63 2e 20 61 62 6f 75 |hacks,.e|tc. abou|
|000003c0| 74 20 6d 79 20 67 65 74 | 68 6f 73 74 6e 61 6d 65 |t my get|hostname|
|000003d0| 2e 63 20 6f 72 20 6d 79 | 20 68 61 63 6b 73 20 74 |.c or my| hacks t|
|000003e0| 6f 20 4c 6f 63 6b 74 54 | 59 20 73 68 6f 75 6c 64 |o LocktT|Y should|
|000003f0| 20 62 65 20 64 69 72 65 | 63 74 65 64 0a 74 6f 20 | be dire|cted.to |
|00000400| 6d 65 2c 20 44 6f 6e 61 | 6c 64 20 42 75 72 72 2c |me, Dona|ld Burr,|
|00000410| 20 61 74 20 65 69 74 68 | 65 72 20 64 62 75 72 72 | at eith|er dburr|
|00000420| 40 6f 63 66 2e 62 65 72 | 6b 65 6c 65 79 2e 65 64 |@ocf.ber|keley.ed|
|00000430| 75 20 28 6c 69 6b 65 6c | 79 20 74 6f 20 67 6f 20 |u (likel|y to go |
|00000440| 61 77 61 79 0a 61 66 74 | 65 72 20 61 20 66 65 77 |away.aft|er a few|
|00000450| 20 6d 6f 6e 74 68 73 20 | 6f 72 20 73 6f 29 2c 20 | months |or so), |
|00000460| 6f 72 20 37 32 35 34 30 | 2e 33 30 37 31 40 63 6f |or 72540|.3071@co|
|00000470| 6d 70 75 73 65 72 76 65 | 2e 43 4f 4d 20 28 6c 69 |mpuserve|.COM (li|
|00000480| 6b 65 6c 79 20 74 6f 20 | 73 74 61 79 0a 6c 6f 6e |kely to |stay.lon|
|00000490| 67 65 72 29 2e 0a 0a 45 | 6e 6a 6f 79 21 21 0a 0a |ger)...E|njoy!!..|
|000004a0| 23 21 20 2f 62 69 6e 2f | 73 68 0a 23 20 54 68 69 |#! /bin/|sh.# Thi|
|000004b0| 73 20 69 73 20 61 20 73 | 68 65 6c 6c 20 61 72 63 |s is a s|hell arc|
|000004c0| 68 69 76 65 2c 20 6d 65 | 61 6e 69 6e 67 3a 0a 23 |hive, me|aning:.#|
|000004d0| 20 31 2e 20 52 65 6d 6f | 76 65 20 65 76 65 72 79 | 1. Remo|ve every|
|000004e0| 74 68 69 6e 67 20 61 62 | 6f 76 65 20 74 68 65 20 |thing ab|ove the |
|000004f0| 23 21 20 2f 62 69 6e 2f | 73 68 20 6c 69 6e 65 2e |#! /bin/|sh line.|
|00000500| 0a 23 20 32 2e 20 53 61 | 76 65 20 74 68 65 20 72 |.# 2. Sa|ve the r|
|00000510| 65 73 75 6c 74 69 6e 67 | 20 74 65 78 74 20 69 6e |esulting| text in|
|00000520| 20 61 20 66 69 6c 65 2e | 0a 23 20 33 2e 20 45 78 | a file.|.# 3. Ex|
|00000530| 65 63 75 74 65 20 74 68 | 65 20 66 69 6c 65 20 77 |ecute th|e file w|
|00000540| 69 74 68 20 2f 62 69 6e | 2f 73 68 20 28 6e 6f 74 |ith /bin|/sh (not|
|00000550| 20 63 73 68 29 20 74 6f | 20 63 72 65 61 74 65 20 | csh) to| create |
|00000560| 74 68 65 20 66 69 6c 65 | 73 3a 0a 23 09 4d 61 6b |the file|s:.#.Mak|
|00000570| 65 66 69 6c 65 0a 23 09 | 52 45 41 44 4d 45 0a 23 |efile.#.|README.#|
|00000580| 09 52 45 41 44 4d 45 2e | 73 79 73 76 0a 23 09 67 |.README.|sysv.#.g|
|00000590| 65 74 68 6f 73 74 6e 61 | 6d 65 2e 63 0a 23 09 6c |ethostna|me.c.#.l|
|000005a0| 6f 63 6b 74 74 79 2e 31 | 0a 23 09 6c 6f 63 6b 74 |ocktty.1|.#.lockt|
|000005b0| 74 79 2e 63 0a 23 20 57 | 72 61 70 70 65 64 20 62 |ty.c.# W|rapped b|
|000005c0| 79 20 72 6f 6f 74 40 64 | 65 75 74 73 63 68 20 20 |y root@d|eutsch |
|000005d0| 6f 6e 20 53 61 74 20 4d | 61 79 20 31 31 20 31 30 |on Sat M|ay 11 10|
|000005e0| 3a 33 37 3a 35 39 20 31 | 39 39 31 0a 65 78 70 6f |:37:59 1|991.expo|
|000005f0| 72 74 20 50 41 54 48 3b | 20 50 41 54 48 3d 2f 62 |rt PATH;| PATH=/b|
|00000600| 69 6e 3a 24 50 41 54 48 | 0a 65 63 68 6f 20 73 68 |in:$PATH|.echo sh|
|00000610| 61 72 3a 20 65 78 74 72 | 61 63 74 69 6e 67 20 22 |ar: extr|acting "|
|00000620| 27 4d 61 6b 65 66 69 6c | 65 27 22 20 27 28 32 39 |'Makefil|e'" '(29|
|00000630| 30 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 69 |0 charac|ters)'.i|
|00000640| 66 20 74 65 73 74 20 2d | 66 20 27 4d 61 6b 65 66 |f test -|f 'Makef|
|00000650| 69 6c 65 27 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |ile'.the|n..echo |
|00000660| 73 68 61 72 3a 20 77 69 | 6c 6c 20 6e 6f 74 20 6f |shar: wi|ll not o|
|00000670| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00000680| 6e 67 20 66 69 6c 65 20 | 22 27 4d 61 6b 65 66 69 |ng file |"'Makefi|
|00000690| 6c 65 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |le'".els|e.cat <<|
|000006a0| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 4d 61 | \SHAR_E|OF > 'Ma|
|000006b0| 6b 65 66 69 6c 65 27 0a | 43 43 20 3d 20 63 63 0a |kefile'.|CC = cc.|
|000006c0| 4c 49 42 53 20 3d 20 2d | 6c 63 75 72 73 65 73 20 |LIBS = -|lcurses |
|000006d0| 2d 6c 74 65 72 6d 63 61 | 70 0a 53 48 45 4c 4c 20 |-ltermca|p.SHELL |
|000006e0| 3d 20 2f 62 69 6e 2f 73 | 68 0a 43 46 4c 41 47 53 |= /bin/s|h.CFLAGS|
|000006f0| 20 3d 20 2d 4f 0a 53 4f | 55 52 43 45 20 3d 20 6c | = -O.SO|URCE = l|
|00000700| 6f 63 6b 74 74 79 2e 63 | 0a 54 41 52 47 45 54 20 |ocktty.c|.TARGET |
|00000710| 3d 20 6c 6f 63 6b 74 74 | 79 0a 0a 24 28 54 41 52 |= locktt|y..$(TAR|
|00000720| 47 45 54 29 20 3a 20 24 | 28 53 4f 55 52 43 45 29 |GET) : $|(SOURCE)|
|00000730| 0a 09 24 28 43 43 29 20 | 24 28 43 46 4c 41 47 53 |..$(CC) |$(CFLAGS|
|00000740| 29 20 2d 6f 20 24 28 54 | 41 52 47 45 54 29 20 24 |) -o $(T|ARGET) $|
|00000750| 28 53 4f 55 52 43 45 29 | 20 24 28 4c 49 42 53 29 |(SOURCE)| $(LIBS)|
|00000760| 0a 0a 69 73 63 20 3a 0a | 09 6d 61 6b 65 20 4c 49 |..isc :.|.make LI|
|00000770| 42 53 3d 22 24 28 4c 49 | 42 53 29 20 2d 6c 69 6e |BS="$(LI|BS) -lin|
|00000780| 65 74 22 0a 0a 73 79 73 | 76 20 3a 0a 09 6d 61 6b |et"..sys|v :..mak|
|00000790| 65 20 53 4f 55 52 43 45 | 3d 22 24 28 53 4f 55 52 |e SOURCE|="$(SOUR|
|000007a0| 43 45 29 20 67 65 74 68 | 6f 73 74 6e 61 6d 65 2e |CE) geth|ostname.|
|000007b0| 63 22 0a 0a 63 6c 65 61 | 6e 20 3a 20 0a 09 72 6d |c"..clea|n : ..rm|
|000007c0| 20 2d 66 20 2a 2e 6f 20 | 63 6f 72 65 20 2a 7e 20 | -f *.o |core *~ |
|000007d0| 24 28 54 41 52 47 45 54 | 29 0a 53 48 41 52 5f 45 |$(TARGET|).SHAR_E|
|000007e0| 4f 46 0a 69 66 20 74 65 | 73 74 20 32 39 30 20 2d |OF.if te|st 290 -|
|000007f0| 6e 65 20 22 60 77 63 20 | 2d 63 20 3c 20 27 4d 61 |ne "`wc |-c < 'Ma|
|00000800| 6b 65 66 69 6c 65 27 60 | 22 0a 74 68 65 6e 0a 09 |kefile'`|".then..|
|00000810| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 72 72 6f 72 |echo sha|r: error|
|00000820| 20 74 72 61 6e 73 6d 69 | 74 74 69 6e 67 20 22 27 | transmi|tting "'|
|00000830| 4d 61 6b 65 66 69 6c 65 | 27 22 20 27 28 73 68 6f |Makefile|'" '(sho|
|00000840| 75 6c 64 20 68 61 76 65 | 20 62 65 65 6e 20 32 39 |uld have| been 29|
|00000850| 30 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 66 |0 charac|ters)'.f|
|00000860| 69 0a 63 68 6d 6f 64 20 | 2b 78 20 27 4d 61 6b 65 |i.chmod |+x 'Make|
|00000870| 66 69 6c 65 27 0a 66 69 | 20 23 20 65 6e 64 20 6f |file'.fi| # end o|
|00000880| 66 20 6f 76 65 72 77 72 | 69 74 69 6e 67 20 63 68 |f overwr|iting ch|
|00000890| 65 63 6b 0a 65 63 68 6f | 20 73 68 61 72 3a 20 65 |eck.echo| shar: e|
|000008a0| 78 74 72 61 63 74 69 6e | 67 20 22 27 52 45 41 44 |xtractin|g "'READ|
|000008b0| 4d 45 27 22 20 27 28 31 | 34 39 35 20 63 68 61 72 |ME'" '(1|495 char|
|000008c0| 61 63 74 65 72 73 29 27 | 0a 69 66 20 74 65 73 74 |acters)'|.if test|
|000008d0| 20 2d 66 20 27 52 45 41 | 44 4d 45 27 0a 74 68 65 | -f 'REA|DME'.the|
|000008e0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 77 69 |n..echo |shar: wi|
|000008f0| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|00000900| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|00000910| 22 27 52 45 41 44 4d 45 | 27 22 0a 65 6c 73 65 0a |"'README|'".else.|
|00000920| 63 61 74 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |cat << \|SHAR_EOF|
|00000930| 20 3e 20 27 52 45 41 44 | 4d 45 27 0a 6c 6f 63 6b | > 'READ|ME'.lock|
|00000940| 74 74 79 20 31 2e 31 0a | 0a 41 20 6c 6f 6e 67 20 |tty 1.1.|.A long |
|00000950| 74 69 6d 65 20 49 20 77 | 61 73 20 6c 6f 6f 6b 69 |time I w|as looki|
|00000960| 6e 67 20 66 6f 72 20 61 | 20 75 74 69 6c 69 74 79 |ng for a| utility|
|00000970| 20 74 6f 20 6c 6f 63 6b | 20 74 68 65 20 73 63 72 | to lock| the scr|
|00000980| 65 65 6e 20 6f 66 20 61 | 6e 20 41 53 43 49 49 0a |een of a|n ASCII.|
|00000990| 74 65 72 6d 69 6e 61 6c | 2c 20 73 6f 6d 65 74 68 |terminal|, someth|
|000009a0| 69 6e 67 20 6c 69 6b 65 | 20 6c 6f 63 6b 73 63 72 |ing like| lockscr|
|000009b0| 65 65 6e 20 6f 72 20 78 | 6c 6f 63 6b 20 6f 6e 20 |een or x|lock on |
|000009c0| 53 75 6e 76 69 65 77 20 | 72 65 73 70 2e 20 58 20 |Sunview |resp. X |
|000009d0| 57 69 6e 64 6f 77 73 2c | 0a 62 75 74 20 64 69 64 |Windows,|.but did|
|000009e0| 6e 27 74 20 66 69 6e 64 | 20 61 6e 79 74 68 69 6e |n't find| anythin|
|000009f0| 67 2e 0a 0a 4f 4b 2c 20 | 68 65 72 65 20 69 73 20 |g...OK, |here is |
|00000a00| 22 6c 6f 63 6b 74 74 79 | 22 2e 20 54 6f 20 6b 65 |"locktty|". To ke|
|00000a10| 65 70 20 69 74 20 70 6f | 72 74 61 62 6c 65 20 65 |ep it po|rtable e|
|00000a20| 76 65 6e 20 66 6f 72 20 | 73 79 73 74 65 6d 73 20 |ven for |systems |
|00000a30| 77 69 74 68 20 61 0a 73 | 68 61 64 6f 77 20 70 61 |with a.s|hadow pa|
|00000a40| 73 73 77 6f 72 64 20 66 | 69 6c 65 2c 20 49 20 6b |ssword f|ile, I k|
|00000a50| 65 65 70 20 74 68 65 20 | 63 72 79 70 74 65 64 20 |eep the |crypted |
|00000a60| 70 61 73 73 77 6f 72 64 | 20 69 6e 20 61 20 66 69 |password| in a fi|
|00000a70| 6c 65 20 69 6e 20 74 68 | 65 0a 75 73 65 72 27 73 |le in th|e.user's|
|00000a80| 20 68 6f 6d 65 20 64 69 | 72 65 63 74 6f 72 79 2e | home di|rectory.|
|00000a90| 20 49 66 20 74 68 65 20 | 66 69 6c 65 20 64 6f 65 | If the |file doe|
|00000aa0| 73 20 6e 6f 74 20 65 78 | 69 73 74 2c 20 74 68 65 |s not ex|ist, the|
|00000ab0| 20 75 73 65 72 20 69 73 | 0a 70 72 6f 6d 70 74 65 | user is|.prompte|
|00000ac0| 64 20 66 6f 72 20 61 20 | 70 61 73 73 77 6f 72 64 |d for a |password|
|00000ad0| 2e 0a 0a 54 68 65 20 70 | 61 73 73 77 6f 72 64 20 |...The p|assword |
|00000ae0| 66 69 6c 65 20 63 61 6e | 20 62 65 20 63 68 61 6e |file can| be chan|
|00000af0| 67 65 64 20 62 79 20 75 | 73 69 6e 67 20 74 68 65 |ged by u|sing the|
|00000b00| 20 2d 70 20 6f 70 74 69 | 6f 6e 2e 0a 0a 43 68 61 | -p opti|on...Cha|
|00000b10| 6e 67 65 73 20 74 6f 20 | 31 2e 30 3a 0a 20 20 2d |nges to |1.0:. -|
|00000b20| 20 63 72 79 70 74 28 29 | 20 61 6e 64 20 67 65 74 | crypt()| and get|
|00000b30| 65 6e 76 28 29 20 70 72 | 65 64 65 63 6c 61 72 65 |env() pr|edeclare|
|00000b40| 64 20 28 66 6f 72 20 41 | 4e 53 49 20 63 6f 6d 70 |d (for A|NSI comp|
|00000b50| 69 6c 65 72 73 29 0a 20 | 20 2d 20 65 72 72 6e 6f |ilers). | - errno|
|00000b60| 20 64 65 63 6c 61 72 65 | 64 20 28 69 73 6e 27 74 | declare|d (isn't|
|00000b70| 20 64 65 63 6c 61 72 65 | 64 20 69 6e 20 65 76 65 | declare|d in eve|
|00000b80| 72 79 20 65 72 72 6e 6f | 2e 68 29 0a 20 20 2d 20 |ry errno|.h). - |
|00000b90| 69 6e 73 65 72 74 65 64 | 20 66 66 6c 75 73 68 28 |inserted| fflush(|
|00000ba0| 29 20 61 66 74 65 72 20 | 65 76 65 72 79 20 28 66 |) after |every (f|
|00000bb0| 29 70 75 74 73 28 29 0a | 20 20 2d 20 75 6e 6c 6f |)puts().| - unlo|
|00000bc0| 63 6b 20 70 72 6f 6d 70 | 74 20 69 73 20 72 65 61 |ck promp|t is rea|
|00000bd0| 6c 6c 79 20 65 72 61 73 | 65 64 20 6e 6f 77 0a 20 |lly eras|ed now. |
|00000be0| 20 2d 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 | - the n|umber of|
|00000bf0| 20 66 61 69 6c 65 64 20 | 75 6e 6c 6f 63 6b 20 61 | failed |unlock a|
|00000c00| 74 74 65 6d 70 74 73 20 | 69 73 20 64 69 73 70 6c |ttempts |is displ|
|00000c10| 61 79 65 64 20 61 66 74 | 65 72 20 75 6e 6c 6f 63 |ayed aft|er unloc|
|00000c20| 6b 0a 20 20 2d 20 75 73 | 65 72 6e 61 6d 65 20 61 |k. - us|ername a|
|00000c30| 6e 64 20 68 6f 73 74 6e | 61 6d 65 20 61 72 65 20 |nd hostn|ame are |
|00000c40| 64 69 73 70 6c 61 79 65 | 64 20 69 6e 20 74 68 65 |displaye|d in the|
|00000c50| 20 75 6e 6c 6f 63 6b 20 | 70 72 6f 6d 70 74 0a 0a | unlock |prompt..|
|00000c60| 54 68 65 73 65 20 63 68 | 61 6e 67 65 73 20 77 65 |These ch|anges we|
|00000c70| 72 65 20 69 6e 73 70 69 | 72 65 64 20 6f 72 20 73 |re inspi|red or s|
|00000c80| 75 67 67 65 73 74 65 64 | 20 62 79 20 74 68 65 20 |uggested| by the |
|00000c90| 66 6f 6c 6c 6f 77 69 6e | 67 20 70 65 6f 70 6c 65 |followin|g people|
|00000ca0| 3a 0a 44 61 76 69 64 20 | 41 2e 20 42 65 72 73 6f |:.David |A. Berso|
|00000cb0| 6e 2c 20 54 69 6d 20 44 | 61 77 73 6f 6e 2c 20 47 |n, Tim D|awson, G|
|00000cc0| 72 65 67 20 4d 69 6c 6c | 65 72 2c 20 43 68 72 69 |reg Mill|er, Chri|
|00000cd0| 73 20 50 68 69 6c 6c 69 | 70 73 2c 20 52 61 6e 64 |s Philli|ps, Rand|
|00000ce0| 79 20 48 61 6c 6c 2e 0a | 0a 54 68 65 20 70 72 6f |y Hall..|.The pro|
|00000cf0| 67 72 61 6d 20 69 73 20 | 77 69 74 68 6f 75 74 20 |gram is |without |
|00000d00| 61 6e 79 20 63 68 61 6e | 67 65 73 20 73 75 63 63 |any chan|ges succ|
|00000d10| 65 73 73 66 75 6c 6c 79 | 20 74 65 73 74 65 64 20 |essfully| tested |
|00000d20| 6f 6e 0a 20 20 2d 20 53 | 75 6e 4f 53 20 34 2e 31 |on. - S|unOS 4.1|
|00000d30| 20 6f 6e 20 73 75 6e 33 | 2c 20 73 75 6e 34 2c 20 | on sun3|, sun4, |
|00000d40| 77 69 74 68 20 63 63 2c | 20 67 63 63 2c 20 62 75 |with cc,| gcc, bu|
|00000d50| 74 20 6f 6e 20 61 20 73 | 75 6e 33 20 77 69 74 68 |t on a s|un3 with|
|00000d60| 20 63 63 20 61 6e 64 20 | 2d 4f 20 69 74 0a 20 20 | cc and |-O it. |
|00000d70| 20 20 74 68 72 6f 77 73 | 20 63 6f 72 65 20 73 6f | throws| core so|
|00000d80| 6d 65 74 69 6d 65 73 2c | 0a 20 20 2d 20 49 6e 74 |metimes,|. - Int|
|00000d90| 65 72 61 63 74 69 76 65 | 20 69 78 2f 33 38 36 20 |eractive| ix/386 |
|00000da0| 32 2e 30 2e 32 2c 20 0a | 20 20 2d 20 55 6c 74 72 |2.0.2, .| - Ultr|
|00000db0| 69 78 20 57 6f 72 6b 73 | 79 73 74 65 6d 20 56 32 |ix Works|ystem V2|
|00000dc0| 2e 31 20 28 52 65 76 2e | 20 31 34 29 2c 20 0a 20 |.1 (Rev.| 14), . |
|00000dd0| 20 2d 20 48 50 2d 55 58 | 20 37 2e 30 30 2c 0a 20 | - HP-UX| 7.00,. |
|00000de0| 20 2d 20 49 52 49 58 20 | 53 79 73 74 65 6d 20 56 | - IRIX |System V|
|00000df0| 20 52 65 6c 65 61 73 65 | 20 33 2e 32 2e 31 2c 0a | Release| 3.2.1,.|
|00000e00| 20 20 2d 20 4e 69 78 64 | 6f 72 66 20 54 4f 53 20 | - Nixd|orf TOS |
|00000e10| 34 2e 30 2e 31 32 2c 0a | 20 20 2d 20 49 42 4d 20 |4.0.12,.| - IBM |
|00000e20| 41 49 58 20 31 2e 32 20 | 28 50 53 2f 32 29 2c 0a |AIX 1.2 |(PS/2),.|
|00000e30| 20 20 2d 20 43 6f 6e 76 | 65 78 4f 53 20 52 65 6c | - Conv|exOS Rel|
|00000e40| 65 61 73 65 20 56 39 2e | 30 2e 0a 0a 54 6f 20 63 |ease V9.|0...To c|
|00000e50| 6f 6d 70 69 6c 65 20 69 | 74 20 75 6e 64 65 72 20 |ompile i|t under |
|00000e60| 49 6e 74 65 72 61 63 74 | 69 76 65 20 55 4e 49 58 |Interact|ive UNIX|
|00000e70| 2c 20 74 79 70 65 20 22 | 6d 61 6b 65 20 69 73 63 |, type "|make isc|
|00000e80| 22 2c 20 6f 74 68 65 72 | 77 69 73 65 20 6a 75 73 |", other|wise jus|
|00000e90| 74 0a 74 79 70 65 20 22 | 6d 61 6b 65 22 20 74 6f |t.type "|make" to|
|00000ea0| 20 62 75 69 6c 64 20 6c | 6f 63 6b 74 74 79 2e 0a | build l|ocktty..|
|00000eb0| 0a 50 6c 65 61 73 65 20 | 73 65 6e 64 20 63 6f 72 |.Please |send cor|
|00000ec0| 72 65 63 74 69 6f 6e 73 | 2c 20 69 6d 70 72 6f 76 |rections|, improv|
|00000ed0| 65 6d 65 6e 74 73 2c 20 | 61 6e 64 20 66 6c 61 6d |ements, |and flam|
|00000ee0| 65 73 20 74 6f 0a 0a 09 | 6e 69 63 6b 65 6c 40 63 |es to...|nickel@c|
|00000ef0| 73 2e 74 75 2d 62 65 72 | 6c 69 6e 2e 64 65 20 28 |s.tu-ber|lin.de (|
|00000f00| 4a 75 65 72 67 65 6e 20 | 4e 69 63 6b 65 6c 73 65 |Juergen |Nickelse|
|00000f10| 6e 29 0a 53 48 41 52 5f | 45 4f 46 0a 69 66 20 74 |n).SHAR_|EOF.if t|
|00000f20| 65 73 74 20 31 34 39 35 | 20 2d 6e 65 20 22 60 77 |est 1495| -ne "`w|
|00000f30| 63 20 2d 63 20 3c 20 27 | 52 45 41 44 4d 45 27 60 |c -c < '|README'`|
|00000f40| 22 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |".then..|echo sha|
|00000f50| 72 3a 20 65 72 72 6f 72 | 20 74 72 61 6e 73 6d 69 |r: error| transmi|
|00000f60| 74 74 69 6e 67 20 22 27 | 52 45 41 44 4d 45 27 22 |tting "'|README'"|
|00000f70| 20 27 28 73 68 6f 75 6c | 64 20 68 61 76 65 20 62 | '(shoul|d have b|
|00000f80| 65 65 6e 20 31 34 39 35 | 20 63 68 61 72 61 63 74 |een 1495| charact|
|00000f90| 65 72 73 29 27 0a 66 69 | 0a 63 68 6d 6f 64 20 2b |ers)'.fi|.chmod +|
|00000fa0| 78 20 27 52 45 41 44 4d | 45 27 0a 66 69 20 23 20 |x 'READM|E'.fi # |
|00000fb0| 65 6e 64 20 6f 66 20 6f | 76 65 72 77 72 69 74 69 |end of o|verwriti|
|00000fc0| 6e 67 20 63 68 65 63 6b | 0a 65 63 68 6f 20 73 68 |ng check|.echo sh|
|00000fd0| 61 72 3a 20 65 78 74 72 | 61 63 74 69 6e 67 20 22 |ar: extr|acting "|
|00000fe0| 27 52 45 41 44 4d 45 2e | 73 79 73 76 27 22 20 27 |'README.|sysv'" '|
|00000ff0| 28 37 33 35 20 63 68 61 | 72 61 63 74 65 72 73 29 |(735 cha|racters)|
|00001000| 27 0a 69 66 20 74 65 73 | 74 20 2d 66 20 27 52 45 |'.if tes|t -f 'RE|
|00001010| 41 44 4d 45 2e 73 79 73 | 76 27 0a 74 68 65 6e 0a |ADME.sys|v'.then.|
|00001020| 09 65 63 68 6f 20 73 68 | 61 72 3a 20 77 69 6c 6c |.echo sh|ar: will|
|00001030| 20 6e 6f 74 20 6f 76 65 | 72 2d 77 72 69 74 65 20 | not ove|r-write |
|00001040| 65 78 69 73 74 69 6e 67 | 20 66 69 6c 65 20 22 27 |existing| file "'|
|00001050| 52 45 41 44 4d 45 2e 73 | 79 73 76 27 22 0a 65 6c |README.s|ysv'".el|
|00001060| 73 65 0a 63 61 74 20 3c | 3c 20 5c 53 48 41 52 5f |se.cat <|< \SHAR_|
|00001070| 45 4f 46 20 3e 20 27 52 | 45 41 44 4d 45 2e 73 79 |EOF > 'R|EADME.sy|
|00001080| 73 76 27 0a 4c 4f 43 4b | 54 54 59 20 48 41 43 4b |sv'.LOCK|TTY HACK|
|00001090| 20 46 4f 52 20 53 59 53 | 56 0a 62 79 20 44 6f 6e | FOR SYS|V.by Don|
|000010a0| 61 6c 64 20 42 75 72 72 | 0a 0a 43 75 72 72 65 6e |ald Burr|..Curren|
|000010b0| 74 20 65 6d 61 69 6c 20 | 61 64 64 72 65 73 73 65 |t email |addresse|
|000010c0| 73 3a 20 64 62 75 72 72 | 40 6f 63 66 2e 62 65 72 |s: dburr|@ocf.ber|
|000010d0| 6b 65 6c 65 79 2e 65 64 | 75 20 2d 2d 20 6c 69 6b |keley.ed|u -- lik|
|000010e0| 65 6c 79 20 74 6f 20 63 | 68 61 6e 67 65 20 73 6f |ely to c|hange so|
|000010f0| 6f 6e 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |on. | |
|00001100| 20 20 20 20 20 20 20 20 | 20 20 20 20 37 32 35 34 | | 7254|
|00001110| 30 2e 33 30 37 31 40 63 | 6f 6d 70 75 73 65 72 76 |0.3071@c|ompuserv|
|00001120| 65 2e 63 6f 6d 20 2d 2d | 20 70 72 6f 62 61 62 6c |e.com --| probabl|
|00001130| 79 20 70 65 72 6d 61 6e | 65 6e 74 0a 0a 4c 6f 63 |y perman|ent..Loc|
|00001140| 6b 54 54 59 20 63 61 6e | 20 72 65 61 6c 6c 79 20 |kTTY can| really |
|00001150| 62 65 20 70 6f 72 74 65 | 64 20 74 6f 20 53 79 73 |be porte|d to Sys|
|00001160| 56 20 65 61 73 69 6c 79 | 2e 20 54 68 65 20 6f 6e |V easily|. The on|
|00001170| 6c 79 20 42 53 44 69 73 | 6d 20 69 6e 20 74 68 65 |ly BSDis|m in the|
|00001180| 72 65 20 69 73 0a 27 67 | 65 74 68 6f 73 74 6e 61 |re is.'g|ethostna|
|00001190| 6d 65 27 2e 20 20 49 20 | 68 61 76 65 20 68 61 63 |me'. I |have hac|
|000011a0| 6b 65 64 20 75 70 20 61 | 20 66 61 6b 65 20 27 67 |ked up a| fake 'g|
|000011b0| 65 74 68 6f 73 74 6e 61 | 6d 65 2e 63 27 20 74 68 |ethostna|me.c' th|
|000011c0| 61 74 20 73 69 6d 70 6c | 79 0a 63 61 6c 6c 73 20 |at simpl|y.calls |
|000011d0| 75 75 6e 61 6d 65 20 61 | 6e 64 20 70 61 73 73 65 |uuname a|nd passe|
|000011e0| 73 20 69 74 73 20 72 65 | 73 75 6c 74 20 62 61 63 |s its re|sult bac|
|000011f0| 6b 20 74 6f 20 74 68 65 | 20 63 61 6c 6c 69 6e 67 |k to the| calling|
|00001200| 20 70 72 6f 67 72 61 6d | 2e 20 20 49 74 0a 63 6f | program|. It.co|
|00001210| 6d 70 69 6c 65 64 20 66 | 69 6e 65 20 6f 6e 20 6d |mpiled f|ine on m|
|00001220| 79 20 43 61 6c 6c 61 6e | 20 33 30 30 2c 20 73 6f |y Callan| 300, so|
|00001230| 20 69 74 20 73 68 6f 75 | 6c 64 20 77 6f 72 6b 20 | it shou|ld work |
|00001240| 6f 6e 20 79 6f 75 72 73 | 20 61 73 20 77 65 6c 6c |on yours| as well|
|00001250| 2e 0a 4d 61 69 6c 20 6d | 65 20 77 69 74 68 20 61 |..Mail m|e with a|
|00001260| 6e 79 20 62 75 67 73 2c | 20 63 6f 6d 6d 65 6e 74 |ny bugs,| comment|
|00001270| 73 2c 20 73 75 67 67 65 | 73 74 69 6f 6e 73 2c 20 |s, sugge|stions, |
|00001280| 66 6c 61 6d 65 73 2c 20 | 77 68 61 74 65 76 65 72 |flames, |whatever|
|00001290| 2e 0a 0a 54 68 69 73 20 | 76 65 72 73 69 6f 6e 20 |...This |version |
|000012a0| 6f 66 20 6c 6f 63 6b 74 | 74 79 20 63 61 6e 20 6d |of lockt|ty can m|
|000012b0| 61 6b 65 20 69 74 73 65 | 6c 66 20 66 6f 72 20 62 |ake itse|lf for b|
|000012c0| 6f 74 68 20 42 53 44 20 | 61 6e 64 20 53 79 73 56 |oth BSD |and SysV|
|000012d0| 2e 0a 0a 54 6f 20 6d 61 | 6b 65 20 66 6f 72 20 42 |...To ma|ke for B|
|000012e0| 53 44 2c 20 73 69 6d 70 | 6c 79 20 74 79 70 65 20 |SD, simp|ly type |
|000012f0| 22 6d 61 6b 65 22 2e 0a | 54 6f 20 6d 61 6b 65 20 |"make"..|To make |
|00001300| 66 6f 72 20 49 6e 74 65 | 72 61 63 74 69 76 65 20 |for Inte|ractive |
|00001310| 55 4e 49 58 2c 20 73 69 | 6d 70 6c 79 20 74 79 70 |UNIX, si|mply typ|
|00001320| 65 20 22 6d 61 6b 65 20 | 69 73 63 22 2e 0a 54 6f |e "make |isc"..To|
|00001330| 20 6d 61 6b 65 20 74 68 | 65 20 53 79 73 56 20 76 | make th|e SysV v|
|00001340| 65 72 73 69 6f 6e 2c 20 | 74 79 70 65 20 22 6d 61 |ersion, |type "ma|
|00001350| 6b 65 20 73 79 73 76 22 | 2e 0a 0a 45 6e 6a 6f 79 |ke sysv"|...Enjoy|
|00001360| 21 21 0a 53 48 41 52 5f | 45 4f 46 0a 69 66 20 74 |!!.SHAR_|EOF.if t|
|00001370| 65 73 74 20 37 33 35 20 | 2d 6e 65 20 22 60 77 63 |est 735 |-ne "`wc|
|00001380| 20 2d 63 20 3c 20 27 52 | 45 41 44 4d 45 2e 73 79 | -c < 'R|EADME.sy|
|00001390| 73 76 27 60 22 0a 74 68 | 65 6e 0a 09 65 63 68 6f |sv'`".th|en..echo|
|000013a0| 20 73 68 61 72 3a 20 65 | 72 72 6f 72 20 74 72 61 | shar: e|rror tra|
|000013b0| 6e 73 6d 69 74 74 69 6e | 67 20 22 27 52 45 41 44 |nsmittin|g "'READ|
|000013c0| 4d 45 2e 73 79 73 76 27 | 22 20 27 28 73 68 6f 75 |ME.sysv'|" '(shou|
|000013d0| 6c 64 20 68 61 76 65 20 | 62 65 65 6e 20 37 33 35 |ld have |been 735|
|000013e0| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 66 69 | charact|ers)'.fi|
|000013f0| 0a 63 68 6d 6f 64 20 2b | 78 20 27 52 45 41 44 4d |.chmod +|x 'READM|
|00001400| 45 2e 73 79 73 76 27 0a | 66 69 20 23 20 65 6e 64 |E.sysv'.|fi # end|
|00001410| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|00001420| 63 68 65 63 6b 0a 65 63 | 68 6f 20 73 68 61 72 3a |check.ec|ho shar:|
|00001430| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 67 65 | extract|ing "'ge|
|00001440| 74 68 6f 73 74 6e 61 6d | 65 2e 63 27 22 20 27 28 |thostnam|e.c'" '(|
|00001450| 37 36 39 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |769 char|acters)'|
|00001460| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 27 67 65 74 |.if test| -f 'get|
|00001470| 68 6f 73 74 6e 61 6d 65 | 2e 63 27 0a 74 68 65 6e |hostname|.c'.then|
|00001480| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 77 69 6c |..echo s|har: wil|
|00001490| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|000014a0| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 22 | existin|g file "|
|000014b0| 27 67 65 74 68 6f 73 74 | 6e 61 6d 65 2e 63 27 22 |'gethost|name.c'"|
|000014c0| 0a 65 6c 73 65 0a 63 61 | 74 20 3c 3c 20 5c 53 48 |.else.ca|t << \SH|
|000014d0| 41 52 5f 45 4f 46 20 3e | 20 27 67 65 74 68 6f 73 |AR_EOF >| 'gethos|
|000014e0| 74 6e 61 6d 65 2e 63 27 | 0a 2f 2a 20 67 65 74 68 |tname.c'|./* geth|
|000014f0| 6f 73 74 6e 61 6d 65 28 | 29 20 66 6f 72 20 53 79 |ostname(|) for Sy|
|00001500| 73 56 20 2d 2d 20 62 79 | 20 44 6f 6e 61 6c 64 20 |sV -- by| Donald |
|00001510| 42 75 72 72 0a 20 20 20 | 55 73 65 73 20 75 6e 61 |Burr. |Uses una|
|00001520| 6d 65 28 29 20 61 6e 64 | 20 72 65 74 75 72 6e 73 |me() and| returns|
|00001530| 20 74 68 65 20 73 79 73 | 74 65 6d 27 73 20 55 55 | the sys|tem's UU|
|00001540| 43 50 20 6e 6f 64 65 6e | 61 6d 65 20 66 6f 72 20 |CP noden|ame for |
|00001550| 61 20 68 6f 73 74 6e 61 | 6d 65 0a 20 20 20 41 20 |a hostna|me. A |
|00001560| 71 75 69 63 6b 20 68 61 | 63 6b 20 49 20 64 69 64 |quick ha|ck I did|
|00001570| 20 66 6f 72 20 6c 6f 63 | 6b 74 74 79 20 2a 2f 0a | for loc|ktty */.|
|00001580| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 75 |.#includ|e <sys/u|
|00001590| 74 73 6e 61 6d 65 2e 68 | 3e 09 2f 2a 20 23 69 6e |tsname.h|>./* #in|
|000015a0| 63 6c 75 64 65 20 66 6f | 72 20 75 6e 61 6d 65 28 |clude fo|r uname(|
|000015b0| 29 20 63 61 6c 6c 20 2a | 2f 0a 23 69 6e 63 6c 75 |) call *|/.#inclu|
|000015c0| 64 65 20 3c 73 74 72 69 | 6e 67 2e 68 3e 09 09 2f |de <stri|ng.h>../|
|000015d0| 2a 20 53 74 72 69 6e 67 | 20 72 6f 75 74 69 6e 65 |* String| routine|
|000015e0| 73 20 73 74 72 63 70 79 | 28 29 20 2a 2f 0a 0a 69 |s strcpy|() */..i|
|000015f0| 6e 74 20 67 65 74 68 6f | 73 74 6e 61 6d 65 28 68 |nt getho|stname(h|
|00001600| 6f 73 74 6e 61 6d 65 2c | 20 73 6f 6d 65 6e 75 6d |ostname,| somenum|
|00001610| 62 65 72 29 0a 0a 63 68 | 61 72 09 2a 68 6f 73 74 |ber)..ch|ar.*host|
|00001620| 6e 61 6d 65 5b 5d 3b 09 | 09 2f 2a 20 57 68 65 72 |name[];.|./* Wher|
|00001630| 65 20 74 68 65 20 68 6f | 73 74 6e 61 6d 65 20 77 |e the ho|stname w|
|00001640| 69 6c 6c 20 62 65 20 72 | 65 74 75 72 6e 65 64 20 |ill be r|eturned |
|00001650| 2a 2f 0a 69 6e 74 09 73 | 6f 6d 65 6e 75 6d 62 65 |*/.int.s|omenumbe|
|00001660| 72 3b 09 09 2f 2a 20 48 | 61 76 65 6e 27 74 20 66 |r;../* H|aven't f|
|00001670| 69 67 75 72 65 64 20 6f | 75 74 20 77 68 61 74 20 |igured o|ut what |
|00001680| 74 68 69 73 20 69 73 20 | 2a 2f 0a 0a 7b 0a 09 73 |this is |*/..{..s|
|00001690| 74 72 75 63 74 20 75 74 | 73 6e 61 6d 65 20 6e 61 |truct ut|sname na|
|000016a0| 6d 65 3b 09 2f 2a 20 75 | 6e 61 6d 65 20 72 65 74 |me;./* u|name ret|
|000016b0| 75 72 6e 73 20 74 68 65 | 20 73 79 73 6e 61 6d 65 |urns the| sysname|
|000016c0| 20 68 65 72 65 20 2a 2f | 0a 2f 2a 20 68 61 64 20 | here */|./* had |
|000016d0| 61 6e 20 61 73 74 65 72 | 69 73 6b 20 2a 2f 0a 09 |an aster|isk */..|
|000016e0| 69 66 20 28 28 75 6e 61 | 6d 65 28 26 6e 61 6d 65 |if ((una|me(&name|
|000016f0| 29 29 20 3d 3d 20 2d 31 | 29 09 2f 2a 20 64 69 64 |)) == -1|)./* did|
|00001700| 20 69 74 20 66 61 69 6c | 3f 20 2a 2f 0a 09 09 72 | it fail|? */...r|
|00001710| 65 74 75 72 6e 20 2d 31 | 3b 09 09 2f 2a 20 66 61 |eturn -1|;../* fa|
|00001720| 69 6c 65 64 2c 20 73 6f | 20 72 65 74 75 72 6e 20 |iled, so| return |
|00001730| 61 20 66 61 69 6c 75 72 | 65 20 2a 2f 0a 09 65 6c |a failur|e */..el|
|00001740| 73 65 20 7b 0a 09 09 73 | 74 72 63 70 79 28 68 6f |se {...s|trcpy(ho|
|00001750| 73 74 6e 61 6d 65 2c 20 | 6e 61 6d 65 2e 6e 6f 64 |stname, |name.nod|
|00001760| 65 6e 61 6d 65 29 3b 0a | 09 09 09 09 09 2f 2a 20 |ename);.|...../* |
|00001770| 72 65 74 75 72 6e 20 74 | 68 65 20 6e 6f 64 65 6e |return t|he noden|
|00001780| 61 6d 65 20 2a 2f 0a 09 | 09 72 65 74 75 72 6e 20 |ame */..|.return |
|00001790| 31 3b 20 20 7d 09 09 2f | 2a 20 73 75 63 63 65 73 |1; }../|* succes|
|000017a0| 73 66 75 6c 6c 20 63 6f | 6d 70 6c 65 74 69 6f 6e |sfull co|mpletion|
|000017b0| 20 2a 2f 0a 0a 09 72 65 | 74 75 72 6e 20 2d 31 3b | */...re|turn -1;|
|000017c0| 09 09 2f 2a 20 73 6f 6d | 65 74 68 69 6e 67 20 6d |../* som|ething m|
|000017d0| 75 73 74 20 62 65 20 77 | 72 6f 6e 67 2e 2e 2e 20 |ust be w|rong... |
|000017e0| 65 78 69 74 20 2a 2f 0a | 7d 0a 53 48 41 52 5f 45 |exit */.|}.SHAR_E|
|000017f0| 4f 46 0a 69 66 20 74 65 | 73 74 20 37 36 39 20 2d |OF.if te|st 769 -|
|00001800| 6e 65 20 22 60 77 63 20 | 2d 63 20 3c 20 27 67 65 |ne "`wc |-c < 'ge|
|00001810| 74 68 6f 73 74 6e 61 6d | 65 2e 63 27 60 22 0a 74 |thostnam|e.c'`".t|
|00001820| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00001830| 65 72 72 6f 72 20 74 72 | 61 6e 73 6d 69 74 74 69 |error tr|ansmitti|
|00001840| 6e 67 20 22 27 67 65 74 | 68 6f 73 74 6e 61 6d 65 |ng "'get|hostname|
|00001850| 2e 63 27 22 20 27 28 73 | 68 6f 75 6c 64 20 68 61 |.c'" '(s|hould ha|
|00001860| 76 65 20 62 65 65 6e 20 | 37 36 39 20 63 68 61 72 |ve been |769 char|
|00001870| 61 63 74 65 72 73 29 27 | 0a 66 69 0a 63 68 6d 6f |acters)'|.fi.chmo|
|00001880| 64 20 2b 78 20 27 67 65 | 74 68 6f 73 74 6e 61 6d |d +x 'ge|thostnam|
|00001890| 65 2e 63 27 0a 66 69 20 | 23 20 65 6e 64 20 6f 66 |e.c'.fi |# end of|
|000018a0| 20 6f 76 65 72 77 72 69 | 74 69 6e 67 20 63 68 65 | overwri|ting che|
|000018b0| 63 6b 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 65 78 |ck.echo |shar: ex|
|000018c0| 74 72 61 63 74 69 6e 67 | 20 22 27 6c 6f 63 6b 74 |tracting| "'lockt|
|000018d0| 74 79 2e 31 27 22 20 27 | 28 31 34 33 39 20 63 68 |ty.1'" '|(1439 ch|
|000018e0| 61 72 61 63 74 65 72 73 | 29 27 0a 69 66 20 74 65 |aracters|)'.if te|
|000018f0| 73 74 20 2d 66 20 27 6c | 6f 63 6b 74 74 79 2e 31 |st -f 'l|ocktty.1|
|00001900| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|00001910| 72 3a 20 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: will |not over|
|00001920| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|00001930| 66 69 6c 65 20 22 27 6c | 6f 63 6b 74 74 79 2e 31 |file "'l|ocktty.1|
|00001940| 27 22 0a 65 6c 73 65 0a | 63 61 74 20 3c 3c 20 5c |'".else.|cat << \|
|00001950| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 6c 6f 63 6b |SHAR_EOF| > 'lock|
|00001960| 74 74 79 2e 31 27 0a 2e | 54 48 20 4c 4f 43 4b 54 |tty.1'..|TH LOCKT|
|00001970| 54 59 20 31 4c 20 22 4c | 4f 43 4b 54 54 59 20 31 |TY 1L "L|OCKTTY 1|
|00001980| 2e 31 22 20 22 22 0a 2e | 53 48 20 4e 41 4d 45 0a |.1" ""..|SH NAME.|
|00001990| 6c 6f 63 6b 74 74 79 20 | 2d 20 6c 6f 63 6b 20 74 |locktty |- lock t|
|000019a0| 65 72 6d 69 6e 61 6c 0a | 2e 53 48 20 53 59 4e 4f |erminal.|.SH SYNO|
|000019b0| 50 53 49 53 0a 2e 42 20 | 6c 6f 63 6b 74 74 79 0a |PSIS..B |locktty.|
|000019c0| 5b 0a 2e 42 20 2d 70 0a | 5d 0a 2e 50 50 0a 2e 53 |[..B -p.|]..PP..S|
|000019d0| 48 20 44 45 53 43 52 49 | 50 54 49 4f 4e 0a 2e 49 |H DESCRI|PTION..I|
|000019e0| 20 4c 6f 63 6b 74 74 79 | 5c 5e 0a 70 75 74 73 20 | Locktty|\^.puts |
|000019f0| 74 68 65 20 74 65 72 6d | 69 6e 61 6c 20 69 6e 74 |the term|inal int|
|00001a00| 6f 20 72 61 77 20 6d 6f | 64 65 2c 20 63 6c 65 61 |o raw mo|de, clea|
|00001a10| 72 73 20 74 68 65 20 73 | 63 72 65 65 6e 2c 20 61 |rs the s|creen, a|
|00001a20| 6e 64 0a 70 72 6f 6d 70 | 74 73 20 74 68 65 20 75 |nd.promp|ts the u|
|00001a30| 73 65 72 20 66 6f 72 20 | 61 20 70 61 73 73 77 6f |ser for |a passwo|
|00001a40| 72 64 2e 20 45 6e 74 65 | 72 65 64 20 70 61 73 73 |rd. Ente|red pass|
|00001a50| 77 6f 72 64 73 20 61 72 | 65 20 63 72 79 70 74 65 |words ar|e crypte|
|00001a60| 64 20 61 6e 64 0a 63 68 | 65 63 6b 65 64 20 61 67 |d and.ch|ecked ag|
|00001a70| 61 69 6e 73 74 20 61 20 | 63 72 79 70 74 65 64 20 |ainst a |crypted |
|00001a80| 70 61 73 73 77 6f 72 64 | 20 69 6e 20 61 20 66 69 |password| in a fi|
|00001a90| 6c 65 20 69 6e 20 74 68 | 65 20 75 73 65 72 73 27 |le in th|e users'|
|00001aa0| 20 68 6f 6d 65 0a 64 69 | 72 65 63 74 6f 72 79 20 | home.di|rectory |
|00001ab0| 28 7e 2f 2e 6c 6f 63 6b | 70 61 73 73 77 64 29 2e |(~/.lock|passwd).|
|00001ac0| 20 49 66 20 74 68 65 20 | 63 6f 72 72 65 63 74 20 | If the |correct |
|00001ad0| 70 61 73 73 77 6f 72 64 | 20 69 73 20 67 69 76 65 |password| is give|
|00001ae0| 6e 2c 20 74 68 65 0a 74 | 65 72 6d 69 6e 61 6c 20 |n, the.t|erminal |
|00001af0| 69 73 20 73 65 74 20 69 | 6e 74 6f 20 6e 6f 72 6d |is set i|nto norm|
|00001b00| 61 6c 20 73 74 61 74 65 | 20 61 67 61 69 6e 2e 20 |al state| again. |
|00001b10| 49 66 20 6e 6f 74 2c 20 | 61 20 6d 65 73 73 61 67 |If not, |a messag|
|00001b20| 65 20 69 73 20 67 69 76 | 65 6e 2c 0a 61 6e 64 20 |e is giv|en,.and |
|00001b30| 61 66 74 65 72 20 73 6f | 6d 65 20 74 69 6d 65 20 |after so|me time |
|00001b40| 61 20 6e 65 77 20 70 61 | 73 73 77 6f 72 64 20 69 |a new pa|ssword i|
|00001b50| 73 20 72 65 61 64 2e 0a | 2e 50 50 0a 49 66 20 74 |s read..|.PP.If t|
|00001b60| 68 65 20 66 69 6c 65 20 | 7e 2f 2e 6c 6f 63 6b 70 |he file |~/.lockp|
|00001b70| 61 73 73 77 64 20 64 6f | 65 73 20 6e 6f 74 20 65 |asswd do|es not e|
|00001b80| 78 69 73 74 2c 20 74 68 | 65 20 75 73 65 72 20 69 |xist, th|e user i|
|00001b90| 73 20 70 72 6f 6d 70 74 | 65 64 20 66 6f 72 0a 61 |s prompt|ed for.a|
|00001ba0| 20 70 61 73 73 77 6f 72 | 64 20 74 77 69 63 65 20 | passwor|d twice |
|00001bb0| 62 65 66 6f 72 65 20 74 | 68 65 20 73 63 72 65 65 |before t|he scree|
|00001bc0| 6e 20 69 73 20 6c 6f 63 | 6b 65 64 2e 20 54 68 69 |n is loc|ked. Thi|
|00001bd0| 73 20 70 61 73 73 77 6f | 72 64 20 69 73 0a 63 72 |s passwo|rd is.cr|
|00001be0| 79 70 74 65 64 20 61 6e | 64 20 73 74 6f 72 65 64 |ypted an|d stored|
|00001bf0| 20 69 6e 20 7e 2f 2e 6c | 6f 63 6b 70 61 73 73 77 | in ~/.l|ockpassw|
|00001c00| 64 2e 0a 2e 50 50 0a 54 | 68 65 20 65 6e 63 72 79 |d...PP.T|he encry|
|00001c10| 70 74 65 64 20 70 61 73 | 73 77 6f 72 64 20 69 6e |pted pas|sword in|
|00001c20| 20 7e 2f 2e 6c 6f 63 6b | 70 61 73 73 77 64 20 63 | ~/.lock|passwd c|
|00001c30| 61 6e 20 62 65 20 63 68 | 61 6e 67 65 64 20 62 79 |an be ch|anged by|
|00001c40| 20 69 6e 76 6f 6b 69 6e | 67 0a 2e 49 20 6c 6f 63 | invokin|g..I loc|
|00001c50| 6b 74 74 79 20 0a 77 69 | 74 68 20 74 68 65 20 0a |ktty .wi|th the .|
|00001c60| 2e 42 20 2d 70 20 0a 6f | 70 74 69 6f 6e 2e 0a 2e |.B -p .o|ption...|
|00001c70| 53 48 20 4f 50 54 49 4f | 4e 53 0a 2e 54 50 0a 2e |SH OPTIO|NS..TP..|
|00001c80| 42 20 2d 70 0a 61 73 6b | 20 66 6f 72 20 6e 65 77 |B -p.ask| for new|
|00001c90| 20 70 61 73 73 77 6f 72 | 64 20 69 6e 20 7e 2f 2e | passwor|d in ~/.|
|00001ca0| 6c 6f 63 6b 70 61 73 73 | 77 64 0a 2e 53 48 20 44 |lockpass|wd..SH D|
|00001cb0| 49 41 47 4e 4f 53 54 49 | 43 53 0a 2e 54 50 0a 7e |IAGNOSTI|CS..TP.~|
|00001cc0| 2f 2e 6c 6f 63 6b 70 61 | 73 73 77 64 20 69 6e 20 |/.lockpa|sswd in |
|00001cd0| 77 72 6f 6e 67 20 66 6f | 72 6d 61 74 0a 7e 2f 2e |wrong fo|rmat.~/.|
|00001ce0| 6c 6f 63 6b 70 61 73 73 | 77 64 20 64 6f 65 73 20 |lockpass|wd does |
|00001cf0| 6e 6f 74 20 61 70 70 65 | 61 72 20 74 6f 20 62 65 |not appe|ar to be|
|00001d00| 20 61 20 76 61 6c 69 64 | 20 70 61 73 73 77 6f 72 | a valid| passwor|
|00001d10| 64 20 63 72 79 70 74 2e | 0a 2e 53 48 20 46 49 4c |d crypt.|..SH FIL|
|00001d20| 45 53 0a 24 48 4f 4d 45 | 2f 2e 6c 6f 63 6b 70 61 |ES.$HOME|/.lockpa|
|00001d30| 73 73 77 64 20 20 20 20 | 20 20 20 20 20 20 20 20 |sswd | |
|00001d40| 20 65 6e 63 72 79 70 74 | 65 64 20 70 61 73 73 77 | encrypt|ed passw|
|00001d50| 6f 72 64 0a 2e 53 48 20 | 42 55 47 53 0a 49 20 68 |ord..SH |BUGS.I h|
|00001d60| 61 76 65 6e 27 74 20 66 | 6f 75 6e 64 20 61 20 70 |aven't f|ound a p|
|00001d70| 6f 72 74 61 62 6c 65 20 | 77 61 79 20 74 6f 20 66 |ortable |way to f|
|00001d80| 6c 75 73 68 20 69 6e 70 | 75 74 20 62 65 66 6f 72 |lush inp|ut befor|
|00001d90| 65 20 72 65 61 64 69 6e | 67 20 61 20 6e 65 77 0a |e readin|g a new.|
|00001da0| 70 61 73 73 77 6f 72 64 | 2e 0a 2e 62 72 0a 54 68 |password|...br.Th|
|00001db0| 65 20 65 78 65 63 75 74 | 61 62 6c 65 20 69 73 20 |e execut|able is |
|00001dc0| 68 75 67 65 20 63 6f 6d | 70 61 72 65 64 20 74 6f |huge com|pared to|
|00001dd0| 20 74 68 65 20 73 6f 75 | 72 63 65 2e 0a 2e 62 72 | the sou|rce...br|
|00001de0| 0a 2e 49 20 4c 6f 63 6b | 74 74 79 0a 70 72 65 74 |..I Lock|tty.pret|
|00001df0| 65 6e 64 73 20 74 6f 20 | 63 68 65 63 6b 20 74 68 |ends to |check th|
|00001e00| 65 20 76 61 6c 69 64 69 | 74 79 20 6f 66 20 7e 2f |e validi|ty of ~/|
|00001e10| 2e 6c 6f 63 6b 70 61 73 | 73 77 64 2c 20 62 75 74 |.lockpas|swd, but|
|00001e20| 20 63 68 65 63 6b 73 20 | 6f 6e 6c 79 20 74 68 65 | checks |only the|
|00001e30| 0a 6c 65 6e 67 74 68 20 | 61 6e 64 20 74 68 65 20 |.length |and the |
|00001e40| 63 68 61 72 61 63 74 65 | 72 20 73 65 74 2e 0a 2e |characte|r set...|
|00001e50| 62 72 0a 4f 6e 6c 79 20 | 74 68 65 20 66 69 72 73 |br.Only |the firs|
|00001e60| 74 20 38 20 63 68 61 72 | 61 63 74 65 72 73 20 6f |t 8 char|acters o|
|00001e70| 66 20 74 68 65 20 70 61 | 73 73 77 6f 72 64 20 61 |f the pa|ssword a|
|00001e80| 72 65 20 73 69 67 6e 69 | 66 69 63 61 6e 74 2e 0a |re signi|ficant..|
|00001e90| 2e 53 48 20 41 55 54 48 | 4f 52 0a 4a 75 65 72 67 |.SH AUTH|OR.Juerg|
|00001ea0| 65 6e 20 4e 69 63 6b 65 | 6c 73 65 6e 2c 20 54 65 |en Nicke|lsen, Te|
|00001eb0| 63 68 6e 69 73 63 68 65 | 20 55 6e 69 76 65 72 73 |chnische| Univers|
|00001ec0| 69 74 61 65 74 20 42 65 | 72 6c 69 6e 2c 20 47 65 |itaet Be|rlin, Ge|
|00001ed0| 72 6d 61 6e 79 0a 2e 62 | 72 0a 6e 69 63 6b 65 6c |rmany..b|r.nickel|
|00001ee0| 40 63 73 2e 74 75 2d 62 | 65 72 6c 69 6e 2e 64 65 |@cs.tu-b|erlin.de|
|00001ef0| 0a 2e 53 48 20 43 4f 50 | 59 52 49 47 48 54 53 0a |..SH COP|YRIGHTS.|
|00001f00| 4e 6f 6e 65 2e 0a 53 48 | 41 52 5f 45 4f 46 0a 69 |None..SH|AR_EOF.i|
|00001f10| 66 20 74 65 73 74 20 31 | 34 33 39 20 2d 6e 65 20 |f test 1|439 -ne |
|00001f20| 22 60 77 63 20 2d 63 20 | 3c 20 27 6c 6f 63 6b 74 |"`wc -c |< 'lockt|
|00001f30| 74 79 2e 31 27 60 22 0a | 74 68 65 6e 0a 09 65 63 |ty.1'`".|then..ec|
|00001f40| 68 6f 20 73 68 61 72 3a | 20 65 72 72 6f 72 20 74 |ho shar:| error t|
|00001f50| 72 61 6e 73 6d 69 74 74 | 69 6e 67 20 22 27 6c 6f |ransmitt|ing "'lo|
|00001f60| 63 6b 74 74 79 2e 31 27 | 22 20 27 28 73 68 6f 75 |cktty.1'|" '(shou|
|00001f70| 6c 64 20 68 61 76 65 20 | 62 65 65 6e 20 31 34 33 |ld have |been 143|
|00001f80| 39 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 66 |9 charac|ters)'.f|
|00001f90| 69 0a 63 68 6d 6f 64 20 | 2b 78 20 27 6c 6f 63 6b |i.chmod |+x 'lock|
|00001fa0| 74 74 79 2e 31 27 0a 66 | 69 20 23 20 65 6e 64 20 |tty.1'.f|i # end |
|00001fb0| 6f 66 20 6f 76 65 72 77 | 72 69 74 69 6e 67 20 63 |of overw|riting c|
|00001fc0| 68 65 63 6b 0a 65 63 68 | 6f 20 73 68 61 72 3a 20 |heck.ech|o shar: |
|00001fd0| 65 78 74 72 61 63 74 69 | 6e 67 20 22 27 6c 6f 63 |extracti|ng "'loc|
|00001fe0| 6b 74 74 79 2e 63 27 22 | 20 27 28 37 30 32 37 20 |ktty.c'"| '(7027 |
|00001ff0| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|00002000| 74 65 73 74 20 2d 66 20 | 27 6c 6f 63 6b 74 74 79 |test -f |'locktty|
|00002010| 2e 63 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |.c'.then|..echo s|
|00002020| 68 61 72 3a 20 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |har: wil|l not ov|
|00002030| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|00002040| 67 20 66 69 6c 65 20 22 | 27 6c 6f 63 6b 74 74 79 |g file "|'locktty|
|00002050| 2e 63 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |.c'".els|e.cat <<|
|00002060| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 6c 6f | \SHAR_E|OF > 'lo|
|00002070| 63 6b 74 74 79 2e 63 27 | 0a 2f 2a 20 6c 6f 63 6b |cktty.c'|./* lock|
|00002080| 74 74 79 20 2d 20 6c 6f | 63 6b 20 74 65 72 6d 69 |tty - lo|ck termi|
|00002090| 6e 61 6c 20 0a 20 2a 20 | 76 65 72 73 69 6f 6e 20 |nal . * |version |
|000020a0| 31 2e 31 20 70 61 74 63 | 68 6c 65 76 65 6c 20 31 |1.1 patc|hlevel 1|
|000020b0| 0a 20 2a 0a 20 2a 20 63 | 6f 6d 70 69 6c 65 20 77 |. *. * c|ompile w|
|000020c0| 69 74 68 20 63 63 20 2d | 6f 20 6c 6f 63 6b 74 74 |ith cc -|o locktt|
|000020d0| 79 20 6c 6f 63 6b 74 74 | 79 2e 63 20 2d 6c 63 75 |y locktt|y.c -lcu|
|000020e0| 72 73 65 73 20 2d 6c 74 | 65 72 6d 63 61 70 0a 20 |rses -lt|ermcap. |
|000020f0| 2a 20 55 73 61 67 65 3a | 20 6c 6f 63 6b 74 74 79 |* Usage:| locktty|
|00002100| 20 5b 20 2d 70 20 5d 0a | 20 2a 0a 20 2a 20 6c 6f | [ -p ].| *. * lo|
|00002110| 63 6b 74 74 79 20 70 75 | 74 73 20 74 68 65 20 74 |cktty pu|ts the t|
|00002120| 65 72 6d 69 6e 61 6c 20 | 69 6e 74 6f 20 72 61 77 |erminal |into raw|
|00002130| 20 6d 6f 64 65 2c 20 63 | 6c 65 61 72 73 20 74 68 | mode, c|lears th|
|00002140| 65 20 73 63 72 65 65 6e | 2c 20 61 6e 64 0a 20 2a |e screen|, and. *|
|00002150| 20 70 72 6f 6d 70 74 73 | 20 74 68 65 20 75 73 65 | prompts| the use|
|00002160| 72 20 66 6f 72 20 61 20 | 70 61 73 73 77 6f 72 64 |r for a |password|
|00002170| 2e 20 45 6e 74 65 72 65 | 64 20 70 61 73 73 77 6f |. Entere|d passwo|
|00002180| 72 64 73 20 61 72 65 20 | 63 72 79 70 74 65 64 20 |rds are |crypted |
|00002190| 61 6e 64 0a 20 2a 20 63 | 68 65 63 6b 65 64 20 61 |and. * c|hecked a|
|000021a0| 67 61 69 6e 73 74 20 61 | 20 63 72 79 70 74 65 64 |gainst a| crypted|
|000021b0| 20 70 61 73 73 77 6f 72 | 64 20 69 6e 20 61 20 66 | passwor|d in a f|
|000021c0| 69 6c 65 20 69 6e 20 74 | 68 65 20 75 73 65 72 73 |ile in t|he users|
|000021d0| 27 20 68 6f 6d 65 0a 20 | 2a 20 64 69 72 65 63 74 |' home. |* direct|
|000021e0| 6f 72 79 20 28 7e 2f 2e | 6c 6f 63 6b 70 61 73 73 |ory (~/.|lockpass|
|000021f0| 77 64 29 2e 20 49 66 20 | 74 68 65 20 63 6f 72 72 |wd). If |the corr|
|00002200| 65 63 74 20 70 61 73 73 | 77 6f 72 64 20 69 73 20 |ect pass|word is |
|00002210| 67 69 76 65 6e 2c 20 74 | 68 65 0a 20 2a 20 74 65 |given, t|he. * te|
|00002220| 72 6d 69 6e 61 6c 20 69 | 73 20 73 65 74 20 69 6e |rminal i|s set in|
|00002230| 74 6f 20 6e 6f 72 6d 61 | 6c 20 73 74 61 74 65 20 |to norma|l state |
|00002240| 61 67 61 69 6e 2e 20 49 | 66 20 6e 6f 74 2c 20 61 |again. I|f not, a|
|00002250| 20 6d 65 73 73 67 61 65 | 20 69 73 0a 20 2a 20 67 | messgae| is. * g|
|00002260| 69 76 65 6e 2c 20 61 6e | 64 20 61 66 74 65 72 20 |iven, an|d after |
|00002270| 73 6f 6d 65 20 74 69 6d | 65 20 61 20 6e 65 77 20 |some tim|e a new |
|00002280| 70 61 73 73 77 6f 72 64 | 20 69 73 20 72 65 61 64 |password| is read|
|00002290| 2e 0a 20 2a 20 49 66 20 | 74 68 65 20 66 69 6c 65 |.. * If |the file|
|000022a0| 20 7e 2f 2e 6c 6f 63 6b | 70 61 73 73 77 64 20 64 | ~/.lock|passwd d|
|000022b0| 6f 65 73 20 6e 6f 74 20 | 65 78 69 73 74 2c 20 74 |oes not |exist, t|
|000022c0| 68 65 20 75 73 65 72 20 | 69 73 20 70 72 6f 6d 70 |he user |is promp|
|000022d0| 74 65 64 20 66 6f 72 0a | 20 2a 20 61 20 70 61 73 |ted for.| * a pas|
|000022e0| 73 77 6f 72 64 20 74 77 | 69 63 65 20 62 65 66 6f |sword tw|ice befo|
|000022f0| 72 65 20 74 68 65 20 73 | 63 72 65 65 6e 20 69 73 |re the s|creen is|
|00002300| 20 6c 6f 63 6b 65 64 2e | 20 54 68 69 73 20 70 61 | locked.| This pa|
|00002310| 73 73 77 6f 72 64 20 69 | 73 0a 20 2a 20 63 72 79 |ssword i|s. * cry|
|00002320| 70 74 65 64 20 61 6e 64 | 20 73 74 6f 72 65 64 20 |pted and| stored |
|00002330| 69 6e 20 7e 2f 2e 6c 6f | 63 6b 70 61 73 73 77 64 |in ~/.lo|ckpasswd|
|00002340| 2e 0a 20 2a 20 54 68 65 | 20 65 6e 63 72 79 70 74 |.. * The| encrypt|
|00002350| 65 64 20 70 61 73 73 77 | 6f 72 64 20 69 6e 20 7e |ed passw|ord in ~|
|00002360| 2f 2e 6c 6f 63 6b 70 61 | 73 73 77 64 20 63 61 6e |/.lockpa|sswd can|
|00002370| 20 62 65 20 63 68 61 6e | 67 65 64 20 62 79 20 69 | be chan|ged by i|
|00002380| 6e 76 6f 6b 69 6e 67 0a | 20 2a 20 6c 6f 63 6b 74 |nvoking.| * lockt|
|00002390| 74 79 20 77 69 74 68 20 | 74 68 65 20 2d 70 20 6f |ty with |the -p o|
|000023a0| 70 74 69 6f 6e 2e 0a 20 | 2a 0a 20 2a 20 50 6c 65 |ption.. |*. * Ple|
|000023b0| 61 73 65 20 73 65 6e 64 | 20 63 6f 72 72 65 63 74 |ase send| correct|
|000023c0| 69 6f 6e 73 2c 20 69 6d | 70 72 6f 76 65 6d 65 6e |ions, im|provemen|
|000023d0| 74 73 2c 20 61 6e 64 20 | 66 6c 61 6d 65 73 20 74 |ts, and |flames t|
|000023e0| 6f 0a 20 2a 09 6e 69 63 | 6b 65 6c 40 63 73 2e 74 |o. *.nic|kel@cs.t|
|000023f0| 75 2d 62 65 72 6c 69 6e | 2e 64 65 20 28 4a 75 65 |u-berlin|.de (Jue|
|00002400| 72 67 65 6e 20 4e 69 63 | 6b 65 6c 73 65 6e 29 0a |rgen Nic|kelsen).|
|00002410| 20 2a 2f 0a 0a 23 69 6e | 63 6c 75 64 65 20 3c 63 | */..#in|clude <c|
|00002420| 75 72 73 65 73 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |urses.h>|.#includ|
|00002430| 65 20 3c 73 69 67 6e 61 | 6c 2e 68 3e 0a 23 69 6e |e <signa|l.h>.#in|
|00002440| 63 6c 75 64 65 20 3c 73 | 74 64 69 6f 2e 68 3e 0a |clude <s|tdio.h>.|
|00002450| 23 69 6e 63 6c 75 64 65 | 20 3c 65 72 72 6e 6f 2e |#include| <errno.|
|00002460| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 66 63 6e |h>.#incl|ude <fcn|
|00002470| 74 6c 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |tl.h>.#i|nclude <|
|00002480| 73 74 72 69 6e 67 2e 68 | 3e 0a 23 69 6e 63 6c 75 |string.h|>.#inclu|
|00002490| 64 65 20 3c 70 77 64 2e | 68 3e 0a 0a 23 64 65 66 |de <pwd.|h>..#def|
|000024a0| 69 6e 65 20 74 72 75 65 | 09 31 0a 23 64 65 66 69 |ine true|.1.#defi|
|000024b0| 6e 65 20 66 61 6c 73 65 | 09 30 0a 0a 23 64 65 66 |ne false|.0..#def|
|000024c0| 69 6e 65 20 53 49 5a 45 | 09 31 30 32 34 09 09 2f |ine SIZE|.1024../|
|000024d0| 2a 20 6d 61 78 69 6d 75 | 6d 20 73 69 7a 65 20 66 |* maximu|m size f|
|000024e0| 6f 72 20 70 61 73 73 77 | 6f 72 64 20 2a 2f 0a 23 |or passw|ord */.#|
|000024f0| 64 65 66 69 6e 65 20 50 | 46 49 4c 45 09 22 2e 6c |define P|FILE.".l|
|00002500| 6f 63 6b 70 61 73 73 77 | 64 22 09 2f 2a 20 6e 61 |ockpassw|d"./* na|
|00002510| 6d 65 20 6f 66 20 70 61 | 73 73 77 6f 72 64 20 66 |me of pa|ssword f|
|00002520| 69 6c 65 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 4d |ile */.#|define M|
|00002530| 41 58 50 41 54 48 4c 45 | 4e 09 34 30 39 36 09 2f |AXPATHLE|N.4096./|
|00002540| 2a 20 74 68 69 73 20 73 | 68 6f 75 6c 64 20 65 78 |* this s|hould ex|
|00002550| 63 65 65 64 20 74 68 65 | 20 72 65 61 6c 20 76 61 |ceed the| real va|
|00002560| 6c 75 65 0a 09 09 09 09 | 20 2a 20 6f 6e 20 6e 65 |lue.....| * on ne|
|00002570| 61 72 6c 79 20 61 6c 6c | 20 6d 61 63 68 69 6e 65 |arly all| machine|
|00002580| 73 20 2a 2f 0a 23 64 65 | 66 69 6e 65 20 43 4c 45 |s */.#de|fine CLE|
|00002590| 4e 09 31 34 09 09 2f 2a | 20 65 6e 6f 75 67 68 20 |N.14../*| enough |
|000025a0| 66 6f 72 20 74 68 65 20 | 63 72 79 70 74 65 64 20 |for the |crypted |
|000025b0| 70 77 64 27 73 20 2a 2f | 0a 23 64 65 66 69 6e 65 |pwd's */|.#define|
|000025c0| 20 53 41 4c 54 43 09 5c | 0a 09 22 61 62 63 64 65 | SALTC.\|.."abcde|
|000025d0| 66 67 68 69 6a 6b 6c 6d | 6e 6f 70 71 72 73 74 75 |fghijklm|nopqrstu|
|000025e0| 76 77 78 79 7a 41 42 43 | 44 45 46 47 48 49 4a 4b |vwxyzABC|DEFGHIJK|
|000025f0| 4c 4d 4e 4f 50 51 52 53 | 54 55 56 57 58 59 5a 30 |LMNOPQRS|TUVWXYZ0|
|00002600| 31 32 33 34 35 36 37 38 | 39 2e 2f 22 0a 09 09 09 |12345678|9./"....|
|00002610| 09 2f 2a 20 63 68 61 72 | 61 63 74 65 72 73 20 74 |./* char|acters t|
|00002620| 68 61 74 20 6d 61 79 20 | 61 70 70 65 61 72 20 69 |hat may |appear i|
|00002630| 6e 20 74 68 65 20 73 61 | 6c 74 20 2a 2f 0a 0a 69 |n the sa|lt */..i|
|00002640| 6e 74 20 0a 20 20 20 20 | 75 69 64 2c 09 09 09 2f |nt . |uid,.../|
|00002650| 2a 20 75 73 65 72 69 64 | 20 2a 2f 0a 20 20 20 20 |* userid| */. |
|00002660| 66 61 69 6c 5f 63 6f 75 | 6e 74 20 3d 20 2d 31 3b |fail_cou|nt = -1;|
|00002670| 09 09 2f 2a 20 6e 75 6d | 62 65 72 20 6f 66 20 66 |../* num|ber of f|
|00002680| 61 69 6c 65 64 20 75 6e | 6c 6f 63 6b 20 61 74 74 |ailed un|lock att|
|00002690| 65 6d 70 74 73 20 2a 2f | 0a 0a 73 74 72 75 63 74 |empts */|..struct|
|000026a0| 20 70 61 73 73 77 64 20 | 0a 20 20 20 20 2a 70 77 | passwd |. *pw|
|000026b0| 5f 65 6e 74 72 79 3b 09 | 09 09 2f 2a 20 70 61 73 |_entry;.|../* pas|
|000026c0| 73 77 64 20 66 69 6c 65 | 20 65 6e 74 72 79 20 2a |swd file| entry *|
|000026d0| 2f 0a 0a 63 68 61 72 0a | 20 20 20 20 2a 70 72 6f |/..char.| *pro|
|000026e0| 67 6e 61 6d 65 2c 09 09 | 09 2f 2a 20 74 68 65 20 |gname,..|./* the |
|000026f0| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 67 61 6d 65 |name of |the game|
|00002700| 20 2a 2f 0a 20 20 20 20 | 6e 65 77 63 5b 43 4c 45 | */. |newc[CLE|
|00002710| 4e 20 2b 20 31 5d 2c 09 | 09 2f 2a 20 65 6e 74 65 |N + 1],.|./* ente|
|00002720| 72 65 64 20 70 77 64 20 | 28 63 72 79 70 74 65 64 |red pwd |(crypted|
|00002730| 29 20 2a 2f 0a 20 20 20 | 20 6f 6c 64 63 5b 43 4c |) */. | oldc[CL|
|00002740| 45 4e 20 2b 20 31 5d 2c | 09 09 2f 2a 20 6f 6c 64 |EN + 1],|../* old|
|00002750| 20 70 77 64 20 28 63 72 | 79 70 74 65 64 29 20 2a | pwd (cr|ypted) *|
|00002760| 2f 0a 20 20 20 20 70 66 | 69 6c 6e 61 6d 5b 4d 41 |/. pf|ilnam[MA|
|00002770| 58 50 41 54 48 4c 45 4e | 5d 2c 09 2f 2a 20 6e 61 |XPATHLEN|],./* na|
|00002780| 6d 65 20 6f 66 20 70 61 | 73 73 77 6f 72 64 20 66 |me of pa|ssword f|
|00002790| 69 6c 65 20 2a 2f 0a 20 | 20 20 20 68 6f 73 74 6e |ile */. | hostn|
|000027a0| 61 6d 65 5b 32 30 5d 2c | 09 09 2f 2a 20 68 6f 73 |ame[20],|../* hos|
|000027b0| 74 6e 61 6d 65 20 2a 2f | 0a 20 20 20 20 70 72 6f |tname */|. pro|
|000027c0| 6d 70 74 5b 34 30 5d 20 | 3b 09 09 2f 2a 20 75 6e |mpt[40] |;../* un|
|000027d0| 6c 6f 63 6b 20 70 72 6f | 6d 70 74 20 2a 2f 0a 0a |lock pro|mpt */..|
|000027e0| 65 78 74 65 72 6e 20 69 | 6e 74 20 65 72 72 6e 6f |extern i|nt errno|
|000027f0| 20 3b 0a 65 78 74 65 72 | 6e 20 63 68 61 72 20 2a | ;.exter|n char *|
|00002800| 67 65 74 65 6e 76 28 29 | 2c 20 2a 63 72 79 70 74 |getenv()|, *crypt|
|00002810| 28 29 20 3b 0a 0a 0a 6d | 61 69 6e 28 61 72 67 63 |() ;...m|ain(argc|
|00002820| 2c 20 61 72 67 76 29 0a | 69 6e 74 20 61 72 67 63 |, argv).|int argc|
|00002830| 20 3b 0a 63 68 61 72 20 | 2a 2a 61 72 67 76 20 3b | ;.char |**argv ;|
|00002840| 0a 7b 0a 20 20 20 20 63 | 68 61 72 20 0a 09 74 6d |.{. c|har ..tm|
|00002850| 70 6c 5b 53 49 5a 45 2b | 31 5d 2c 09 09 2f 2a 20 |pl[SIZE+|1],../* |
|00002860| 73 70 61 63 65 20 66 6f | 72 20 72 65 61 64 69 6e |space fo|r readin|
|00002870| 67 20 66 72 6f 6d 20 74 | 65 72 6d 69 6e 61 6c 20 |g from t|erminal |
|00002880| 2a 2f 0a 09 2a 73 6c 70 | 20 3b 09 09 09 2f 2a 20 |*/..*slp| ;.../* |
|00002890| 70 6f 69 6e 74 65 72 20 | 74 6f 20 73 6c 61 73 68 |pointer |to slash|
|000028a0| 20 69 6e 20 70 72 6f 67 | 6e 61 6d 65 20 2a 2f 0a | in prog|name */.|
|000028b0| 20 20 20 20 69 6e 74 20 | 70 77 64 66 69 6c 65 20 | int |pwdfile |
|000028c0| 3b 09 09 2f 2a 20 72 65 | 61 64 20 68 61 6e 64 6c |;../* re|ad handl|
|000028d0| 65 20 66 6f 72 20 70 61 | 73 73 77 6f 72 64 20 66 |e for pa|ssword f|
|000028e0| 69 6c 65 20 2a 2f 0a 0a | 20 20 20 20 2f 2a 20 64 |ile */..| /* d|
|000028f0| 65 74 65 72 6d 69 6e 65 | 20 6e 61 6d 65 20 6f 66 |etermine| name of|
|00002900| 20 70 72 6f 67 72 61 6d | 20 2a 2f 0a 20 20 20 20 | program| */. |
|00002910| 70 72 6f 67 6e 61 6d 65 | 20 3d 20 2a 61 72 67 76 |progname| = *argv|
|00002920| 20 3b 0a 20 20 20 20 69 | 66 20 28 73 6c 70 20 3d | ;. i|f (slp =|
|00002930| 20 73 74 72 72 63 68 72 | 28 70 72 6f 67 6e 61 6d | strrchr|(prognam|
|00002940| 65 2c 20 27 2f 27 29 29 | 20 7b 0a 09 70 72 6f 67 |e, '/'))| {..prog|
|00002950| 6e 61 6d 65 20 3d 20 73 | 6c 70 20 2b 20 31 20 3b |name = s|lp + 1 ;|
|00002960| 0a 20 20 20 20 7d 0a 0a | 20 20 20 20 2f 2a 20 67 |. }..| /* g|
|00002970| 65 74 20 68 6f 73 74 20 | 61 6e 64 20 75 73 65 72 |et host |and user|
|00002980| 20 6e 61 6d 65 73 20 2a | 2f 0a 0a 20 20 20 20 69 | names *|/.. i|
|00002990| 66 20 28 67 65 74 68 6f | 73 74 6e 61 6d 65 28 68 |f (getho|stname(h|
|000029a0| 6f 73 74 6e 61 6d 65 2c | 20 31 39 29 20 3d 3d 20 |ostname,| 19) == |
|000029b0| 2d 31 29 20 7b 0a 09 68 | 6f 73 74 6e 61 6d 65 5b |-1) {..h|ostname[|
|000029c0| 30 5d 20 3d 20 27 5c 30 | 27 20 3b 0a 20 20 20 20 |0] = '\0|' ;. |
|000029d0| 7d 0a 20 20 20 20 75 69 | 64 20 3d 20 67 65 74 75 |}. ui|d = getu|
|000029e0| 69 64 28 29 20 3b 0a 20 | 20 20 20 70 77 5f 65 6e |id() ;. | pw_en|
|000029f0| 74 72 79 20 3d 20 67 65 | 74 70 77 75 69 64 28 75 |try = ge|tpwuid(u|
|00002a00| 69 64 29 20 3b 0a 0a 20 | 20 20 20 2f 2a 20 6e 6f |id) ;.. | /* no|
|00002a10| 74 65 20 74 68 61 74 20 | 70 77 5f 65 6e 74 72 79 |te that |pw_entry|
|00002a20| 2d 3e 70 77 5f 64 69 72 | 20 69 73 20 74 68 65 20 |->pw_dir| is the |
|00002a30| 75 73 65 72 27 73 20 68 | 6f 6d 65 20 64 69 72 20 |user's h|ome dir |
|00002a40| 2a 2f 0a 20 20 20 20 69 | 66 20 28 70 77 5f 65 6e |*/. i|f (pw_en|
|00002a50| 74 72 79 20 21 3d 20 4e | 55 4c 4c 29 20 7b 0a 09 |try != N|ULL) {..|
|00002a60| 69 66 20 28 68 6f 73 74 | 6e 61 6d 65 5b 30 5d 20 |if (host|name[0] |
|00002a70| 21 3d 20 27 5c 30 27 29 | 20 7b 0a 09 20 20 20 20 |!= '\0')| {.. |
|00002a80| 73 70 72 69 6e 74 66 28 | 70 72 6f 6d 70 74 2c 20 |sprintf(|prompt, |
|00002a90| 22 55 6e 6c 6f 63 6b 20 | 25 73 40 25 73 3a 20 22 |"Unlock |%s@%s: "|
|00002aa0| 2c 20 70 77 5f 65 6e 74 | 72 79 2d 3e 70 77 5f 6e |, pw_ent|ry->pw_n|
|00002ab0| 61 6d 65 2c 20 68 6f 73 | 74 6e 61 6d 65 29 20 3b |ame, hos|tname) ;|
|00002ac0| 0a 09 7d 20 65 6c 73 65 | 20 7b 0a 09 20 20 20 20 |..} else| {.. |
|00002ad0| 73 70 72 69 6e 74 66 28 | 70 72 6f 6d 70 74 2c 20 |sprintf(|prompt, |
|00002ae0| 22 55 6e 6c 6f 63 6b 20 | 75 73 65 72 20 25 73 3a |"Unlock |user %s:|
|00002af0| 20 22 2c 20 70 77 5f 65 | 6e 74 72 79 2d 3e 70 77 | ", pw_e|ntry->pw|
|00002b00| 5f 6e 61 6d 65 29 20 3b | 0a 09 7d 0a 20 20 20 20 |_name) ;|..}. |
|00002b10| 7d 20 65 6c 73 65 20 69 | 66 20 28 68 6f 73 74 6e |} else i|f (hostn|
|00002b20| 61 6d 65 5b 30 5d 20 21 | 3d 20 27 5c 30 27 29 20 |ame[0] !|= '\0') |
|00002b30| 7b 0a 09 73 70 72 69 6e | 74 66 28 70 72 6f 6d 70 |{..sprin|tf(promp|
|00002b40| 74 2c 20 22 55 6e 6c 6f | 63 6b 20 68 6f 73 74 20 |t, "Unlo|ck host |
|00002b50| 25 73 20 22 2c 20 68 6f | 73 74 6e 61 6d 65 29 20 |%s ", ho|stname) |
|00002b60| 3b 0a 20 20 20 20 7d 20 | 65 6c 73 65 20 7b 0a 09 |;. } |else {..|
|00002b70| 73 70 72 69 6e 74 66 28 | 70 72 6f 6d 70 74 2c 20 |sprintf(|prompt, |
|00002b80| 22 55 6e 6c 6f 63 6b 3a | 20 22 20 29 20 3b 0a 20 |"Unlock:| " ) ;. |
|00002b90| 20 20 20 7d 0a 0a 20 20 | 20 20 2f 2a 20 62 75 69 | }.. | /* bui|
|00002ba0| 6c 64 20 6e 61 6d 65 20 | 6f 66 20 70 61 73 73 77 |ld name |of passw|
|00002bb0| 6f 72 64 20 66 69 6c 65 | 20 2a 2f 0a 20 20 20 20 |ord file| */. |
|00002bc0| 0a 20 20 20 20 73 74 72 | 63 70 79 28 70 66 69 6c |. str|cpy(pfil|
|00002bd0| 6e 61 6d 2c 20 67 65 74 | 65 6e 76 28 22 48 4f 4d |nam, get|env("HOM|
|00002be0| 45 22 29 29 20 3b 0a 20 | 20 20 20 73 74 72 63 61 |E")) ;. | strca|
|00002bf0| 74 28 70 66 69 6c 6e 61 | 6d 2c 20 22 2f 22 29 20 |t(pfilna|m, "/") |
|00002c00| 3b 0a 20 20 20 20 73 74 | 72 63 61 74 28 70 66 69 |;. st|rcat(pfi|
|00002c10| 6c 6e 61 6d 2c 20 50 46 | 49 4c 45 29 20 3b 0a 0a |lnam, PF|ILE) ;..|
|00002c20| 20 20 20 20 70 72 65 70 | 74 65 72 6d 28 29 20 3b | prep|term() ;|
|00002c30| 09 09 2f 2a 20 70 72 65 | 70 61 72 65 20 74 65 72 |../* pre|pare ter|
|00002c40| 6d 69 6e 61 6c 20 2a 2f | 0a 0a 20 20 20 20 69 66 |minal */|.. if|
|00002c50| 20 28 61 72 67 63 20 3e | 20 31 29 20 7b 09 09 2f | (argc >| 1) {../|
|00002c60| 2a 20 63 68 65 63 6b 20 | 61 72 67 75 6d 65 6e 74 |* check |argument|
|00002c70| 73 20 2a 2f 0a 09 69 66 | 20 28 73 74 72 63 6d 70 |s */..if| (strcmp|
|00002c80| 28 61 72 67 76 5b 31 5d | 2c 20 22 2d 70 22 29 20 |(argv[1]|, "-p") |
|00002c90| 7c 7c 20 61 72 67 63 20 | 21 3d 20 32 29 20 7b 0a ||| argc |!= 2) {.|
|00002ca0| 09 20 20 20 20 72 65 73 | 65 74 28 29 20 3b 0a 09 |. res|et() ;..|
|00002cb0| 20 20 20 20 75 73 61 67 | 65 28 29 20 3b 0a 09 20 | usag|e() ;.. |
|00002cc0| 20 20 20 65 78 69 74 28 | 31 29 20 3b 0a 09 7d 20 | exit(|1) ;..} |
|00002cd0| 65 6c 73 65 20 7b 0a 09 | 20 20 20 20 6e 65 77 70 |else {..| newp|
|00002ce0| 77 64 66 69 6c 65 28 29 | 20 3b 09 2f 2a 20 2d 70 |wdfile()| ;./* -p|
|00002cf0| 3a 20 6e 65 77 20 70 61 | 73 73 77 6f 72 64 20 2a |: new pa|ssword *|
|00002d00| 2f 0a 09 7d 0a 20 20 20 | 20 7d 0a 0a 20 20 20 20 |/..}. | }.. |
|00002d10| 2f 2a 20 4f 70 65 6e 20 | 70 61 73 73 77 6f 72 64 |/* Open |password|
|00002d20| 20 66 69 6c 65 2e 20 49 | 66 20 69 74 20 64 6f 65 | file. I|f it doe|
|00002d30| 73 20 6e 6f 74 20 65 78 | 69 73 74 2c 20 63 72 65 |s not ex|ist, cre|
|00002d40| 61 74 65 20 69 74 20 66 | 69 72 73 74 2e 20 2a 2f |ate it f|irst. */|
|00002d50| 0a 20 20 20 20 64 6f 20 | 7b 0a 09 69 66 20 28 28 |. do |{..if ((|
|00002d60| 70 77 64 66 69 6c 65 20 | 3d 20 6f 70 65 6e 28 70 |pwdfile |= open(p|
|00002d70| 66 69 6c 6e 61 6d 2c 20 | 4f 5f 52 44 4f 4e 4c 59 |filnam, |O_RDONLY|
|00002d80| 29 29 20 3d 3d 20 2d 31 | 29 20 7b 0a 09 20 20 20 |)) == -1|) {.. |
|00002d90| 20 69 66 20 28 65 72 72 | 6e 6f 20 3d 3d 20 45 4e | if (err|no == EN|
|00002da0| 4f 45 4e 54 29 20 7b 0a | 09 09 70 75 74 73 28 22 |OENT) {.|..puts("|
|00002db0| 4e 6f 20 70 61 73 73 77 | 6f 72 64 20 66 69 6c 65 |No passw|ord file|
|00002dc0| 2e 5c 72 22 29 20 3b 0a | 09 09 66 66 6c 75 73 68 |.\r") ;.|..fflush|
|00002dd0| 28 73 74 64 6f 75 74 29 | 20 3b 0a 09 09 6e 65 77 |(stdout)| ;...new|
|00002de0| 70 77 64 66 69 6c 65 28 | 29 20 3b 0a 09 20 20 20 |pwdfile(|) ;.. |
|00002df0| 20 7d 20 65 6c 73 65 20 | 7b 0a 09 09 70 65 72 72 | } else |{...perr|
|00002e00| 6f 72 28 70 66 69 6c 6e | 61 6d 29 20 3b 0a 09 09 |or(pfiln|am) ;...|
|00002e10| 72 65 73 65 74 28 29 20 | 3b 0a 09 09 65 78 69 74 |reset() |;...exit|
|00002e20| 28 65 72 72 6e 6f 29 20 | 3b 0a 09 20 20 20 20 7d |(errno) |;.. }|
|00002e30| 0a 09 7d 0a 20 20 20 20 | 7d 20 77 68 69 6c 65 20 |..}. |} while |
|00002e40| 28 70 77 64 66 69 6c 65 | 20 3d 3d 20 2d 31 29 20 |(pwdfile| == -1) |
|00002e50| 3b 0a 20 20 20 20 0a 20 | 20 20 20 2f 2a 20 72 65 |;. . | /* re|
|00002e60| 61 64 20 61 6e 64 20 63 | 68 65 63 6b 20 6f 6c 64 |ad and c|heck old|
|00002e70| 20 63 72 79 70 74 20 2a | 2f 0a 20 20 20 20 69 66 | crypt *|/. if|
|00002e80| 20 28 72 65 61 64 28 70 | 77 64 66 69 6c 65 2c 20 | (read(p|wdfile, |
|00002e90| 6f 6c 64 63 2c 20 43 4c | 45 4e 29 20 21 3d 20 43 |oldc, CL|EN) != C|
|00002ea0| 4c 45 4e 20 7c 7c 20 63 | 68 65 63 6b 6f 6c 64 63 |LEN || c|heckoldc|
|00002eb0| 28 29 29 20 7b 0a 09 66 | 70 75 74 73 28 22 7e 2f |()) {..f|puts("~/|
|00002ec0| 22 2c 20 73 74 64 6f 75 | 74 29 20 3b 0a 09 66 70 |", stdou|t) ;..fp|
|00002ed0| 75 74 73 28 50 46 49 4c | 45 2c 20 73 74 64 6f 75 |uts(PFIL|E, stdou|
|00002ee0| 74 29 20 3b 0a 09 70 75 | 74 73 28 22 20 69 6e 20 |t) ;..pu|ts(" in |
|00002ef0| 77 72 6f 6e 67 20 66 6f | 72 6d 61 74 5c 72 22 29 |wrong fo|rmat\r")|
|00002f00| 20 3b 0a 09 66 66 6c 75 | 73 68 28 73 74 64 6f 75 | ;..fflu|sh(stdou|
|00002f10| 74 29 20 3b 0a 09 72 65 | 73 65 74 28 29 20 3b 0a |t) ;..re|set() ;.|
|00002f20| 09 65 78 69 74 28 33 29 | 20 3b 0a 20 20 20 20 7d |.exit(3)| ;. }|
|00002f30| 0a 0a 20 20 20 20 2f 2a | 20 63 6c 65 61 72 20 73 |.. /*| clear s|
|00002f40| 63 72 65 65 6e 20 61 6e | 64 20 72 65 61 64 20 70 |creen an|d read p|
|00002f50| 61 73 73 77 6f 72 64 20 | 2a 2f 0a 20 20 20 20 64 |assword |*/. d|
|00002f60| 6f 20 7b 0a 20 20 20 20 | 20 20 20 20 66 61 69 6c |o {. | fail|
|00002f70| 5f 63 6f 75 6e 74 2b 2b | 3b 0a 09 63 6c 65 61 72 |_count++|;..clear|
|00002f80| 28 29 20 3b 0a 09 72 65 | 66 72 65 73 68 28 29 20 |() ;..re|fresh() |
|00002f90| 3b 0a 09 66 70 75 74 73 | 28 70 72 6f 6d 70 74 2c |;..fputs|(prompt,|
|00002fa0| 20 73 74 64 6f 75 74 29 | 20 3b 0a 09 66 66 6c 75 | stdout)| ;..fflu|
|00002fb0| 73 68 28 73 74 64 6f 75 | 74 29 20 3b 0a 0a 09 72 |sh(stdou|t) ;...r|
|00002fc0| 65 61 64 70 61 73 73 28 | 74 6d 70 6c 2c 20 66 61 |eadpass(|tmpl, fa|
|00002fd0| 6c 73 65 29 20 3b 0a 09 | 73 74 72 63 70 79 28 6e |lse) ;..|strcpy(n|
|00002fe0| 65 77 63 2c 20 63 72 79 | 70 74 28 74 6d 70 6c 2c |ewc, cry|pt(tmpl,|
|00002ff0| 20 6f 6c 64 63 29 29 20 | 3b 0a 20 20 20 20 7d 20 | oldc)) |;. } |
|00003000| 77 68 69 6c 65 20 28 73 | 74 72 63 6d 70 28 6e 65 |while (s|trcmp(ne|
|00003010| 77 63 2c 20 6f 6c 64 63 | 29 20 26 26 20 0a 09 20 |wc, oldc|) && .. |
|00003020| 20 20 20 20 28 70 75 74 | 73 28 22 5c 72 5c 6e 4e | (put|s("\r\nN|
|00003030| 6f 20 77 61 79 2e 5c 72 | 22 29 2c 20 66 66 6c 75 |o way.\r|"), fflu|
|00003040| 73 68 28 73 74 64 6f 75 | 74 29 2c 20 73 6c 65 65 |sh(stdou|t), slee|
|00003050| 70 28 33 29 2c 20 31 29 | 29 20 3b 0a 09 09 09 09 |p(3), 1)|) ;.....|
|00003060| 2f 2a 20 74 68 69 73 20 | 69 73 20 6e 6f 74 20 6e |/* this |is not n|
|00003070| 69 63 65 2c 20 49 20 6b | 6e 6f 77 20 2a 2f 0a 0a |ice, I k|now */..|
|00003080| 20 20 20 20 2f 2a 20 72 | 65 61 64 79 20 2a 2f 0a | /* r|eady */.|
|00003090| 20 20 20 20 72 65 73 65 | 74 28 29 20 3b 0a 20 20 | rese|t() ;. |
|000030a0| 20 20 69 66 20 28 66 61 | 69 6c 5f 63 6f 75 6e 74 | if (fa|il_count|
|000030b0| 29 20 7b 20 20 0a 09 70 | 72 69 6e 74 66 28 22 46 |) { ..p|rintf("F|
|000030c0| 61 69 6c 65 64 20 61 74 | 74 65 6d 70 73 3a 20 25 |ailed at|temps: %|
|000030d0| 64 5c 6e 50 72 65 73 73 | 20 72 65 74 75 72 6e 20 |d\nPress| return |
|000030e0| 74 6f 20 65 78 69 74 20 | 22 2c 20 66 61 69 6c 5f |to exit |", fail_|
|000030f0| 63 6f 75 6e 74 29 20 3b | 0a 09 66 66 6c 75 73 68 |count) ;|..fflush|
|00003100| 28 73 74 64 6f 75 74 29 | 20 3b 0a 09 67 65 74 73 |(stdout)| ;..gets|
|00003110| 28 6f 6c 64 63 29 3b 0a | 20 20 20 20 7d 0a 20 20 |(oldc);.| }. |
|00003120| 20 20 65 78 69 74 28 30 | 29 20 3b 0a 7d 0a 0a 0a | exit(0|) ;.}...|
|00003130| 2f 2a 20 72 65 61 64 20 | 61 20 6c 69 6e 65 20 69 |/* read |a line i|
|00003140| 6e 20 72 61 77 20 6d 6f | 64 65 2c 20 74 65 72 6d |n raw mo|de, term|
|00003150| 69 6e 61 74 65 64 20 62 | 79 20 6e 65 77 6c 69 6e |inated b|y newlin|
|00003160| 65 20 6f 72 20 63 61 72 | 72 69 61 67 65 20 72 65 |e or car|riage re|
|00003170| 74 75 72 6e 0a 20 2a 20 | 6f 72 20 65 78 63 65 65 |turn. * |or excee|
|00003180| 64 69 6e 67 20 53 49 5a | 45 2e 20 43 61 6e 20 67 |ding SIZ|E. Can g|
|00003190| 65 74 20 69 6e 74 65 72 | 72 75 70 74 65 64 20 62 |et inter|rupted b|
|000031a0| 79 20 43 74 72 6c 2d 43 | 20 69 66 20 69 6e 74 72 |y Ctrl-C| if intr|
|000031b0| 20 21 3d 20 30 2e 20 2a | 2f 0a 72 65 61 64 70 61 | != 0. *|/.readpa|
|000031c0| 73 73 28 70 2c 20 69 6e | 74 72 29 0a 63 68 61 72 |ss(p, in|tr).char|
|000031d0| 20 2a 70 20 3b 0a 69 6e | 74 20 69 6e 74 72 20 3b | *p ;.in|t intr ;|
|000031e0| 0a 7b 0a 20 20 20 20 69 | 6e 74 20 6e 20 3b 0a 20 |.{. i|nt n ;. |
|000031f0| 20 20 20 63 68 61 72 20 | 63 20 3d 20 27 20 27 20 | char |c = ' ' |
|00003200| 3b 09 09 2f 2a 20 74 6f | 20 68 61 76 65 20 61 20 |;../* to| have a |
|00003210| 76 61 6c 75 65 20 77 68 | 69 63 68 20 69 73 20 6e |value wh|ich is n|
|00003220| 65 69 74 68 65 72 20 2a | 2f 0a 09 09 09 09 2f 2a |either *|/...../*|
|00003230| 20 27 5c 6e 27 20 6e 6f | 72 20 27 5c 72 27 20 2a | '\n' no|r '\r' *|
|00003240| 2f 0a 0a 20 20 20 20 66 | 6f 72 20 28 6e 20 3d 20 |/.. f|or (n = |
|00003250| 30 3b 20 6e 20 3c 20 53 | 49 5a 45 20 26 26 20 63 |0; n < S|IZE && c|
|00003260| 20 21 3d 20 27 5c 72 27 | 20 26 26 20 63 20 21 3d | != '\r'| && c !=|
|00003270| 20 27 5c 6e 27 3b 20 6e | 2b 2b 29 20 7b 0a 09 63 | '\n'; n|++) {..c|
|00003280| 20 3d 20 70 5b 6e 5d 20 | 3d 20 67 65 74 63 68 61 | = p[n] |= getcha|
|00003290| 72 28 29 20 3b 0a 09 69 | 66 20 28 69 6e 74 72 20 |r() ;..i|f (intr |
|000032a0| 26 26 20 63 20 3d 3d 20 | 27 5c 30 30 33 27 29 20 |&& c == |'\003') |
|000032b0| 7b 0a 09 20 20 20 20 72 | 65 73 65 74 28 29 20 3b |{.. r|eset() ;|
|000032c0| 0a 09 20 20 20 20 65 78 | 69 74 28 31 29 20 3b 0a |.. ex|it(1) ;.|
|000032d0| 09 7d 0a 20 20 20 20 7d | 0a 20 20 20 20 70 5b 6e |.}. }|. p[n|
|000032e0| 5d 20 3d 20 27 5c 30 27 | 20 3b 0a 7d 0a 0a 0a 2f |] = '\0'| ;.}.../|
|000032f0| 2a 20 70 72 65 70 61 72 | 65 20 74 65 72 6d 69 6e |* prepar|e termin|
|00003300| 61 6c 3a 20 6f 70 65 6e | 20 73 74 64 69 6e 20 61 |al: open| stdin a|
|00003310| 6e 64 20 73 74 64 6f 75 | 74 20 74 6f 20 2f 64 65 |nd stdou|t to /de|
|00003320| 76 2f 74 74 79 2c 20 64 | 6f 6e 27 74 20 65 63 68 |v/tty, d|on't ech|
|00003330| 6f 20 2a 2f 0a 2f 2a 20 | 63 68 61 72 61 63 74 65 |o */./* |characte|
|00003340| 72 73 20 61 6e 64 20 6d | 61 6b 65 20 73 75 72 65 |rs and m|ake sure|
|00003350| 20 77 65 20 67 65 74 20 | 6e 6f 20 73 69 67 6e 61 | we get |no signa|
|00003360| 6c 20 28 72 61 77 20 6d | 6f 64 65 20 2b 20 73 6f |l (raw m|ode + so|
|00003370| 6d 65 20 68 65 6c 70 29 | 2e 20 2a 2f 0a 70 72 65 |me help)|. */.pre|
|00003380| 70 74 65 72 6d 28 29 0a | 7b 0a 20 20 20 20 69 6e |pterm().|{. in|
|00003390| 74 20 69 6e 20 3b 0a 0a | 20 20 20 20 2f 2a 20 77 |t in ;..| /* w|
|000033a0| 65 20 77 61 6e 74 20 74 | 6f 20 72 65 61 64 20 74 |e want t|o read t|
|000033b0| 68 65 20 70 61 73 73 77 | 6f 72 64 20 4f 4e 4c 59 |he passw|ord ONLY|
|000033c0| 20 66 72 6f 6d 20 61 20 | 74 65 72 6d 69 6e 61 6c | from a |terminal|
|000033d0| 20 2a 2f 0a 20 20 20 20 | 69 66 20 28 28 69 6e 20 | */. |if ((in |
|000033e0| 3d 20 6f 70 65 6e 28 22 | 2f 64 65 76 2f 74 74 79 |= open("|/dev/tty|
|000033f0| 22 2c 20 4f 5f 52 44 57 | 52 29 29 20 3d 3d 20 2d |", O_RDW|R)) == -|
|00003400| 31 29 20 7b 0a 09 70 65 | 72 72 6f 72 28 22 2f 64 |1) {..pe|rror("/d|
|00003410| 65 76 2f 74 74 79 22 29 | 20 3b 0a 09 65 78 69 74 |ev/tty")| ;..exit|
|00003420| 28 31 29 20 3b 0a 20 20 | 20 20 7d 0a 20 20 20 20 |(1) ;. | }. |
|00003430| 63 6c 6f 73 65 28 30 29 | 20 3b 0a 20 20 20 20 64 |close(0)| ;. d|
|00003440| 75 70 28 69 6e 29 20 3b | 0a 20 20 20 20 63 6c 6f |up(in) ;|. clo|
|00003450| 73 65 28 31 29 20 3b 0a | 20 20 20 20 64 75 70 28 |se(1) ;.| dup(|
|00003460| 69 6e 29 20 3b 0a 20 20 | 20 20 63 6c 6f 73 65 28 |in) ;. | close(|
|00003470| 32 29 20 3b 0a 20 20 20 | 20 64 75 70 28 69 6e 29 |2) ;. | dup(in)|
|00003480| 20 3b 0a 0a 20 20 20 20 | 2f 2a 20 6d 61 6b 65 20 | ;.. |/* make |
|00003490| 73 75 72 65 20 77 65 20 | 77 6f 6e 27 74 20 67 65 |sure we |won't ge|
|000034a0| 74 20 69 6e 74 65 72 72 | 75 70 74 65 64 20 2a 2f |t interr|upted */|
|000034b0| 0a 20 20 20 20 69 6e 69 | 74 73 63 72 28 29 20 3b |. ini|tscr() ;|
|000034c0| 0a 20 20 20 20 72 61 77 | 28 29 20 3b 0a 20 20 20 |. raw|() ;. |
|000034d0| 20 2f 2a 20 74 68 65 20 | 62 72 65 61 6b 20 6b 65 | /* the |break ke|
|000034e0| 79 20 6f 6e 20 49 53 43 | 27 73 20 61 74 33 38 36 |y on ISC|'s at386|
|000034f0| 20 63 6f 6e 73 6f 6c 65 | 20 67 65 6e 65 72 61 74 | console| generat|
|00003500| 65 73 20 61 20 53 49 47 | 49 4e 54 20 65 76 65 6e |es a SIG|INT even|
|00003510| 20 69 6e 0a 20 20 20 20 | 20 2a 20 72 61 77 20 6d | in. | * raw m|
|00003520| 6f 64 65 20 2a 2f 0a 20 | 20 20 20 73 69 67 6e 61 |ode */. | signa|
|00003530| 6c 28 53 49 47 49 4e 54 | 2c 20 53 49 47 5f 49 47 |l(SIGINT|, SIG_IG|
|00003540| 4e 29 20 3b 0a 0a 20 20 | 20 20 2f 2a 20 64 6f 6e |N) ;.. | /* don|
|00003550| 27 74 20 65 63 68 6f 20 | 6b 65 79 73 74 72 6f 6b |'t echo |keystrok|
|00003560| 65 73 20 2a 2f 0a 20 20 | 20 20 6e 6f 65 63 68 6f |es */. | noecho|
|00003570| 28 29 20 3b 0a 7d 0a 0a | 0a 2f 2a 20 70 75 74 20 |() ;.}..|./* put |
|00003580| 74 65 72 6d 69 6e 61 6c | 20 69 6e 74 6f 20 61 20 |terminal| into a |
|00003590| 73 74 61 74 65 20 74 68 | 65 20 75 73 65 72 20 69 |state th|e user i|
|000035a0| 73 20 73 75 70 70 6f 73 | 65 64 20 74 6f 20 77 61 |s suppos|ed to wa|
|000035b0| 6e 74 20 61 66 74 65 72 | 20 74 68 65 20 2a 2f 0a |nt after| the */.|
|000035c0| 2f 2a 20 74 65 72 6d 69 | 6e 61 74 69 6f 6e 20 6f |/* termi|nation o|
|000035d0| 66 20 74 68 65 20 70 72 | 6f 67 72 61 6d 2e 20 2a |f the pr|ogram. *|
|000035e0| 2f 0a 72 65 73 65 74 28 | 29 0a 7b 0a 20 20 20 20 |/.reset(|).{. |
|000035f0| 69 6e 74 20 69 20 3b 0a | 0a 20 20 20 20 2f 2a 20 |int i ;.|. /* |
|00003600| 72 65 73 65 74 20 6d 6f | 64 65 73 20 2a 2f 0a 20 |reset mo|des */. |
|00003610| 20 20 20 63 6c 65 61 72 | 28 29 20 3b 0a 20 20 20 | clear|() ;. |
|00003620| 20 6e 6f 72 61 77 28 29 | 20 3b 0a 20 20 20 20 65 | noraw()| ;. e|
|00003630| 63 68 6f 28 29 20 3b 0a | 20 20 20 20 2f 2a 20 65 |cho() ;.| /* e|
|00003640| 6e 64 20 63 75 72 73 65 | 73 20 2a 2f 0a 20 20 20 |nd curse|s */. |
|00003650| 20 65 6e 64 77 69 6e 28 | 29 20 3b 0a 0a 20 20 20 | endwin(|) ;.. |
|00003660| 20 2f 2a 20 64 65 6c 65 | 74 65 20 70 72 6f 6d 70 | /* dele|te promp|
|00003670| 74 20 2a 2f 0a 20 20 20 | 20 66 6f 72 20 28 69 20 |t */. | for (i |
|00003680| 3d 20 30 3b 20 69 20 3c | 20 73 74 72 6c 65 6e 28 |= 0; i <| strlen(|
|00003690| 70 72 6f 6d 70 74 29 3b | 20 69 2b 2b 29 20 7b 0a |prompt);| i++) {.|
|000036a0| 09 70 75 74 63 68 61 72 | 28 27 5c 62 27 29 3b 0a |.putchar|('\b');.|
|000036b0| 09 70 75 74 63 68 61 72 | 28 27 20 27 29 3b 0a 09 |.putchar|(' ');..|
|000036c0| 70 75 74 63 68 61 72 28 | 27 5c 62 27 29 3b 0a 20 |putchar(|'\b');. |
|000036d0| 20 20 20 7d 0a 7d 0a 0a | 0a 2f 2a 20 63 72 65 61 | }.}..|./* crea|
|000036e0| 74 65 20 61 20 6e 65 77 | 20 70 61 73 73 77 6f 72 |te a new| passwor|
|000036f0| 64 20 66 69 6c 65 20 2a | 2f 0a 6e 65 77 70 77 64 |d file *|/.newpwd|
|00003700| 66 69 6c 65 28 29 0a 7b | 0a 20 20 20 20 63 68 61 |file().{|. cha|
|00003710| 72 20 74 6d 70 6c 5b 53 | 49 5a 45 2b 31 5d 2c 20 |r tmpl[S|IZE+1], |
|00003720| 73 61 6c 74 5b 33 5d 20 | 3b 0a 20 20 20 20 69 6e |salt[3] |;. in|
|00003730| 74 20 6f 75 74 20 3b 0a | 0a 20 20 20 20 2f 2a 20 |t out ;.|. /* |
|00003740| 6d 61 6b 65 20 73 61 6c | 74 20 66 6f 72 20 63 72 |make sal|t for cr|
|00003750| 79 70 74 20 2a 2f 0a 20 | 20 20 20 73 72 61 6e 64 |ypt */. | srand|
|00003760| 28 74 69 6d 65 28 4e 55 | 4c 4c 29 29 20 3b 0a 20 |(time(NU|LL)) ;. |
|00003770| 20 20 20 73 61 6c 74 5b | 30 5d 20 3d 20 53 41 4c | salt[|0] = SAL|
|00003780| 54 43 5b 72 61 6e 64 28 | 29 20 25 20 73 74 72 6c |TC[rand(|) % strl|
|00003790| 65 6e 28 53 41 4c 54 43 | 29 5d 20 3b 0a 20 20 20 |en(SALTC|)] ;. |
|000037a0| 20 73 61 6c 74 5b 31 5d | 20 3d 20 53 41 4c 54 43 | salt[1]| = SALTC|
|000037b0| 5b 72 61 6e 64 28 29 20 | 25 20 73 74 72 6c 65 6e |[rand() |% strlen|
|000037c0| 28 53 41 4c 54 43 29 5d | 20 3b 0a 20 20 20 20 73 |(SALTC)]| ;. s|
|000037d0| 61 6c 74 5b 32 5d 20 3d | 20 27 5c 30 27 20 3b 0a |alt[2] =| '\0' ;.|
|000037e0| 0a 20 20 20 20 2f 2a 20 | 72 65 61 64 20 61 6e 64 |. /* |read and|
|000037f0| 20 76 65 72 69 66 79 20 | 70 61 73 73 77 6f 72 64 | verify |password|
|00003800| 20 2a 2f 0a 20 20 20 20 | 66 70 75 74 73 28 22 45 | */. |fputs("E|
|00003810| 6e 74 65 72 20 70 61 73 | 73 77 6f 72 64 3a 20 20 |nter pas|sword: |
|00003820| 22 2c 20 73 74 64 6f 75 | 74 29 20 3b 0a 20 20 20 |", stdou|t) ;. |
|00003830| 20 66 66 6c 75 73 68 28 | 73 74 64 6f 75 74 29 20 | fflush(|stdout) |
|00003840| 3b 0a 20 20 20 20 72 65 | 61 64 70 61 73 73 28 74 |;. re|adpass(t|
|00003850| 6d 70 6c 2c 20 74 72 75 | 65 29 20 3b 0a 20 20 20 |mpl, tru|e) ;. |
|00003860| 20 73 74 72 63 70 79 28 | 6f 6c 64 63 2c 20 63 72 | strcpy(|oldc, cr|
|00003870| 79 70 74 28 74 6d 70 6c | 2c 20 73 61 6c 74 29 29 |ypt(tmpl|, salt))|
|00003880| 20 3b 0a 20 20 20 20 66 | 70 75 74 73 28 22 5c 72 | ;. f|puts("\r|
|00003890| 5c 6e 52 65 74 79 70 65 | 20 70 61 73 73 77 6f 72 |\nRetype| passwor|
|000038a0| 64 3a 20 22 2c 20 73 74 | 64 6f 75 74 29 20 3b 0a |d: ", st|dout) ;.|
|000038b0| 20 20 20 20 66 66 6c 75 | 73 68 28 73 74 64 6f 75 | fflu|sh(stdou|
|000038c0| 74 29 20 3b 0a 20 20 20 | 20 72 65 61 64 70 61 73 |t) ;. | readpas|
|000038d0| 73 28 74 6d 70 6c 2c 20 | 74 72 75 65 29 20 3b 0a |s(tmpl, |true) ;.|
|000038e0| 20 20 20 20 73 74 72 63 | 70 79 28 6e 65 77 63 2c | strc|py(newc,|
|000038f0| 20 63 72 79 70 74 28 74 | 6d 70 6c 2c 20 73 61 6c | crypt(t|mpl, sal|
|00003900| 74 29 29 20 3b 0a 20 20 | 20 20 6e 65 77 63 5b 43 |t)) ;. | newc[C|
|00003910| 4c 45 4e 5d 20 3d 20 27 | 5c 30 27 20 3b 0a 0a 20 |LEN] = '|\0' ;.. |
|00003920| 20 20 20 69 66 20 28 73 | 74 72 63 6d 70 28 6f 6c | if (s|trcmp(ol|
|00003930| 64 63 2c 20 6e 65 77 63 | 29 29 20 7b 0a 09 70 75 |dc, newc|)) {..pu|
|00003940| 74 73 28 22 5c 72 5c 6e | 4e 6f 20 6d 61 74 63 68 |ts("\r\n|No match|
|00003950| 2e 5c 72 22 29 20 3b 0a | 09 66 66 6c 75 73 68 28 |.\r") ;.|.fflush(|
|00003960| 73 74 64 6f 75 74 29 20 | 3b 0a 09 72 65 73 65 74 |stdout) |;..reset|
|00003970| 28 29 20 3b 0a 09 65 78 | 69 74 28 32 29 20 3b 0a |() ;..ex|it(2) ;.|
|00003980| 20 20 20 20 7d 0a 0a 20 | 20 20 20 2f 2a 20 63 72 | }.. | /* cr|
|00003990| 65 61 74 65 20 70 61 73 | 73 77 6f 72 64 20 66 69 |eate pas|sword fi|
|000039a0| 6c 65 20 2a 2f 0a 20 20 | 20 20 69 66 20 28 28 6f |le */. | if ((o|
|000039b0| 75 74 20 3d 20 6f 70 65 | 6e 28 70 66 69 6c 6e 61 |ut = ope|n(pfilna|
|000039c0| 6d 2c 20 4f 5f 57 52 4f | 4e 4c 59 20 7c 20 4f 5f |m, O_WRO|NLY | O_|
|000039d0| 43 52 45 41 54 2c 20 30 | 36 30 30 29 29 20 3d 3d |CREAT, 0|600)) ==|
|000039e0| 20 2d 31 29 20 7b 0a 09 | 72 65 73 65 74 28 29 20 | -1) {..|reset() |
|000039f0| 3b 0a 09 70 65 72 72 6f | 72 28 70 66 69 6c 6e 61 |;..perro|r(pfilna|
|00003a00| 6d 29 20 3b 0a 09 65 78 | 69 74 28 65 72 72 6e 6f |m) ;..ex|it(errno|
|00003a10| 29 20 3b 0a 20 20 20 20 | 7d 0a 0a 20 20 20 20 2f |) ;. |}.. /|
|00003a20| 2a 20 77 72 69 74 65 20 | 63 72 79 70 74 20 2a 2f |* write |crypt */|
|00003a30| 0a 20 20 20 20 77 72 69 | 74 65 28 6f 75 74 2c 20 |. wri|te(out, |
|00003a40| 6e 65 77 63 2c 20 43 4c | 45 4e 29 20 3b 0a 20 20 |newc, CL|EN) ;. |
|00003a50| 20 20 63 6c 6f 73 65 28 | 6f 75 74 29 20 3b 0a 7d | close(|out) ;.}|
|00003a60| 0a 0a 0a 75 73 61 67 65 | 28 29 0a 7b 0a 20 20 20 |...usage|().{. |
|00003a70| 20 66 70 75 74 73 28 22 | 55 73 61 67 65 3a 20 22 | fputs("|Usage: "|
|00003a80| 2c 20 73 74 64 6f 75 74 | 29 20 3b 0a 20 20 20 20 |, stdout|) ;. |
|00003a90| 66 70 75 74 73 28 70 72 | 6f 67 6e 61 6d 65 2c 20 |fputs(pr|ogname, |
|00003aa0| 73 74 64 6f 75 74 29 20 | 3b 0a 20 20 20 20 70 75 |stdout) |;. pu|
|00003ab0| 74 73 28 22 20 5b 20 2d | 70 20 5d 5c 72 22 29 20 |ts(" [ -|p ]\r") |
|00003ac0| 3b 0a 7d 0a 0a 0a 2f 2a | 20 72 65 74 75 72 6e 73 |;.}.../*| returns|
|00003ad0| 20 74 72 75 65 20 69 66 | 20 6f 6c 64 63 20 64 6f | true if| oldc do|
|00003ae0| 65 73 20 6e 6f 74 20 6c | 6f 6f 6b 20 6c 69 6b 65 |es not l|ook like|
|00003af0| 20 61 20 76 61 6c 69 64 | 20 63 72 79 70 74 20 2a | a valid| crypt *|
|00003b00| 2f 0a 63 68 65 63 6b 6f | 6c 64 63 28 29 0a 7b 0a |/.checko|ldc().{.|
|00003b10| 20 20 20 20 69 6e 74 20 | 69 20 3b 0a 0a 20 20 20 | int |i ;.. |
|00003b20| 20 2f 2a 20 63 68 65 63 | 6b 20 66 6f 72 20 69 6c | /* chec|k for il|
|00003b30| 6c 65 67 61 6c 20 63 68 | 61 72 61 63 74 65 72 73 |legal ch|aracters|
|00003b40| 20 2a 2f 0a 20 20 20 20 | 66 6f 72 20 28 69 20 3d | */. |for (i =|
|00003b50| 20 30 3b 20 69 20 3c 20 | 43 4c 45 4e 20 2d 20 31 | 0; i < |CLEN - 1|
|00003b60| 3b 20 69 2b 2b 29 20 7b | 0a 09 69 66 20 28 21 73 |; i++) {|..if (!s|
|00003b70| 74 72 63 68 72 28 53 41 | 4c 54 43 2c 20 6f 6c 64 |trchr(SA|LTC, old|
|00003b80| 63 5b 69 5d 29 29 20 7b | 0a 09 20 20 20 20 72 65 |c[i])) {|.. re|
|00003b90| 74 75 72 6e 20 74 72 75 | 65 20 3b 0a 09 7d 0a 20 |turn tru|e ;..}. |
|00003ba0| 20 20 20 7d 0a 0a 20 20 | 20 20 2f 2a 20 63 68 65 | }.. | /* che|
|00003bb0| 63 6b 20 66 6f 72 20 74 | 65 72 6d 69 6e 61 74 69 |ck for t|erminati|
|00003bc0| 6e 67 20 6e 75 6c 6c 20 | 63 68 61 72 61 63 74 65 |ng null |characte|
|00003bd0| 72 20 2a 2f 0a 20 20 20 | 20 72 65 74 75 72 6e 20 |r */. | return |
|00003be0| 6f 6c 64 63 5b 69 5d 20 | 3b 0a 7d 0a 53 48 41 52 |oldc[i] |;.}.SHAR|
|00003bf0| 5f 45 4f 46 0a 69 66 20 | 74 65 73 74 20 37 30 32 |_EOF.if |test 702|
|00003c00| 37 20 2d 6e 65 20 22 60 | 77 63 20 2d 63 20 3c 20 |7 -ne "`|wc -c < |
|00003c10| 27 6c 6f 63 6b 74 74 79 | 2e 63 27 60 22 0a 74 68 |'locktty|.c'`".th|
|00003c20| 65 6e 0a 09 65 63 68 6f | 20 73 68 61 72 3a 20 65 |en..echo| shar: e|
|00003c30| 72 72 6f 72 20 74 72 61 | 6e 73 6d 69 74 74 69 6e |rror tra|nsmittin|
|00003c40| 67 20 22 27 6c 6f 63 6b | 74 74 79 2e 63 27 22 20 |g "'lock|tty.c'" |
|00003c50| 27 28 73 68 6f 75 6c 64 | 20 68 61 76 65 20 62 65 |'(should| have be|
|00003c60| 65 6e 20 37 30 32 37 20 | 63 68 61 72 61 63 74 65 |en 7027 |characte|
|00003c70| 72 73 29 27 0a 66 69 0a | 63 68 6d 6f 64 20 2b 78 |rs)'.fi.|chmod +x|
|00003c80| 20 27 6c 6f 63 6b 74 74 | 79 2e 63 27 0a 66 69 20 | 'locktt|y.c'.fi |
|00003c90| 23 20 65 6e 64 20 6f 66 | 20 6f 76 65 72 77 72 69 |# end of| overwri|
|00003ca0| 74 69 6e 67 20 63 68 65 | 63 6b 0a 23 09 45 6e 64 |ting che|ck.#.End|
|00003cb0| 20 6f 66 20 73 68 65 6c | 6c 20 61 72 63 68 69 76 | of shel|l archiv|
|00003cc0| 65 0a 65 63 68 6f 20 73 | 68 61 72 3a 20 65 6e 64 |e.echo s|har: end|
|00003cd0| 20 6f 66 20 73 68 65 6c | 6c 20 61 72 63 68 69 76 | of shel|l archiv|
|00003ce0| 65 2e 0a 65 78 69 74 20 | 30 0a 3d 3d 3d 3d 3d 3d |e..exit |0.======|
|00003cf0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003d00| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003d10| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003d20| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00003d30| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 0a 44 6f 6e 61 6c 64 |========|=.Donald|
|00003d40| 20 42 75 72 72 2c 20 55 | 6e 69 76 2e 20 6f 66 20 | Burr, U|niv. of |
|00003d50| 43 61 6c 69 66 6f 72 6e | 69 61 2c 42 65 72 6b 65 |Californ|ia,Berke|
|00003d60| 6c 65 79 20 7c 20 41 6d | 65 72 69 63 61 20 4f 6e |ley | Am|erica On|
|00003d70| 6c 69 6e 65 3a 20 44 6f | 6e 61 6c 64 42 75 72 72 |line: Do|naldBurr|
|00003d80| 0a 49 4e 54 45 52 4e 45 | 54 3a 20 64 62 75 72 72 |.INTERNE|T: dburr|
|00003d90| 40 6f 63 66 2e 42 65 72 | 6b 65 6c 65 79 2e 45 44 |@ocf.Ber|keley.ED|
|00003da0| 55 20 20 20 20 20 20 20 | 20 20 20 7c 5f 43 6f 6d |U | |_Com|
|00003db0| 70 75 24 65 72 76 65 3a | 5f 37 32 35 34 30 2c 33 |pu$erve:|_72540,3|
|00003dc0| 30 37 31 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |071_____|________|
|00003dd0| 0a 20 20 20 20 20 20 6f | 72 3a 20 37 32 35 34 30 |. o|r: 72540|
|00003de0| 2e 33 30 37 31 40 63 6f | 6d 70 75 73 65 72 76 65 |.3071@co|mpuserve|
|00003df0| 2e 43 4f 4d 20 20 20 20 | 20 20 20 7c 20 20 20 20 |.COM | | |
|00003e00| 22 53 65 6e 64 20 66 6c | 61 6d 65 73 20 74 6f 20 |"Send fl|ames to |
|00003e10| 2f 64 65 76 2f 6e 75 6c | 6c 2e 22 0a |/dev/nul|l.". |
+--------+-------------------------+-------------------------+--------+--------+