home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume18 / pwdiff < prev    next >
SHell self-extracting ARchive  |  1989-03-26  |  8.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


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

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, ASCII text 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| 53 75 62 6a 65 63 74 3a | 20 20 76 31 38 69 30 36 |Subject:| v18i06|
|00000010| 38 3a 20 20 54 6f 6f 6c | 20 74 6f 20 61 69 64 65 |8: Tool| to aide|
|00000020| 20 69 6e 20 6d 65 72 67 | 69 6e 67 20 70 61 73 73 | in merg|ing pass|
|00000030| 77 6f 72 64 20 66 69 6c | 65 73 0a 4e 65 77 73 67 |word fil|es.Newsg|
|00000040| 72 6f 75 70 73 3a 20 63 | 6f 6d 70 2e 73 6f 75 72 |roups: c|omp.sour|
|00000050| 63 65 73 2e 75 6e 69 78 | 0a 53 65 6e 64 65 72 3a |ces.unix|.Sender:|
|00000060| 20 73 6f 75 72 63 65 73 | 0a 41 70 70 72 6f 76 65 | sources|.Approve|
|00000070| 64 3a 20 72 73 61 6c 7a | 40 75 75 6e 65 74 2e 55 |d: rsalz|@uunet.U|
|00000080| 55 2e 4e 45 54 0a 0a 53 | 75 62 6d 69 74 74 65 64 |U.NET..S|ubmitted|
|00000090| 2d 62 79 3a 20 44 6f 6e | 20 4c 69 62 65 73 20 3c |-by: Don| Libes <|
|000000a0| 6c 69 62 65 73 40 63 6d | 65 2d 64 75 72 65 72 2e |libes@cm|e-durer.|
|000000b0| 61 72 70 61 3e 0a 50 6f | 73 74 69 6e 67 2d 6e 75 |arpa>.Po|sting-nu|
|000000c0| 6d 62 65 72 3a 20 56 6f | 6c 75 6d 65 20 31 38 2c |mber: Vo|lume 18,|
|000000d0| 20 49 73 73 75 65 20 36 | 38 0a 41 72 63 68 69 76 | Issue 6|8.Archiv|
|000000e0| 65 2d 6e 61 6d 65 3a 20 | 70 77 64 69 66 66 0a 0a |e-name: |pwdiff..|
|000000f0| 70 77 64 69 66 66 20 74 | 61 6b 65 73 20 6d 75 6c |pwdiff t|akes mul|
|00000100| 74 69 70 6c 65 20 70 61 | 73 73 77 6f 72 64 20 66 |tiple pa|ssword f|
|00000110| 69 6c 65 73 20 61 6e 64 | 20 63 6f 6d 70 61 72 65 |iles and| compare|
|00000120| 73 20 74 68 65 6d 20 69 | 6e 20 61 6e 0a 69 6e 74 |s them i|n an.int|
|00000130| 65 6c 6c 69 67 65 6e 74 | 20 77 61 79 2e 20 20 46 |elligent| way. F|
|00000140| 6f 72 20 69 6e 73 74 61 | 6e 63 65 2c 20 69 74 20 |or insta|nce, it |
|00000150| 77 69 6c 6c 20 72 65 70 | 6f 72 74 20 6f 6e 20 64 |will rep|ort on d|
|00000160| 69 66 66 65 72 65 6e 74 | 20 6e 61 6d 65 73 0a 77 |ifferent| names.w|
|00000170| 69 74 68 20 74 68 65 20 | 73 61 6d 65 20 75 69 64 |ith the |same uid|
|00000180| 2c 20 62 75 74 20 6c 65 | 74 20 70 61 73 73 20 74 |, but le|t pass t|
|00000190| 68 65 20 73 61 6d 65 20 | 6e 61 6d 65 20 77 69 74 |he same |name wit|
|000001a0| 68 20 74 68 65 20 73 61 | 6d 65 20 75 69 64 2e 0a |h the sa|me uid..|
|000001b0| 0a 57 68 61 74 20 68 61 | 70 70 65 6e 65 64 20 77 |.What ha|ppened w|
|000001c0| 61 73 20 74 68 61 74 20 | 77 65 20 73 74 61 72 74 |as that |we start|
|000001d0| 65 64 20 6f 75 74 20 77 | 69 74 68 20 6f 6e 65 20 |ed out w|ith one |
|000001e0| 73 68 61 72 65 64 20 70 | 61 73 73 77 6f 72 64 20 |shared p|assword |
|000001f0| 66 69 6c 65 20 69 6e 0a | 61 20 73 6d 61 6c 6c 20 |file in.|a small |
|00000200| 4c 41 4e 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2e |LAN envi|ronment.|
|00000210| 20 20 4f 76 65 72 20 74 | 69 6d 65 2c 20 6d 6f 72 | Over t|ime, mor|
|00000220| 65 20 6d 61 63 68 69 6e | 65 73 20 63 61 6d 65 20 |e machin|es came |
|00000230| 6f 6e 2d 6c 69 6e 65 2e | 0a 4e 65 77 20 61 64 6d |on-line.|.New adm|
|00000240| 69 6e 69 73 74 72 61 74 | 6f 72 73 20 73 6f 6d 65 |inistrat|ors some|
|00000250| 74 69 6d 65 73 20 73 68 | 61 72 65 64 20 74 68 65 |times sh|ared the|
|00000260| 20 6f 6c 64 20 70 61 73 | 73 77 6f 72 64 20 66 69 | old pas|sword fi|
|00000270| 6c 65 2c 20 61 6e 64 0a | 73 6f 6d 65 74 69 6d 65 |le, and.|sometime|
|00000280| 73 20 6a 75 73 74 20 63 | 6f 70 69 65 64 20 69 74 |s just c|opied it|
|00000290| 2e 20 20 47 72 61 64 75 | 61 6c 6c 79 20 69 74 20 |. Gradu|ally it |
|000002a0| 64 69 76 65 72 67 65 64 | 2c 20 73 6f 20 74 68 61 |diverged|, so tha|
|000002b0| 74 20 73 6f 6d 65 20 6f | 66 20 74 68 65 0a 75 69 |t some o|f the.ui|
|000002c0| 64 73 20 6d 61 70 70 65 | 64 20 74 6f 20 6d 75 6c |ds mappe|d to mul|
|000002d0| 74 69 70 6c 65 20 75 73 | 65 72 73 20 61 63 72 6f |tiple us|ers acro|
|000002e0| 73 73 20 74 68 65 20 4c | 41 4e 2e 0a 0a 45 76 65 |ss the L|AN...Eve|
|000002f0| 6e 74 75 61 6c 6c 79 20 | 6f 75 72 20 4c 41 4e 20 |ntually |our LAN |
|00000300| 67 6f 74 20 62 69 67 20 | 65 6e 6f 75 67 68 2c 20 |got big |enough, |
|00000310| 73 6f 20 74 68 61 74 20 | 77 65 20 68 69 72 65 64 |so that |we hired|
|00000320| 20 61 20 73 69 74 65 77 | 69 64 65 20 61 64 6d 69 | a sitew|ide admi|
|00000330| 6e 2c 0a 61 6e 64 20 68 | 65 20 77 61 6e 74 65 64 |n,.and h|e wanted|
|00000340| 20 74 6f 20 75 73 65 20 | 6f 6e 65 20 63 6f 6d 6d | to use |one comm|
|00000350| 6f 6e 20 70 61 73 73 77 | 6f 72 64 20 66 69 6c 65 |on passw|ord file|
|00000360| 2e 20 20 54 68 69 73 20 | 6d 61 6b 65 73 20 4e 46 |. This |makes NF|
|00000370| 53 20 61 63 63 65 73 73 | 0a 6d 75 63 68 20 65 61 |S access|.much ea|
|00000380| 73 69 65 72 2c 20 66 6f | 72 20 65 78 61 6d 70 6c |sier, fo|r exampl|
|00000390| 65 2e 20 20 53 6f 20 49 | 20 77 72 6f 74 65 20 74 |e. So I| wrote t|
|000003a0| 68 69 73 20 70 72 6f 67 | 72 61 6d 20 74 6f 20 73 |his prog|ram to s|
|000003b0| 6f 6c 76 65 20 68 69 73 | 0a 70 72 6f 62 6c 65 6d |olve his|.problem|
|000003c0| 2e 20 20 49 20 66 69 67 | 75 72 65 20 74 68 69 73 |. I fig|ure this|
|000003d0| 20 76 65 72 79 20 73 61 | 6d 65 20 74 68 69 6e 67 | very sa|me thing|
|000003e0| 20 6d 75 73 74 20 68 61 | 70 70 65 6e 20 74 6f 20 | must ha|ppen to |
|000003f0| 6c 6f 74 73 20 6f 66 20 | 73 69 74 65 73 2c 0a 73 |lots of |sites,.s|
|00000400| 6f 20 74 6f 20 73 61 76 | 65 20 79 6f 75 20 73 6f |o to sav|e you so|
|00000410| 6d 65 20 67 72 69 65 66 | 2c 20 68 65 72 65 20 69 |me grief|, here i|
|00000420| 74 20 69 73 2e 0a 09 09 | 44 6f 6e 20 4c 69 62 65 |t is....|Don Libe|
|00000430| 73 0a 0a 23 21 20 2f 62 | 69 6e 2f 73 68 0a 23 20 |s..#! /b|in/sh.# |
|00000440| 54 68 69 73 20 69 73 20 | 61 20 73 68 65 6c 6c 20 |This is |a shell |
|00000450| 61 72 63 68 69 76 65 2e | 20 20 52 65 6d 6f 76 65 |archive.| Remove|
|00000460| 20 61 6e 79 74 68 69 6e | 67 20 62 65 66 6f 72 65 | anythin|g before|
|00000470| 20 74 68 69 73 20 6c 69 | 6e 65 2c 20 74 68 65 6e | this li|ne, then|
|00000480| 20 75 6e 70 61 63 6b 0a | 23 20 69 74 20 62 79 20 | unpack.|# it by |
|00000490| 73 61 76 69 6e 67 20 69 | 74 20 69 6e 74 6f 20 61 |saving i|t into a|
|000004a0| 20 66 69 6c 65 20 61 6e | 64 20 74 79 70 69 6e 67 | file an|d typing|
|000004b0| 20 22 73 68 20 66 69 6c | 65 22 2e 20 20 54 6f 20 | "sh fil|e". To |
|000004c0| 6f 76 65 72 77 72 69 74 | 65 20 65 78 69 73 74 69 |overwrit|e existi|
|000004d0| 6e 67 0a 23 20 66 69 6c | 65 73 2c 20 74 79 70 65 |ng.# fil|es, type|
|000004e0| 20 22 73 68 20 66 69 6c | 65 20 2d 63 22 2e 20 20 | "sh fil|e -c". |
|000004f0| 59 6f 75 20 63 61 6e 20 | 61 6c 73 6f 20 66 65 65 |You can |also fee|
|00000500| 64 20 74 68 69 73 20 61 | 73 20 73 74 61 6e 64 61 |d this a|s standa|
|00000510| 72 64 20 69 6e 70 75 74 | 20 76 69 61 0a 23 20 75 |rd input| via.# u|
|00000520| 6e 73 68 61 72 2c 20 6f | 72 20 62 79 20 74 79 70 |nshar, o|r by typ|
|00000530| 69 6e 67 20 22 73 68 20 | 3c 66 69 6c 65 22 2c 20 |ing "sh |<file", |
|00000540| 65 2e 67 2e 2e 20 20 49 | 66 20 74 68 69 73 20 61 |e.g.. I|f this a|
|00000550| 72 63 68 69 76 65 20 69 | 73 20 63 6f 6d 70 6c 65 |rchive i|s comple|
|00000560| 74 65 2c 20 79 6f 75 0a | 23 20 77 69 6c 6c 20 73 |te, you.|# will s|
|00000570| 65 65 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |ee the f|ollowing|
|00000580| 20 6d 65 73 73 61 67 65 | 20 61 74 20 74 68 65 20 | message| at the |
|00000590| 65 6e 64 3a 0a 23 09 09 | 22 45 6e 64 20 6f 66 20 |end:.#..|"End of |
|000005a0| 73 68 65 6c 6c 20 61 72 | 63 68 69 76 65 2e 22 0a |shell ar|chive.".|
|000005b0| 23 20 43 6f 6e 74 65 6e | 74 73 3a 20 20 4d 61 6b |# Conten|ts: Mak|
|000005c0| 65 66 69 6c 65 20 52 45 | 41 44 4d 45 20 70 77 64 |efile RE|ADME pwd|
|000005d0| 69 66 66 2e 38 20 70 77 | 64 69 66 66 2e 63 0a 50 |iff.8 pw|diff.c.P|
|000005e0| 41 54 48 3d 2f 62 69 6e | 3a 2f 75 73 72 2f 62 69 |ATH=/bin|:/usr/bi|
|000005f0| 6e 3a 2f 75 73 72 2f 75 | 63 62 20 3b 20 65 78 70 |n:/usr/u|cb ; exp|
|00000600| 6f 72 74 20 50 41 54 48 | 0a 65 63 68 6f 20 45 78 |ort PATH|.echo Ex|
|00000610| 74 72 61 63 74 69 6e 67 | 20 4d 61 6b 65 66 69 6c |tracting| Makefil|
|00000620| 65 20 5c 28 65 6e 74 65 | 72 65 64 20 62 79 20 68 |e \(ente|red by h|
|00000630| 61 6e 64 2c 20 6e 6f 20 | 65 72 72 6f 72 20 63 68 |and, no |error ch|
|00000640| 65 63 6b 69 6e 67 5c 29 | 0a 73 65 64 20 22 73 2f |ecking\)|.sed "s/|
|00000650| 5e 58 2f 2f 22 20 3e 4d | 61 6b 65 66 69 6c 65 20 |^X//" >M|akefile |
|00000660| 3c 3c 27 45 4e 44 5f 4f | 46 5f 46 49 4c 45 27 0a |<<'END_O|F_FILE'.|
|00000670| 58 61 6c 6c 3a 09 09 70 | 77 64 69 66 66 20 70 77 |Xall:..p|wdiff pw|
|00000680| 64 69 66 66 2e 38 0a 58 | 0a 58 69 6e 73 74 61 6c |diff.8.X|.Xinstal|
|00000690| 6c 3a 09 61 6c 6c 0a 58 | 09 40 65 63 68 6f 20 49 |l:.all.X|.@echo I|
|000006a0| 6e 73 74 61 6c 6c 69 6e | 67 20 61 63 63 6f 72 64 |nstallin|g accord|
|000006b0| 69 6e 67 20 74 6f 20 6c | 6f 63 61 6c 20 63 6f 6e |ing to l|ocal con|
|000006c0| 76 65 6e 74 69 6f 6e 0a | 58 0a 58 70 77 64 69 66 |vention.|X.Xpwdif|
|000006d0| 66 3a 09 09 70 77 64 69 | 66 66 2e 63 0a 58 09 24 |f:..pwdi|ff.c.X.$|
|000006e0| 28 43 43 29 20 2d 6f 20 | 70 77 64 69 66 66 20 24 |(CC) -o |pwdiff $|
|000006f0| 28 43 46 4c 41 47 53 29 | 20 70 77 64 69 66 66 2e |(CFLAGS)| pwdiff.|
|00000700| 63 0a 45 4e 44 5f 4f 46 | 5f 46 49 4c 45 0a 69 66 |c.END_OF|_FILE.if|
|00000710| 20 74 65 73 74 20 2d 66 | 20 27 52 45 41 44 4d 45 | test -f| 'README|
|00000720| 27 20 2d 61 20 22 24 7b | 31 7d 22 20 21 3d 20 22 |' -a "${|1}" != "|
|00000730| 2d 63 22 20 3b 20 74 68 | 65 6e 20 0a 20 20 65 63 |-c" ; th|en . ec|
|00000740| 68 6f 20 73 68 61 72 3a | 20 57 69 6c 6c 20 6e 6f |ho shar:| Will no|
|00000750| 74 20 63 6c 6f 62 62 65 | 72 20 65 78 69 73 74 69 |t clobbe|r existi|
|00000760| 6e 67 20 66 69 6c 65 20 | 5c 22 27 52 45 41 44 4d |ng file |\"'READM|
|00000770| 45 27 5c 22 0a 65 6c 73 | 65 0a 65 63 68 6f 20 73 |E'\".els|e.echo s|
|00000780| 68 61 72 3a 20 45 78 74 | 72 61 63 74 69 6e 67 20 |har: Ext|racting |
|00000790| 5c 22 27 52 45 41 44 4d | 45 27 5c 22 20 5c 28 31 |\"'READM|E'\" \(1|
|000007a0| 30 38 39 20 63 68 61 72 | 61 63 74 65 72 73 5c 29 |089 char|acters\)|
|000007b0| 0a 73 65 64 20 22 73 2f | 5e 58 2f 2f 22 20 3e 27 |.sed "s/|^X//" >'|
|000007c0| 52 45 41 44 4d 45 27 20 | 3c 3c 27 45 4e 44 5f 4f |README' |<<'END_O|
|000007d0| 46 5f 46 49 4c 45 27 0a | 58 70 77 64 69 66 66 20 |F_FILE'.|Xpwdiff |
|000007e0| 74 61 6b 65 73 20 6d 75 | 6c 74 69 70 6c 65 20 70 |takes mu|ltiple p|
|000007f0| 61 73 73 77 6f 72 64 20 | 66 69 6c 65 73 20 61 6e |assword |files an|
|00000800| 64 20 63 6f 6d 70 61 72 | 65 73 20 74 68 65 6d 20 |d compar|es them |
|00000810| 69 6e 20 61 6e 0a 58 69 | 6e 74 65 6c 6c 69 67 65 |in an.Xi|ntellige|
|00000820| 6e 74 20 77 61 79 2e 20 | 20 46 6f 72 20 69 6e 73 |nt way. | For ins|
|00000830| 74 61 6e 63 65 2c 20 69 | 74 20 77 69 6c 6c 20 72 |tance, i|t will r|
|00000840| 65 70 6f 72 74 20 6f 6e | 20 64 69 66 66 65 72 65 |eport on| differe|
|00000850| 6e 74 20 6e 61 6d 65 73 | 0a 58 77 69 74 68 20 74 |nt names|.Xwith t|
|00000860| 68 65 20 73 61 6d 65 20 | 75 69 64 2c 20 62 75 74 |he same |uid, but|
|00000870| 20 6c 65 74 20 70 61 73 | 73 20 74 68 65 20 73 61 | let pas|s the sa|
|00000880| 6d 65 20 6e 61 6d 65 20 | 77 69 74 68 20 74 68 65 |me name |with the|
|00000890| 20 73 61 6d 65 20 75 69 | 64 2e 0a 58 0a 58 49 20 | same ui|d..X.XI |
|000008a0| 77 72 6f 74 65 20 69 74 | 20 6f 6e 65 20 64 61 79 |wrote it| one day|
|000008b0| 20 77 68 65 6e 20 77 65 | 20 68 61 64 20 74 6f 20 | when we| had to |
|000008c0| 6a 6f 69 6e 20 74 77 6f | 20 70 61 73 73 77 6f 72 |join two| passwor|
|000008d0| 64 20 66 69 6c 65 73 20 | 66 72 6f 6d 0a 58 64 69 |d files |from.Xdi|
|000008e0| 66 66 65 72 65 6e 74 20 | 6d 61 63 68 69 6e 65 73 |fferent |machines|
|000008f0| 2e 0a 58 0a 58 57 68 61 | 74 20 68 61 70 70 65 6e |..X.XWha|t happen|
|00000900| 65 64 20 77 61 73 20 74 | 68 61 74 20 77 65 20 73 |ed was t|hat we s|
|00000910| 74 61 72 74 65 64 20 6f | 75 74 20 77 69 74 68 20 |tarted o|ut with |
|00000920| 6f 6e 65 20 73 68 61 72 | 65 64 20 70 61 73 73 77 |one shar|ed passw|
|00000930| 6f 72 64 20 66 69 6c 65 | 20 69 6e 0a 58 61 20 73 |ord file| in.Xa s|
|00000940| 6d 61 6c 6c 20 4c 41 4e | 20 65 6e 76 69 72 6f 6e |mall LAN| environ|
|00000950| 6d 65 6e 74 2e 20 20 4f | 76 65 72 20 74 69 6d 65 |ment. O|ver time|
|00000960| 2c 20 6d 6f 72 65 20 6d | 61 63 68 69 6e 65 73 20 |, more m|achines |
|00000970| 63 61 6d 65 20 6f 6e 2d | 6c 69 6e 65 2e 0a 58 4e |came on-|line..XN|
|00000980| 65 77 20 61 64 6d 69 6e | 69 73 74 72 61 74 6f 72 |ew admin|istrator|
|00000990| 73 20 73 6f 6d 65 74 69 | 6d 65 73 20 73 68 61 72 |s someti|mes shar|
|000009a0| 65 64 20 74 68 65 20 6f | 6c 64 20 70 61 73 73 77 |ed the o|ld passw|
|000009b0| 6f 72 64 20 66 69 6c 65 | 2c 20 61 6e 64 0a 58 73 |ord file|, and.Xs|
|000009c0| 6f 6d 65 74 69 6d 65 73 | 20 6a 75 73 74 20 63 6f |ometimes| just co|
|000009d0| 70 69 65 64 20 69 74 2e | 20 20 47 72 61 64 75 61 |pied it.| Gradua|
|000009e0| 6c 6c 79 20 69 74 20 64 | 69 76 65 72 67 65 64 2c |lly it d|iverged,|
|000009f0| 20 73 6f 20 74 68 61 74 | 20 73 6f 6d 65 20 6f 66 | so that| some of|
|00000a00| 20 74 68 65 0a 58 75 69 | 64 73 20 6d 61 70 70 65 | the.Xui|ds mappe|
|00000a10| 64 20 74 6f 20 6d 75 6c | 74 69 70 6c 65 20 75 73 |d to mul|tiple us|
|00000a20| 65 72 73 20 61 63 72 6f | 73 73 20 74 68 65 20 4c |ers acro|ss the L|
|00000a30| 41 4e 2e 0a 58 0a 58 45 | 76 65 6e 74 75 61 6c 6c |AN..X.XE|ventuall|
|00000a40| 79 20 6f 75 72 20 4c 41 | 4e 20 67 6f 74 20 62 69 |y our LA|N got bi|
|00000a50| 67 20 65 6e 6f 75 67 68 | 2c 20 73 6f 20 74 68 61 |g enough|, so tha|
|00000a60| 74 20 77 65 20 68 69 72 | 65 64 20 61 20 73 69 74 |t we hir|ed a sit|
|00000a70| 65 77 69 64 65 20 61 64 | 6d 69 6e 2c 0a 58 61 6e |ewide ad|min,.Xan|
|00000a80| 64 20 68 65 20 77 61 6e | 74 65 64 20 74 6f 20 75 |d he wan|ted to u|
|00000a90| 73 65 20 6f 6e 65 20 63 | 6f 6d 6d 6f 6e 20 70 61 |se one c|ommon pa|
|00000aa0| 73 73 77 6f 72 64 20 66 | 69 6c 65 2e 20 20 54 68 |ssword f|ile. Th|
|00000ab0| 69 73 20 6d 61 6b 65 73 | 20 4e 46 53 20 61 63 63 |is makes| NFS acc|
|00000ac0| 65 73 73 0a 58 6d 75 63 | 68 20 65 61 73 69 65 72 |ess.Xmuc|h easier|
|00000ad0| 2c 20 66 6f 72 20 65 78 | 61 6d 70 6c 65 2e 20 20 |, for ex|ample. |
|00000ae0| 53 6f 20 49 20 77 72 6f | 74 65 20 74 68 69 73 20 |So I wro|te this |
|00000af0| 70 72 6f 67 72 61 6d 20 | 74 6f 20 73 6f 6c 76 65 |program |to solve|
|00000b00| 20 68 69 73 0a 58 70 72 | 6f 62 6c 65 6d 2e 20 20 | his.Xpr|oblem. |
|00000b10| 49 20 66 69 67 75 72 65 | 20 74 68 69 73 20 76 65 |I figure| this ve|
|00000b20| 72 79 20 73 61 6d 65 20 | 74 68 69 6e 67 20 6d 75 |ry same |thing mu|
|00000b30| 73 74 20 68 61 70 70 65 | 6e 20 74 6f 20 6c 6f 74 |st happe|n to lot|
|00000b40| 73 20 6f 66 20 73 69 74 | 65 73 2c 0a 58 73 6f 20 |s of sit|es,.Xso |
|00000b50| 74 6f 20 73 61 76 65 20 | 79 6f 75 20 73 6f 6d 65 |to save |you some|
|00000b60| 20 67 72 69 65 66 2c 20 | 68 65 72 65 20 69 74 20 | grief, |here it |
|00000b70| 69 73 2e 20 20 53 65 6e | 64 20 62 75 67 73 2c 20 |is. Sen|d bugs, |
|00000b80| 69 6d 70 72 6f 76 65 6d | 65 6e 74 73 2c 20 61 6e |improvem|ents, an|
|00000b90| 64 0a 58 63 61 73 68 20 | 74 6f 20 6d 65 2e 0a 58 |d.Xcash |to me..X|
|00000ba0| 0a 58 44 6f 6e 20 4c 69 | 62 65 73 0a 58 4e 61 74 |.XDon Li|bes.XNat|
|00000bb0| 69 6f 6e 61 6c 20 42 75 | 72 65 61 75 20 6f 66 20 |ional Bu|reau of |
|00000bc0| 53 74 61 6e 64 61 72 64 | 73 0a 58 42 6c 64 67 20 |Standard|s.XBldg |
|00000bd0| 32 32 30 2c 20 52 6d 20 | 41 2d 31 32 37 0a 58 47 |220, Rm |A-127.XG|
|00000be0| 61 69 74 68 65 72 73 62 | 75 72 67 2c 20 4d 44 20 |aithersb|urg, MD |
|00000bf0| 20 32 30 38 39 39 0a 58 | 28 33 30 31 29 20 39 37 | 20899.X|(301) 97|
|00000c00| 35 2d 33 35 33 35 0a 58 | 6c 69 62 65 73 40 63 6d |5-3535.X|libes@cm|
|00000c10| 65 2d 64 75 72 65 72 2e | 61 72 70 61 0a 58 75 75 |e-durer.|arpa.Xuu|
|00000c20| 6e 65 74 21 63 6d 65 2d | 64 75 72 65 72 21 6c 69 |net!cme-|durer!li|
|00000c30| 62 65 73 0a 45 4e 44 5f | 4f 46 5f 46 49 4c 45 0a |bes.END_|OF_FILE.|
|00000c40| 69 66 20 74 65 73 74 20 | 31 30 38 39 20 2d 6e 65 |if test |1089 -ne|
|00000c50| 20 60 77 63 20 2d 63 20 | 3c 27 52 45 41 44 4d 45 | `wc -c |<'README|
|00000c60| 27 60 3b 20 74 68 65 6e | 0a 20 20 20 20 65 63 68 |'`; then|. ech|
|00000c70| 6f 20 73 68 61 72 3a 20 | 5c 22 27 52 45 41 44 4d |o shar: |\"'READM|
|00000c80| 45 27 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |E'\" unp|acked wi|
|00000c90| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|00000ca0| 69 0a 23 20 65 6e 64 20 | 6f 66 20 27 52 45 41 44 |i.# end |of 'READ|
|00000cb0| 4d 45 27 0a 66 69 0a 69 | 66 20 74 65 73 74 20 2d |ME'.fi.i|f test -|
|00000cc0| 66 20 27 70 77 64 69 66 | 66 2e 38 27 20 2d 61 20 |f 'pwdif|f.8' -a |
|00000cd0| 22 24 7b 31 7d 22 20 21 | 3d 20 22 2d 63 22 20 3b |"${1}" !|= "-c" ;|
|00000ce0| 20 74 68 65 6e 20 0a 20 | 20 65 63 68 6f 20 73 68 | then . | echo sh|
|00000cf0| 61 72 3a 20 57 69 6c 6c | 20 6e 6f 74 20 63 6c 6f |ar: Will| not clo|
|00000d00| 62 62 65 72 20 65 78 69 | 73 74 69 6e 67 20 66 69 |bber exi|sting fi|
|00000d10| 6c 65 20 5c 22 27 70 77 | 64 69 66 66 2e 38 27 5c |le \"'pw|diff.8'\|
|00000d20| 22 0a 65 6c 73 65 0a 65 | 63 68 6f 20 73 68 61 72 |".else.e|cho shar|
|00000d30| 3a 20 45 78 74 72 61 63 | 74 69 6e 67 20 5c 22 27 |: Extrac|ting \"'|
|00000d40| 70 77 64 69 66 66 2e 38 | 27 5c 22 20 5c 28 37 32 |pwdiff.8|'\" \(72|
|00000d50| 34 20 63 68 61 72 61 63 | 74 65 72 73 5c 29 0a 73 |4 charac|ters\).s|
|00000d60| 65 64 20 22 73 2f 5e 58 | 2f 2f 22 20 3e 27 70 77 |ed "s/^X|//" >'pw|
|00000d70| 64 69 66 66 2e 38 27 20 | 3c 3c 27 45 4e 44 5f 4f |diff.8' |<<'END_O|
|00000d80| 46 5f 46 49 4c 45 27 0a | 58 2e 54 48 20 50 57 44 |F_FILE'.|X.TH PWD|
|00000d90| 49 46 46 20 38 20 22 32 | 35 20 4a 75 6e 65 20 31 |IFF 8 "2|5 June 1|
|00000da0| 39 38 38 22 0a 58 2e 53 | 48 20 4e 41 4d 45 0a 58 |988".X.S|H NAME.X|
|00000db0| 70 77 64 69 66 66 20 5c | 2d 20 66 69 6e 64 20 64 |pwdiff \|- find d|
|00000dc0| 69 66 66 65 72 65 6e 63 | 65 73 20 69 6e 20 70 61 |ifferenc|es in pa|
|00000dd0| 73 73 77 6f 72 64 20 66 | 69 6c 65 73 0a 58 2e 53 |ssword f|iles.X.S|
|00000de0| 48 20 53 59 4e 4f 50 53 | 49 53 0a 58 70 77 64 69 |H SYNOPS|IS.Xpwdi|
|00000df0| 66 66 20 66 69 6c 65 31 | 20 66 69 6c 65 32 20 66 |ff file1| file2 f|
|00000e00| 69 6c 65 33 20 2e 2e 2e | 0a 58 2e 53 48 20 44 45 |ile3 ...|.X.SH DE|
|00000e10| 53 43 52 49 50 54 49 4f | 4e 0a 58 54 68 69 73 20 |SCRIPTIO|N.XThis |
|00000e20| 70 72 6f 67 72 61 6d 20 | 63 6f 6d 70 61 72 65 73 |program |compares|
|00000e30| 20 6d 75 6c 74 69 70 6c | 65 20 70 61 73 73 77 6f | multipl|e passwo|
|00000e40| 72 64 20 66 69 6c 65 73 | 20 61 6e 64 20 72 65 70 |rd files| and rep|
|00000e50| 6f 72 74 73 20 6f 6e 20 | 75 69 64 20 6f 72 0a 58 |orts on |uid or.X|
|00000e60| 6e 61 6d 65 20 63 6f 6e | 66 6c 69 63 74 73 20 74 |name con|flicts t|
|00000e70| 68 61 74 20 77 6f 75 6c | 64 20 70 72 65 76 65 6e |hat woul|d preven|
|00000e80| 74 20 74 68 65 20 66 69 | 6c 65 73 20 66 72 6f 6d |t the fi|les from|
|00000e90| 20 62 65 69 6e 67 20 6d | 65 72 67 65 64 2e 0a 58 | being m|erged..X|
|00000ea0| 2e 50 50 0a 58 46 6f 72 | 20 65 78 61 6d 70 6c 65 |.PP.XFor| example|
|00000eb0| 2c 20 69 66 20 75 69 64 | 20 32 37 20 69 73 20 64 |, if uid| 27 is d|
|00000ec0| 6f 6e 20 69 6e 20 66 69 | 6c 65 31 20 61 6e 64 20 |on in fi|le1 and |
|00000ed0| 73 75 73 61 6e 20 69 6e | 20 66 69 6c 65 32 2c 20 |susan in| file2, |
|00000ee0| 74 68 69 73 20 77 69 6c | 6c 20 62 65 0a 58 64 65 |this wil|l be.Xde|
|00000ef0| 74 65 63 74 65 64 2e 0a | 58 2e 50 50 0a 58 54 68 |tected..|X.PP.XTh|
|00000f00| 65 20 70 72 6f 67 72 61 | 6d 20 61 6c 73 6f 20 6e |e progra|m also n|
|00000f10| 6f 74 65 73 20 73 79 6e | 74 61 63 74 69 63 61 6c |otes syn|tactical|
|00000f20| 6c 79 20 69 6e 63 6f 72 | 72 65 63 74 20 6c 69 6e |ly incor|rect lin|
|00000f30| 65 73 20 61 6e 64 20 6e | 69 63 6b 6e 61 6d 65 73 |es and n|icknames|
|00000f40| 0a 58 28 74 68 65 20 75 | 73 65 72 20 6e 61 6d 65 |.X(the u|ser name|
|00000f50| 20 64 6f 65 73 20 6e 6f | 74 20 6d 61 74 63 68 20 | does no|t match |
|00000f60| 74 68 65 20 68 6f 6d 65 | 20 64 69 72 65 63 74 6f |the home| directo|
|00000f70| 72 79 29 2e 20 20 53 69 | 6e 63 65 20 6d 61 6e 79 |ry). Si|nce many|
|00000f80| 20 6c 6f 77 0a 58 75 69 | 64 73 20 61 72 65 20 6e | low.Xui|ds are n|
|00000f90| 69 63 6b 6e 61 6d 65 73 | 20 28 72 6f 6f 74 2c 20 |icknames| (root, |
|00000fa0| 75 75 63 70 2c 20 65 74 | 63 2e 29 20 61 20 63 6f |uucp, et|c.) a co|
|00000fb0| 6d 70 69 6c 65 2d 74 69 | 6d 65 20 63 6f 6e 73 74 |mpile-ti|me const|
|00000fc0| 61 6e 74 20 63 6f 6e 74 | 72 6f 6c 73 0a 58 61 20 |ant cont|rols.Xa |
|00000fd0| 63 75 74 2d 6f 66 66 20 | 62 65 6c 6f 77 20 77 68 |cut-off |below wh|
|00000fe0| 69 63 68 20 6e 69 63 6b | 6e 61 6d 65 73 20 61 72 |ich nick|names ar|
|00000ff0| 65 20 69 67 6e 6f 72 65 | 64 2e 20 20 41 73 20 64 |e ignore|d. As d|
|00001000| 69 73 74 72 69 62 75 74 | 65 64 2c 20 75 69 64 73 |istribut|ed, uids|
|00001010| 0a 58 62 65 6c 6f 77 20 | 32 30 20 61 72 65 20 6e |.Xbelow |20 are n|
|00001020| 6f 74 20 63 68 65 63 6b | 65 64 20 66 6f 72 20 6e |ot check|ed for n|
|00001030| 69 63 6b 6e 61 6d 65 73 | 2e 0a 58 2e 53 48 20 41 |icknames|..X.SH A|
|00001040| 55 54 48 4f 52 0a 58 44 | 6f 6e 20 4c 69 62 65 73 |UTHOR.XD|on Libes|
|00001050| 2c 20 4e 61 74 69 6f 6e | 61 6c 20 42 75 72 65 61 |, Nation|al Burea|
|00001060| 75 20 6f 66 20 53 74 61 | 6e 64 61 72 64 73 0a 45 |u of Sta|ndards.E|
|00001070| 4e 44 5f 4f 46 5f 46 49 | 4c 45 0a 69 66 20 74 65 |ND_OF_FI|LE.if te|
|00001080| 73 74 20 37 32 34 20 2d | 6e 65 20 60 77 63 20 2d |st 724 -|ne `wc -|
|00001090| 63 20 3c 27 70 77 64 69 | 66 66 2e 38 27 60 3b 20 |c <'pwdi|ff.8'`; |
|000010a0| 74 68 65 6e 0a 20 20 20 | 20 65 63 68 6f 20 73 68 |then. | echo sh|
|000010b0| 61 72 3a 20 5c 22 27 70 | 77 64 69 66 66 2e 38 27 |ar: \"'p|wdiff.8'|
|000010c0| 5c 22 20 75 6e 70 61 63 | 6b 65 64 20 77 69 74 68 |\" unpac|ked with|
|000010d0| 20 77 72 6f 6e 67 20 73 | 69 7a 65 21 0a 66 69 0a | wrong s|ize!.fi.|
|000010e0| 23 20 65 6e 64 20 6f 66 | 20 27 70 77 64 69 66 66 |# end of| 'pwdiff|
|000010f0| 2e 38 27 0a 66 69 0a 69 | 66 20 74 65 73 74 20 2d |.8'.fi.i|f test -|
|00001100| 66 20 27 70 77 64 69 66 | 66 2e 63 27 20 2d 61 20 |f 'pwdif|f.c' -a |
|00001110| 22 24 7b 31 7d 22 20 21 | 3d 20 22 2d 63 22 20 3b |"${1}" !|= "-c" ;|
|00001120| 20 74 68 65 6e 20 0a 20 | 20 65 63 68 6f 20 73 68 | then . | echo sh|
|00001130| 61 72 3a 20 57 69 6c 6c | 20 6e 6f 74 20 63 6c 6f |ar: Will| not clo|
|00001140| 62 62 65 72 20 65 78 69 | 73 74 69 6e 67 20 66 69 |bber exi|sting fi|
|00001150| 6c 65 20 5c 22 27 70 77 | 64 69 66 66 2e 63 27 5c |le \"'pw|diff.c'\|
|00001160| 22 0a 65 6c 73 65 0a 65 | 63 68 6f 20 73 68 61 72 |".else.e|cho shar|
|00001170| 3a 20 45 78 74 72 61 63 | 74 69 6e 67 20 5c 22 27 |: Extrac|ting \"'|
|00001180| 70 77 64 69 66 66 2e 63 | 27 5c 22 20 5c 28 33 33 |pwdiff.c|'\" \(33|
|00001190| 31 31 20 63 68 61 72 61 | 63 74 65 72 73 5c 29 0a |11 chara|cters\).|
|000011a0| 73 65 64 20 22 73 2f 5e | 58 2f 2f 22 20 3e 27 70 |sed "s/^|X//" >'p|
|000011b0| 77 64 69 66 66 2e 63 27 | 20 3c 3c 27 45 4e 44 5f |wdiff.c'| <<'END_|
|000011c0| 4f 46 5f 46 49 4c 45 27 | 0a 58 2f 2a 20 43 68 65 |OF_FILE'|.X/* Che|
|000011d0| 63 6b 20 6d 75 6c 74 69 | 70 6c 65 20 70 61 73 73 |ck multi|ple pass|
|000011e0| 77 64 20 66 69 6c 65 73 | 20 66 6f 72 20 75 69 64 |wd files| for uid|
|000011f0| 2f 6e 61 6d 65 20 6f 76 | 65 72 6c 61 70 20 2d 20 |/name ov|erlap - |
|00001200| 44 6f 6e 20 4c 69 62 65 | 73 20 2a 2f 0a 58 0a 58 |Don Libe|s */.X.X|
|00001210| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 64 69 6f 2e |#include| <stdio.|
|00001220| 68 3e 0a 58 23 69 6e 63 | 6c 75 64 65 20 3c 70 77 |h>.X#inc|lude <pw|
|00001230| 64 2e 68 3e 0a 58 0a 58 | 23 64 65 66 69 6e 65 20 |d.h>.X.X|#define |
|00001240| 54 52 55 45 20 31 0a 58 | 23 64 65 66 69 6e 65 20 |TRUE 1.X|#define |
|00001250| 46 41 4c 53 45 20 30 0a | 58 0a 58 73 74 72 75 63 |FALSE 0.|X.Xstruc|
|00001260| 74 20 74 69 6e 79 70 61 | 73 73 77 64 20 7b 09 2f |t tinypa|sswd {./|
|00001270| 2a 20 6c 69 6b 65 20 73 | 74 72 75 63 74 20 70 77 |* like s|truct pw|
|00001280| 64 20 62 75 74 20 6d 69 | 73 73 69 6e 67 20 73 6f |d but mi|ssing so|
|00001290| 6d 65 20 65 6e 74 72 69 | 65 73 20 2a 2f 0a 58 09 |me entri|es */.X.|
|000012a0| 63 68 61 72 20 2a 6e 61 | 6d 65 3b 0a 58 09 63 68 |char *na|me;.X.ch|
|000012b0| 61 72 20 2a 64 69 72 3b | 0a 58 09 73 74 72 75 63 |ar *dir;|.X.struc|
|000012c0| 74 20 74 69 6e 79 70 61 | 73 73 77 64 20 2a 6e 65 |t tinypa|sswd *ne|
|000012d0| 78 74 3b 20 20 2f 2a 20 | 6f 74 68 65 72 20 65 6e |xt; /* |other en|
|000012e0| 74 72 69 65 73 20 6d 61 | 70 70 69 6e 67 20 74 6f |tries ma|pping to|
|000012f0| 20 73 61 6d 65 20 75 69 | 64 20 2a 2f 0a 58 09 63 | same ui|d */.X.c|
|00001300| 68 61 72 20 2a 66 69 6c | 65 3b 09 09 20 20 2f 2a |har *fil|e;.. /*|
|00001310| 20 66 69 6c 65 20 74 68 | 69 73 20 65 6e 74 72 79 | file th|is entry|
|00001320| 20 77 61 73 20 66 6f 75 | 6e 64 20 69 6e 20 2a 2f | was fou|nd in */|
|00001330| 0a 58 7d 3b 0a 58 0a 58 | 23 64 65 66 69 6e 65 20 |.X};.X.X|#define |
|00001340| 4d 49 4e 55 53 45 52 55 | 49 44 09 32 30 09 2f 2a |MINUSERU|ID.20./*|
|00001350| 20 64 6f 6e 27 74 20 63 | 68 65 63 6b 20 75 69 64 | don't c|heck uid|
|00001360| 73 20 62 65 6c 6f 77 20 | 74 68 69 73 20 66 6f 72 |s below |this for|
|00001370| 20 2a 2f 0a 58 09 09 09 | 09 2f 2a 20 6e 61 6d 65 | */.X...|./* name|
|00001380| 73 20 74 6f 20 6d 61 74 | 63 68 20 64 69 72 65 63 |s to mat|ch direc|
|00001390| 74 6f 72 69 65 73 20 2a | 2f 0a 58 23 64 65 66 69 |tories *|/.X#defi|
|000013a0| 6e 65 20 4d 41 58 4c 49 | 4e 45 4c 45 4e 09 31 33 |ne MAXLI|NELEN.13|
|000013b0| 32 0a 58 23 64 65 66 69 | 6e 65 20 4d 41 58 55 49 |2.X#defi|ne MAXUI|
|000013c0| 44 09 09 35 37 30 30 09 | 09 2f 2a 20 6c 61 72 67 |D..5700.|./* larg|
|000013d0| 65 73 74 20 75 69 64 20 | 77 65 20 6d 69 67 68 74 |est uid |we might|
|000013e0| 20 70 6f 73 73 69 62 6c | 79 20 73 65 65 20 2a 2f | possibl|y see */|
|000013f0| 0a 58 23 64 65 66 69 6e | 65 20 4e 4f 42 4f 44 59 |.X#defin|e NOBODY|
|00001400| 09 09 2d 32 0a 58 23 64 | 65 66 69 6e 65 20 73 6b |..-2.X#d|efine sk|
|00001410| 69 70 75 69 64 28 78 29 | 09 28 78 20 3d 3d 20 4e |ipuid(x)|.(x == N|
|00001420| 4f 42 4f 44 59 29 09 2f | 2a 20 61 6e 79 20 75 69 |OBODY)./|* any ui|
|00001430| 64 73 20 74 6f 20 73 6b | 69 70 2e 20 20 49 66 20 |ds to sk|ip. If |
|00001440| 6e 6f 6e 65 20 2a 2f 0a | 58 09 09 09 09 09 2f 2a |none */.|X...../*|
|00001450| 20 74 68 65 6e 20 6a 75 | 73 74 20 64 65 66 69 6e | then ju|st defin|
|00001460| 65 20 74 6f 20 62 65 20 | 30 20 2a 2f 0a 58 0a 58 |e to be |0 */.X.X|
|00001470| 73 74 72 75 63 74 20 74 | 69 6e 79 70 61 73 73 77 |struct t|inypassw|
|00001480| 64 20 2a 70 77 64 73 5b | 4d 41 58 55 49 44 5d 3b |d *pwds[|MAXUID];|
|00001490| 0a 58 63 68 61 72 20 6c | 69 6e 65 5b 4d 41 58 4c |.Xchar l|ine[MAXL|
|000014a0| 49 4e 45 4c 45 4e 5d 3b | 0a 58 73 74 72 75 63 74 |INELEN];|.Xstruct|
|000014b0| 20 74 69 6e 79 70 61 73 | 73 77 64 20 2a 70 77 64 | tinypas|swd *pwd|
|000014c0| 3b 0a 58 0a 58 63 68 61 | 72 20 2a 6d 61 6c 6c 6f |;.X.Xcha|r *mallo|
|000014d0| 63 28 29 3b 0a 58 63 68 | 61 72 20 2a 6e 65 77 73 |c();.Xch|ar *news|
|000014e0| 74 72 28 29 3b 0a 58 63 | 68 61 72 20 2a 72 69 6e |tr();.Xc|har *rin|
|000014f0| 64 65 78 28 29 3b 0a 58 | 73 74 72 75 63 74 20 70 |dex();.X|struct p|
|00001500| 61 73 73 77 64 20 2a 66 | 67 65 74 70 77 65 6e 74 |asswd *f|getpwent|
|00001510| 28 29 3b 0a 58 23 64 65 | 66 69 6e 65 20 6e 65 77 |();.X#de|fine new|
|00001520| 28 74 79 70 65 29 09 28 | 74 79 70 65 20 2a 29 6d |(type).(|type *)m|
|00001530| 61 6c 6c 6f 63 28 73 69 | 7a 65 6f 66 28 74 79 70 |alloc(si|zeof(typ|
|00001540| 65 29 29 0a 58 0a 58 6d | 61 69 6e 28 61 72 67 63 |e)).X.Xm|ain(argc|
|00001550| 2c 61 72 67 76 29 0a 58 | 69 6e 74 20 61 72 67 63 |,argv).X|int argc|
|00001560| 3b 0a 58 63 68 61 72 20 | 2a 2a 61 72 67 76 3b 0a |;.Xchar |**argv;.|
|00001570| 58 7b 0a 58 09 69 6e 74 | 20 66 69 6c 65 3b 0a 58 |X{.X.int| file;.X|
|00001580| 09 69 6e 74 20 75 69 64 | 3b 0a 58 09 46 49 4c 45 |.int uid|;.X.FILE|
|00001590| 20 2a 70 66 70 3b 0a 58 | 09 73 74 72 75 63 74 20 | *pfp;.X|.struct |
|000015a0| 70 61 73 73 77 64 20 2a | 73 74 61 74 69 63 70 77 |passwd *|staticpw|
|000015b0| 64 3b 0a 58 09 63 68 61 | 72 20 2a 6c 65 61 66 3b |d;.X.cha|r *leaf;|
|000015c0| 0a 58 0a 58 09 66 6f 72 | 20 28 75 69 64 3d 30 3b |.X.X.for| (uid=0;|
|000015d0| 75 69 64 3c 4d 41 58 55 | 49 44 3b 75 69 64 2b 2b |uid<MAXU|ID;uid++|
|000015e0| 29 20 70 77 64 73 5b 75 | 69 64 5d 20 3d 20 4e 55 |) pwds[u|id] = NU|
|000015f0| 4c 4c 3b 0a 58 0a 58 09 | 66 6f 72 20 28 66 69 6c |LL;.X.X.|for (fil|
|00001600| 65 3d 31 3b 66 69 6c 65 | 3c 61 72 67 63 3b 66 69 |e=1;file|<argc;fi|
|00001610| 6c 65 2b 2b 29 20 7b 0a | 58 09 09 69 66 20 28 4e |le++) {.|X..if (N|
|00001620| 55 4c 4c 20 3d 3d 20 28 | 70 66 70 20 3d 20 66 6f |ULL == (|pfp = fo|
|00001630| 70 65 6e 28 61 72 67 76 | 5b 66 69 6c 65 5d 2c 22 |pen(argv|[file],"|
|00001640| 72 22 29 29 29 20 7b 0a | 58 09 09 09 70 65 72 72 |r"))) {.|X...perr|
|00001650| 6f 72 28 61 72 67 76 5b | 66 69 6c 65 5d 29 3b 0a |or(argv[|file]);.|
|00001660| 58 09 09 09 63 6f 6e 74 | 69 6e 75 65 3b 0a 58 09 |X...cont|inue;.X.|
|00001670| 09 7d 0a 58 0a 58 09 09 | 77 68 69 6c 65 20 28 4e |.}.X.X..|while (N|
|00001680| 55 4c 4c 20 21 3d 20 28 | 73 74 61 74 69 63 70 77 |ULL != (|staticpw|
|00001690| 64 20 3d 20 66 67 65 74 | 70 77 65 6e 74 28 70 66 |d = fget|pwent(pf|
|000016a0| 70 29 29 29 20 7b 0a 58 | 09 09 09 69 66 20 28 70 |p))) {.X|...if (p|
|000016b0| 77 64 20 3d 3d 20 4e 55 | 4c 4c 29 20 7b 0a 58 09 |wd == NU|LL) {.X.|
|000016c0| 09 09 09 69 66 20 28 4e | 55 4c 4c 20 3d 3d 20 28 |...if (N|ULL == (|
|000016d0| 70 77 64 20 3d 20 6e 65 | 77 28 73 74 72 75 63 74 |pwd = ne|w(struct|
|000016e0| 20 74 69 6e 79 70 61 73 | 73 77 64 29 29 29 20 7b | tinypas|swd))) {|
|000016f0| 0a 58 09 09 09 09 09 70 | 72 69 6e 74 66 28 22 6d |.X.....p|rintf("m|
|00001700| 61 6c 6c 6f 63 3a 20 6f | 75 74 20 6f 66 20 73 70 |alloc: o|ut of sp|
|00001710| 61 63 65 5c 6e 22 29 3b | 0a 58 09 09 09 09 09 65 |ace\n");|.X.....e|
|00001720| 78 69 74 28 2d 31 29 3b | 0a 58 09 09 09 09 7d 0a |xit(-1);|.X....}.|
|00001730| 58 09 09 09 7d 0a 58 0a | 58 09 09 09 2f 2a 20 73 |X...}.X.|X.../* s|
|00001740| 6b 69 70 20 53 75 6e 20 | 79 70 20 68 6f 6f 6b 20 |kip Sun |yp hook |
|00001750| 2a 2f 0a 58 09 09 09 69 | 66 20 28 73 74 61 74 69 |*/.X...i|f (stati|
|00001760| 63 70 77 64 2d 3e 70 77 | 5f 6e 61 6d 65 5b 30 5d |cpwd->pw|_name[0]|
|00001770| 20 3d 3d 20 27 2b 27 29 | 20 63 6f 6e 74 69 6e 75 | == '+')| continu|
|00001780| 65 3b 0a 58 0a 58 09 09 | 09 70 77 64 2d 3e 6e 61 |e;.X.X..|.pwd->na|
|00001790| 6d 65 20 3d 20 6e 65 77 | 73 74 72 28 73 74 61 74 |me = new|str(stat|
|000017a0| 69 63 70 77 64 2d 3e 70 | 77 5f 6e 61 6d 65 29 3b |icpwd->p|w_name);|
|000017b0| 0a 58 09 09 09 70 77 64 | 2d 3e 64 69 72 20 3d 20 |.X...pwd|->dir = |
|000017c0| 6e 65 77 73 74 72 28 73 | 74 61 74 69 63 70 77 64 |newstr(s|taticpwd|
|000017d0| 2d 3e 70 77 5f 64 69 72 | 29 3b 0a 58 09 09 09 75 |->pw_dir|);.X...u|
|000017e0| 69 64 20 3d 20 73 74 61 | 74 69 63 70 77 64 2d 3e |id = sta|ticpwd->|
|000017f0| 70 77 5f 75 69 64 3b 0a | 58 0a 58 09 09 09 69 66 |pw_uid;.|X.X...if|
|00001800| 20 28 73 6b 69 70 75 69 | 64 28 75 69 64 29 29 20 | (skipui|d(uid)) |
|00001810| 63 6f 6e 74 69 6e 75 65 | 3b 0a 58 09 09 09 69 66 |continue|;.X...if|
|00001820| 20 28 75 69 64 20 3c 20 | 30 20 7c 7c 20 75 69 64 | (uid < |0 || uid|
|00001830| 20 3e 3d 20 4d 41 58 55 | 49 44 29 20 7b 0a 58 09 | >= MAXU|ID) {.X.|
|00001840| 09 09 09 70 72 69 6e 74 | 66 28 22 25 73 3a 20 75 |...print|f("%s: u|
|00001850| 69 64 20 25 64 20 6f 75 | 74 20 6f 66 20 72 61 6e |id %d ou|t of ran|
|00001860| 67 65 5c 6e 22 2c 0a 58 | 09 09 09 09 09 61 72 67 |ge\n",.X|.....arg|
|00001870| 76 5b 66 69 6c 65 5d 2c | 75 69 64 29 3b 0a 58 09 |v[file],|uid);.X.|
|00001880| 09 09 09 63 6f 6e 74 69 | 6e 75 65 3b 0a 58 09 09 |...conti|nue;.X..|
|00001890| 09 7d 0a 58 0a 58 09 09 | 09 2f 2a 20 63 68 65 63 |.}.X.X..|./* chec|
|000018a0| 6b 20 66 6f 72 20 6d 61 | 74 63 68 69 6e 67 20 64 |k for ma|tching d|
|000018b0| 69 72 65 63 74 6f 72 69 | 65 73 20 6f 6e 20 6c 61 |irectori|es on la|
|000018c0| 72 67 65 20 75 69 64 73 | 20 2a 2f 0a 58 09 09 09 |rge uids| */.X...|
|000018d0| 69 66 20 28 75 69 64 20 | 3e 20 4d 49 4e 55 53 45 |if (uid |> MINUSE|
|000018e0| 52 55 49 44 29 20 7b 0a | 58 09 09 09 09 69 66 20 |RUID) {.|X....if |
|000018f0| 28 30 20 3d 3d 20 28 6c | 65 61 66 20 3d 20 72 69 |(0 == (l|eaf = ri|
|00001900| 6e 64 65 78 28 70 77 64 | 2d 3e 64 69 72 2c 27 2f |ndex(pwd|->dir,'/|
|00001910| 27 29 29 29 20 7b 0a 58 | 09 09 09 09 09 70 72 69 |'))) {.X|.....pri|
|00001920| 6e 74 66 28 22 25 73 3a | 20 6e 6f 20 6c 65 61 66 |ntf("%s:| no leaf|
|00001930| 20 69 6e 20 64 69 72 65 | 63 74 6f 72 79 20 25 73 | in dire|ctory %s|
|00001940| 5c 6e 22 2c 0a 58 09 09 | 09 09 09 09 61 72 67 76 |\n",.X..|....argv|
|00001950| 5b 66 69 6c 65 5d 2c 6c | 69 6e 65 29 3b 0a 58 09 |[file],l|ine);.X.|
|00001960| 09 09 09 7d 20 65 6c 73 | 65 20 69 66 20 28 30 20 |...} els|e if (0 |
|00001970| 21 3d 20 73 74 72 63 6d | 70 28 70 77 64 2d 3e 6e |!= strcm|p(pwd->n|
|00001980| 61 6d 65 2c 31 2b 6c 65 | 61 66 29 29 20 7b 0a 58 |ame,1+le|af)) {.X|
|00001990| 09 09 09 09 09 70 72 69 | 6e 74 66 28 22 25 73 3a |.....pri|ntf("%s:|
|000019a0| 20 6e 69 63 6b 6e 61 6d | 65 20 25 73 20 68 61 73 | nicknam|e %s has|
|000019b0| 20 64 69 72 65 63 74 6f | 72 79 20 25 73 5c 6e 22 | directo|ry %s\n"|
|000019c0| 2c 0a 58 09 09 09 09 09 | 09 61 72 67 76 5b 66 69 |,.X.....|.argv[fi|
|000019d0| 6c 65 5d 2c 70 77 64 2d | 3e 6e 61 6d 65 2c 70 77 |le],pwd-|>name,pw|
|000019e0| 64 2d 3e 64 69 72 29 3b | 0a 58 09 09 09 09 7d 0a |d->dir);|.X....}.|
|000019f0| 58 09 09 09 7d 0a 58 0a | 58 09 09 09 70 77 64 2d |X...}.X.|X...pwd-|
|00001a00| 3e 66 69 6c 65 20 3d 20 | 61 72 67 76 5b 66 69 6c |>file = |argv[fil|
|00001a10| 65 5d 3b 0a 58 09 09 09 | 70 77 64 2d 3e 6e 65 78 |e];.X...|pwd->nex|
|00001a20| 74 20 3d 20 4e 55 4c 4c | 3b 0a 58 0a 58 09 09 09 |t = NULL|;.X.X...|
|00001a30| 69 66 20 28 21 68 61 73 | 68 5f 70 77 64 28 26 70 |if (!has|h_pwd(&p|
|00001a40| 77 64 73 5b 75 69 64 5d | 2c 70 77 64 29 29 20 7b |wds[uid]|,pwd)) {|
|00001a50| 0a 58 09 09 09 09 66 72 | 65 65 28 70 77 64 2d 3e |.X....fr|ee(pwd->|
|00001a60| 6e 61 6d 65 29 3b 0a 58 | 09 09 09 09 66 72 65 65 |name);.X|....free|
|00001a70| 28 70 77 64 2d 3e 64 69 | 72 29 3b 0a 58 09 09 09 |(pwd->di|r);.X...|
|00001a80| 7d 20 65 6c 73 65 20 70 | 77 64 20 3d 20 4e 55 4c |} else p|wd = NUL|
|00001a90| 4c 3b 0a 58 09 09 7d 0a | 58 09 09 66 63 6c 6f 73 |L;.X..}.|X..fclos|
|00001aa0| 65 28 70 66 70 29 3b 0a | 58 09 7d 0a 58 0a 58 09 |e(pfp);.|X.}.X.X.|
|00001ab0| 2f 2a 20 73 63 61 6e 20 | 64 6f 77 6e 20 6c 69 73 |/* scan |down lis|
|00001ac0| 74 20 6c 6f 6f 6b 69 6e | 67 20 66 6f 72 20 64 75 |t lookin|g for du|
|00001ad0| 70 73 20 2a 2f 0a 58 09 | 66 6f 72 20 28 75 69 64 |ps */.X.|for (uid|
|00001ae0| 3d 30 3b 75 69 64 3c 4d | 41 58 55 49 44 3b 75 69 |=0;uid<M|AXUID;ui|
|00001af0| 64 2b 2b 29 20 7b 0a 58 | 09 09 2f 2a 20 6e 6f 20 |d++) {.X|../* no |
|00001b00| 70 77 64 20 77 69 74 68 | 20 74 68 69 73 20 75 69 |pwd with| this ui|
|00001b10| 64 20 2a 2f 0a 58 09 09 | 69 66 20 28 70 77 64 73 |d */.X..|if (pwds|
|00001b20| 5b 75 69 64 5d 20 3d 3d | 20 4e 55 4c 4c 29 20 63 |[uid] ==| NULL) c|
|00001b30| 6f 6e 74 69 6e 75 65 3b | 0a 58 0a 58 09 09 2f 2a |ontinue;|.X.X../*|
|00001b40| 20 6e 6f 20 6f 74 68 65 | 72 20 70 77 64 20 77 69 | no othe|r pwd wi|
|00001b50| 74 68 20 74 68 69 73 20 | 75 69 64 20 2a 2f 0a 58 |th this |uid */.X|
|00001b60| 09 09 69 66 20 28 70 77 | 64 73 5b 75 69 64 5d 2d |..if (pw|ds[uid]-|
|00001b70| 3e 6e 65 78 74 20 3d 3d | 20 4e 55 4c 4c 29 20 63 |>next ==| NULL) c|
|00001b80| 6f 6e 74 69 6e 75 65 3b | 0a 58 0a 58 09 09 70 72 |ontinue;|.X.X..pr|
|00001b90| 69 6e 74 5f 70 77 64 28 | 75 69 64 29 3b 0a 58 09 |int_pwd(|uid);.X.|
|00001ba0| 7d 0a 58 7d 0a 58 0a 58 | 70 72 69 6e 74 5f 70 77 |}.X}.X.X|print_pw|
|00001bb0| 64 28 75 69 64 29 0a 58 | 69 6e 74 20 75 69 64 3b |d(uid).X|int uid;|
|00001bc0| 0a 58 7b 0a 58 09 73 74 | 72 75 63 74 20 74 69 6e |.X{.X.st|ruct tin|
|00001bd0| 79 70 61 73 73 77 64 20 | 2a 70 3b 0a 58 0a 58 09 |ypasswd |*p;.X.X.|
|00001be0| 66 6f 72 20 28 70 20 3d | 20 70 77 64 73 5b 75 69 |for (p =| pwds[ui|
|00001bf0| 64 5d 3b 70 3b 70 3d 70 | 2d 3e 6e 65 78 74 29 20 |d];p;p=p|->next) |
|00001c00| 7b 0a 58 09 09 70 72 69 | 6e 74 66 28 22 25 36 64 |{.X..pri|ntf("%6d|
|00001c10| 20 25 32 30 73 20 25 34 | 30 73 5c 6e 22 2c 75 69 | %20s %4|0s\n",ui|
|00001c20| 64 2c 70 2d 3e 6e 61 6d | 65 2c 70 2d 3e 66 69 6c |d,p->nam|e,p->fil|
|00001c30| 65 29 3b 0a 58 09 7d 0a | 58 7d 0a 58 0a 58 2f 2a |e);.X.}.|X}.X.X/*|
|00001c40| 20 72 65 74 75 72 6e 73 | 20 54 52 55 45 20 69 66 | returns| TRUE if|
|00001c50| 20 70 77 64 20 73 74 6f | 72 65 64 2c 20 46 41 4c | pwd sto|red, FAL|
|00001c60| 53 45 20 69 66 20 6e 6f | 74 20 73 74 6f 72 65 64 |SE if no|t stored|
|00001c70| 20 2a 2f 0a 58 68 61 73 | 68 5f 70 77 64 28 70 65 | */.Xhas|h_pwd(pe|
|00001c80| 70 2c 70 29 0a 58 73 74 | 72 75 63 74 20 74 69 6e |p,p).Xst|ruct tin|
|00001c90| 79 70 61 73 73 77 64 20 | 2a 2a 70 65 70 3b 09 2f |ypasswd |**pep;./|
|00001ca0| 2a 20 70 77 64 73 20 65 | 6e 74 72 79 20 70 6f 69 |* pwds e|ntry poi|
|00001cb0| 6e 74 65 72 20 2a 2f 0a | 58 73 74 72 75 63 74 20 |nter */.|Xstruct |
|00001cc0| 74 69 6e 79 70 61 73 73 | 77 64 20 2a 70 3b 0a 58 |tinypass|wd *p;.X|
|00001cd0| 7b 0a 58 09 69 6e 74 20 | 64 69 66 66 65 72 65 6e |{.X.int |differen|
|00001ce0| 74 20 3d 20 46 41 4c 53 | 45 3b 0a 58 09 73 74 72 |t = FALS|E;.X.str|
|00001cf0| 75 63 74 20 74 69 6e 79 | 70 61 73 73 77 64 20 2a |uct tiny|passwd *|
|00001d00| 70 70 74 72 3b 20 20 2f | 2a 20 70 6f 69 6e 74 65 |pptr; /|* pointe|
|00001d10| 72 20 74 6f 20 6f 70 65 | 6e 2d 68 61 73 68 65 64 |r to ope|n-hashed|
|00001d20| 20 70 77 64 20 65 6e 74 | 72 69 65 73 20 2a 2f 0a | pwd ent|ries */.|
|00001d30| 58 09 73 74 72 75 63 74 | 20 74 69 6e 79 70 61 73 |X.struct| tinypas|
|00001d40| 73 77 64 20 2a 6c 61 73 | 74 70 3b 20 2f 2a 20 77 |swd *las|tp; /* w|
|00001d50| 68 65 72 65 20 74 6f 20 | 61 70 70 65 6e 64 20 6e |here to |append n|
|00001d60| 65 77 20 73 74 72 75 63 | 74 20 70 61 73 73 77 64 |ew struc|t passwd|
|00001d70| 20 2a 2f 0a 58 0a 58 09 | 69 66 20 28 4e 55 4c 4c | */.X.X.|if (NULL|
|00001d80| 20 3d 3d 20 2a 70 65 70 | 29 20 7b 0a 58 09 09 2a | == *pep|) {.X..*|
|00001d90| 70 65 70 20 3d 20 70 3b | 0a 58 09 09 72 65 74 75 |pep = p;|.X..retu|
|00001da0| 72 6e 28 54 52 55 45 29 | 3b 0a 58 09 7d 0a 58 0a |rn(TRUE)|;.X.}.X.|
|00001db0| 58 09 66 6f 72 20 28 70 | 70 74 72 20 3d 20 2a 70 |X.for (p|ptr = *p|
|00001dc0| 65 70 3b 70 70 74 72 3b | 70 70 74 72 3d 70 70 74 |ep;pptr;|pptr=ppt|
|00001dd0| 72 2d 3e 6e 65 78 74 29 | 20 7b 0a 58 09 09 6c 61 |r->next)| {.X..la|
|00001de0| 73 74 70 20 3d 20 70 70 | 74 72 3b 0a 58 09 09 69 |stp = pp|tr;.X..i|
|00001df0| 66 20 28 64 69 66 66 65 | 72 65 6e 74 29 20 63 6f |f (diffe|rent) co|
|00001e00| 6e 74 69 6e 75 65 3b 09 | 2f 2a 20 6a 75 73 74 20 |ntinue;.|/* just |
|00001e10| 67 65 74 20 74 6f 20 65 | 6e 64 20 6f 66 20 6c 69 |get to e|nd of li|
|00001e20| 73 74 20 2a 2f 0a 58 09 | 09 69 66 20 28 30 20 21 |st */.X.|.if (0 !|
|00001e30| 3d 20 73 74 72 63 6d 70 | 28 70 70 74 72 2d 3e 6e |= strcmp|(pptr->n|
|00001e40| 61 6d 65 2c 70 2d 3e 6e | 61 6d 65 29 29 20 64 69 |ame,p->n|ame)) di|
|00001e50| 66 66 65 72 65 6e 74 20 | 3d 20 54 52 55 45 3b 0a |fferent |= TRUE;.|
|00001e60| 58 09 7d 0a 58 09 69 66 | 20 28 64 69 66 66 65 72 |X.}.X.if| (differ|
|00001e70| 65 6e 74 29 20 6c 61 73 | 74 70 2d 3e 6e 65 78 74 |ent) las|tp->next|
|00001e80| 20 3d 20 70 3b 0a 58 0a | 58 09 72 65 74 75 72 6e | = p;.X.|X.return|
|00001e90| 28 64 69 66 66 65 72 65 | 6e 74 29 3b 0a 58 7d 0a |(differe|nt);.X}.|
|00001ea0| 58 0a 58 63 68 61 72 20 | 2a 6e 65 77 73 74 72 28 |X.Xchar |*newstr(|
|00001eb0| 73 29 0a 58 63 68 61 72 | 20 2a 73 3b 0a 58 7b 0a |s).Xchar| *s;.X{.|
|00001ec0| 58 09 63 68 61 72 20 2a | 6e 65 77 73 3b 0a 58 0a |X.char *|news;.X.|
|00001ed0| 58 09 69 66 20 28 21 28 | 6e 65 77 73 20 3d 20 6d |X.if (!(|news = m|
|00001ee0| 61 6c 6c 6f 63 28 31 2b | 73 74 72 6c 65 6e 28 73 |alloc(1+|strlen(s|
|00001ef0| 29 29 29 29 20 7b 0a 58 | 09 09 70 72 69 6e 74 66 |)))) {.X|..printf|
|00001f00| 28 22 6e 65 77 73 74 72 | 3a 20 6f 75 74 20 6f 66 |("newstr|: out of|
|00001f10| 20 73 70 61 63 65 5c 6e | 22 29 3b 0a 58 09 09 65 | space\n|");.X..e|
|00001f20| 78 69 74 28 30 29 3b 0a | 58 09 7d 0a 58 09 73 74 |xit(0);.|X.}.X.st|
|00001f30| 72 63 70 79 28 6e 65 77 | 73 2c 73 29 3b 0a 58 09 |rcpy(new|s,s);.X.|
|00001f40| 72 65 74 75 72 6e 28 6e | 65 77 73 29 3b 0a 58 7d |return(n|ews);.X}|
|00001f50| 0a 45 4e 44 5f 4f 46 5f | 46 49 4c 45 0a 69 66 20 |.END_OF_|FILE.if |
|00001f60| 74 65 73 74 20 33 33 31 | 31 20 2d 6e 65 20 60 77 |test 331|1 -ne `w|
|00001f70| 63 20 2d 63 20 3c 27 70 | 77 64 69 66 66 2e 63 27 |c -c <'p|wdiff.c'|
|00001f80| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00001f90| 20 73 68 61 72 3a 20 5c | 22 27 70 77 64 69 66 66 | shar: \|"'pwdiff|
|00001fa0| 2e 63 27 5c 22 20 75 6e | 70 61 63 6b 65 64 20 77 |.c'\" un|packed w|
|00001fb0| 69 74 68 20 77 72 6f 6e | 67 20 73 69 7a 65 21 0a |ith wron|g size!.|
|00001fc0| 66 69 0a 23 20 65 6e 64 | 20 6f 66 20 27 70 77 64 |fi.# end| of 'pwd|
|00001fd0| 69 66 66 2e 63 27 0a 66 | 69 0a 65 63 68 6f 20 73 |iff.c'.f|i.echo s|
|00001fe0| 68 61 72 3a 20 45 6e 64 | 20 6f 66 20 73 68 65 6c |har: End| of shel|
|00001ff0| 6c 20 61 72 63 68 69 76 | 65 2e 0a 65 78 69 74 20 |l archiv|e..exit |
|00002000| 30 0a 0a | |0.. | |
+--------+-------------------------+-------------------------+--------+--------+