home *** CD-ROM | disk | FTP | other *** search
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: 1350
Confidence | Program | Detection | Match Type | Support
|
---|
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, 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 74 72 | 69 65 72 40 73 68 61 73 |From: tr|ier@shas|
|00000010| 74 61 2e 73 63 6c 2e 63 | 77 72 75 2e 65 64 75 20 |ta.scl.c|wru.edu |
|00000020| 28 53 74 65 70 68 65 6e | 20 54 72 69 65 72 29 0a |(Stephen| Trier).|
|00000030| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 61 6c 74 2e |Newsgrou|ps: alt.|
|00000040| 73 6f 75 72 63 65 73 0a | 53 75 62 6a 65 63 74 3a |sources.|Subject:|
|00000050| 20 70 77 64 2e 6c 69 62 | 3a 20 50 75 62 6c 69 63 | pwd.lib|: Public|
|00000060| 20 44 6f 6d 61 69 6e 20 | 70 61 73 73 77 64 20 6c | Domain |passwd l|
|00000070| 69 62 72 61 72 79 0a 4d | 65 73 73 61 67 65 2d 49 |ibrary.M|essage-I|
|00000080| 44 3a 20 3c 31 39 39 30 | 4d 61 79 31 39 2e 31 37 |D: <1990|May19.17|
|00000090| 33 32 34 38 2e 33 38 37 | 34 40 75 73 65 6e 65 74 |3248.387|4@usenet|
|000000a0| 2e 69 6e 73 2e 63 77 72 | 75 2e 65 64 75 3e 0a 44 |.ins.cwr|u.edu>.D|
|000000b0| 61 74 65 3a 20 31 39 20 | 4d 61 79 20 39 30 20 31 |ate: 19 |May 90 1|
|000000c0| 37 3a 33 32 3a 34 38 20 | 47 4d 54 0a 0a 41 72 63 |7:32:48 |GMT..Arc|
|000000d0| 68 69 76 65 2d 4e 61 6d | 65 3a 20 70 77 64 2e 6c |hive-Nam|e: pwd.l|
|000000e0| 69 62 0a 0a 49 6e 20 74 | 68 65 20 70 72 6f 63 65 |ib..In t|he proce|
|000000f0| 73 73 20 6f 66 20 70 6f | 72 74 69 6e 67 20 73 6d |ss of po|rting sm|
|00000100| 61 69 6c 20 74 6f 20 4d | 53 2d 44 4f 53 2c 20 49 |ail to M|S-DOS, I|
|00000110| 20 66 6f 75 6e 64 20 74 | 68 61 74 20 49 20 6e 65 | found t|hat I ne|
|00000120| 65 64 65 64 20 74 68 65 | 20 4d 53 2d 44 4f 53 0a |eded the| MS-DOS.|
|00000130| 65 71 75 69 76 61 6c 65 | 6e 74 20 6f 66 20 74 68 |equivale|nt of th|
|00000140| 65 20 55 6e 69 78 20 70 | 61 73 73 77 6f 72 64 20 |e Unix p|assword |
|00000150| 66 69 6c 65 20 6c 69 62 | 72 61 72 79 2e 20 20 48 |file lib|rary. H|
|00000160| 65 72 65 20 69 74 20 69 | 73 2e 20 20 54 68 65 20 |ere it i|s. The |
|00000170| 63 6f 64 65 20 69 73 0a | 73 69 6d 70 6c 65 2c 20 |code is.|simple, |
|00000180| 62 75 74 20 49 27 76 65 | 20 66 6f 75 6e 64 20 69 |but I've| found i|
|00000190| 74 20 68 61 6e 64 79 20 | 74 6f 20 68 61 76 65 20 |t handy |to have |
|000001a0| 69 6e 20 6d 79 20 6c 69 | 62 72 61 72 79 2e 0a 0a |in my li|brary...|
|000001b0| 50 6f 72 74 69 6e 67 20 | 74 68 65 20 63 6f 64 65 |Porting |the code|
|000001c0| 20 74 6f 20 61 6e 6f 74 | 68 65 72 20 6f 70 65 72 | to anot|her oper|
|000001d0| 61 74 69 6e 67 20 73 79 | 73 74 65 6d 20 73 68 6f |ating sy|stem sho|
|000001e0| 75 6c 64 20 62 65 20 71 | 75 69 74 65 20 73 74 72 |uld be q|uite str|
|000001f0| 61 69 67 68 74 66 6f 72 | 77 61 72 64 2c 0a 72 65 |aightfor|ward,.re|
|00000200| 71 75 69 72 69 6e 67 20 | 6f 6e 6c 79 20 6c 69 67 |quiring |only lig|
|00000210| 68 74 20 65 64 69 74 69 | 6e 67 20 74 6f 20 65 73 |ht editi|ng to es|
|00000220| 74 61 62 6c 69 73 68 20 | 61 20 64 65 66 61 75 6c |tablish |a defaul|
|00000230| 74 20 6c 6f 63 61 74 69 | 6f 6e 20 66 6f 72 20 2f |t locati|on for /|
|00000240| 65 74 63 2f 70 61 73 73 | 77 64 2e 0a 59 6f 75 20 |etc/pass|wd..You |
|00000250| 6d 61 79 20 61 6c 73 6f | 20 6e 65 65 64 20 74 6f |may also| need to|
|00000260| 20 63 68 61 6e 67 65 20 | 74 68 65 20 66 75 6e 63 | change |the func|
|00000270| 74 69 6f 6e 20 64 65 63 | 6c 61 72 61 74 69 6f 6e |tion dec|laration|
|00000280| 73 20 69 66 20 79 6f 75 | 20 68 61 76 65 20 61 6e |s if you| have an|
|00000290| 20 6f 6c 64 0a 63 6f 6d | 70 69 6c 65 72 2e 0a 0a | old.com|piler...|
|000002a0| 49 6e 20 73 68 61 72 20 | 66 6f 72 6d 61 74 3a 0a |In shar |format:.|
|000002b0| 0a 23 21 20 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |.#! /bin|/sh.# Th|
|000002c0| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|000002d0| 63 68 69 76 65 2e 20 20 | 52 65 6d 6f 76 65 20 61 |chive. |Remove a|
|000002e0| 6e 79 74 68 69 6e 67 20 | 62 65 66 6f 72 65 20 74 |nything |before t|
|000002f0| 68 69 73 20 6c 69 6e 65 | 2c 20 74 68 65 6e 20 75 |his line|, then u|
|00000300| 6e 70 61 63 6b 0a 23 20 | 69 74 20 62 79 20 73 61 |npack.# |it by sa|
|00000310| 76 69 6e 67 20 69 74 20 | 69 6e 74 6f 20 61 20 66 |ving it |into a f|
|00000320| 69 6c 65 20 61 6e 64 20 | 74 79 70 69 6e 67 20 22 |ile and |typing "|
|00000330| 73 68 20 66 69 6c 65 22 | 2e 20 20 54 6f 20 6f 76 |sh file"|. To ov|
|00000340| 65 72 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |erwrite |existing|
|00000350| 0a 23 20 66 69 6c 65 73 | 2c 20 74 79 70 65 20 22 |.# files|, type "|
|00000360| 73 68 20 66 69 6c 65 20 | 2d 63 22 2e 20 20 59 6f |sh file |-c". Yo|
|00000370| 75 20 63 61 6e 20 61 6c | 73 6f 20 66 65 65 64 20 |u can al|so feed |
|00000380| 74 68 69 73 20 61 73 20 | 73 74 61 6e 64 61 72 64 |this as |standard|
|00000390| 20 69 6e 70 75 74 20 76 | 69 61 0a 23 20 75 6e 73 | input v|ia.# uns|
|000003a0| 68 61 72 2c 20 6f 72 20 | 62 79 20 74 79 70 69 6e |har, or |by typin|
|000003b0| 67 20 22 73 68 20 3c 66 | 69 6c 65 22 2c 20 65 2e |g "sh <f|ile", e.|
|000003c0| 67 2e 2e 20 20 49 66 20 | 74 68 69 73 20 61 72 63 |g.. If |this arc|
|000003d0| 68 69 76 65 20 69 73 20 | 63 6f 6d 70 6c 65 74 65 |hive is |complete|
|000003e0| 2c 20 79 6f 75 0a 23 20 | 77 69 6c 6c 20 73 65 65 |, you.# |will see|
|000003f0| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000400| 65 73 73 61 67 65 20 61 | 74 20 74 68 65 20 65 6e |essage a|t the en|
|00000410| 64 3a 0a 23 09 09 22 45 | 6e 64 20 6f 66 20 61 72 |d:.#.."E|nd of ar|
|00000420| 63 68 69 76 65 20 31 20 | 28 6f 66 20 31 29 2e 22 |chive 1 |(of 1)."|
|00000430| 0a 23 20 43 6f 6e 74 65 | 6e 74 73 3a 20 20 65 6e |.# Conte|nts: en|
|00000440| 64 70 77 65 6e 74 2e 63 | 20 67 65 74 70 77 65 6e |dpwent.c| getpwen|
|00000450| 74 2e 63 20 67 65 74 70 | 77 6e 61 6d 2e 63 20 67 |t.c getp|wnam.c g|
|00000460| 65 74 70 77 75 69 64 2e | 63 20 6d 61 6b 65 66 69 |etpwuid.|c makefi|
|00000470| 6c 65 0a 23 20 20 20 6d | 61 6e 69 66 65 73 74 20 |le.# m|anifest |
|00000480| 70 61 73 73 77 64 20 70 | 77 5f 66 69 6c 65 2e 63 |passwd p|w_file.c|
|00000490| 20 70 77 5f 6f 70 65 6e | 2e 63 20 70 77 64 2e 68 | pw_open|.c pwd.h|
|000004a0| 20 72 65 61 64 6d 65 20 | 73 65 74 70 77 65 6e 74 | readme |setpwent|
|000004b0| 2e 63 20 74 65 73 74 2e | 63 0a 23 20 57 72 61 70 |.c test.|c.# Wrap|
|000004c0| 70 65 64 20 62 79 20 69 | 62 6d 70 63 40 6c 61 70 |ped by i|bmpc@lap|
|000004d0| 68 72 6f 69 67 2e 55 55 | 43 50 20 6f 6e 20 53 61 |hroig.UU|CP on Sa|
|000004e0| 74 20 4d 61 79 20 31 39 | 20 31 33 3a 31 37 3a 34 |t May 19| 13:17:4|
|000004f0| 34 20 31 39 39 30 0a 50 | 41 54 48 3d 2f 62 69 6e |4 1990.P|ATH=/bin|
|00000500| 3a 2f 75 73 72 2f 62 69 | 6e 3a 2f 75 73 72 2f 75 |:/usr/bi|n:/usr/u|
|00000510| 63 62 20 3b 20 65 78 70 | 6f 72 74 20 50 41 54 48 |cb ; exp|ort PATH|
|00000520| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 65 6e 64 70 |.if test| -f endp|
|00000530| 77 65 6e 74 2e 63 20 2d | 61 20 22 24 7b 31 7d 22 |went.c -|a "${1}"|
|00000540| 20 21 3d 20 22 2d 63 22 | 20 3b 20 74 68 65 6e 20 | != "-c"| ; then |
|00000550| 0a 20 20 65 63 68 6f 20 | 73 68 61 72 3a 20 57 69 |. echo |shar: Wi|
|00000560| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|00000570| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|00000580| 5c 22 65 6e 64 70 77 65 | 6e 74 2e 63 5c 22 0a 65 |\"endpwe|nt.c\".e|
|00000590| 6c 73 65 0a 65 63 68 6f | 20 73 68 61 72 3a 20 45 |lse.echo| shar: E|
|000005a0| 78 74 72 61 63 74 69 6e | 67 20 5c 22 65 6e 64 70 |xtractin|g \"endp|
|000005b0| 77 65 6e 74 2e 63 5c 22 | 20 5c 28 33 31 39 20 63 |went.c\"| \(319 c|
|000005c0| 68 61 72 61 63 74 65 72 | 73 5c 29 0a 73 65 64 20 |haracter|s\).sed |
|000005d0| 22 73 2f 5e 58 2f 2f 22 | 20 3e 65 6e 64 70 77 65 |"s/^X//"| >endpwe|
|000005e0| 6e 74 2e 63 20 3c 3c 27 | 45 4e 44 5f 4f 46 5f 65 |nt.c <<'|END_OF_e|
|000005f0| 6e 64 70 77 65 6e 74 2e | 63 27 0a 58 2f 2a 0a 58 |ndpwent.|c'.X/*.X|
|00000600| 20 2a 20 20 20 20 20 20 | 65 6e 64 70 77 65 6e 74 | * |endpwent|
|00000610| 2e 63 3a 20 43 6c 6f 73 | 65 20 70 61 73 73 77 6f |.c: Clos|e passwo|
|00000620| 72 64 20 66 69 6c 65 0a | 58 20 2a 0a 58 20 2a 20 |rd file.|X *.X * |
|00000630| 20 20 20 20 20 53 74 65 | 70 68 65 6e 20 43 2e 20 | Ste|phen C. |
|00000640| 54 72 69 65 72 0a 58 20 | 2a 20 20 20 20 20 20 4d |Trier.X |* M|
|00000650| 61 72 63 68 20 32 36 2c | 20 31 39 39 30 0a 58 20 |arch 26,| 1990.X |
|00000660| 2a 0a 58 20 2a 20 20 20 | 20 20 20 54 68 69 73 20 |*.X * | This |
|00000670| 70 72 6f 67 72 61 6d 20 | 69 73 20 69 6e 20 74 68 |program |is in th|
|00000680| 65 20 70 75 62 6c 69 63 | 20 64 6f 6d 61 69 6e 0a |e public| domain.|
|00000690| 58 20 2a 0a 58 20 2a 2f | 0a 58 0a 58 23 69 6e 63 |X *.X */|.X.X#inc|
|000006a0| 6c 75 64 65 20 3c 73 74 | 64 69 6f 2e 68 3e 0a 58 |lude <st|dio.h>.X|
|000006b0| 23 69 6e 63 6c 75 64 65 | 20 3c 70 77 64 2e 68 3e |#include| <pwd.h>|
|000006c0| 0a 58 0a 58 65 78 74 65 | 72 6e 20 46 49 4c 45 20 |.X.Xexte|rn FILE |
|000006d0| 2a 5f 70 77 5f 66 69 6c | 65 3b 0a 58 0a 58 69 6e |*_pw_fil|e;.X.Xin|
|000006e0| 74 20 65 6e 64 70 77 65 | 6e 74 28 76 6f 69 64 29 |t endpwe|nt(void)|
|000006f0| 0a 58 7b 0a 58 20 20 20 | 20 69 6e 74 20 74 65 6d |.X{.X | int tem|
|00000700| 70 3b 0a 58 0a 58 20 20 | 20 20 74 65 6d 70 20 3d |p;.X.X | temp =|
|00000710| 20 66 63 6c 6f 73 65 28 | 5f 70 77 5f 66 69 6c 65 | fclose(|_pw_file|
|00000720| 29 3b 0a 58 20 20 20 20 | 5f 70 77 5f 66 69 6c 65 |);.X |_pw_file|
|00000730| 20 3d 20 4e 55 4c 4c 3b | 0a 58 0a 58 20 20 20 20 | = NULL;|.X.X |
|00000740| 72 65 74 75 72 6e 20 74 | 65 6d 70 3b 0a 58 7d 0a |return t|emp;.X}.|
|00000750| 58 0a 58 0a 45 4e 44 5f | 4f 46 5f 65 6e 64 70 77 |X.X.END_|OF_endpw|
|00000760| 65 6e 74 2e 63 0a 69 66 | 20 74 65 73 74 20 33 31 |ent.c.if| test 31|
|00000770| 39 20 2d 6e 65 20 60 77 | 63 20 2d 63 20 3c 65 6e |9 -ne `w|c -c <en|
|00000780| 64 70 77 65 6e 74 2e 63 | 60 3b 20 74 68 65 6e 0a |dpwent.c|`; then.|
|00000790| 20 20 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 5c | echo| shar: \|
|000007a0| 22 65 6e 64 70 77 65 6e | 74 2e 63 5c 22 20 75 6e |"endpwen|t.c\" un|
|000007b0| 70 61 63 6b 65 64 20 77 | 69 74 68 20 77 72 6f 6e |packed w|ith wron|
|000007c0| 67 20 73 69 7a 65 21 0a | 66 69 0a 23 20 65 6e 64 |g size!.|fi.# end|
|000007d0| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|000007e0| 63 68 65 63 6b 0a 66 69 | 0a 69 66 20 74 65 73 74 |check.fi|.if test|
|000007f0| 20 2d 66 20 67 65 74 70 | 77 65 6e 74 2e 63 20 2d | -f getp|went.c -|
|00000800| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|00000810| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|00000820| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 6f |shar: Wi|ll not o|
|00000830| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00000840| 6e 67 20 66 69 6c 65 20 | 5c 22 67 65 74 70 77 65 |ng file |\"getpwe|
|00000850| 6e 74 2e 63 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |nt.c\".e|lse.echo|
|00000860| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|00000870| 67 20 5c 22 67 65 74 70 | 77 65 6e 74 2e 63 5c 22 |g \"getp|went.c\"|
|00000880| 20 5c 28 35 38 33 20 63 | 68 61 72 61 63 74 65 72 | \(583 c|haracter|
|00000890| 73 5c 29 0a 73 65 64 20 | 22 73 2f 5e 58 2f 2f 22 |s\).sed |"s/^X//"|
|000008a0| 20 3e 67 65 74 70 77 65 | 6e 74 2e 63 20 3c 3c 27 | >getpwe|nt.c <<'|
|000008b0| 45 4e 44 5f 4f 46 5f 67 | 65 74 70 77 65 6e 74 2e |END_OF_g|etpwent.|
|000008c0| 63 27 0a 58 2f 2a 0a 58 | 20 2a 20 20 20 20 20 20 |c'.X/*.X| * |
|000008d0| 67 65 74 70 77 65 6e 74 | 2e 63 3a 20 47 65 74 20 |getpwent|.c: Get |
|000008e0| 6e 65 78 74 20 70 61 73 | 73 77 6f 72 64 20 66 69 |next pas|sword fi|
|000008f0| 6c 65 20 65 6e 74 72 79 | 0a 58 20 2a 0a 58 20 2a |le entry|.X *.X *|
|00000900| 20 20 20 20 20 20 53 74 | 65 70 68 65 6e 20 43 2e | St|ephen C.|
|00000910| 20 54 72 69 65 72 0a 58 | 20 2a 20 20 20 20 20 20 | Trier.X| * |
|00000920| 4d 61 72 63 68 20 32 36 | 2c 20 31 39 39 30 0a 58 |March 26|, 1990.X|
|00000930| 20 2a 0a 58 20 2a 20 20 | 20 20 20 20 54 68 69 73 | *.X * | This|
|00000940| 20 70 72 6f 67 72 61 6d | 20 69 73 20 69 6e 20 74 | program| is in t|
|00000950| 68 65 20 70 75 62 6c 69 | 63 20 64 6f 6d 61 69 6e |he publi|c domain|
|00000960| 0a 58 20 2a 0a 58 20 2a | 2f 0a 58 0a 58 23 69 6e |.X *.X *|/.X.X#in|
|00000970| 63 6c 75 64 65 20 3c 73 | 74 64 69 6f 2e 68 3e 0a |clude <s|tdio.h>.|
|00000980| 58 23 69 6e 63 6c 75 64 | 65 20 3c 70 77 64 2e 68 |X#includ|e <pwd.h|
|00000990| 3e 0a 58 0a 58 65 78 74 | 65 72 6e 20 46 49 4c 45 |>.X.Xext|ern FILE|
|000009a0| 20 2a 5f 70 77 5f 66 69 | 6c 65 3b 0a 58 0a 58 73 | *_pw_fi|le;.X.Xs|
|000009b0| 74 72 75 63 74 20 70 61 | 73 73 77 64 20 2a 67 65 |truct pa|sswd *ge|
|000009c0| 74 70 77 65 6e 74 28 76 | 6f 69 64 29 0a 58 7b 0a |tpwent(v|oid).X{.|
|000009d0| 58 20 20 20 20 73 74 61 | 74 69 63 20 73 74 72 75 |X sta|tic stru|
|000009e0| 63 74 20 70 61 73 73 77 | 64 20 74 65 6d 70 3b 0a |ct passw|d temp;.|
|000009f0| 58 0a 58 20 20 20 20 69 | 66 20 28 28 5f 70 77 5f |X.X i|f ((_pw_|
|00000a00| 66 69 6c 65 20 3d 3d 20 | 4e 55 4c 4c 29 20 26 26 |file == |NULL) &&|
|00000a10| 20 28 21 70 77 5f 6f 70 | 65 6e 66 69 6c 65 28 4e | (!pw_op|enfile(N|
|00000a20| 55 4c 4c 29 29 29 0a 58 | 09 72 65 74 75 72 6e 20 |ULL))).X|.return |
|00000a30| 4e 55 4c 4c 3b 0a 58 20 | 20 20 20 69 66 20 28 66 |NULL;.X | if (f|
|00000a40| 73 63 61 6e 66 28 5f 70 | 77 5f 66 69 6c 65 2c 20 |scanf(_p|w_file, |
|00000a50| 22 25 5b 5e 3a 5d 3a 25 | 5b 5e 3a 5d 3a 25 64 3a |"%[^:]:%|[^:]:%d:|
|00000a60| 25 64 3a 25 5b 5e 3a 5d | 3a 25 5b 5e 3a 5d 3a 25 |%d:%[^:]|:%[^:]:%|
|00000a70| 5b 5e 3a 5c 6e 5d 20 22 | 2c 20 74 65 6d 70 2e 70 |[^:\n] "|, temp.p|
|00000a80| 77 5f 6e 61 6d 65 2c 0a | 58 09 20 20 20 20 74 65 |w_name,.|X. te|
|00000a90| 6d 70 2e 70 77 5f 70 61 | 73 73 77 64 2c 20 26 28 |mp.pw_pa|sswd, &(|
|00000aa0| 74 65 6d 70 2e 70 77 5f | 75 69 64 29 2c 20 26 28 |temp.pw_|uid), &(|
|00000ab0| 74 65 6d 70 2e 70 77 5f | 67 69 64 29 2c 20 74 65 |temp.pw_|gid), te|
|00000ac0| 6d 70 2e 70 77 5f 67 65 | 63 6f 73 2c 0a 58 09 20 |mp.pw_ge|cos,.X. |
|00000ad0| 20 20 20 74 65 6d 70 2e | 70 77 5f 64 69 72 2c 20 | temp.|pw_dir, |
|00000ae0| 74 65 6d 70 2e 70 77 5f | 73 68 65 6c 6c 29 20 3d |temp.pw_|shell) =|
|00000af0| 3d 20 37 29 0a 58 09 72 | 65 74 75 72 6e 20 26 74 |= 7).X.r|eturn &t|
|00000b00| 65 6d 70 3b 0a 58 20 20 | 20 20 65 6c 73 65 0a 58 |emp;.X | else.X|
|00000b10| 09 72 65 74 75 72 6e 20 | 4e 55 4c 4c 3b 0a 58 7d |.return |NULL;.X}|
|00000b20| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 45 4e 44 5f 4f |.X.X.X.X|.X.END_O|
|00000b30| 46 5f 67 65 74 70 77 65 | 6e 74 2e 63 0a 69 66 20 |F_getpwe|nt.c.if |
|00000b40| 74 65 73 74 20 35 38 33 | 20 2d 6e 65 20 60 77 63 |test 583| -ne `wc|
|00000b50| 20 2d 63 20 3c 67 65 74 | 70 77 65 6e 74 2e 63 60 | -c <get|pwent.c`|
|00000b60| 3b 20 74 68 65 6e 0a 20 | 20 20 20 65 63 68 6f 20 |; then. | echo |
|00000b70| 73 68 61 72 3a 20 5c 22 | 67 65 74 70 77 65 6e 74 |shar: \"|getpwent|
|00000b80| 2e 63 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |.c\" unp|acked wi|
|00000b90| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|00000ba0| 69 0a 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i.# end |of overw|
|00000bb0| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 66 69 0a |riting c|heck.fi.|
|00000bc0| 69 66 20 74 65 73 74 20 | 2d 66 20 67 65 74 70 77 |if test |-f getpw|
|00000bd0| 6e 61 6d 2e 63 20 2d 61 | 20 22 24 7b 31 7d 22 20 |nam.c -a| "${1}" |
|00000be0| 21 3d 20 22 2d 63 22 20 | 3b 20 74 68 65 6e 20 0a |!= "-c" |; then .|
|00000bf0| 20 20 65 63 68 6f 20 73 | 68 61 72 3a 20 57 69 6c | echo s|har: Wil|
|00000c00| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|00000c10| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 5c | existin|g file \|
|00000c20| 22 67 65 74 70 77 6e 61 | 6d 2e 63 5c 22 0a 65 6c |"getpwna|m.c\".el|
|00000c30| 73 65 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 45 78 |se.echo |shar: Ex|
|00000c40| 74 72 61 63 74 69 6e 67 | 20 5c 22 67 65 74 70 77 |tracting| \"getpw|
|00000c50| 6e 61 6d 2e 63 5c 22 20 | 5c 28 34 39 31 20 63 68 |nam.c\" |\(491 ch|
|00000c60| 61 72 61 63 74 65 72 73 | 5c 29 0a 73 65 64 20 22 |aracters|\).sed "|
|00000c70| 73 2f 5e 58 2f 2f 22 20 | 3e 67 65 74 70 77 6e 61 |s/^X//" |>getpwna|
|00000c80| 6d 2e 63 20 3c 3c 27 45 | 4e 44 5f 4f 46 5f 67 65 |m.c <<'E|ND_OF_ge|
|00000c90| 74 70 77 6e 61 6d 2e 63 | 27 0a 58 2f 2a 0a 58 20 |tpwnam.c|'.X/*.X |
|00000ca0| 2a 20 20 20 20 20 20 67 | 65 74 70 77 6e 61 6d 2e |* g|etpwnam.|
|00000cb0| 63 3a 20 47 65 74 20 70 | 61 73 73 77 6f 72 64 20 |c: Get p|assword |
|00000cc0| 66 69 6c 65 20 65 6e 74 | 72 79 20 62 79 20 6e 61 |file ent|ry by na|
|00000cd0| 6d 65 0a 58 20 2a 0a 58 | 20 2a 20 20 20 20 20 20 |me.X *.X| * |
|00000ce0| 53 74 65 70 68 65 6e 20 | 43 2e 20 54 72 69 65 72 |Stephen |C. Trier|
|00000cf0| 0a 58 20 2a 20 20 20 20 | 20 20 4d 61 72 63 68 20 |.X * | March |
|00000d00| 32 36 2c 20 31 39 39 30 | 0a 58 20 2a 0a 58 20 2a |26, 1990|.X *.X *|
|00000d10| 20 20 20 20 20 20 54 68 | 69 73 20 70 72 6f 67 72 | Th|is progr|
|00000d20| 61 6d 20 69 73 20 69 6e | 20 74 68 65 20 70 75 62 |am is in| the pub|
|00000d30| 6c 69 63 20 64 6f 6d 61 | 69 6e 0a 58 20 2a 0a 58 |lic doma|in.X *.X|
|00000d40| 20 2a 2f 0a 58 0a 58 23 | 69 6e 63 6c 75 64 65 20 | */.X.X#|include |
|00000d50| 3c 73 74 64 69 6f 2e 68 | 3e 0a 58 23 69 6e 63 6c |<stdio.h|>.X#incl|
|00000d60| 75 64 65 20 3c 73 74 72 | 69 6e 67 2e 68 3e 0a 58 |ude <str|ing.h>.X|
|00000d70| 23 69 6e 63 6c 75 64 65 | 20 3c 70 77 64 2e 68 3e |#include| <pwd.h>|
|00000d80| 0a 58 0a 58 65 78 74 65 | 72 6e 20 46 49 4c 45 20 |.X.Xexte|rn FILE |
|00000d90| 2a 5f 70 77 5f 66 69 6c | 65 3b 0a 58 0a 58 73 74 |*_pw_fil|e;.X.Xst|
|00000da0| 72 75 63 74 20 70 61 73 | 73 77 64 20 2a 67 65 74 |ruct pas|swd *get|
|00000db0| 70 77 6e 61 6d 28 63 68 | 61 72 20 2a 6e 61 6d 65 |pwnam(ch|ar *name|
|00000dc0| 29 0a 58 7b 0a 58 20 20 | 20 20 73 74 72 75 63 74 |).X{.X | struct|
|00000dd0| 20 70 61 73 73 77 64 20 | 2a 74 65 6d 70 3b 0a 58 | passwd |*temp;.X|
|00000de0| 0a 58 20 20 20 20 69 66 | 20 28 73 65 74 70 77 65 |.X if| (setpwe|
|00000df0| 6e 74 28 29 29 0a 58 09 | 72 65 74 75 72 6e 20 4e |nt()).X.|return N|
|00000e00| 55 4c 4c 3b 0a 58 20 20 | 20 20 77 68 69 6c 65 20 |ULL;.X | while |
|00000e10| 28 74 65 6d 70 20 3d 20 | 67 65 74 70 77 65 6e 74 |(temp = |getpwent|
|00000e20| 28 29 29 0a 58 09 69 66 | 20 28 73 74 72 63 6d 70 |()).X.if| (strcmp|
|00000e30| 28 74 65 6d 70 2d 3e 70 | 77 5f 6e 61 6d 65 2c 20 |(temp->p|w_name, |
|00000e40| 6e 61 6d 65 29 20 3d 3d | 20 30 29 20 20 7b 0a 58 |name) ==| 0) {.X|
|00000e50| 09 20 20 20 20 73 65 74 | 70 77 65 6e 74 28 29 3b |. set|pwent();|
|00000e60| 0a 58 09 20 20 20 20 72 | 65 74 75 72 6e 20 74 65 |.X. r|eturn te|
|00000e70| 6d 70 3b 0a 58 09 20 20 | 20 20 7d 0a 58 20 20 20 |mp;.X. | }.X |
|00000e80| 20 73 65 74 70 77 65 6e | 74 28 29 3b 0a 58 20 20 | setpwen|t();.X |
|00000e90| 20 20 72 65 74 75 72 6e | 20 4e 55 4c 4c 3b 0a 58 | return| NULL;.X|
|00000ea0| 7d 0a 58 0a 45 4e 44 5f | 4f 46 5f 67 65 74 70 77 |}.X.END_|OF_getpw|
|00000eb0| 6e 61 6d 2e 63 0a 69 66 | 20 74 65 73 74 20 34 39 |nam.c.if| test 49|
|00000ec0| 31 20 2d 6e 65 20 60 77 | 63 20 2d 63 20 3c 67 65 |1 -ne `w|c -c <ge|
|00000ed0| 74 70 77 6e 61 6d 2e 63 | 60 3b 20 74 68 65 6e 0a |tpwnam.c|`; then.|
|00000ee0| 20 20 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 5c | echo| shar: \|
|00000ef0| 22 67 65 74 70 77 6e 61 | 6d 2e 63 5c 22 20 75 6e |"getpwna|m.c\" un|
|00000f00| 70 61 63 6b 65 64 20 77 | 69 74 68 20 77 72 6f 6e |packed w|ith wron|
|00000f10| 67 20 73 69 7a 65 21 0a | 66 69 0a 23 20 65 6e 64 |g size!.|fi.# end|
|00000f20| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|00000f30| 63 68 65 63 6b 0a 66 69 | 0a 69 66 20 74 65 73 74 |check.fi|.if test|
|00000f40| 20 2d 66 20 67 65 74 70 | 77 75 69 64 2e 63 20 2d | -f getp|wuid.c -|
|00000f50| 61 20 22 24 7b 31 7d 22 | 20 21 3d 20 22 2d 63 22 |a "${1}"| != "-c"|
|00000f60| 20 3b 20 74 68 65 6e 20 | 0a 20 20 65 63 68 6f 20 | ; then |. echo |
|00000f70| 73 68 61 72 3a 20 57 69 | 6c 6c 20 6e 6f 74 20 6f |shar: Wi|ll not o|
|00000f80| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00000f90| 6e 67 20 66 69 6c 65 20 | 5c 22 67 65 74 70 77 75 |ng file |\"getpwu|
|00000fa0| 69 64 2e 63 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |id.c\".e|lse.echo|
|00000fb0| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|00000fc0| 67 20 5c 22 67 65 74 70 | 77 75 69 64 2e 63 5c 22 |g \"getp|wuid.c\"|
|00000fd0| 20 5c 28 34 35 37 20 63 | 68 61 72 61 63 74 65 72 | \(457 c|haracter|
|00000fe0| 73 5c 29 0a 73 65 64 20 | 22 73 2f 5e 58 2f 2f 22 |s\).sed |"s/^X//"|
|00000ff0| 20 3e 67 65 74 70 77 75 | 69 64 2e 63 20 3c 3c 27 | >getpwu|id.c <<'|
|00001000| 45 4e 44 5f 4f 46 5f 67 | 65 74 70 77 75 69 64 2e |END_OF_g|etpwuid.|
|00001010| 63 27 0a 58 2f 2a 0a 58 | 20 2a 20 20 20 20 20 20 |c'.X/*.X| * |
|00001020| 67 65 74 70 77 75 69 64 | 2e 63 3a 20 47 65 74 20 |getpwuid|.c: Get |
|00001030| 70 61 73 73 77 6f 72 64 | 20 66 69 6c 65 20 65 6e |password| file en|
|00001040| 74 72 79 20 62 79 20 75 | 73 65 72 20 69 64 0a 58 |try by u|ser id.X|
|00001050| 20 2a 0a 58 20 2a 20 20 | 20 20 20 20 53 74 65 70 | *.X * | Step|
|00001060| 68 65 6e 20 43 2e 20 54 | 72 69 65 72 0a 58 20 2a |hen C. T|rier.X *|
|00001070| 20 20 20 20 20 20 4d 61 | 72 63 68 20 32 36 2c 20 | Ma|rch 26, |
|00001080| 31 39 39 30 0a 58 20 2a | 0a 58 20 2a 20 20 20 20 |1990.X *|.X * |
|00001090| 20 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 69 | This p|rogram i|
|000010a0| 73 20 69 6e 20 74 68 65 | 20 70 75 62 6c 69 63 20 |s in the| public |
|000010b0| 64 6f 6d 61 69 6e 0a 58 | 20 2a 0a 58 20 2a 2f 0a |domain.X| *.X */.|
|000010c0| 58 0a 58 23 69 6e 63 6c | 75 64 65 20 3c 73 74 64 |X.X#incl|ude <std|
|000010d0| 69 6f 2e 68 3e 0a 58 23 | 69 6e 63 6c 75 64 65 20 |io.h>.X#|include |
|000010e0| 3c 70 77 64 2e 68 3e 0a | 58 0a 58 65 78 74 65 72 |<pwd.h>.|X.Xexter|
|000010f0| 6e 20 46 49 4c 45 20 2a | 5f 70 77 5f 66 69 6c 65 |n FILE *|_pw_file|
|00001100| 3b 0a 58 0a 58 73 74 72 | 75 63 74 20 70 61 73 73 |;.X.Xstr|uct pass|
|00001110| 77 64 20 2a 67 65 74 70 | 77 75 69 64 28 69 6e 74 |wd *getp|wuid(int|
|00001120| 20 69 64 29 0a 58 7b 0a | 58 20 20 20 20 73 74 72 | id).X{.|X str|
|00001130| 75 63 74 20 70 61 73 73 | 77 64 20 2a 74 65 6d 70 |uct pass|wd *temp|
|00001140| 3b 0a 58 0a 58 20 20 20 | 20 69 66 20 28 73 65 74 |;.X.X | if (set|
|00001150| 70 77 65 6e 74 28 29 29 | 0a 58 09 72 65 74 75 72 |pwent())|.X.retur|
|00001160| 6e 20 4e 55 4c 4c 3b 0a | 58 20 20 20 20 77 68 69 |n NULL;.|X whi|
|00001170| 6c 65 20 28 74 65 6d 70 | 20 3d 20 67 65 74 70 77 |le (temp| = getpw|
|00001180| 65 6e 74 28 29 29 0a 58 | 09 69 66 20 28 74 65 6d |ent()).X|.if (tem|
|00001190| 70 2d 3e 70 77 5f 75 69 | 64 20 3d 3d 20 69 64 29 |p->pw_ui|d == id)|
|000011a0| 20 20 7b 0a 58 09 20 20 | 20 20 73 65 74 70 77 65 | {.X. | setpwe|
|000011b0| 6e 74 28 29 3b 0a 58 09 | 20 20 20 20 72 65 74 75 |nt();.X.| retu|
|000011c0| 72 6e 20 74 65 6d 70 3b | 0a 58 09 20 20 20 20 7d |rn temp;|.X. }|
|000011d0| 0a 58 20 20 20 20 73 65 | 74 70 77 65 6e 74 28 29 |.X se|tpwent()|
|000011e0| 3b 0a 58 20 20 20 20 72 | 65 74 75 72 6e 20 4e 55 |;.X r|eturn NU|
|000011f0| 4c 4c 3b 0a 58 7d 0a 58 | 0a 58 0a 45 4e 44 5f 4f |LL;.X}.X|.X.END_O|
|00001200| 46 5f 67 65 74 70 77 75 | 69 64 2e 63 0a 69 66 20 |F_getpwu|id.c.if |
|00001210| 74 65 73 74 20 34 35 37 | 20 2d 6e 65 20 60 77 63 |test 457| -ne `wc|
|00001220| 20 2d 63 20 3c 67 65 74 | 70 77 75 69 64 2e 63 60 | -c <get|pwuid.c`|
|00001230| 3b 20 74 68 65 6e 0a 20 | 20 20 20 65 63 68 6f 20 |; then. | echo |
|00001240| 73 68 61 72 3a 20 5c 22 | 67 65 74 70 77 75 69 64 |shar: \"|getpwuid|
|00001250| 2e 63 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |.c\" unp|acked wi|
|00001260| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|00001270| 69 0a 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i.# end |of overw|
|00001280| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 66 69 0a |riting c|heck.fi.|
|00001290| 69 66 20 74 65 73 74 20 | 2d 66 20 6d 61 6b 65 66 |if test |-f makef|
|000012a0| 69 6c 65 20 2d 61 20 22 | 24 7b 31 7d 22 20 21 3d |ile -a "|${1}" !=|
|000012b0| 20 22 2d 63 22 20 3b 20 | 74 68 65 6e 20 0a 20 20 | "-c" ; |then . |
|000012c0| 65 63 68 6f 20 73 68 61 | 72 3a 20 57 69 6c 6c 20 |echo sha|r: Will |
|000012d0| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|000012e0| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 5c 22 6d |xisting |file \"m|
|000012f0| 61 6b 65 66 69 6c 65 5c | 22 0a 65 6c 73 65 0a 65 |akefile\|".else.e|
|00001300| 63 68 6f 20 73 68 61 72 | 3a 20 45 78 74 72 61 63 |cho shar|: Extrac|
|00001310| 74 69 6e 67 20 5c 22 6d | 61 6b 65 66 69 6c 65 5c |ting \"m|akefile\|
|00001320| 22 20 5c 28 39 30 31 20 | 63 68 61 72 61 63 74 65 |" \(901 |characte|
|00001330| 72 73 5c 29 0a 73 65 64 | 20 22 73 2f 5e 58 2f 2f |rs\).sed| "s/^X//|
|00001340| 22 20 3e 6d 61 6b 65 66 | 69 6c 65 20 3c 3c 27 45 |" >makef|ile <<'E|
|00001350| 4e 44 5f 4f 46 5f 6d 61 | 6b 65 66 69 6c 65 27 0a |ND_OF_ma|kefile'.|
|00001360| 58 23 0a 58 23 20 20 4d | 61 6b 65 66 69 6c 65 20 |X#.X# M|akefile |
|00001370| 28 77 65 6c 6c 2c 20 73 | 6f 72 74 20 6f 66 29 20 |(well, s|ort of) |
|00001380| 66 6f 72 20 70 61 73 73 | 77 64 20 6c 69 62 72 61 |for pass|wd libra|
|00001390| 72 79 0a 58 23 0a 58 23 | 20 20 54 68 69 73 20 6d |ry.X#.X#| This m|
|000013a0| 61 6b 65 73 20 74 68 65 | 20 6c 69 62 72 61 72 79 |akes the| library|
|000013b0| 20 6a 75 73 74 20 66 69 | 6e 65 2c 20 62 75 74 20 | just fi|ne, but |
|000013c0| 6f 6e 6c 79 20 69 6e 20 | 74 68 65 20 73 6d 61 6c |only in |the smal|
|000013d0| 6c 20 6d 65 6d 6f 72 79 | 20 6d 6f 64 65 6c 2e 0a |l memory| model..|
|000013e0| 58 23 20 20 53 6f 6d 65 | 20 65 64 69 74 69 6e 67 |X# Some| editing|
|000013f0| 20 77 69 6c 6c 20 62 65 | 20 6e 65 65 64 65 64 20 | will be| needed |
|00001400| 74 6f 20 6d 61 6b 65 20 | 74 68 65 20 6f 74 68 65 |to make |the othe|
|00001410| 72 20 6c 69 62 72 61 72 | 69 65 73 2e 0a 58 23 0a |r librar|ies..X#.|
|00001420| 58 0a 58 4d 4f 44 45 4c | 20 3d 20 73 0a 58 43 46 |X.XMODEL| = s.XCF|
|00001430| 4c 41 47 53 20 3d 20 2d | 77 20 2d 4f 20 2d 6d 24 |LAGS = -|w -O -m$|
|00001440| 28 4d 4f 44 45 4c 29 0a | 58 4f 42 4a 53 20 3d 20 |(MODEL).|XOBJS = |
|00001450| 65 6e 64 70 77 65 6e 74 | 2e 6f 62 6a 20 67 65 74 |endpwent|.obj get|
|00001460| 70 77 6e 61 6d 2e 6f 62 | 6a 20 70 77 5f 66 69 6c |pwnam.ob|j pw_fil|
|00001470| 65 2e 6f 62 6a 20 73 65 | 74 70 77 65 6e 74 2e 6f |e.obj se|tpwent.o|
|00001480| 62 6a 20 67 65 74 70 77 | 65 6e 74 2e 6f 62 6a 5c |bj getpw|ent.obj\|
|00001490| 0a 58 20 20 20 20 20 20 | 20 67 65 74 70 77 75 69 |.X | getpwui|
|000014a0| 64 2e 6f 62 6a 20 70 77 | 5f 6f 70 65 6e 2e 6f 62 |d.obj pw|_open.ob|
|000014b0| 6a 0a 58 4c 49 42 4e 41 | 4d 45 20 3d 20 24 28 4d |j.XLIBNA|ME = $(M|
|000014c0| 4f 44 45 4c 29 70 77 64 | 2e 6c 69 62 0a 58 0a 58 |ODEL)pwd|.lib.X.X|
|000014d0| 2e 63 2e 6f 62 6a 3a 0a | 58 20 20 20 20 74 63 63 |.c.obj:.|X tcc|
|000014e0| 20 24 28 43 46 4c 41 47 | 53 29 20 2d 63 20 24 3c | $(CFLAG|S) -c $<|
|000014f0| 0a 58 20 20 20 20 74 6c | 69 62 20 24 28 4c 49 42 |.X tl|ib $(LIB|
|00001500| 4e 41 4d 45 29 20 2f 43 | 20 2f 45 20 2b 2d 24 2a |NAME) /C| /E +-$*|
|00001510| 0a 58 0a 58 61 6c 6c 3a | 20 24 28 4c 49 42 4e 41 |.X.Xall:| $(LIBNA|
|00001520| 4d 45 29 20 23 20 74 65 | 73 74 2e 65 78 65 0a 58 |ME) # te|st.exe.X|
|00001530| 0a 58 63 6c 65 61 6e 3a | 0a 58 20 20 20 20 2d 72 |.Xclean:|.X -r|
|00001540| 6d 20 2f 66 20 2a 2e 6f | 62 6a 20 24 28 4d 4f 44 |m /f *.o|bj $(MOD|
|00001550| 45 4c 29 70 77 64 2e 62 | 61 6b 0a 58 0a 58 63 6c |EL)pwd.b|ak.X.Xcl|
|00001560| 6f 62 62 65 72 3a 20 63 | 6c 65 61 6e 0a 58 20 20 |obber: c|lean.X |
|00001570| 20 20 2d 72 6d 20 2f 66 | 20 24 28 4d 4f 44 45 4c | -rm /f| $(MODEL|
|00001580| 29 70 77 64 2e 6c 69 62 | 20 74 65 73 74 2e 65 78 |)pwd.lib| test.ex|
|00001590| 65 0a 58 0a 58 24 28 4c | 49 42 4e 41 4d 45 29 3a |e.X.X$(L|IBNAME):|
|000015a0| 20 24 28 4f 42 4a 53 29 | 0a 58 0a 58 74 65 73 74 | $(OBJS)|.X.Xtest|
|000015b0| 2e 65 78 65 3a 20 74 65 | 73 74 2e 6f 62 6a 20 73 |.exe: te|st.obj s|
|000015c0| 70 77 64 2e 6c 69 62 0a | 58 20 20 20 20 74 63 63 |pwd.lib.|X tcc|
|000015d0| 20 24 28 43 46 4c 41 47 | 53 29 20 2d 65 74 65 73 | $(CFLAG|S) -etes|
|000015e0| 74 20 74 65 73 74 2e 6f | 62 6a 20 73 70 77 64 2e |t test.o|bj spwd.|
|000015f0| 6c 69 62 0a 58 0a 58 74 | 65 73 74 2e 6f 62 6a 3a |lib.X.Xt|est.obj:|
|00001600| 20 74 65 73 74 2e 63 20 | 70 77 64 2e 68 0a 58 20 | test.c |pwd.h.X |
|00001610| 20 20 20 74 63 63 20 24 | 28 43 46 4c 41 47 53 29 | tcc $|(CFLAGS)|
|00001620| 20 2d 63 20 24 2a 0a 58 | 0a 58 65 6e 64 70 77 65 | -c $*.X|.Xendpwe|
|00001630| 6e 74 2e 6f 62 6a 3a 20 | 65 6e 64 70 77 65 6e 74 |nt.obj: |endpwent|
|00001640| 2e 63 20 70 77 64 2e 68 | 0a 58 0a 58 67 65 74 70 |.c pwd.h|.X.Xgetp|
|00001650| 77 6e 61 6d 2e 6f 62 6a | 3a 20 67 65 74 70 77 6e |wnam.obj|: getpwn|
|00001660| 61 6d 2e 63 20 70 77 64 | 2e 68 0a 58 0a 58 70 77 |am.c pwd|.h.X.Xpw|
|00001670| 5f 66 69 6c 65 2e 6f 62 | 6a 3a 20 70 77 5f 66 69 |_file.ob|j: pw_fi|
|00001680| 6c 65 2e 63 20 70 77 64 | 2e 68 0a 58 0a 58 73 65 |le.c pwd|.h.X.Xse|
|00001690| 74 70 77 65 6e 74 2e 6f | 62 6a 3a 20 73 65 74 70 |tpwent.o|bj: setp|
|000016a0| 77 65 6e 74 2e 63 20 70 | 77 64 2e 68 0a 58 0a 58 |went.c p|wd.h.X.X|
|000016b0| 67 65 74 70 77 65 6e 74 | 2e 6f 62 6a 3a 20 67 65 |getpwent|.obj: ge|
|000016c0| 74 70 77 65 6e 74 2e 63 | 20 70 77 64 2e 68 0a 58 |tpwent.c| pwd.h.X|
|000016d0| 0a 58 67 65 74 70 77 75 | 69 64 2e 6f 62 6a 3a 20 |.Xgetpwu|id.obj: |
|000016e0| 67 65 74 70 77 75 69 64 | 2e 63 20 70 77 64 2e 68 |getpwuid|.c pwd.h|
|000016f0| 0a 58 0a 58 70 77 5f 6f | 70 65 6e 2e 6f 62 6a 3a |.X.Xpw_o|pen.obj:|
|00001700| 20 70 77 5f 6f 70 65 6e | 2e 63 20 70 77 64 2e 68 | pw_open|.c pwd.h|
|00001710| 0a 58 0a 58 0a 45 4e 44 | 5f 4f 46 5f 6d 61 6b 65 |.X.X.END|_OF_make|
|00001720| 66 69 6c 65 0a 69 66 20 | 74 65 73 74 20 39 30 31 |file.if |test 901|
|00001730| 20 2d 6e 65 20 60 77 63 | 20 2d 63 20 3c 6d 61 6b | -ne `wc| -c <mak|
|00001740| 65 66 69 6c 65 60 3b 20 | 74 68 65 6e 0a 20 20 20 |efile`; |then. |
|00001750| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 5c 22 6d 61 | echo sh|ar: \"ma|
|00001760| 6b 65 66 69 6c 65 5c 22 | 20 75 6e 70 61 63 6b 65 |kefile\"| unpacke|
|00001770| 64 20 77 69 74 68 20 77 | 72 6f 6e 67 20 73 69 7a |d with w|rong siz|
|00001780| 65 21 0a 66 69 0a 23 20 | 65 6e 64 20 6f 66 20 6f |e!.fi.# |end of o|
|00001790| 76 65 72 77 72 69 74 69 | 6e 67 20 63 68 65 63 6b |verwriti|ng check|
|000017a0| 0a 66 69 0a 69 66 20 74 | 65 73 74 20 2d 66 20 6d |.fi.if t|est -f m|
|000017b0| 61 6e 69 66 65 73 74 20 | 2d 61 20 22 24 7b 31 7d |anifest |-a "${1}|
|000017c0| 22 20 21 3d 20 22 2d 63 | 22 20 3b 20 74 68 65 6e |" != "-c|" ; then|
|000017d0| 20 0a 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 57 | . echo| shar: W|
|000017e0| 69 6c 6c 20 6e 6f 74 20 | 6f 76 65 72 2d 77 72 69 |ill not |over-wri|
|000017f0| 74 65 20 65 78 69 73 74 | 69 6e 67 20 66 69 6c 65 |te exist|ing file|
|00001800| 20 5c 22 6d 61 6e 69 66 | 65 73 74 5c 22 0a 65 6c | \"manif|est\".el|
|00001810| 73 65 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 45 78 |se.echo |shar: Ex|
|00001820| 74 72 61 63 74 69 6e 67 | 20 5c 22 6d 61 6e 69 66 |tracting| \"manif|
|00001830| 65 73 74 5c 22 20 5c 28 | 34 38 36 20 63 68 61 72 |est\" \(|486 char|
|00001840| 61 63 74 65 72 73 5c 29 | 0a 73 65 64 20 22 73 2f |acters\)|.sed "s/|
|00001850| 5e 58 2f 2f 22 20 3e 6d | 61 6e 69 66 65 73 74 20 |^X//" >m|anifest |
|00001860| 3c 3c 27 45 4e 44 5f 4f | 46 5f 6d 61 6e 69 66 65 |<<'END_O|F_manife|
|00001870| 73 74 27 0a 58 20 20 20 | 46 69 6c 65 20 4e 61 6d |st'.X |File Nam|
|00001880| 65 09 09 41 72 63 68 69 | 76 65 20 23 09 44 65 73 |e..Archi|ve #.Des|
|00001890| 63 72 69 70 74 69 6f 6e | 0a 58 2d 2d 2d 2d 2d 2d |cription|.X------|
|000018a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000018b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000018c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000018d0| 2d 2d 2d 2d 2d 0a 58 20 | 65 6e 64 70 77 65 6e 74 |-----.X |endpwent|
|000018e0| 2e 63 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.c | |
|000018f0| 20 20 31 09 0a 58 20 67 | 65 74 70 77 65 6e 74 2e | 1..X g|etpwent.|
|00001900| 63 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |c | |
|00001910| 20 31 09 0a 58 20 67 65 | 74 70 77 6e 61 6d 2e 63 | 1..X ge|tpwnam.c|
|00001920| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001930| 31 09 0a 58 20 67 65 74 | 70 77 75 69 64 2e 63 20 |1..X get|pwuid.c |
|00001940| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 31 | | 1|
|00001950| 09 0a 58 20 6d 61 6b 65 | 66 69 6c 65 20 20 20 20 |..X make|file |
|00001960| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 31 09 | | 1.|
|00001970| 0a 58 20 6d 61 6e 69 66 | 65 73 74 20 20 20 20 20 |.X manif|est |
|00001980| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 31 09 0a | | 1..|
|00001990| 58 20 70 61 73 73 77 64 | 20 20 20 20 20 20 20 20 |X passwd| |
|000019a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 31 09 0a 58 | | 1..X|
|000019b0| 20 70 77 5f 66 69 6c 65 | 2e 63 20 20 20 20 20 20 | pw_file|.c |
|000019c0| 20 20 20 20 20 20 20 20 | 20 20 20 31 09 0a 58 20 | | 1..X |
|000019d0| 70 77 5f 6f 70 65 6e 2e | 63 20 20 20 20 20 20 20 |pw_open.|c |
|000019e0| 20 20 20 20 20 20 20 20 | 20 20 31 09 0a 58 20 70 | | 1..X p|
|000019f0| 77 64 2e 68 20 20 20 20 | 20 20 20 20 20 20 20 20 |wd.h | |
|00001a00| 20 20 20 20 20 20 20 20 | 20 31 09 0a 58 20 72 65 | | 1..X re|
|00001a10| 61 64 6d 65 20 20 20 20 | 20 20 20 20 20 20 20 20 |adme | |
|00001a20| 20 20 20 20 20 20 20 20 | 31 09 0a 58 20 73 65 74 | |1..X set|
|00001a30| 70 77 65 6e 74 2e 63 20 | 20 20 20 20 20 20 20 20 |pwent.c | |
|00001a40| 20 20 20 20 20 20 20 31 | 09 0a 58 20 74 65 73 74 | 1|..X test|
|00001a50| 2e 63 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.c | |
|00001a60| 20 20 20 20 20 20 31 09 | 0a 45 4e 44 5f 4f 46 5f | 1.|.END_OF_|
|00001a70| 6d 61 6e 69 66 65 73 74 | 0a 69 66 20 74 65 73 74 |manifest|.if test|
|00001a80| 20 34 38 36 20 2d 6e 65 | 20 60 77 63 20 2d 63 20 | 486 -ne| `wc -c |
|00001a90| 3c 6d 61 6e 69 66 65 73 | 74 60 3b 20 74 68 65 6e |<manifes|t`; then|
|00001aa0| 0a 20 20 20 20 65 63 68 | 6f 20 73 68 61 72 3a 20 |. ech|o shar: |
|00001ab0| 5c 22 6d 61 6e 69 66 65 | 73 74 5c 22 20 75 6e 70 |\"manife|st\" unp|
|00001ac0| 61 63 6b 65 64 20 77 69 | 74 68 20 77 72 6f 6e 67 |acked wi|th wrong|
|00001ad0| 20 73 69 7a 65 21 0a 66 | 69 0a 23 20 65 6e 64 20 | size!.f|i.# end |
|00001ae0| 6f 66 20 6f 76 65 72 77 | 72 69 74 69 6e 67 20 63 |of overw|riting c|
|00001af0| 68 65 63 6b 0a 66 69 0a | 69 66 20 74 65 73 74 20 |heck.fi.|if test |
|00001b00| 2d 66 20 70 61 73 73 77 | 64 20 2d 61 20 22 24 7b |-f passw|d -a "${|
|00001b10| 31 7d 22 20 21 3d 20 22 | 2d 63 22 20 3b 20 74 68 |1}" != "|-c" ; th|
|00001b20| 65 6e 20 0a 20 20 65 63 | 68 6f 20 73 68 61 72 3a |en . ec|ho shar:|
|00001b30| 20 57 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 2d 77 | Will no|t over-w|
|00001b40| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |rite exi|sting fi|
|00001b50| 6c 65 20 5c 22 70 61 73 | 73 77 64 5c 22 0a 65 6c |le \"pas|swd\".el|
|00001b60| 73 65 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 45 78 |se.echo |shar: Ex|
|00001b70| 74 72 61 63 74 69 6e 67 | 20 5c 22 70 61 73 73 77 |tracting| \"passw|
|00001b80| 64 5c 22 20 5c 28 31 34 | 39 20 63 68 61 72 61 63 |d\" \(14|9 charac|
|00001b90| 74 65 72 73 5c 29 0a 73 | 65 64 20 22 73 2f 5e 58 |ters\).s|ed "s/^X|
|00001ba0| 2f 2f 22 20 3e 70 61 73 | 73 77 64 20 3c 3c 27 45 |//" >pas|swd <<'E|
|00001bb0| 4e 44 5f 4f 46 5f 70 61 | 73 73 77 64 27 0a 58 75 |ND_OF_pa|sswd'.Xu|
|00001bc0| 73 65 72 31 3a 70 61 73 | 73 77 6f 72 64 31 3a 31 |ser1:pas|sword1:1|
|00001bd0| 3a 31 31 3a 4a 6f 65 20 | 55 73 65 72 3a 5c 68 6f |:11:Joe |User:\ho|
|00001be0| 6d 65 73 5c 75 73 65 72 | 31 3a 73 68 31 0a 58 75 |mes\user|1:sh1.Xu|
|00001bf0| 73 65 72 32 3a 70 61 73 | 73 77 6f 72 64 32 3a 32 |ser2:pas|sword2:2|
|00001c00| 3a 31 32 3a 4a 6f 65 20 | 55 73 65 72 20 4a 72 2e |:12:Joe |User Jr.|
|00001c10| 3a 5c 68 6f 6d 65 73 5c | 75 73 65 72 32 3a 73 68 |:\homes\|user2:sh|
|00001c20| 32 0a 58 75 73 65 72 33 | 3a 70 61 73 73 77 6f 72 |2.Xuser3|:passwor|
|00001c30| 64 33 3a 33 3a 31 33 3a | 4a 6f 65 20 55 73 65 72 |d3:3:13:|Joe User|
|00001c40| 20 49 49 49 3a 5c 68 6f | 6d 65 73 5c 75 73 65 72 | III:\ho|mes\user|
|00001c50| 33 3a 73 68 33 0a 45 4e | 44 5f 4f 46 5f 70 61 73 |3:sh3.EN|D_OF_pas|
|00001c60| 73 77 64 0a 69 66 20 74 | 65 73 74 20 31 34 39 20 |swd.if t|est 149 |
|00001c70| 2d 6e 65 20 60 77 63 20 | 2d 63 20 3c 70 61 73 73 |-ne `wc |-c <pass|
|00001c80| 77 64 60 3b 20 74 68 65 | 6e 0a 20 20 20 20 65 63 |wd`; the|n. ec|
|00001c90| 68 6f 20 73 68 61 72 3a | 20 5c 22 70 61 73 73 77 |ho shar:| \"passw|
|00001ca0| 64 5c 22 20 75 6e 70 61 | 63 6b 65 64 20 77 69 74 |d\" unpa|cked wit|
|00001cb0| 68 20 77 72 6f 6e 67 20 | 73 69 7a 65 21 0a 66 69 |h wrong |size!.fi|
|00001cc0| 0a 23 20 65 6e 64 20 6f | 66 20 6f 76 65 72 77 72 |.# end o|f overwr|
|00001cd0| 69 74 69 6e 67 20 63 68 | 65 63 6b 0a 66 69 0a 69 |iting ch|eck.fi.i|
|00001ce0| 66 20 74 65 73 74 20 2d | 66 20 70 77 5f 66 69 6c |f test -|f pw_fil|
|00001cf0| 65 2e 63 20 2d 61 20 22 | 24 7b 31 7d 22 20 21 3d |e.c -a "|${1}" !=|
|00001d00| 20 22 2d 63 22 20 3b 20 | 74 68 65 6e 20 0a 20 20 | "-c" ; |then . |
|00001d10| 65 63 68 6f 20 73 68 61 | 72 3a 20 57 69 6c 6c 20 |echo sha|r: Will |
|00001d20| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00001d30| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 5c 22 70 |xisting |file \"p|
|00001d40| 77 5f 66 69 6c 65 2e 63 | 5c 22 0a 65 6c 73 65 0a |w_file.c|\".else.|
|00001d50| 65 63 68 6f 20 73 68 61 | 72 3a 20 45 78 74 72 61 |echo sha|r: Extra|
|00001d60| 63 74 69 6e 67 20 5c 22 | 70 77 5f 66 69 6c 65 2e |cting \"|pw_file.|
|00001d70| 63 5c 22 20 5c 28 32 32 | 32 20 63 68 61 72 61 63 |c\" \(22|2 charac|
|00001d80| 74 65 72 73 5c 29 0a 73 | 65 64 20 22 73 2f 5e 58 |ters\).s|ed "s/^X|
|00001d90| 2f 2f 22 20 3e 70 77 5f | 66 69 6c 65 2e 63 20 3c |//" >pw_|file.c <|
|00001da0| 3c 27 45 4e 44 5f 4f 46 | 5f 70 77 5f 66 69 6c 65 |<'END_OF|_pw_file|
|00001db0| 2e 63 27 0a 58 2f 2a 0a | 58 20 2a 20 20 20 20 20 |.c'.X/*.|X * |
|00001dc0| 20 70 77 5f 66 69 6c 65 | 2e 63 3a 20 47 6c 6f 62 | pw_file|.c: Glob|
|00001dd0| 61 6c 20 76 61 72 69 61 | 62 6c 65 20 66 6f 72 20 |al varia|ble for |
|00001de0| 50 44 20 70 61 73 73 77 | 64 20 6c 69 62 72 61 72 |PD passw|d librar|
|00001df0| 79 0a 58 20 2a 0a 58 20 | 2a 20 20 20 20 20 20 53 |y.X *.X |* S|
|00001e00| 74 65 70 68 65 6e 20 43 | 2e 20 54 72 69 65 72 0a |tephen C|. Trier.|
|00001e10| 58 20 2a 20 20 20 20 20 | 20 4d 61 72 63 68 20 32 |X * | March 2|
|00001e20| 36 2c 20 31 39 39 30 0a | 58 20 2a 0a 58 20 2a 20 |6, 1990.|X *.X * |
|00001e30| 20 20 20 20 20 54 68 69 | 73 20 70 72 6f 67 72 61 | Thi|s progra|
|00001e40| 6d 20 69 73 20 69 6e 20 | 74 68 65 20 70 75 62 6c |m is in |the publ|
|00001e50| 69 63 20 64 6f 6d 61 69 | 6e 0a 58 20 2a 0a 58 20 |ic domai|n.X *.X |
|00001e60| 2a 2f 0a 58 0a 58 23 69 | 6e 63 6c 75 64 65 20 3c |*/.X.X#i|nclude <|
|00001e70| 73 74 64 69 6f 2e 68 3e | 0a 58 23 69 6e 63 6c 75 |stdio.h>|.X#inclu|
|00001e80| 64 65 20 3c 70 77 64 2e | 68 3e 0a 58 0a 58 46 49 |de <pwd.|h>.X.XFI|
|00001e90| 4c 45 20 2a 5f 70 77 5f | 66 69 6c 65 3b 0a 58 0a |LE *_pw_|file;.X.|
|00001ea0| 58 0a 45 4e 44 5f 4f 46 | 5f 70 77 5f 66 69 6c 65 |X.END_OF|_pw_file|
|00001eb0| 2e 63 0a 69 66 20 74 65 | 73 74 20 32 32 32 20 2d |.c.if te|st 222 -|
|00001ec0| 6e 65 20 60 77 63 20 2d | 63 20 3c 70 77 5f 66 69 |ne `wc -|c <pw_fi|
|00001ed0| 6c 65 2e 63 60 3b 20 74 | 68 65 6e 0a 20 20 20 20 |le.c`; t|hen. |
|00001ee0| 65 63 68 6f 20 73 68 61 | 72 3a 20 5c 22 70 77 5f |echo sha|r: \"pw_|
|00001ef0| 66 69 6c 65 2e 63 5c 22 | 20 75 6e 70 61 63 6b 65 |file.c\"| unpacke|
|00001f00| 64 20 77 69 74 68 20 77 | 72 6f 6e 67 20 73 69 7a |d with w|rong siz|
|00001f10| 65 21 0a 66 69 0a 23 20 | 65 6e 64 20 6f 66 20 6f |e!.fi.# |end of o|
|00001f20| 76 65 72 77 72 69 74 69 | 6e 67 20 63 68 65 63 6b |verwriti|ng check|
|00001f30| 0a 66 69 0a 69 66 20 74 | 65 73 74 20 2d 66 20 70 |.fi.if t|est -f p|
|00001f40| 77 5f 6f 70 65 6e 2e 63 | 20 2d 61 20 22 24 7b 31 |w_open.c| -a "${1|
|00001f50| 7d 22 20 21 3d 20 22 2d | 63 22 20 3b 20 74 68 65 |}" != "-|c" ; the|
|00001f60| 6e 20 0a 20 20 65 63 68 | 6f 20 73 68 61 72 3a 20 |n . ech|o shar: |
|00001f70| 57 69 6c 6c 20 6e 6f 74 | 20 6f 76 65 72 2d 77 72 |Will not| over-wr|
|00001f80| 69 74 65 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ite exis|ting fil|
|00001f90| 65 20 5c 22 70 77 5f 6f | 70 65 6e 2e 63 5c 22 0a |e \"pw_o|pen.c\".|
|00001fa0| 65 6c 73 65 0a 65 63 68 | 6f 20 73 68 61 72 3a 20 |else.ech|o shar: |
|00001fb0| 45 78 74 72 61 63 74 69 | 6e 67 20 5c 22 70 77 5f |Extracti|ng \"pw_|
|00001fc0| 6f 70 65 6e 2e 63 5c 22 | 20 5c 28 37 31 30 20 63 |open.c\"| \(710 c|
|00001fd0| 68 61 72 61 63 74 65 72 | 73 5c 29 0a 73 65 64 20 |haracter|s\).sed |
|00001fe0| 22 73 2f 5e 58 2f 2f 22 | 20 3e 70 77 5f 6f 70 65 |"s/^X//"| >pw_ope|
|00001ff0| 6e 2e 63 20 3c 3c 27 45 | 4e 44 5f 4f 46 5f 70 77 |n.c <<'E|ND_OF_pw|
|00002000| 5f 6f 70 65 6e 2e 63 27 | 0a 58 2f 2a 0a 58 20 2a |_open.c'|.X/*.X *|
|00002010| 20 20 20 20 20 20 70 77 | 5f 6f 70 65 6e 2e 63 3a | pw|_open.c:|
|00002020| 20 4f 70 65 6e 20 61 20 | 70 61 73 73 77 6f 72 64 | Open a |password|
|00002030| 20 66 69 6c 65 0a 58 20 | 2a 0a 58 20 2a 20 20 20 | file.X |*.X * |
|00002040| 20 20 20 53 74 65 70 68 | 65 6e 20 43 2e 20 54 72 | Steph|en C. Tr|
|00002050| 69 65 72 0a 58 20 2a 20 | 20 20 20 20 20 4d 61 72 |ier.X * | Mar|
|00002060| 63 68 20 32 36 2c 20 31 | 39 39 30 0a 58 20 2a 0a |ch 26, 1|990.X *.|
|00002070| 58 20 2a 20 20 20 20 20 | 20 54 68 69 73 20 70 72 |X * | This pr|
|00002080| 6f 67 72 61 6d 20 69 73 | 20 69 6e 20 74 68 65 20 |ogram is| in the |
|00002090| 70 75 62 6c 69 63 20 64 | 6f 6d 61 69 6e 0a 58 20 |public d|omain.X |
|000020a0| 2a 0a 58 20 2a 20 20 20 | 20 20 20 70 77 5f 6f 70 |*.X * | pw_op|
|000020b0| 65 6e 66 69 6c 65 20 73 | 68 6f 75 6c 64 20 75 73 |enfile s|hould us|
|000020c0| 75 61 6c 6c 79 20 62 65 | 20 72 65 67 61 72 64 65 |ually be| regarde|
|000020d0| 64 20 61 73 20 61 6e 20 | 69 6e 74 65 72 6e 61 6c |d as an |internal|
|000020e0| 20 66 75 6e 63 74 69 6f | 6e 20 66 6f 72 0a 58 20 | functio|n for.X |
|000020f0| 2a 20 20 20 20 20 20 74 | 68 65 20 75 73 65 20 6f |* t|he use o|
|00002100| 66 20 74 68 65 20 70 61 | 73 73 77 64 20 6c 69 62 |f the pa|sswd lib|
|00002110| 72 61 72 79 20 6f 6e 6c | 79 2e 20 20 48 6f 77 65 |rary onl|y. Howe|
|00002120| 76 65 72 2c 20 69 66 20 | 79 6f 75 72 20 73 6f 66 |ver, if |your sof|
|00002130| 74 77 61 72 65 20 68 61 | 73 0a 58 20 2a 20 20 20 |tware ha|s.X * |
|00002140| 20 20 20 69 74 73 20 6f | 77 6e 20 77 61 79 20 6f | its o|wn way o|
|00002150| 66 20 73 70 65 63 69 66 | 79 69 6e 67 20 74 68 65 |f specif|ying the|
|00002160| 20 6c 6f 63 61 74 69 6f | 6e 20 6f 66 20 74 68 65 | locatio|n of the|
|00002170| 20 70 61 73 73 77 6f 72 | 64 20 66 69 6c 65 2c 20 | passwor|d file, |
|00002180| 79 6f 75 20 6d 61 79 0a | 58 20 2a 20 20 20 20 20 |you may.|X * |
|00002190| 20 77 69 73 68 20 74 6f | 20 75 73 65 20 70 77 5f | wish to| use pw_|
|000021a0| 6f 70 65 6e 66 69 6c 65 | 20 74 6f 20 70 61 73 73 |openfile| to pass|
|000021b0| 20 74 68 61 74 20 6c 6f | 63 61 74 69 6f 6e 20 74 | that lo|cation t|
|000021c0| 6f 20 74 68 65 20 6c 69 | 62 72 61 72 79 2e 0a 58 |o the li|brary..X|
|000021d0| 20 2a 0a 58 20 2a 2f 0a | 58 0a 58 23 69 6e 63 6c | *.X */.|X.X#incl|
|000021e0| 75 64 65 20 3c 73 74 64 | 69 6f 2e 68 3e 0a 58 23 |ude <std|io.h>.X#|
|000021f0| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 6c 69 62 2e |include |<stdlib.|
|00002200| 68 3e 0a 58 23 69 6e 63 | 6c 75 64 65 20 3c 70 77 |h>.X#inc|lude <pw|
|00002210| 64 2e 68 3e 0a 58 0a 58 | 65 78 74 65 72 6e 20 46 |d.h>.X.X|extern F|
|00002220| 49 4c 45 20 2a 5f 70 77 | 5f 66 69 6c 65 3b 0a 58 |ILE *_pw|_file;.X|
|00002230| 0a 58 69 6e 74 20 70 77 | 5f 6f 70 65 6e 66 69 6c |.Xint pw|_openfil|
|00002240| 65 28 63 68 61 72 20 2a | 6e 61 6d 65 29 0a 58 7b |e(char *|name).X{|
|00002250| 0a 58 20 20 20 20 69 66 | 20 28 6e 61 6d 65 20 3d |.X if| (name =|
|00002260| 3d 20 4e 55 4c 4c 29 0a | 58 09 6e 61 6d 65 20 3d |= NULL).|X.name =|
|00002270| 20 67 65 74 65 6e 76 28 | 22 50 41 53 53 57 44 22 | getenv(|"PASSWD"|
|00002280| 29 3b 0a 58 20 20 20 20 | 69 66 20 28 6e 61 6d 65 |);.X |if (name|
|00002290| 20 3d 3d 20 4e 55 4c 4c | 29 0a 58 09 6e 61 6d 65 | == NULL|).X.name|
|000022a0| 20 3d 20 22 5c 5c 65 74 | 63 5c 5c 70 61 73 73 77 | = "\\et|c\\passw|
|000022b0| 64 22 3b 0a 58 20 20 20 | 20 72 65 74 75 72 6e 20 |d";.X | return |
|000022c0| 28 5f 70 77 5f 66 69 6c | 65 20 3d 20 66 6f 70 65 |(_pw_fil|e = fope|
|000022d0| 6e 28 6e 61 6d 65 2c 20 | 22 72 22 29 29 20 21 3d |n(name, |"r")) !=|
|000022e0| 20 4e 55 4c 4c 3b 0a 58 | 7d 0a 58 0a 58 0a 45 4e | NULL;.X|}.X.X.EN|
|000022f0| 44 5f 4f 46 5f 70 77 5f | 6f 70 65 6e 2e 63 0a 69 |D_OF_pw_|open.c.i|
|00002300| 66 20 74 65 73 74 20 37 | 31 30 20 2d 6e 65 20 60 |f test 7|10 -ne `|
|00002310| 77 63 20 2d 63 20 3c 70 | 77 5f 6f 70 65 6e 2e 63 |wc -c <p|w_open.c|
|00002320| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00002330| 20 73 68 61 72 3a 20 5c | 22 70 77 5f 6f 70 65 6e | shar: \|"pw_open|
|00002340| 2e 63 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |.c\" unp|acked wi|
|00002350| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|00002360| 69 0a 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i.# end |of overw|
|00002370| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 66 69 0a |riting c|heck.fi.|
|00002380| 69 66 20 74 65 73 74 20 | 2d 66 20 70 77 64 2e 68 |if test |-f pwd.h|
|00002390| 20 2d 61 20 22 24 7b 31 | 7d 22 20 21 3d 20 22 2d | -a "${1|}" != "-|
|000023a0| 63 22 20 3b 20 74 68 65 | 6e 20 0a 20 20 65 63 68 |c" ; the|n . ech|
|000023b0| 6f 20 73 68 61 72 3a 20 | 57 69 6c 6c 20 6e 6f 74 |o shar: |Will not|
|000023c0| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|000023d0| 74 69 6e 67 20 66 69 6c | 65 20 5c 22 70 77 64 2e |ting fil|e \"pwd.|
|000023e0| 68 5c 22 0a 65 6c 73 65 | 0a 65 63 68 6f 20 73 68 |h\".else|.echo sh|
|000023f0| 61 72 3a 20 45 78 74 72 | 61 63 74 69 6e 67 20 5c |ar: Extr|acting \|
|00002400| 22 70 77 64 2e 68 5c 22 | 20 5c 28 31 30 35 34 20 |"pwd.h\"| \(1054 |
|00002410| 63 68 61 72 61 63 74 65 | 72 73 5c 29 0a 73 65 64 |characte|rs\).sed|
|00002420| 20 22 73 2f 5e 58 2f 2f | 22 20 3e 70 77 64 2e 68 | "s/^X//|" >pwd.h|
|00002430| 20 3c 3c 27 45 4e 44 5f | 4f 46 5f 70 77 64 2e 68 | <<'END_|OF_pwd.h|
|00002440| 27 0a 58 2f 2a 0a 58 20 | 2a 20 20 20 20 20 20 70 |'.X/*.X |* p|
|00002450| 77 64 2e 68 3a 20 70 61 | 73 73 77 6f 72 64 20 66 |wd.h: pa|ssword f|
|00002460| 75 6e 63 74 69 6f 6e 20 | 68 65 61 64 65 72 20 66 |unction |header f|
|00002470| 69 6c 65 0a 58 20 2a 0a | 58 20 2a 20 20 20 20 20 |ile.X *.|X * |
|00002480| 20 53 74 65 70 68 65 6e | 20 43 2e 20 54 72 69 65 | Stephen| C. Trie|
|00002490| 72 0a 58 20 2a 20 20 20 | 20 20 20 4d 61 72 63 68 |r.X * | March|
|000024a0| 20 32 36 2c 20 31 39 39 | 30 0a 58 20 2a 0a 58 20 | 26, 199|0.X *.X |
|000024b0| 2a 20 20 20 20 20 20 54 | 68 69 73 20 69 73 20 74 |* T|his is t|
|000024c0| 68 65 20 68 65 61 64 65 | 72 20 66 69 6c 65 20 66 |he heade|r file f|
|000024d0| 6f 72 20 6d 79 20 66 61 | 6d 69 6c 79 20 6f 66 20 |or my fa|mily of |
|000024e0| 70 61 73 73 77 6f 72 64 | 2d 66 69 6c 65 20 66 75 |password|-file fu|
|000024f0| 6e 63 74 69 6f 6e 73 0a | 58 20 2a 20 20 20 20 20 |nctions.|X * |
|00002500| 20 66 6f 72 20 4d 53 2d | 44 4f 53 2e 20 20 49 20 | for MS-|DOS. I |
|00002510| 62 61 73 65 64 20 74 68 | 65 73 65 20 66 75 6e 63 |based th|ese func|
|00002520| 74 69 6f 6e 73 20 6f 6e | 20 69 6e 66 6f 72 6d 61 |tions on| informa|
|00002530| 74 69 6f 6e 20 61 76 61 | 69 6c 61 62 6c 65 20 69 |tion ava|ilable i|
|00002540| 6e 0a 58 20 2a 20 20 20 | 20 20 20 6f 75 72 20 6c |n.X * | our l|
|00002550| 69 62 72 61 72 79 3b 20 | 49 20 64 6f 20 6e 6f 74 |ibrary; |I do not|
|00002560| 20 68 61 76 65 20 61 63 | 63 65 73 73 20 74 6f 20 | have ac|cess to |
|00002570| 61 6e 79 20 72 65 73 74 | 72 69 63 74 65 64 20 73 |any rest|ricted s|
|00002580| 6f 75 72 63 65 20 63 6f | 64 65 2e 0a 58 20 2a 20 |ource co|de..X * |
|00002590| 20 20 20 20 20 54 68 65 | 72 65 66 6f 72 65 2c 20 | The|refore, |
|000025a0| 74 68 65 73 65 20 66 75 | 6e 63 74 69 6f 6e 73 20 |these fu|nctions |
|000025b0| 61 72 65 20 69 6e 20 74 | 68 65 20 70 75 62 6c 69 |are in t|he publi|
|000025c0| 63 20 64 6f 6d 61 69 6e | 2e 0a 58 20 2a 0a 58 20 |c domain|..X *.X |
|000025d0| 2a 20 20 20 20 20 20 54 | 68 69 73 20 69 6d 70 6c |* T|his impl|
|000025e0| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 6f 66 20 67 65 |ementati|on of ge|
|000025f0| 74 70 77 65 6e 74 28 29 | 20 61 6e 64 20 66 72 69 |tpwent()| and fri|
|00002600| 65 6e 64 73 20 73 68 6f | 75 6c 64 20 62 65 20 70 |ends sho|uld be p|
|00002610| 72 65 74 74 79 0a 58 20 | 2a 20 20 20 20 20 20 6d |retty.X |* m|
|00002620| 75 63 68 20 63 6f 6d 70 | 61 74 69 62 6c 65 20 77 |uch comp|atible w|
|00002630| 69 74 68 20 74 68 65 20 | 42 53 44 20 69 6d 70 6c |ith the |BSD impl|
|00002640| 65 6d 65 6e 74 61 74 69 | 6f 6e 2e 20 20 53 6f 6d |ementati|on. Som|
|00002650| 65 20 6c 69 74 74 6c 65 | 2d 75 73 65 64 0a 58 20 |e little|-used.X |
|00002660| 2a 20 20 20 20 20 20 66 | 65 61 74 75 72 65 73 20 |* f|eatures |
|00002670| 6d 61 79 20 68 61 76 65 | 20 62 65 65 6e 20 6f 6d |may have| been om|
|00002680| 69 74 74 65 64 2c 20 62 | 75 74 20 79 6f 75 27 76 |itted, b|ut you'v|
|00002690| 65 20 67 6f 74 20 74 68 | 65 20 73 6f 75 72 63 65 |e got th|e source|
|000026a0| 20 61 6e 64 0a 58 20 2a | 20 20 20 20 20 20 79 6f | and.X *| yo|
|000026b0| 75 20 61 72 65 20 77 65 | 6c 63 6f 6d 65 20 74 6f |u are we|lcome to|
|000026c0| 20 61 64 64 20 77 68 61 | 74 65 76 65 72 20 66 65 | add wha|tever fe|
|000026d0| 61 74 75 72 65 73 20 79 | 6f 75 20 6e 65 65 64 2e |atures y|ou need.|
|000026e0| 0a 58 20 2a 0a 58 20 2a | 2f 0a 58 0a 58 73 74 72 |.X *.X *|/.X.Xstr|
|000026f0| 75 63 74 20 70 61 73 73 | 77 64 20 7b 0a 58 20 20 |uct pass|wd {.X |
|00002700| 20 20 63 68 61 72 20 70 | 77 5f 6e 61 6d 65 5b 31 | char p|w_name[1|
|00002710| 32 5d 3b 0a 58 20 20 20 | 20 63 68 61 72 20 70 77 |2];.X | char pw|
|00002720| 5f 70 61 73 73 77 64 5b | 31 32 5d 3b 0a 58 20 20 |_passwd[|12];.X |
|00002730| 20 20 69 6e 74 20 70 77 | 5f 75 69 64 3b 0a 58 20 | int pw|_uid;.X |
|00002740| 20 20 20 69 6e 74 20 70 | 77 5f 67 69 64 3b 0a 58 | int p|w_gid;.X|
|00002750| 20 20 20 20 63 68 61 72 | 20 70 77 5f 67 65 63 6f | char| pw_geco|
|00002760| 73 5b 38 30 5d 3b 0a 58 | 20 20 20 20 63 68 61 72 |s[80];.X| char|
|00002770| 20 70 77 5f 64 69 72 5b | 38 30 5d 3b 0a 58 20 20 | pw_dir[|80];.X |
|00002780| 20 20 63 68 61 72 20 70 | 77 5f 73 68 65 6c 6c 5b | char p|w_shell[|
|00002790| 38 30 5d 3b 0a 58 20 20 | 20 20 7d 20 3b 0a 58 0a |80];.X | } ;.X.|
|000027a0| 58 73 74 72 75 63 74 20 | 70 61 73 73 77 64 20 2a |Xstruct |passwd *|
|000027b0| 67 65 74 70 77 65 6e 74 | 28 76 6f 69 64 29 3b 0a |getpwent|(void);.|
|000027c0| 58 73 74 72 75 63 74 20 | 70 61 73 73 77 64 20 2a |Xstruct |passwd *|
|000027d0| 67 65 74 70 77 75 69 64 | 28 69 6e 74 20 69 64 29 |getpwuid|(int id)|
|000027e0| 3b 0a 58 73 74 72 75 63 | 74 20 70 61 73 73 77 64 |;.Xstruc|t passwd|
|000027f0| 20 2a 67 65 74 70 77 6e | 61 6d 28 63 68 61 72 20 | *getpwn|am(char |
|00002800| 2a 6e 61 6d 29 3b 0a 58 | 69 6e 74 20 73 65 74 70 |*nam);.X|int setp|
|00002810| 77 65 6e 74 28 76 6f 69 | 64 29 3b 0a 58 69 6e 74 |went(voi|d);.Xint|
|00002820| 20 65 6e 64 70 77 65 6e | 74 28 76 6f 69 64 29 3b | endpwen|t(void);|
|00002830| 0a 58 69 6e 74 20 70 77 | 5f 6f 70 65 6e 66 69 6c |.Xint pw|_openfil|
|00002840| 65 28 63 68 61 72 20 2a | 6e 61 6d 65 29 3b 20 20 |e(char *|name); |
|00002850| 2f 2a 20 53 70 65 63 69 | 66 79 20 61 20 66 69 6c |/* Speci|fy a fil|
|00002860| 65 6e 61 6d 65 20 74 6f | 20 75 73 65 20 66 6f 72 |ename to| use for|
|00002870| 20 70 61 73 73 77 6f 72 | 64 20 66 69 6c 65 20 2a | passwor|d file *|
|00002880| 2f 0a 45 4e 44 5f 4f 46 | 5f 70 77 64 2e 68 0a 69 |/.END_OF|_pwd.h.i|
|00002890| 66 20 74 65 73 74 20 31 | 30 35 34 20 2d 6e 65 20 |f test 1|054 -ne |
|000028a0| 60 77 63 20 2d 63 20 3c | 70 77 64 2e 68 60 3b 20 |`wc -c <|pwd.h`; |
|000028b0| 74 68 65 6e 0a 20 20 20 | 20 65 63 68 6f 20 73 68 |then. | echo sh|
|000028c0| 61 72 3a 20 5c 22 70 77 | 64 2e 68 5c 22 20 75 6e |ar: \"pw|d.h\" un|
|000028d0| 70 61 63 6b 65 64 20 77 | 69 74 68 20 77 72 6f 6e |packed w|ith wron|
|000028e0| 67 20 73 69 7a 65 21 0a | 66 69 0a 23 20 65 6e 64 |g size!.|fi.# end|
|000028f0| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|00002900| 63 68 65 63 6b 0a 66 69 | 0a 69 66 20 74 65 73 74 |check.fi|.if test|
|00002910| 20 2d 66 20 72 65 61 64 | 6d 65 20 2d 61 20 22 24 | -f read|me -a "$|
|00002920| 7b 31 7d 22 20 21 3d 20 | 22 2d 63 22 20 3b 20 74 |{1}" != |"-c" ; t|
|00002930| 68 65 6e 20 0a 20 20 65 | 63 68 6f 20 73 68 61 72 |hen . e|cho shar|
|00002940| 3a 20 57 69 6c 6c 20 6e | 6f 74 20 6f 76 65 72 2d |: Will n|ot over-|
|00002950| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 20 66 |write ex|isting f|
|00002960| 69 6c 65 20 5c 22 72 65 | 61 64 6d 65 5c 22 0a 65 |ile \"re|adme\".e|
|00002970| 6c 73 65 0a 65 63 68 6f | 20 73 68 61 72 3a 20 45 |lse.echo| shar: E|
|00002980| 78 74 72 61 63 74 69 6e | 67 20 5c 22 72 65 61 64 |xtractin|g \"read|
|00002990| 6d 65 5c 22 20 5c 28 32 | 37 34 32 20 63 68 61 72 |me\" \(2|742 char|
|000029a0| 61 63 74 65 72 73 5c 29 | 0a 73 65 64 20 22 73 2f |acters\)|.sed "s/|
|000029b0| 5e 58 2f 2f 22 20 3e 72 | 65 61 64 6d 65 20 3c 3c |^X//" >r|eadme <<|
|000029c0| 27 45 4e 44 5f 4f 46 5f | 72 65 61 64 6d 65 27 0a |'END_OF_|readme'.|
|000029d0| 58 09 09 09 20 20 20 20 | 20 4d 53 2d 44 4f 53 20 |X... | MS-DOS |
|000029e0| 70 61 73 73 77 64 20 6c | 69 62 72 61 72 79 0a 58 |passwd l|ibrary.X|
|000029f0| 09 09 09 20 20 20 20 20 | 20 20 53 74 65 70 68 65 |... | Stephe|
|00002a00| 6e 20 43 2e 20 54 72 69 | 65 72 0a 58 0a 58 20 20 |n C. Tri|er.X.X |
|00002a10| 20 20 20 49 6e 20 74 68 | 65 20 70 72 6f 63 65 73 | In th|e proces|
|00002a20| 73 20 6f 66 20 70 6f 72 | 74 69 6e 67 20 55 4e 49 |s of por|ting UNI|
|00002a30| 58 20 73 6f 66 74 77 61 | 72 65 20 74 6f 20 4d 53 |X softwa|re to MS|
|00002a40| 2d 44 4f 53 2c 20 65 73 | 70 65 63 69 61 6c 6c 79 |-DOS, es|pecially|
|00002a50| 20 6e 65 77 73 20 61 6e | 64 0a 58 6d 61 69 6c 20 | news an|d.Xmail |
|00002a60| 70 61 63 6b 61 67 65 73 | 2c 20 49 27 76 65 20 72 |packages|, I've r|
|00002a70| 75 6e 20 69 6e 74 6f 20 | 61 20 6e 65 65 64 20 66 |un into |a need f|
|00002a80| 6f 72 20 74 68 65 20 55 | 4e 49 58 2d 73 74 79 6c |or the U|NIX-styl|
|00002a90| 65 20 70 61 73 73 77 6f | 72 64 20 66 69 6c 65 0a |e passwo|rd file.|
|00002aa0| 58 66 75 6e 63 74 69 6f | 6e 73 2e 20 20 54 68 69 |Xfunctio|ns. Thi|
|00002ab0| 73 20 74 69 6d 65 20 49 | 20 63 6f 75 6c 64 6e 27 |s time I| couldn'|
|00002ac0| 74 20 66 69 6e 64 20 61 | 20 64 69 66 66 65 72 65 |t find a| differe|
|00002ad0| 6e 74 20 77 61 79 20 6f | 75 74 2c 20 73 6f 20 49 |nt way o|ut, so I|
|00002ae0| 20 77 68 69 70 70 65 64 | 20 75 70 0a 58 74 68 65 | whipped| up.Xthe|
|00002af0| 73 65 20 66 75 6e 63 74 | 69 6f 6e 73 2e 20 20 54 |se funct|ions. T|
|00002b00| 68 65 79 20 61 72 65 6e | 27 74 20 73 65 63 75 72 |hey aren|'t secur|
|00002b10| 65 2c 20 61 6e 64 20 74 | 68 65 79 20 61 72 65 6e |e, and t|hey aren|
|00002b20| 27 74 20 69 6e 74 65 6e | 64 65 64 20 74 6f 20 62 |'t inten|ded to b|
|00002b30| 65 2e 20 20 49 6e 73 74 | 65 61 64 2c 0a 58 74 68 |e. Inst|ead,.Xth|
|00002b40| 65 79 20 61 72 65 20 6d | 65 61 6e 74 20 74 6f 20 |ey are m|eant to |
|00002b50| 61 63 63 65 73 73 20 74 | 68 65 20 73 65 63 6f 6e |access t|he secon|
|00002b60| 64 20 66 75 6e 63 74 69 | 6f 6e 20 6f 66 20 74 68 |d functi|on of th|
|00002b70| 65 20 55 4e 49 58 20 70 | 61 73 73 77 64 20 66 69 |e UNIX p|asswd fi|
|00002b80| 6c 65 2c 20 77 68 69 63 | 68 20 69 73 0a 58 74 6f |le, whic|h is.Xto|
|00002b90| 20 63 6f 6e 74 61 69 6e | 20 69 6e 66 6f 72 6d 61 | contain| informa|
|00002ba0| 74 69 6f 6e 20 61 62 6f | 75 74 20 76 61 72 69 6f |tion abo|ut vario|
|00002bb0| 75 73 20 75 73 65 72 73 | 2e 20 20 54 68 69 73 20 |us users|. This |
|00002bc0| 74 68 65 79 20 73 68 6f | 75 6c 64 20 64 6f 20 77 |they sho|uld do w|
|00002bd0| 65 6c 6c 2e 0a 58 0a 58 | 20 20 20 20 20 49 20 63 |ell..X.X| I c|
|00002be0| 61 6e 6e 6f 74 20 67 75 | 61 72 61 6e 74 65 65 20 |annot gu|arantee |
|00002bf0| 74 68 61 74 20 74 68 65 | 73 65 20 66 75 6e 63 74 |that the|se funct|
|00002c00| 69 6f 6e 73 20 61 72 65 | 20 61 20 77 6f 6e 64 65 |ions are| a wonde|
|00002c10| 72 66 75 6c 6c 79 20 65 | 78 61 63 74 20 63 6c 6f |rfully e|xact clo|
|00002c20| 6e 65 20 6f 66 0a 58 74 | 68 65 20 55 4e 49 58 20 |ne of.Xt|he UNIX |
|00002c30| 76 65 72 73 69 6f 6e 73 | 3b 20 74 68 65 72 65 20 |versions|; there |
|00002c40| 6d 61 79 20 65 76 65 6e | 20 62 65 20 73 6f 6d 65 |may even| be some|
|00002c50| 20 62 69 67 20 64 69 66 | 66 65 72 65 6e 63 65 73 | big dif|ferences|
|00002c60| 2e 20 20 54 68 69 73 20 | 69 73 20 62 65 63 61 75 |. This |is becau|
|00002c70| 73 65 20 49 0a 58 68 61 | 76 65 20 6e 6f 20 72 65 |se I.Xha|ve no re|
|00002c80| 61 6c 20 64 6f 63 75 6d | 65 6e 74 61 74 69 6f 6e |al docum|entation|
|00002c90| 20 61 76 61 69 6c 61 62 | 6c 65 20 61 62 6f 75 74 | availab|le about|
|00002ca0| 20 74 68 65 20 55 4e 49 | 58 20 76 65 72 73 69 6f | the UNI|X versio|
|00002cb0| 6e 73 2e 20 20 48 6f 77 | 65 76 65 72 2c 20 74 68 |ns. How|ever, th|
|00002cc0| 61 74 0a 58 61 6c 73 6f | 20 6d 65 61 6e 73 20 74 |at.Xalso| means t|
|00002cd0| 68 61 74 20 49 20 61 6d | 20 66 72 65 65 20 74 6f |hat I am| free to|
|00002ce0| 20 70 6c 61 63 65 20 6d | 79 20 76 65 72 73 69 6f | place m|y versio|
|00002cf0| 6e 20 69 6e 20 74 68 65 | 20 70 75 62 6c 69 63 20 |n in the| public |
|00002d00| 64 6f 6d 61 69 6e 2e 20 | 20 55 73 65 20 69 74 20 |domain. | Use it |
|00002d10| 61 73 0a 58 79 6f 75 20 | 77 69 73 68 2c 20 61 6e |as.Xyou |wish, an|
|00002d20| 64 20 49 20 77 6f 75 6c | 64 20 62 65 20 71 75 69 |d I woul|d be qui|
|00002d30| 74 65 20 69 6e 74 65 72 | 65 73 74 65 64 20 69 6e |te inter|ested in|
|00002d40| 20 68 65 61 72 69 6e 67 | 20 6f 66 20 61 6e 79 20 | hearing| of any |
|00002d50| 63 68 61 6e 67 65 73 20 | 6f 72 0a 58 69 6d 70 72 |changes |or.Ximpr|
|00002d60| 6f 76 65 6d 65 6e 74 73 | 20 79 6f 75 20 6d 61 6b |ovements| you mak|
|00002d70| 65 2e 0a 58 0a 58 20 20 | 20 20 20 54 68 65 72 65 |e..X.X | There|
|00002d80| 20 69 73 20 61 20 73 69 | 6d 70 6c 65 20 6d 61 6b | is a si|mple mak|
|00002d90| 65 66 69 6c 65 20 69 6e | 63 6c 75 64 65 64 2c 20 |efile in|cluded, |
|00002da0| 62 75 74 20 69 74 20 69 | 73 20 6e 6f 74 20 63 61 |but it i|s not ca|
|00002db0| 70 61 62 6c 65 20 6f 66 | 20 62 75 69 6c 64 69 6e |pable of| buildin|
|00002dc0| 67 0a 58 6d 6f 72 65 20 | 74 68 61 6e 20 6f 6e 65 |g.Xmore |than one|
|00002dd0| 20 6c 69 62 72 61 72 79 | 20 61 74 20 61 20 74 69 | library| at a ti|
|00002de0| 6d 65 2e 20 20 54 68 61 | 74 27 73 20 61 20 62 69 |me. Tha|t's a bi|
|00002df0| 74 20 62 65 79 6f 6e 64 | 20 6d 79 20 6d 61 6b 65 |t beyond| my make|
|00002e00| 66 69 6c 65 2d 77 72 69 | 74 69 6e 67 0a 58 61 62 |file-wri|ting.Xab|
|00002e10| 69 6c 69 74 79 2c 20 73 | 6f 20 69 66 20 79 6f 75 |ility, s|o if you|
|00002e20| 20 77 61 6e 74 20 61 20 | 66 75 6c 6c 79 2d 61 75 | want a |fully-au|
|00002e30| 74 6f 6d 61 74 65 64 2c | 20 77 68 69 7a 2d 62 61 |tomated,| whiz-ba|
|00002e40| 6e 67 20 6d 61 6b 65 66 | 69 6c 65 2c 20 79 6f 75 |ng makef|ile, you|
|00002e50| 27 6c 6c 20 68 61 76 65 | 20 74 6f 0a 58 77 72 69 |'ll have| to.Xwri|
|00002e60| 74 65 20 69 74 20 79 6f | 75 72 73 65 6c 66 2e 20 |te it yo|urself. |
|00002e70| 20 28 49 27 64 20 62 65 | 20 72 61 74 68 65 72 20 | (I'd be| rather |
|00002e80| 69 6e 74 65 72 65 73 74 | 65 64 20 69 6e 20 73 75 |interest|ed in su|
|00002e90| 63 68 20 61 20 62 65 61 | 73 74 2c 20 74 6f 20 74 |ch a bea|st, to t|
|00002ea0| 65 6c 6c 20 74 68 65 0a | 58 74 72 75 74 68 2e 29 |ell the.|Xtruth.)|
|00002eb0| 0a 58 0a 58 20 20 20 20 | 20 48 6f 70 65 20 74 68 |.X.X | Hope th|
|00002ec0| 65 73 65 20 61 72 65 20 | 75 73 65 66 75 6c 20 74 |ese are |useful t|
|00002ed0| 6f 20 79 6f 75 2e 0a 58 | 0a 58 09 20 20 20 20 20 |o you..X|.X. |
|00002ee0| 20 53 74 65 70 68 65 6e | 0a 58 0a 58 0a 58 0a 58 | Stephen|.X.X.X.X|
|00002ef0| 48 6f 77 20 74 6f 20 72 | 65 61 63 68 20 6d 65 20 |How to r|each me |
|00002f00| 62 79 20 65 6d 61 69 6c | 3a 0a 58 20 20 20 73 63 |by email|:.X sc|
|00002f10| 74 25 73 65 6c 64 6f 6e | 40 73 63 6c 2e 63 77 72 |t%seldon|@scl.cwr|
|00002f20| 75 2e 65 64 75 0a 58 20 | 20 20 73 63 74 40 70 6f |u.edu.X | sct@po|
|00002f30| 2e 63 77 72 75 2e 65 64 | 75 20 69 66 20 79 6f 75 |.cwru.ed|u if you|
|00002f40| 72 20 6d 61 69 6c 65 72 | 20 64 6f 65 73 6e 27 74 |r mailer| doesn't|
|00002f50| 20 75 6e 64 65 72 74 61 | 6e 64 20 22 25 22 20 73 | underta|nd "%" s|
|00002f60| 79 6e 74 61 78 2e 0a 58 | 0a 58 0a 58 53 61 6d 70 |yntax..X|.X.XSamp|
|00002f70| 6c 65 20 6f 75 74 70 75 | 74 20 66 72 6f 6d 20 74 |le outpu|t from t|
|00002f80| 68 65 20 74 65 73 74 20 | 70 72 6f 67 72 61 6d 3a |he test |program:|
|00002f90| 0a 58 0a 58 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 20 63 |.X.X----|------ c|
|00002fa0| 75 74 20 68 65 72 65 20 | 2d 2d 2d 2d 2d 2d 2d 2d |ut here |--------|
|00002fb0| 2d 2d 0a 58 4e 61 6d 65 | 3a 20 75 73 65 72 31 20 |--.XName|: user1 |
|00002fc0| 20 50 61 73 73 77 6f 72 | 64 3a 20 70 61 73 73 77 | Passwor|d: passw|
|00002fd0| 6f 72 64 31 20 20 55 73 | 65 72 20 4e 75 6d 3a 20 |ord1 Us|er Num: |
|00002fe0| 31 20 20 47 72 6f 75 70 | 20 4e 75 6d 3a 20 31 31 |1 Group| Num: 11|
|00002ff0| 0a 58 46 75 6c 6c 20 4e | 61 6d 65 3a 20 4a 6f 65 |.XFull N|ame: Joe|
|00003000| 20 55 73 65 72 20 20 48 | 6f 6d 65 20 44 69 72 3a | User H|ome Dir:|
|00003010| 20 5c 68 6f 6d 65 73 5c | 75 73 65 72 31 20 20 53 | \homes\|user1 S|
|00003020| 68 65 6c 6c 3a 20 73 68 | 31 0a 58 0a 58 4e 61 6d |hell: sh|1.X.XNam|
|00003030| 65 3a 20 75 73 65 72 32 | 20 20 50 61 73 73 77 6f |e: user2| Passwo|
|00003040| 72 64 3a 20 70 61 73 73 | 77 6f 72 64 32 20 20 55 |rd: pass|word2 U|
|00003050| 73 65 72 20 4e 75 6d 3a | 20 32 20 20 47 72 6f 75 |ser Num:| 2 Grou|
|00003060| 70 20 4e 75 6d 3a 20 31 | 32 0a 58 46 75 6c 6c 20 |p Num: 1|2.XFull |
|00003070| 4e 61 6d 65 3a 20 4a 6f | 65 20 55 73 65 72 20 4a |Name: Jo|e User J|
|00003080| 72 2e 20 20 48 6f 6d 65 | 20 44 69 72 3a 20 5c 68 |r. Home| Dir: \h|
|00003090| 6f 6d 65 73 5c 75 73 65 | 72 32 20 20 53 68 65 6c |omes\use|r2 Shel|
|000030a0| 6c 3a 20 73 68 32 0a 58 | 0a 58 4e 61 6d 65 3a 20 |l: sh2.X|.XName: |
|000030b0| 75 73 65 72 33 20 20 50 | 61 73 73 77 6f 72 64 3a |user3 P|assword:|
|000030c0| 20 70 61 73 73 77 6f 72 | 64 33 20 20 55 73 65 72 | passwor|d3 User|
|000030d0| 20 4e 75 6d 3a 20 33 20 | 20 47 72 6f 75 70 20 4e | Num: 3 | Group N|
|000030e0| 75 6d 3a 20 31 33 0a 58 | 46 75 6c 6c 20 4e 61 6d |um: 13.X|Full Nam|
|000030f0| 65 3a 20 4a 6f 65 20 55 | 73 65 72 20 49 49 49 20 |e: Joe U|ser III |
|00003100| 20 48 6f 6d 65 20 44 69 | 72 3a 20 5c 68 6f 6d 65 | Home Di|r: \home|
|00003110| 73 5c 75 73 65 72 33 20 | 20 53 68 65 6c 6c 3a 20 |s\user3 | Shell: |
|00003120| 73 68 33 0a 58 0a 58 73 | 65 74 70 77 65 6e 74 20 |sh3.X.Xs|etpwent |
|00003130| 72 65 74 75 72 6e 73 20 | 30 0a 58 4e 61 6d 65 3a |returns |0.XName:|
|00003140| 20 75 73 65 72 31 20 20 | 50 61 73 73 77 6f 72 64 | user1 |Password|
|00003150| 3a 20 70 61 73 73 77 6f | 72 64 31 20 20 55 73 65 |: passwo|rd1 Use|
|00003160| 72 20 4e 75 6d 3a 20 31 | 20 20 47 72 6f 75 70 20 |r Num: 1| Group |
|00003170| 4e 75 6d 3a 20 31 31 0a | 58 46 75 6c 6c 20 4e 61 |Num: 11.|XFull Na|
|00003180| 6d 65 3a 20 4a 6f 65 20 | 55 73 65 72 20 20 48 6f |me: Joe |User Ho|
|00003190| 6d 65 20 44 69 72 3a 20 | 5c 68 6f 6d 65 73 5c 75 |me Dir: |\homes\u|
|000031a0| 73 65 72 31 20 20 53 68 | 65 6c 6c 3a 20 73 68 31 |ser1 Sh|ell: sh1|
|000031b0| 0a 58 0a 58 4e 61 6d 65 | 3a 20 75 73 65 72 32 20 |.X.XName|: user2 |
|000031c0| 20 50 61 73 73 77 6f 72 | 64 3a 20 70 61 73 73 77 | Passwor|d: passw|
|000031d0| 6f 72 64 32 20 20 55 73 | 65 72 20 4e 75 6d 3a 20 |ord2 Us|er Num: |
|000031e0| 32 20 20 47 72 6f 75 70 | 20 4e 75 6d 3a 20 31 32 |2 Group| Num: 12|
|000031f0| 0a 58 46 75 6c 6c 20 4e | 61 6d 65 3a 20 4a 6f 65 |.XFull N|ame: Joe|
|00003200| 20 55 73 65 72 20 4a 72 | 2e 20 20 48 6f 6d 65 20 | User Jr|. Home |
|00003210| 44 69 72 3a 20 5c 68 6f | 6d 65 73 5c 75 73 65 72 |Dir: \ho|mes\user|
|00003220| 32 20 20 53 68 65 6c 6c | 3a 20 73 68 32 0a 58 0a |2 Shell|: sh2.X.|
|00003230| 58 4e 61 6d 65 3a 20 75 | 73 65 72 33 20 20 50 61 |XName: u|ser3 Pa|
|00003240| 73 73 77 6f 72 64 3a 20 | 70 61 73 73 77 6f 72 64 |ssword: |password|
|00003250| 33 20 20 55 73 65 72 20 | 4e 75 6d 3a 20 33 20 20 |3 User |Num: 3 |
|00003260| 47 72 6f 75 70 20 4e 75 | 6d 3a 20 31 33 0a 58 46 |Group Nu|m: 13.XF|
|00003270| 75 6c 6c 20 4e 61 6d 65 | 3a 20 4a 6f 65 20 55 73 |ull Name|: Joe Us|
|00003280| 65 72 20 49 49 49 20 20 | 48 6f 6d 65 20 44 69 72 |er III |Home Dir|
|00003290| 3a 20 5c 68 6f 6d 65 73 | 5c 75 73 65 72 33 20 20 |: \homes|\user3 |
|000032a0| 53 68 65 6c 6c 3a 20 73 | 68 33 0a 58 0a 58 73 65 |Shell: s|h3.X.Xse|
|000032b0| 74 70 77 65 6e 74 20 72 | 65 74 75 72 6e 73 20 30 |tpwent r|eturns 0|
|000032c0| 0a 58 46 69 6e 64 69 6e | 67 20 75 73 65 72 33 3a |.XFindin|g user3:|
|000032d0| 20 75 73 65 72 33 0a 58 | 46 69 6e 64 69 6e 67 20 | user3.X|Finding |
|000032e0| 75 73 65 72 31 3a 20 75 | 73 65 72 31 0a 58 46 69 |user1: u|ser1.XFi|
|000032f0| 6e 64 69 6e 67 20 75 73 | 65 72 32 3a 20 75 73 65 |nding us|er2: use|
|00003300| 72 32 0a 58 46 69 6e 64 | 69 6e 67 20 75 73 65 72 |r2.XFind|ing user|
|00003310| 34 3a 20 4e 55 4c 4c 20 | 20 28 53 68 6f 75 6c 64 |4: NULL | (Should|
|00003320| 20 62 65 20 4e 55 4c 4c | 29 0a 58 0a 58 46 69 6e | be NULL|).X.XFin|
|00003330| 64 69 6e 67 20 75 73 65 | 72 20 69 64 20 32 3a 20 |ding use|r id 2: |
|00003340| 75 73 65 72 32 0a 58 46 | 69 6e 64 69 6e 67 20 75 |user2.XF|inding u|
|00003350| 73 65 72 20 69 64 20 31 | 3a 20 75 73 65 72 31 0a |ser id 1|: user1.|
|00003360| 58 46 69 6e 64 69 6e 67 | 20 75 73 65 72 20 69 64 |XFinding| user id|
|00003370| 20 33 3a 20 75 73 65 72 | 33 0a 58 46 69 6e 64 69 | 3: user|3.XFindi|
|00003380| 6e 67 20 75 73 65 72 20 | 69 64 20 34 3a 20 4e 55 |ng user |id 4: NU|
|00003390| 4c 4c 20 20 28 53 68 6f | 75 6c 64 20 62 65 20 4e |LL (Sho|uld be N|
|000033a0| 55 4c 4c 29 0a 58 0a 58 | 65 6e 64 70 77 65 6e 74 |ULL).X.X|endpwent|
|000033b0| 20 72 65 74 75 72 6e 73 | 20 30 0a 58 2d 2d 2d 2d | returns| 0.X----|
|000033c0| 2d 2d 2d 2d 2d 20 63 75 | 74 20 68 65 72 65 20 2d |----- cu|t here -|
|000033d0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 58 0a 58 52 65 6d 65 |--------|.X.XReme|
|000033e0| 6d 62 65 72 20 74 68 61 | 74 20 69 6e 20 6f 72 64 |mber tha|t in ord|
|000033f0| 65 72 20 74 6f 20 67 65 | 74 20 74 68 69 73 20 6f |er to ge|t this o|
|00003400| 75 74 70 75 74 2c 20 6f | 6e 65 20 6f 66 20 74 68 |utput, o|ne of th|
|00003410| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6d 75 73 74 |e follow|ing must|
|00003420| 20 62 65 20 74 72 75 65 | 3a 0a 58 28 31 29 20 74 | be true|:.X(1) t|
|00003430| 68 65 20 69 6e 63 6c 75 | 64 65 64 20 22 70 61 73 |he inclu|ded "pas|
|00003440| 73 77 64 22 20 66 69 6c | 65 20 69 73 20 69 6e 20 |swd" fil|e is in |
|00003450| 5c 65 74 63 5c 70 61 73 | 73 77 64 2c 20 6f 72 20 |\etc\pas|swd, or |
|00003460| 28 32 29 20 74 68 65 20 | 24 50 41 53 53 57 44 0a |(2) the |$PASSWD.|
|00003470| 58 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 76 61 72 |Xenviron|ment var|
|00003480| 69 61 62 6c 65 20 6d 75 | 73 74 20 70 6f 69 6e 74 |iable mu|st point|
|00003490| 20 74 6f 20 69 74 73 20 | 6c 6f 63 61 74 69 6f 6e | to its |location|
|000034a0| 2e 20 20 28 73 65 74 20 | 50 41 53 53 57 44 3d 70 |. (set |PASSWD=p|
|000034b0| 61 73 73 77 64 20 69 73 | 0a 58 70 72 6f 62 61 62 |asswd is|.Xprobab|
|000034c0| 6c 79 20 73 75 66 66 69 | 63 69 65 6e 74 2e 29 0a |ly suffi|cient.).|
|000034d0| 45 4e 44 5f 4f 46 5f 72 | 65 61 64 6d 65 0a 69 66 |END_OF_r|eadme.if|
|000034e0| 20 74 65 73 74 20 32 37 | 34 32 20 2d 6e 65 20 60 | test 27|42 -ne `|
|000034f0| 77 63 20 2d 63 20 3c 72 | 65 61 64 6d 65 60 3b 20 |wc -c <r|eadme`; |
|00003500| 74 68 65 6e 0a 20 20 20 | 20 65 63 68 6f 20 73 68 |then. | echo sh|
|00003510| 61 72 3a 20 5c 22 72 65 | 61 64 6d 65 5c 22 20 75 |ar: \"re|adme\" u|
|00003520| 6e 70 61 63 6b 65 64 20 | 77 69 74 68 20 77 72 6f |npacked |with wro|
|00003530| 6e 67 20 73 69 7a 65 21 | 0a 66 69 0a 23 20 65 6e |ng size!|.fi.# en|
|00003540| 64 20 6f 66 20 6f 76 65 | 72 77 72 69 74 69 6e 67 |d of ove|rwriting|
|00003550| 20 63 68 65 63 6b 0a 66 | 69 0a 69 66 20 74 65 73 | check.f|i.if tes|
|00003560| 74 20 2d 66 20 73 65 74 | 70 77 65 6e 74 2e 63 20 |t -f set|pwent.c |
|00003570| 2d 61 20 22 24 7b 31 7d | 22 20 21 3d 20 22 2d 63 |-a "${1}|" != "-c|
|00003580| 22 20 3b 20 74 68 65 6e | 20 0a 20 20 65 63 68 6f |" ; then| . echo|
|00003590| 20 73 68 61 72 3a 20 57 | 69 6c 6c 20 6e 6f 74 20 | shar: W|ill not |
|000035a0| 6f 76 65 72 2d 77 72 69 | 74 65 20 65 78 69 73 74 |over-wri|te exist|
|000035b0| 69 6e 67 20 66 69 6c 65 | 20 5c 22 73 65 74 70 77 |ing file| \"setpw|
|000035c0| 65 6e 74 2e 63 5c 22 0a | 65 6c 73 65 0a 65 63 68 |ent.c\".|else.ech|
|000035d0| 6f 20 73 68 61 72 3a 20 | 45 78 74 72 61 63 74 69 |o shar: |Extracti|
|000035e0| 6e 67 20 5c 22 73 65 74 | 70 77 65 6e 74 2e 63 5c |ng \"set|pwent.c\|
|000035f0| 22 20 5c 28 33 35 33 20 | 63 68 61 72 61 63 74 65 |" \(353 |characte|
|00003600| 72 73 5c 29 0a 73 65 64 | 20 22 73 2f 5e 58 2f 2f |rs\).sed| "s/^X//|
|00003610| 22 20 3e 73 65 74 70 77 | 65 6e 74 2e 63 20 3c 3c |" >setpw|ent.c <<|
|00003620| 27 45 4e 44 5f 4f 46 5f | 73 65 74 70 77 65 6e 74 |'END_OF_|setpwent|
|00003630| 2e 63 27 0a 58 2f 2a 0a | 58 20 2a 20 20 20 20 20 |.c'.X/*.|X * |
|00003640| 20 73 65 74 70 77 65 6e | 74 2e 63 3a 20 52 65 77 | setpwen|t.c: Rew|
|00003650| 69 6e 64 20 70 61 73 73 | 77 6f 72 64 20 66 69 6c |ind pass|word fil|
|00003660| 65 20 74 6f 20 62 65 67 | 69 6e 6e 69 6e 67 20 66 |e to beg|inning f|
|00003670| 6f 72 20 67 65 74 70 77 | 65 6e 74 28 29 0a 58 20 |or getpw|ent().X |
|00003680| 2a 0a 58 20 2a 20 20 20 | 20 20 20 53 74 65 70 68 |*.X * | Steph|
|00003690| 65 6e 20 43 2e 20 54 72 | 69 65 72 0a 58 20 2a 20 |en C. Tr|ier.X * |
|000036a0| 20 20 20 20 20 4d 61 72 | 63 68 20 32 36 2c 20 31 | Mar|ch 26, 1|
|000036b0| 39 39 30 0a 58 20 2a 0a | 58 20 2a 20 20 20 20 20 |990.X *.|X * |
|000036c0| 20 54 68 69 73 20 70 72 | 6f 67 72 61 6d 20 69 73 | This pr|ogram is|
|000036d0| 20 69 6e 20 74 68 65 20 | 70 75 62 6c 69 63 20 64 | in the |public d|
|000036e0| 6f 6d 61 69 6e 0a 58 20 | 2a 0a 58 20 2a 2f 0a 58 |omain.X |*.X */.X|
|000036f0| 0a 58 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 69 |.X#inclu|de <stdi|
|00003700| 6f 2e 68 3e 0a 58 23 69 | 6e 63 6c 75 64 65 20 3c |o.h>.X#i|nclude <|
|00003710| 70 77 64 2e 68 3e 0a 58 | 0a 58 65 78 74 65 72 6e |pwd.h>.X|.Xextern|
|00003720| 20 46 49 4c 45 20 2a 5f | 70 77 5f 66 69 6c 65 3b | FILE *_|pw_file;|
|00003730| 0a 58 0a 58 69 6e 74 20 | 73 65 74 70 77 65 6e 74 |.X.Xint |setpwent|
|00003740| 28 76 6f 69 64 29 0a 58 | 7b 0a 58 20 20 20 20 69 |(void).X|{.X i|
|00003750| 66 20 28 5f 70 77 5f 66 | 69 6c 65 20 3d 3d 20 4e |f (_pw_f|ile == N|
|00003760| 55 4c 4c 29 0a 58 09 70 | 77 5f 6f 70 65 6e 66 69 |ULL).X.p|w_openfi|
|00003770| 6c 65 28 4e 55 4c 4c 29 | 3b 0a 58 20 20 20 20 72 |le(NULL)|;.X r|
|00003780| 65 74 75 72 6e 20 66 73 | 65 65 6b 28 5f 70 77 5f |eturn fs|eek(_pw_|
|00003790| 66 69 6c 65 2c 20 30 4c | 2c 20 53 45 45 4b 5f 53 |file, 0L|, SEEK_S|
|000037a0| 45 54 29 3b 0a 58 7d 0a | 58 0a 58 0a 45 4e 44 5f |ET);.X}.|X.X.END_|
|000037b0| 4f 46 5f 73 65 74 70 77 | 65 6e 74 2e 63 0a 69 66 |OF_setpw|ent.c.if|
|000037c0| 20 74 65 73 74 20 33 35 | 33 20 2d 6e 65 20 60 77 | test 35|3 -ne `w|
|000037d0| 63 20 2d 63 20 3c 73 65 | 74 70 77 65 6e 74 2e 63 |c -c <se|tpwent.c|
|000037e0| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|000037f0| 20 73 68 61 72 3a 20 5c | 22 73 65 74 70 77 65 6e | shar: \|"setpwen|
|00003800| 74 2e 63 5c 22 20 75 6e | 70 61 63 6b 65 64 20 77 |t.c\" un|packed w|
|00003810| 69 74 68 20 77 72 6f 6e | 67 20 73 69 7a 65 21 0a |ith wron|g size!.|
|00003820| 66 69 0a 23 20 65 6e 64 | 20 6f 66 20 6f 76 65 72 |fi.# end| of over|
|00003830| 77 72 69 74 69 6e 67 20 | 63 68 65 63 6b 0a 66 69 |writing |check.fi|
|00003840| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 74 65 73 74 |.if test| -f test|
|00003850| 2e 63 20 2d 61 20 22 24 | 7b 31 7d 22 20 21 3d 20 |.c -a "$|{1}" != |
|00003860| 22 2d 63 22 20 3b 20 74 | 68 65 6e 20 0a 20 20 65 |"-c" ; t|hen . e|
|00003870| 63 68 6f 20 73 68 61 72 | 3a 20 57 69 6c 6c 20 6e |cho shar|: Will n|
|00003880| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|00003890| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 5c 22 74 65 |isting f|ile \"te|
|000038a0| 73 74 2e 63 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |st.c\".e|lse.echo|
|000038b0| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|000038c0| 67 20 5c 22 74 65 73 74 | 2e 63 5c 22 20 5c 28 31 |g \"test|.c\" \(1|
|000038d0| 33 38 36 20 63 68 61 72 | 61 63 74 65 72 73 5c 29 |386 char|acters\)|
|000038e0| 0a 73 65 64 20 22 73 2f | 5e 58 2f 2f 22 20 3e 74 |.sed "s/|^X//" >t|
|000038f0| 65 73 74 2e 63 20 3c 3c | 27 45 4e 44 5f 4f 46 5f |est.c <<|'END_OF_|
|00003900| 74 65 73 74 2e 63 27 0a | 58 2f 2a 0a 58 20 2a 20 |test.c'.|X/*.X * |
|00003910| 20 20 20 20 20 74 65 73 | 74 2e 63 3a 20 53 69 6d | tes|t.c: Sim|
|00003920| 70 6c 65 20 74 65 73 74 | 20 70 72 6f 67 72 61 6d |ple test| program|
|00003930| 20 66 6f 72 20 70 61 73 | 73 77 64 20 6c 69 62 72 | for pas|swd libr|
|00003940| 61 72 79 0a 58 20 2a 0a | 58 20 2a 20 20 20 20 20 |ary.X *.|X * |
|00003950| 20 53 74 65 70 68 65 6e | 20 43 2e 20 54 72 69 65 | Stephen| C. Trie|
|00003960| 72 0a 58 20 2a 20 20 20 | 20 20 20 4d 61 72 63 68 |r.X * | March|
|00003970| 20 32 36 2c 20 31 39 39 | 30 0a 58 20 2a 0a 58 20 | 26, 199|0.X *.X |
|00003980| 2a 2f 0a 58 0a 58 23 69 | 6e 63 6c 75 64 65 20 3c |*/.X.X#i|nclude <|
|00003990| 73 74 64 69 6f 2e 68 3e | 0a 58 23 69 6e 63 6c 75 |stdio.h>|.X#inclu|
|000039a0| 64 65 20 3c 70 77 64 2e | 68 3e 0a 58 0a 58 6d 61 |de <pwd.|h>.X.Xma|
|000039b0| 69 6e 28 29 0a 58 7b 0a | 58 20 20 20 20 69 6e 74 |in().X{.|X int|
|000039c0| 20 69 3b 0a 58 20 20 20 | 20 73 74 72 75 63 74 20 | i;.X | struct |
|000039d0| 70 61 73 73 77 64 20 2a | 74 65 6d 70 3b 0a 58 0a |passwd *|temp;.X.|
|000039e0| 58 20 20 20 20 66 6f 72 | 20 28 69 20 3d 20 30 3b |X for| (i = 0;|
|000039f0| 20 69 20 3c 20 32 3b 20 | 69 2b 2b 29 20 20 7b 0a | i < 2; |i++) {.|
|00003a00| 58 09 77 68 69 6c 65 20 | 28 28 74 65 6d 70 20 3d |X.while |((temp =|
|00003a10| 20 67 65 74 70 77 65 6e | 74 28 29 29 20 21 3d 20 | getpwen|t()) != |
|00003a20| 4e 55 4c 4c 29 20 20 7b | 0a 58 09 20 20 20 20 70 |NULL) {|.X. p|
|00003a30| 72 69 6e 74 66 28 22 4e | 61 6d 65 3a 20 25 73 20 |rintf("N|ame: %s |
|00003a40| 20 50 61 73 73 77 6f 72 | 64 3a 20 25 73 20 20 55 | Passwor|d: %s U|
|00003a50| 73 65 72 20 4e 75 6d 3a | 20 25 64 20 20 47 72 6f |ser Num:| %d Gro|
|00003a60| 75 70 20 4e 75 6d 3a 20 | 25 64 5c 6e 22 2c 0a 58 |up Num: |%d\n",.X|
|00003a70| 09 09 20 20 20 20 74 65 | 6d 70 2d 3e 70 77 5f 6e |.. te|mp->pw_n|
|00003a80| 61 6d 65 2c 20 74 65 6d | 70 2d 3e 70 77 5f 70 61 |ame, tem|p->pw_pa|
|00003a90| 73 73 77 64 2c 20 74 65 | 6d 70 2d 3e 70 77 5f 75 |sswd, te|mp->pw_u|
|00003aa0| 69 64 2c 20 74 65 6d 70 | 2d 3e 70 77 5f 67 69 64 |id, temp|->pw_gid|
|00003ab0| 29 3b 0a 58 09 20 20 20 | 20 70 72 69 6e 74 66 28 |);.X. | printf(|
|00003ac0| 22 46 75 6c 6c 20 4e 61 | 6d 65 3a 20 25 73 20 20 |"Full Na|me: %s |
|00003ad0| 48 6f 6d 65 20 44 69 72 | 3a 20 25 73 20 20 53 68 |Home Dir|: %s Sh|
|00003ae0| 65 6c 6c 3a 20 25 73 5c | 6e 5c 6e 22 2c 0a 58 09 |ell: %s\|n\n",.X.|
|00003af0| 09 20 20 20 20 74 65 6d | 70 2d 3e 70 77 5f 67 65 |. tem|p->pw_ge|
|00003b00| 63 6f 73 2c 20 74 65 6d | 70 2d 3e 70 77 5f 64 69 |cos, tem|p->pw_di|
|00003b10| 72 2c 20 74 65 6d 70 2d | 3e 70 77 5f 73 68 65 6c |r, temp-|>pw_shel|
|00003b20| 6c 29 3b 0a 58 09 20 20 | 20 20 7d 0a 58 09 70 72 |l);.X. | }.X.pr|
|00003b30| 69 6e 74 66 28 22 73 65 | 74 70 77 65 6e 74 20 72 |intf("se|tpwent r|
|00003b40| 65 74 75 72 6e 73 20 25 | 64 5c 6e 22 2c 20 73 65 |eturns %|d\n", se|
|00003b50| 74 70 77 65 6e 74 28 29 | 29 3b 0a 58 09 7d 0a 58 |tpwent()|);.X.}.X|
|00003b60| 20 20 20 20 74 65 6d 70 | 20 3d 20 67 65 74 70 77 | temp| = getpw|
|00003b70| 6e 61 6d 28 22 75 73 65 | 72 33 22 29 3b 0a 58 20 |nam("use|r3");.X |
|00003b80| 20 20 20 70 72 69 6e 74 | 66 28 22 46 69 6e 64 69 | print|f("Findi|
|00003b90| 6e 67 20 75 73 65 72 33 | 3a 20 25 73 5c 6e 22 2c |ng user3|: %s\n",|
|00003ba0| 20 74 65 6d 70 2d 3e 70 | 77 5f 6e 61 6d 65 29 3b | temp->p|w_name);|
|00003bb0| 0a 58 20 20 20 20 74 65 | 6d 70 20 3d 20 67 65 74 |.X te|mp = get|
|00003bc0| 70 77 6e 61 6d 28 22 75 | 73 65 72 31 22 29 3b 0a |pwnam("u|ser1");.|
|00003bd0| 58 20 20 20 20 70 72 69 | 6e 74 66 28 22 46 69 6e |X pri|ntf("Fin|
|00003be0| 64 69 6e 67 20 75 73 65 | 72 31 3a 20 25 73 5c 6e |ding use|r1: %s\n|
|00003bf0| 22 2c 20 74 65 6d 70 2d | 3e 70 77 5f 6e 61 6d 65 |", temp-|>pw_name|
|00003c00| 29 3b 0a 58 20 20 20 20 | 74 65 6d 70 20 3d 20 67 |);.X |temp = g|
|00003c10| 65 74 70 77 6e 61 6d 28 | 22 75 73 65 72 32 22 29 |etpwnam(|"user2")|
|00003c20| 3b 0a 58 20 20 20 20 70 | 72 69 6e 74 66 28 22 46 |;.X p|rintf("F|
|00003c30| 69 6e 64 69 6e 67 20 75 | 73 65 72 32 3a 20 25 73 |inding u|ser2: %s|
|00003c40| 5c 6e 22 2c 20 74 65 6d | 70 2d 3e 70 77 5f 6e 61 |\n", tem|p->pw_na|
|00003c50| 6d 65 29 3b 0a 58 20 20 | 20 20 74 65 6d 70 20 3d |me);.X | temp =|
|00003c60| 20 67 65 74 70 77 6e 61 | 6d 28 22 75 73 65 72 34 | getpwna|m("user4|
|00003c70| 22 29 3b 0a 58 20 20 20 | 20 70 72 69 6e 74 66 28 |");.X | printf(|
|00003c80| 22 46 69 6e 64 69 6e 67 | 20 75 73 65 72 34 3a 20 |"Finding| user4: |
|00003c90| 25 73 20 20 28 53 68 6f | 75 6c 64 20 62 65 20 4e |%s (Sho|uld be N|
|00003ca0| 55 4c 4c 29 5c 6e 5c 6e | 22 2c 0a 58 09 20 20 20 |ULL)\n\n|",.X. |
|00003cb0| 20 74 65 6d 70 20 3f 20 | 74 65 6d 70 2d 3e 70 77 | temp ? |temp->pw|
|00003cc0| 5f 6e 61 6d 65 20 3a 20 | 22 4e 55 4c 4c 22 29 3b |_name : |"NULL");|
|00003cd0| 0a 58 0a 58 20 20 20 20 | 74 65 6d 70 20 3d 20 67 |.X.X |temp = g|
|00003ce0| 65 74 70 77 75 69 64 28 | 32 29 3b 0a 58 20 20 20 |etpwuid(|2);.X |
|00003cf0| 20 70 72 69 6e 74 66 28 | 22 46 69 6e 64 69 6e 67 | printf(|"Finding|
|00003d00| 20 75 73 65 72 20 69 64 | 20 32 3a 20 25 73 5c 6e | user id| 2: %s\n|
|00003d10| 22 2c 20 74 65 6d 70 2d | 3e 70 77 5f 6e 61 6d 65 |", temp-|>pw_name|
|00003d20| 29 3b 0a 58 20 20 20 20 | 74 65 6d 70 20 3d 20 67 |);.X |temp = g|
|00003d30| 65 74 70 77 75 69 64 28 | 31 29 3b 0a 58 20 20 20 |etpwuid(|1);.X |
|00003d40| 20 70 72 69 6e 74 66 28 | 22 46 69 6e 64 69 6e 67 | printf(|"Finding|
|00003d50| 20 75 73 65 72 20 69 64 | 20 31 3a 20 25 73 5c 6e | user id| 1: %s\n|
|00003d60| 22 2c 20 74 65 6d 70 2d | 3e 70 77 5f 6e 61 6d 65 |", temp-|>pw_name|
|00003d70| 29 3b 0a 58 20 20 20 20 | 74 65 6d 70 20 3d 20 67 |);.X |temp = g|
|00003d80| 65 74 70 77 75 69 64 28 | 33 29 3b 0a 58 20 20 20 |etpwuid(|3);.X |
|00003d90| 20 70 72 69 6e 74 66 28 | 22 46 69 6e 64 69 6e 67 | printf(|"Finding|
|00003da0| 20 75 73 65 72 20 69 64 | 20 33 3a 20 25 73 5c 6e | user id| 3: %s\n|
|00003db0| 22 2c 20 74 65 6d 70 2d | 3e 70 77 5f 6e 61 6d 65 |", temp-|>pw_name|
|00003dc0| 29 3b 0a 58 20 20 20 20 | 74 65 6d 70 20 3d 20 67 |);.X |temp = g|
|00003dd0| 65 74 70 77 75 69 64 28 | 34 29 3b 0a 58 20 20 20 |etpwuid(|4);.X |
|00003de0| 20 70 72 69 6e 74 66 28 | 22 46 69 6e 64 69 6e 67 | printf(|"Finding|
|00003df0| 20 75 73 65 72 20 69 64 | 20 34 3a 20 25 73 20 20 | user id| 4: %s |
|00003e00| 28 53 68 6f 75 6c 64 20 | 62 65 20 4e 55 4c 4c 29 |(Should |be NULL)|
|00003e10| 5c 6e 5c 6e 22 2c 0a 58 | 09 20 20 20 20 74 65 6d |\n\n",.X|. tem|
|00003e20| 70 20 3f 20 74 65 6d 70 | 2d 3e 70 77 5f 6e 61 6d |p ? temp|->pw_nam|
|00003e30| 65 20 3a 20 22 4e 55 4c | 4c 22 29 3b 0a 58 0a 58 |e : "NUL|L");.X.X|
|00003e40| 20 20 20 20 70 72 69 6e | 74 66 28 22 65 6e 64 70 | prin|tf("endp|
|00003e50| 77 65 6e 74 20 72 65 74 | 75 72 6e 73 20 25 64 5c |went ret|urns %d\|
|00003e60| 6e 22 2c 20 65 6e 64 70 | 77 65 6e 74 28 29 29 3b |n", endp|went());|
|00003e70| 0a 58 20 20 20 20 72 65 | 74 75 72 6e 20 30 3b 20 |.X re|turn 0; |
|00003e80| 20 2f 2a 20 4b 65 65 70 | 20 54 75 72 62 6f 20 43 | /* Keep| Turbo C|
|00003e90| 20 6c 69 6e 74 20 68 61 | 70 70 79 20 2a 2f 0a 58 | lint ha|ppy */.X|
|00003ea0| 7d 0a 45 4e 44 5f 4f 46 | 5f 74 65 73 74 2e 63 0a |}.END_OF|_test.c.|
|00003eb0| 69 66 20 74 65 73 74 20 | 31 33 38 36 20 2d 6e 65 |if test |1386 -ne|
|00003ec0| 20 60 77 63 20 2d 63 20 | 3c 74 65 73 74 2e 63 60 | `wc -c |<test.c`|
|00003ed0| 3b 20 74 68 65 6e 0a 20 | 20 20 20 65 63 68 6f 20 |; then. | echo |
|00003ee0| 73 68 61 72 3a 20 5c 22 | 74 65 73 74 2e 63 5c 22 |shar: \"|test.c\"|
|00003ef0| 20 75 6e 70 61 63 6b 65 | 64 20 77 69 74 68 20 77 | unpacke|d with w|
|00003f00| 72 6f 6e 67 20 73 69 7a | 65 21 0a 66 69 0a 23 20 |rong siz|e!.fi.# |
|00003f10| 65 6e 64 20 6f 66 20 6f | 76 65 72 77 72 69 74 69 |end of o|verwriti|
|00003f20| 6e 67 20 63 68 65 63 6b | 0a 66 69 0a 65 63 68 6f |ng check|.fi.echo|
|00003f30| 20 73 68 61 72 3a 20 45 | 6e 64 20 6f 66 20 61 72 | shar: E|nd of ar|
|00003f40| 63 68 69 76 65 20 31 20 | 5c 28 6f 66 20 31 5c 29 |chive 1 |\(of 1\)|
|00003f50| 2e 0a 63 70 20 2f 64 65 | 76 2f 6e 75 6c 6c 20 61 |..cp /de|v/null a|
|00003f60| 72 6b 31 69 73 64 6f 6e | 65 0a 4d 49 53 53 49 4e |rk1isdon|e.MISSIN|
|00003f70| 47 3d 22 22 0a 66 6f 72 | 20 49 20 69 6e 20 31 20 |G="".for| I in 1 |
|00003f80| 3b 20 64 6f 0a 20 20 20 | 20 69 66 20 74 65 73 74 |; do. | if test|
|00003f90| 20 21 20 2d 66 20 61 72 | 6b 24 7b 49 7d 69 73 64 | ! -f ar|k${I}isd|
|00003fa0| 6f 6e 65 20 3b 20 74 68 | 65 6e 0a 09 4d 49 53 53 |one ; th|en..MISS|
|00003fb0| 49 4e 47 3d 22 24 7b 4d | 49 53 53 49 4e 47 7d 20 |ING="${M|ISSING} |
|00003fc0| 24 7b 49 7d 22 0a 20 20 | 20 20 66 69 0a 64 6f 6e |${I}". | fi.don|
|00003fd0| 65 0a 69 66 20 74 65 73 | 74 20 22 24 7b 4d 49 53 |e.if tes|t "${MIS|
|00003fe0| 53 49 4e 47 7d 22 20 3d | 20 22 22 20 3b 20 74 68 |SING}" =| "" ; th|
|00003ff0| 65 6e 0a 20 20 20 20 65 | 63 68 6f 20 59 6f 75 20 |en. e|cho You |
|00004000| 68 61 76 65 20 75 6e 70 | 61 63 6b 65 64 20 61 6c |have unp|acked al|
|00004010| 6c 20 31 20 61 72 63 68 | 69 76 65 73 2e 0a 20 20 |l 1 arch|ives.. |
|00004020| 20 20 72 6d 20 2d 66 20 | 61 72 6b 5b 31 2d 39 5d | rm -f |ark[1-9]|
|00004030| 69 73 64 6f 6e 65 0a 65 | 6c 73 65 0a 20 20 20 20 |isdone.e|lse. |
|00004040| 65 63 68 6f 20 59 6f 75 | 20 73 74 69 6c 6c 20 6e |echo You| still n|
|00004050| 65 65 64 20 74 6f 20 75 | 6e 70 61 63 6b 20 74 68 |eed to u|npack th|
|00004060| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 72 63 68 |e follow|ing arch|
|00004070| 69 76 65 73 3a 0a 20 20 | 20 20 65 63 68 6f 20 22 |ives:. | echo "|
|00004080| 20 20 20 20 20 20 20 20 | 22 20 24 7b 4d 49 53 53 | |" ${MISS|
|00004090| 49 4e 47 7d 0a 66 69 0a | 23 23 20 20 45 6e 64 20 |ING}.fi.|## End |
|000040a0| 6f 66 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 |of shell| archive|
|000040b0| 2e 0a 65 78 69 74 20 30 | 0a 20 20 20 20 20 20 20 |..exit 0|. |
|000040c0| 20 20 20 20 20 3c 3d 3e | 20 53 74 65 70 68 65 6e | <=>| Stephen|
|000040d0| 20 54 72 69 65 72 20 20 | 20 20 73 63 74 25 73 65 | Trier | sct%se|
|000040e0| 6c 64 6f 6e 40 73 6b 79 | 62 72 69 64 67 65 2e 53 |ldon@sky|bridge.S|
|000040f0| 43 4c 2e 43 57 52 55 2e | 45 64 75 0a 20 20 20 20 |CL.CWRU.|Edu. |
|00004100| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004110| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 73 75 | | {su|
|00004120| 6e 2c 61 74 74 2c 64 65 | 63 76 61 78 7d 21 63 77 |n,att,de|cvax}!cw|
|00004130| 6a 63 63 21 73 6b 79 62 | 72 69 64 67 65 21 73 65 |jcc!skyb|ridge!se|
|00004140| 6c 64 6f 6e 21 73 63 74 | 0a 20 20 20 20 20 20 20 |ldon!sct|. |
|00004150| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004160| 20 20 20 20 20 20 20 20 | 20 20 73 63 74 40 70 6f | | sct@po|
|00004170| 2e 43 57 52 55 2e 45 64 | 75 0a |.CWRU.Ed|u. |
+--------+-------------------------+-------------------------+--------+--------+