home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume22 / auth-utils / part02 < prev    next >
Text File  |  1990-04-29  |  57KB  |  1,546 lines

  1. Subject:  v22i004:  Utilities for auth2.1 server, Part02/03
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 582fbff6 16089939 01f37867 64bf5410
  5.  
  6. Submitted-by: Daniel J. Bernstein <brnstnd@acf10.nyu.edu>
  7. Posting-number: Volume 22, Issue 4
  8. Archive-name: auth-utils/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 3)."
  17. # Contents:  aport/README aport/checkaport.man aport/killaport.c
  18. #   aport/killaport.man aport/listaport.c clients/README clients/inews
  19. #   sendmail-auth/README servers/README servers/in.chargend
  20. #   servers/services tam/README tam/TAM.doc tam/tamdel.c
  21. # Wrapped by rsalz@litchi.bbn.com on Mon Apr 30 16:18:46 1990
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'aport/README' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'aport/README'\"
  25. else
  26. echo shar: Extracting \"'aport/README'\" \(1647 characters\)
  27. sed "s/^X//" >'aport/README' <<'END_OF_FILE'
  28. Xaport - the aport utilites, version 1.0
  29. X
  30. XThese programs work closely with the authentication directory structure
  31. Xto provide termination, status, and recovery facilities. Future versions
  32. Xof these programs will probably be incorporated into the auth package.
  33. X
  34. Xkillaport version 1.0, April 23, 1990.
  35. XCopyright (c) 1990, Daniel J. Bernstein.
  36. XAll rights reserved.
  37. X
  38. Xlistaport version 1.0, April 23, 1990.
  39. XCopyright (c) 1990, Daniel J. Bernstein.
  40. XAll rights reserved.
  41. X
  42. Xcheckaport version 1.0, April 23, 1990.
  43. XCopyright (c) 1990, Daniel J. Bernstein.
  44. XAll rights reserved.
  45. X
  46. XFiles:
  47. XCHANGES         Description of changes since first distributed version
  48. XREADME          This document
  49. XMakefile        Installation commands
  50. Xkillaport.c     The killaport program
  51. Xlistaport.c     The listaport program
  52. Xcheckaport.c    The checkaport program
  53. Xkillaport.man   Documentation
  54. Xlistaport.man   Documentation
  55. Xcheckaport.man  Documentation
  56. Xdjberr.h        Error macros
  57. X
  58. XEdit the options in Makefile and type make. killaport, listaport, and
  59. Xcheckaport will be the executable programs; killaport.1, listaport.1,
  60. Xand checkaport.1 will be the nroff'ed documentation.
  61. X
  62. Xkillaport and listaport must be setuid auth like authtcp and attachport.
  63. Xcheckaport is an experimental equivalent of fsck for the authentication
  64. Xdirectory; it should not be setuid auth, though it should run as auth or
  65. Xroot periodically by hand or from cron.
  66. X
  67. XI don't pretend to know your machine's setup so there's no make install.
  68. X
  69. XRead CHANGES for a list of changes. Type killaport -C and killaport -W
  70. Xfor copyright and warranty information, killaport -H for help. Similarly
  71. Xfor listaport and checkaport.
  72. END_OF_FILE
  73. if test 1647 -ne `wc -c <'aport/README'`; then
  74.     echo shar: \"'aport/README'\" unpacked with wrong size!
  75. fi
  76. # end of 'aport/README'
  77. fi
  78. if test -f 'aport/checkaport.man' -a "${1}" != "-c" ; then 
  79.   echo shar: Will not clobber existing file \"'aport/checkaport.man'\"
  80. else
  81. echo shar: Extracting \"'aport/checkaport.man'\" \(1734 characters\)
  82. sed "s/^X//" >'aport/checkaport.man' <<'END_OF_FILE'
  83. X.TH checkaport 8
  84. X.SH NAME
  85. Xcheckaport \- clean up authentication directory, checking security
  86. X.SH SYNTAX
  87. Xcheckaport
  88. X[
  89. X\fB\-ACHUVW\fI
  90. X]
  91. X.SH DESCRIPTION
  92. X.I checkaport
  93. Xwades through the
  94. Xauthentication directory,
  95. Xchecking for possible security breaches,
  96. Xannouncing warnings on stderr,
  97. Xand generally cleaning up.
  98. XIt may be run periodically
  99. Xby hand or from
  100. X.I cron.
  101. X.PP
  102. XNormally
  103. X.I checkaport
  104. Xwill run almost instantaneously
  105. Xand produce no output.
  106. XIf something strange has happened or your
  107. X.I rc.local
  108. Xfailed to clean up the authentication directory
  109. Xupon reboot,
  110. X.I checkaport
  111. Xmay give some warnings and
  112. Xdelete some outdated authentication files.
  113. XIn general you'll have to run
  114. X.I checkaport
  115. Xmore than once to clean up after major shocks.
  116. X.PP
  117. XOccasionally
  118. X.I checkaport
  119. Xmay announce a possible violation of security
  120. X(denial of service).
  121. XUsually the ILR user listed is responsible for the breach,
  122. Xbut you have to understand the authentication directory structure
  123. Xbefore you can be sure about this.
  124. X.PP
  125. XOptions
  126. X.B ACHUVW
  127. Xprint the authorship notice,
  128. Xcopyright notice,
  129. Xhelp notice,
  130. Xshort usage summary,
  131. Xversion number,
  132. Xand warranty information respectively.
  133. X.SH FILES
  134. X/usr/etc/auth/tcp
  135. XAuthentication directory
  136. X.SH DIAGNOSTICS
  137. XToo many to list;
  138. Xlater versions will have different diagnostics.
  139. XRead the source code.
  140. X.SH BUGS
  141. XNone known.
  142. X.SH MACHINES
  143. X.I checkaport
  144. Xhas been partially tested
  145. Xon an Astronautics ZS-2 running ZSUnix.
  146. XLike all other failure recovery systems,
  147. Xit's difficult to test thoroughly.
  148. XIf you have any luck with it or
  149. Xsuggestions for improvements, let the
  150. Xauthor know.
  151. X.SH VERSION
  152. Xcheckaport version 1.0, dated April 23, 1990.
  153. X.SH AUTHOR
  154. XCopyright 1990, Daniel J. Bernstein.
  155. X.SH "SEE ALSO"
  156. Xattachport(1),
  157. Xauthtcp(1),
  158. Xauthd(8)
  159. END_OF_FILE
  160. if test 1734 -ne `wc -c <'aport/checkaport.man'`; then
  161.     echo shar: \"'aport/checkaport.man'\" unpacked with wrong size!
  162. fi
  163. # end of 'aport/checkaport.man'
  164. fi
  165. if test -f 'aport/killaport.c' -a "${1}" != "-c" ; then 
  166.   echo shar: Will not clobber existing file \"'aport/killaport.c'\"
  167. else
  168. echo shar: Extracting \"'aport/killaport.c'\" \(5949 characters\)
  169. sed "s/^X//" >'aport/killaport.c' <<'END_OF_FILE'
  170. X/*
  171. Xkillaport.c: kill an attachport
  172. X*/
  173. X
  174. X/* WARNING! killaport is probably setuid auth! */
  175. X/* All setuid programs are dangerous! Check them carefully! */
  176. X
  177. Xstatic char killaportauthor[] =
  178. X"killaport was written by Daniel J. Bernstein.\n\
  179. XInternet address: brnstnd@acf10.nyu.edu.\n";
  180. X
  181. Xstatic char killaportversion[] = 
  182. X"killaport version 1.0, April 23, 1990.\n\
  183. XCopyright (c) 1990, Daniel J. Bernstein.\n\
  184. XAll rights reserved.\n";
  185. X
  186. Xstatic char killaportcopyright[] =
  187. X"killaport version 1.0, April 23, 1990.\n\
  188. XCopyright (c) 1990, Daniel J. Bernstein.\n\
  189. XAll rights reserved.\n\
  190. X\n\
  191. XUntil January 1, 1995, you are granted the following rights: A. To make\n\
  192. Xcopies of this work in original form, so long as (1) the copies are exact\n\
  193. Xand complete; (2) the copies include the copyright notice, this paragraph,\n\
  194. Xand the disclaimer of warranty in their entirety. B. To distribute this\n\
  195. Xwork, or copies made under the provisions above, so long as (1) this is\n\
  196. Xthe original work and not a derivative form; (2) you do not charge a fee\n\
  197. Xfor copying or for distribution; (3) you ensure that the distributed form\n\
  198. Xincludes the copyright notice, this paragraph, and the disclaimer of\n\
  199. Xwarranty in their entirety. These rights are temporary and revocable upon\n\
  200. Xwritten, oral, or other notice by Daniel J. Bernstein. These rights are\n\
  201. Xautomatically revoked on January 1, 1995. This copyright notice shall be\n\
  202. Xgoverned by the laws of the state of New York.\n\
  203. X\n\
  204. XIf you have questions about killaport or about this copyright notice,\n\
  205. Xor if you would like additional rights beyond those granted above,\n\
  206. Xplease feel free to contact the author at brnstnd@acf10.nyu.edu\n\
  207. Xon the Internet.\n";
  208. X
  209. Xstatic char killaportwarranty[] =
  210. X"To the extent permitted by applicable law, Daniel J. Bernstein disclaims\n\
  211. Xall warranties, explicit or implied, including but not limited to the\n\
  212. Ximplied warranties of merchantability and fitness for a particular purpose.\n\
  213. XDaniel J. Bernstein is not and shall not be liable for any damages,\n\
  214. Xincidental or consequential, arising from the use of this program, even\n\
  215. Xif you inform him of the possibility of such damages. This disclaimer\n\
  216. Xshall be governed by the laws of the state of New York.\n\
  217. X\n\
  218. XIn other words, use this program at your own risk.\n\
  219. X\n\
  220. XIf you have questions about killaport or about this disclaimer of warranty,\n\
  221. Xplease feel free to contact the author at brnstnd@acf10.nyu.edu\n\
  222. Xon the Internet.\n";
  223. X
  224. Xstatic char killaportusage[] =
  225. X"Usage: killaport [ -ACHUVW ] port\n\
  226. XHelp:  killaport -H\n";
  227. X
  228. Xstatic char killaporthelp[] =
  229. X"killaport kills an attachport you're running.\n\
  230. X\n\
  231. Xkillaport -A: print authorship notice\n\
  232. Xkillaport -C: print copyright notice\n\
  233. Xkillaport -H: print this notice\n\
  234. Xkillaport -U: print short usage summary\n\
  235. Xkillaport -V: print version number\n\
  236. Xkillaport -W: print disclaimer of warranty\n\
  237. X\n\
  238. Xkillaport port: kill, kill, kill!\n\
  239. X\n\
  240. XIf you have questions about or suggestions for killaport, please feel free\n\
  241. Xto contact the author, Daniel J. Bernstein, at brnstnd@acf10.nyu.edu\n\
  242. Xon the Internet.\n";
  243. X
  244. X#include <sys/types.h>
  245. X#include <netinet/in.h>
  246. X#include <sys/file.h>
  247. X#ifdef BSD
  248. X#include <limits.h>
  249. X#endif
  250. X#include <stdio.h>
  251. X#include <netdb.h>
  252. X#include <signal.h>
  253. X#include <errno.h>
  254. Xextern int errno;
  255. X#include <pwd.h>
  256. Xextern int getopt();
  257. Xextern char *optarg; /* these should be in getopt.h! */
  258. Xextern int optind;
  259. X#include "djberr.h"
  260. X
  261. X#ifndef AUTHDIR
  262. X#define AUTHDIR "/usr/etc/auth"
  263. X#endif
  264. X
  265. Xmain(argc,argv,envp)
  266. Xint argc;
  267. Xchar *argv[];
  268. Xchar *envp[];
  269. X{
  270. X int opt;
  271. X int uid = getuid();
  272. X int euid = geteuid();
  273. X int fd;
  274. X char buf[32]; /* same length as in attachport */
  275. X int r;
  276. X struct passwd *pw;
  277. X char username[10];
  278. X int pid;
  279. X unsigned short port;
  280. X struct servent *se;
  281. X
  282. X /* WARNING! We are probably running setuid auth! */
  283. X
  284. X while ((opt = getopt(argc,argv,"ACHUVW")) != EOF)
  285. X   switch(opt)
  286. X    {
  287. X     case 'A': (void) err(killaportauthor); exit(1);
  288. X     case 'C': (void) err(killaportcopyright); exit(1);
  289. X     case 'H': (void) err(killaporthelp); exit(1);
  290. X     case 'U': (void) err(killaportusage); exit(1);
  291. X     case 'V': (void) err(killaportversion); exit(1);
  292. X     case 'W': (void) err(killaportwarranty); exit(1);
  293. X     case '?': (void) err(killaportusage); exit(1);
  294. X    }
  295. X argv += optind, argc -= optind;
  296. X
  297. X if (!*argv)
  298. X  {
  299. X   (void) err(killaportusage);
  300. X   exit(1);
  301. X  }
  302. X if (sscanf(*argv,"%hd",&port) < 1)
  303. X   if (!(se = getservbyname(*argv,"tcp")))
  304. X    {
  305. X     (void) err(killaportusage);
  306. X     exit(1);
  307. X    }
  308. X   else
  309. X     port = ntohs(se->s_port); /* inconsistency alert! s_port is int! */
  310. X
  311. X if (!(pw = getpwuid(uid)))
  312. X  {
  313. X   (void) errn("killaport: fatal: who are you?");
  314. X   exit(4);
  315. X  }
  316. X
  317. X if ((chdir(AUTHDIR) == -1) || chdir("tcp") == -1)
  318. X  {
  319. X   perrn2("killaport: fatal: cannot change to directory %s/tcp",AUTHDIR);
  320. X   exit(2);
  321. X  }
  322. X
  323. X (void) sprintf(buf,"lock.%u",port);
  324. X
  325. X if (((fd = open(buf,O_RDONLY)) == -1) || (flock(fd,LOCK_EX) == -1))
  326. X  {
  327. X   perrn2("killaport: fatal: cannot open lock file lock.%u",port);
  328. X   exit(5);
  329. X  }
  330. X if ((r = read(fd,buf,31)) <= 0)
  331. X  {
  332. X   errn2("killaport: fatal: cannot read lock file lock.%u",port);
  333. X   exit(6);
  334. X  }
  335. X buf[r] = '\0';
  336. X if (buf[0] == '!')
  337. X  {
  338. X   errn2("killaport: fatal: corrupted lock file lock.%u",port);
  339. X   exit(7);
  340. X  }
  341. X if (sscanf(buf,"%d-%s",&pid,username) < 2)
  342. X  {
  343. X   errn2("killaport: fatal: port %u not owned by an attachport",port);
  344. X   exit(8);
  345. X  }
  346. X if (uid && strcmp(username,pw->pw_name))
  347. X  {
  348. X   (void)
  349. X   errn2("killaport: fatal: cannot kill port %u: Permission denied",port);
  350. X   exit(9);
  351. X  }
  352. X if (kill(pid,SIGTERM) == -1)
  353. X   switch(errno)
  354. X    {
  355. X     case ESRCH:
  356. X       (void) errn2("killaport: fatal: port %u in trauma",port);
  357. X       exit(10);
  358. X     default:
  359. X       (void) errn2("killaport: weird: can't kill port %u attachport?",port);
  360. X       exit(11);
  361. X    }
  362. X (void) errn2("killaport: port %u killed,\
  363. X will be free after last connection drops",port);
  364. X
  365. X (void) close(fd);
  366. X exit(0);
  367. X}
  368. END_OF_FILE
  369. if test 5949 -ne `wc -c <'aport/killaport.c'`; then
  370.     echo shar: \"'aport/killaport.c'\" unpacked with wrong size!
  371. fi
  372. # end of 'aport/killaport.c'
  373. fi
  374. if test -f 'aport/killaport.man' -a "${1}" != "-c" ; then 
  375.   echo shar: Will not clobber existing file \"'aport/killaport.man'\"
  376. else
  377. echo shar: Extracting \"'aport/killaport.man'\" \(2349 characters\)
  378. sed "s/^X//" >'aport/killaport.man' <<'END_OF_FILE'
  379. X.TH killaport 1
  380. X.SH NAME
  381. Xkillaport \- manually kill an attachport
  382. X.SH SYNTAX
  383. Xkillaport
  384. X[
  385. X\fB\-ACHUVW\fI
  386. X]
  387. Xport
  388. X.SH DESCRIPTION
  389. X.I killaport
  390. Xkills the
  391. X.I attachport
  392. Xserving
  393. Xconnections to
  394. Xthe given TCP
  395. X.I port,
  396. Xprovided you are
  397. Xthe owner of that
  398. X.I attachport
  399. Xand
  400. Xit is authenticated.
  401. X.PP
  402. X.I port
  403. Xcan be given as a name
  404. Xor number.
  405. X.PP
  406. XThe
  407. X.I attachport
  408. Xwon't actually die
  409. Xuntil all its children have exited.
  410. XIt will, however, wither away slowly,
  411. Xnot accepting any new connections on the port.
  412. X.PP
  413. XOptions
  414. X.B ACHUVW
  415. Xprint the authorship notice,
  416. Xcopyright notice,
  417. Xhelp notice,
  418. Xshort usage summary,
  419. Xversion number,
  420. Xand warranty information respectively.
  421. X.SH FILES
  422. X/usr/etc/auth/tcp
  423. XAuthentication directory
  424. X.SH "EXIT VALUE"
  425. X0 upon success;
  426. X1 for usage messages;
  427. X2 if
  428. X.I killaport
  429. Xcan't get into the authentication directory;
  430. X4 if you're not listed in your password file;
  431. X5 if nobody is authenticated on that port;
  432. X6 if the lock file is unreadable;
  433. X7 if the lock file is corrupted;
  434. X8 if the port is not an
  435. X.I attachport;
  436. X9 if the port belongs to someone else;
  437. X10 if the
  438. X.I attachport
  439. Xhas silently died;
  440. X11 if the
  441. X.I attachport
  442. Xis unkillable for some other reason.
  443. X.SH DIAGNOSTICS
  444. X.TP
  445. X.I cannot change to directory
  446. X.I killaport
  447. Xdoes not have access to the authentication directory.
  448. X.TP
  449. X.I who are you?
  450. XYou're not listed in your password file.
  451. X.TP
  452. X.I cannot open lock file
  453. XThere are no authenticated utilities running on that port.
  454. X.TP
  455. X.I cannot read lock file
  456. XShouldn't happen.
  457. X.TP
  458. X.I corrupted lock file
  459. XSomeone has attempted to breach
  460. X.I attachport
  461. Xsecurity on this port.
  462. XReport this condition to your system administrator.
  463. X.TP
  464. X.I port not owned by an attachport
  465. XProbably an
  466. X.I authtcp
  467. Xis running on that port.
  468. X.TP
  469. X.I cannot kill port
  470. XThe
  471. X.I attachport
  472. Xbelongs to somebody else.
  473. X.TP
  474. X.I port in trauma
  475. XProbably the machine crashed
  476. Xand your machine's boot sequence
  477. Xdoesn't clear old authentications.
  478. X.TP
  479. X.I can't kill attachport?
  480. XThis shouldn't happen.
  481. X.TP
  482. X.I port killed
  483. XSuccess.
  484. X.SH RESTRICTIONS
  485. XThere's no way for anyone except root
  486. Xto kill an attachport started with
  487. X.B\-X
  488. Xand without
  489. X.B\-0.
  490. X.SH BUGS
  491. XNone known.
  492. X.SH MACHINES
  493. X.I killaport
  494. Xhas been tested
  495. Xon an Astronautics ZS-2 running ZSUnix.
  496. X.SH VERSION
  497. Xkillaport version 1.0, dated 4/23/90.
  498. X.SH AUTHOR
  499. XCopyright 1990, Daniel J. Bernstein.
  500. X.SH "SEE ALSO"
  501. Xattachport(1),
  502. Xlistaport(1),
  503. Xcheckaport(8)
  504. END_OF_FILE
  505. if test 2349 -ne `wc -c <'aport/killaport.man'`; then
  506.     echo shar: \"'aport/killaport.man'\" unpacked with wrong size!
  507. fi
  508. # end of 'aport/killaport.man'
  509. fi
  510. if test -f 'aport/listaport.c' -a "${1}" != "-c" ; then 
  511.   echo shar: Will not clobber existing file \"'aport/listaport.c'\"
  512. else
  513. echo shar: Extracting \"'aport/listaport.c'\" \(5387 characters\)
  514. sed "s/^X//" >'aport/listaport.c' <<'END_OF_FILE'
  515. X/*
  516. Xlistaport.c: list current attachports
  517. X*/
  518. X
  519. X/* WARNING! listaport is probably setuid auth! */
  520. X/* All setuid programs are dangerous! Check them carefully! */
  521. X
  522. Xstatic char listaportauthor[] =
  523. X"listaport was written by Daniel J. Bernstein.\n\
  524. XInternet address: brnstnd@acf10.nyu.edu.\n";
  525. X
  526. Xstatic char listaportversion[] = 
  527. X"listaport version 1.0, April 23, 1990.\n\
  528. XCopyright (c) 1990, Daniel J. Bernstein.\n\
  529. XAll rights reserved.\n";
  530. X
  531. Xstatic char listaportcopyright[] =
  532. X"listaport version 1.0, April 23, 1990.\n\
  533. XCopyright (c) 1990, Daniel J. Bernstein.\n\
  534. XAll rights reserved.\n\
  535. X\n\
  536. XUntil January 1, 1995, you are granted the following rights: A. To make\n\
  537. Xcopies of this work in original form, so long as (1) the copies are exact\n\
  538. Xand complete; (2) the copies include the copyright notice, this paragraph,\n\
  539. Xand the disclaimer of warranty in their entirety. B. To distribute this\n\
  540. Xwork, or copies made under the provisions above, so long as (1) this is\n\
  541. Xthe original work and not a derivative form; (2) you do not charge a fee\n\
  542. Xfor copying or for distribution; (3) you ensure that the distributed form\n\
  543. Xincludes the copyright notice, this paragraph, and the disclaimer of\n\
  544. Xwarranty in their entirety. These rights are temporary and revocable upon\n\
  545. Xwritten, oral, or other notice by Daniel J. Bernstein. These rights are\n\
  546. Xautomatically revoked on January 1, 1995. This copyright notice shall be\n\
  547. Xgoverned by the laws of the state of New York.\n\
  548. X\n\
  549. XIf you have questions about listaport or about this copyright notice,\n\
  550. Xor if you would like additional rights beyond those granted above,\n\
  551. Xplease feel free to contact the author at brnstnd@acf10.nyu.edu\n\
  552. Xon the Internet.\n";
  553. X
  554. Xstatic char listaportwarranty[] =
  555. X"To the extent permitted by applicable law, Daniel J. Bernstein disclaims\n\
  556. Xall warranties, explicit or implied, including but not limited to the\n\
  557. Ximplied warranties of merchantability and fitness for a particular purpose.\n\
  558. XDaniel J. Bernstein is not and shall not be liable for any damages,\n\
  559. Xincidental or consequential, arising from the use of this program, even\n\
  560. Xif you inform him of the possibility of such damages. This disclaimer\n\
  561. Xshall be governed by the laws of the state of New York.\n\
  562. X\n\
  563. XIn other words, use this program at your own risk.\n\
  564. X\n\
  565. XIf you have questions about listaport or about this disclaimer of warranty,\n\
  566. Xplease feel free to contact the author at brnstnd@acf10.nyu.edu\n\
  567. Xon the Internet.\n";
  568. X
  569. Xstatic char listaportusage[] =
  570. X"Usage: listaport [ -ACHUVW ] \n\
  571. XHelp:  listaport -H\n";
  572. X
  573. Xstatic char listaporthelp[] =
  574. X"listaport lists all attachports you're running.\n\
  575. X\n\
  576. Xlistaport -A: print authorship notice\n\
  577. Xlistaport -C: print copyright notice\n\
  578. Xlistaport -H: print this notice\n\
  579. Xlistaport -U: print short usage summary\n\
  580. Xlistaport -V: print version number\n\
  581. Xlistaport -W: print disclaimer of warranty\n\
  582. X\n\
  583. Xlistaport: list ports\n\
  584. X\n\
  585. XIf you have questions about or suggestions for listaport, please feel free\n\
  586. Xto contact the author, Daniel J. Bernstein, at brnstnd@acf10.nyu.edu\n\
  587. Xon the Internet.\n";
  588. X
  589. X#include <sys/types.h>
  590. X#include <sys/dir.h>
  591. X#include <sys/file.h>
  592. X#ifdef BSD
  593. X#include <limits.h>
  594. X#endif
  595. X#include <stdio.h>
  596. X#include <pwd.h>
  597. Xextern int getopt();
  598. Xextern char *optarg; /* these should be in getopt.h! */
  599. Xextern int optind;
  600. X#include "djberr.h"
  601. X
  602. X#ifndef AUTHDIR
  603. X#define AUTHDIR "/usr/etc/auth"
  604. X#endif
  605. X
  606. Xmain(argc,argv,envp)
  607. Xint argc;
  608. Xchar *argv[];
  609. Xchar *envp[];
  610. X{
  611. X int opt;
  612. X int uid = getuid();
  613. X int euid = geteuid();
  614. X DIR *dirp;
  615. X struct direct *dp;
  616. X int fd;
  617. X char buf[32]; /* same length as in attachport */
  618. X int r;
  619. X struct passwd *pw;
  620. X char username[10];
  621. X int pid;
  622. X unsigned short port;
  623. X
  624. X /* WARNING! We are probably running setuid auth! */
  625. X
  626. X while ((opt = getopt(argc,argv,"ACHUVW")) != EOF)
  627. X   switch(opt)
  628. X    {
  629. X     case 'A': (void) err(listaportauthor); exit(1);
  630. X     case 'C': (void) err(listaportcopyright); exit(1);
  631. X     case 'H': (void) err(listaporthelp); exit(1);
  632. X     case 'U': (void) err(listaportusage); exit(1);
  633. X     case 'V': (void) err(listaportversion); exit(1);
  634. X     case 'W': (void) err(listaportwarranty); exit(1);
  635. X     case '?': (void) err(listaportusage); exit(1);
  636. X    }
  637. X argv += optind, argc -= optind;
  638. X
  639. X if (!(pw = getpwuid(uid)))
  640. X  {
  641. X   (void) errn("listaport: fatal: who are you?");
  642. X   exit(4);
  643. X  }
  644. X
  645. X if ((chdir(AUTHDIR) == -1) || chdir("tcp") == -1)
  646. X  {
  647. X   perrn2("listaport: fatal: cannot change to directory %s/tcp",AUTHDIR);
  648. X   exit(2);
  649. X  }
  650. X
  651. X if (!(dirp = opendir(".")))
  652. X  {
  653. X   perrn2("listaport: fatal: cannot read directory %s/tcp",AUTHDIR);
  654. X   exit(3);
  655. X  }
  656. X
  657. X while (dp = readdir(dirp))
  658. X  {
  659. X   if (sscanf(dp->d_name,"lock.%hd",&port) < 1)
  660. X     continue; /* fine, skip the file */
  661. X   if (((fd = open(dp->d_name,O_RDONLY)) == -1) || (flock(fd,LOCK_EX)) == -1)
  662. X    { perrn2("listaport: warning: cannot open lock file %s",dp->d_name); }
  663. X   if ((r = read(fd,buf,31)) <= 0)
  664. X    { perrn2("listaport: warning: cannot read lock file %s",dp->d_name); }
  665. X   (void) close(fd);
  666. X   buf[r] = '\0';
  667. X   if (buf[0] == '!')
  668. X    { perrn2("listaport: warning: corrupted lock file %s",dp->d_name); }
  669. X   if (sscanf(buf,"%d-%s",&pid,username) < 2)
  670. X     continue; /* fine, we just don't recognize this lock file's format */
  671. X   if (!uid || !strcmp(username,pw->pw_name))
  672. X     printf("user %s port %u pid %d\n",username,port,pid);
  673. X  }
  674. X
  675. X (void) closedir(dirp);
  676. X
  677. X exit(0);
  678. X}
  679. END_OF_FILE
  680. if test 5387 -ne `wc -c <'aport/listaport.c'`; then
  681.     echo shar: \"'aport/listaport.c'\" unpacked with wrong size!
  682. fi
  683. # end of 'aport/listaport.c'
  684. fi
  685. if test -f 'clients/README' -a "${1}" != "-c" ; then 
  686.   echo shar: Will not clobber existing file \"'clients/README'\"
  687. else
  688. echo shar: Extracting \"'clients/README'\" \(2230 characters\)
  689. sed "s/^X//" >'clients/README' <<'END_OF_FILE'
  690. Xclients version 1.0, April 20, 1990.
  691. X
  692. Xdate@ - print the date on another host
  693. Xfinger@ - finger someone on another host
  694. Xwho@ - print who is on another host
  695. Xmconnect - connect to a mail (SMTP) server
  696. Xnconnect - connect to a news (NNTP) server
  697. Xechoconnect - connect to an echo server
  698. Xnullconnect - connect to a discard server
  699. Xinews - a really trivial ihave-based mini-inews
  700. X
  701. XThese shell scripts illustrate how easily clients for standard Internet
  702. XTCP ports can be set up with authtcp.
  703. X
  704. Xdate@ version 1.0, April 20, 1990.
  705. Xfinger@ version 1.0, April 20, 1990.
  706. Xwho@ version 1.0, April 20, 1990.
  707. Xmconnect version 1.0, April 20, 1990.
  708. Xnconnect version 1.0, April 20, 1990.
  709. Xechoconnect version 1.0, April 20, 1990.
  710. Xnullconnect version 1.0, April 20, 1990.
  711. Xinews version 1.0, April 20, 1990.
  712. XPlaced into public domain by Daniel J. Bernstein.
  713. X
  714. XFiles:
  715. XCHANGES         Description of changes since first distributed version
  716. XREADME          This document
  717. XMakefile        Installation commands
  718. Xdate@           date@ shell script
  719. Xfinger@         finger@ shell script
  720. Xwho@            who@ shell script
  721. Xmconnect        mconnect shell script
  722. Xnconnect        nconnect shell script
  723. Xechoconnect     echoconnect shell script
  724. Xnullconnect     nullconnect shell script
  725. Xinews           trivial inews shell script
  726. Xdate@.man       date@ documentation
  727. Xfinger@.man     finger@ documentation
  728. Xwho@.man        who@ documentation
  729. Xmconnect.man    mconnect documentation
  730. Xnconnect.man    nconnect documentation
  731. Xechoconnect.man echoconnect documentation
  732. Xnullconnect.man nullconnect documentation
  733. X
  734. XEdit the options in Makefile and type make. date@, finger@, who@,
  735. Xmconnect, nconnect, echoconnect, nullconnect, and inews are executable
  736. Xshell scripts; date@.1, finger@.1, who@.1, mconnect.1, nconnect.1,
  737. Xechoconnect.1, and nullconnect.1 will be the nroff'ed documentation.
  738. X
  739. XSorry, no documentation for the trivial inews shell script. If you want
  740. Xto help support authenticated news and need a quick 'n' easy replacement
  741. Xfor the standard mini-inews, look at this version.
  742. X
  743. XYou must have authtcp installed before using any of these programs. You
  744. Xmust have multitee installed before using most of them.
  745. X
  746. XI don't pretend to know your machine's setup so there's no make install.
  747. END_OF_FILE
  748. if test 2230 -ne `wc -c <'clients/README'`; then
  749.     echo shar: \"'clients/README'\" unpacked with wrong size!
  750. fi
  751. # end of 'clients/README'
  752. fi
  753. if test -f 'clients/inews' -a "${1}" != "-c" ; then 
  754.   echo shar: Will not clobber existing file \"'clients/inews'\"
  755. else
  756. echo shar: Extracting \"'clients/inews'\" \(2319 characters\)
  757. sed "s/^X//" >'clients/inews' <<'END_OF_FILE'
  758. X#!/bin/sh
  759. X# trivial inews version 1.0, 4/20/90.
  760. X# Placed into the public domain by Daniel J. Bernstein.
  761. X#
  762. X# Note that this inews sticks around waiting for the connection, then
  763. X# repeats to the user everything the NNTP server says.
  764. X#
  765. X# Constants.
  766. X#
  767. XHOST=your.fully.qualified.domain.name.goes.here
  768. XSERVER=address.of.your.server
  769. XLOGDIR=/tmp/tin.log   # drwxrwxrwt
  770. X#
  771. X# Set up temp fds.
  772. X#
  773. Xexec 4>/tmp/tin1.$$ 5</tmp/tin1.$$
  774. Xexec 8>/tmp/tin2.$$ 9</tmp/tin2.$$
  775. Xrm /tmp/tin1.$$ /tmp/tin2.$$
  776. Xif cat >&4
  777. Xthen
  778. X  #
  779. X  # Make sure we're not duplicating Date, Message-ID, Sender.
  780. X  # Also check From, Path.
  781. X  #
  782. X  date="`multitee 5:1,8 | sed '/^$/q' | grep Date:`";      rewind 4;rewind 5
  783. X  mess="`multitee 9:1,4 | sed '/^$/q' | grep Message-ID:`";rewind 8;rewind 9
  784. X  path="`multitee 5:1,8 | sed '/^$/q' | grep Path:`";      rewind 4;rewind 5
  785. X  from="`multitee 9:1,4 | sed '/^$/q' | grep From:`";      rewind 8;rewind 9
  786. X  sender="`multitee 5:1,8 | sed '/^$/q' | grep Sender:`";  rewind 4;rewind 5
  787. X  if [ x"$date" != x ]
  788. X  then echo 'inews: must not specify Date'; exit 1;
  789. X  fi
  790. X  if [ x"$mess" != x ]
  791. X  then echo 'inews: must not specify Message-ID'; exit 1
  792. X  fi
  793. X  if [ x"$sender" != x ]
  794. X  then echo 'inews: must not specify Sender'; exit 1
  795. X  fi
  796. X  #
  797. X  # Add Path, From/Sender, Message-ID, Date.
  798. X  # The Message-ID generated below is both unique and descriptive.
  799. X  #
  800. X  now=`date -u`
  801. X  mid=$$:`echo "$now" | colrm 1 4 | colrm 17 22 | tr -d ' '`
  802. X  bmidhb="<$mid@$HOST>" # used at the bottom! watch out!
  803. X  date="Date: $now"
  804. X  mess="Message-ID: $bmidhb"
  805. X  newpath="Path: $HOST!$USER"
  806. X  sender="$USER@$HOST"
  807. X  if [ x"$path" = x ]
  808. X  then echo "$newpath" >&4
  809. X  fi
  810. X  if [ x"$from" != x ]
  811. X  then sendhdr=Sender
  812. X  else sendhdr=From
  813. X  fi
  814. X  export sender
  815. X  pattern="`printenv sender | sed 's-\([\.\*\[\\\^\$\/]\)-\\\\\1-g'`"
  816. X  # A shame fgrep doesn't split -x into match-at-front and match-at-end.
  817. X  if [ x"$sender" != x"$from" ]
  818. X  then if echo x"$from" | sed "/^xFrom: $pattern /d" | grep -s .
  819. X       then echo "$sendhdr: $sender" >&4
  820. X       fi
  821. X  fi
  822. X  echo "$mess" >&4
  823. X  echo "$date" >&4
  824. X  #
  825. X  # Put it all together and send along
  826. X  #
  827. X  cat <&9 >&4
  828. X  ( echo "ihave $bmidhb";
  829. X  tee -a "$LOGDIR/$mid" <&5 | sed 's/^\.$/. /';
  830. X  echo .; echo quit; echo ''
  831. X  ) | addcr | ( authtcp -R "$SERVER" nntp \
  832. X        multitee 0:6 6:1 4>&- 5<&- 8>&- 9<&- ) | delcr
  833. Xfi
  834. END_OF_FILE
  835. if test 2319 -ne `wc -c <'clients/inews'`; then
  836.     echo shar: \"'clients/inews'\" unpacked with wrong size!
  837. fi
  838. chmod +x 'clients/inews'
  839. # end of 'clients/inews'
  840. fi
  841. if test -f 'sendmail-auth/README' -a "${1}" != "-c" ; then 
  842.   echo shar: Will not clobber existing file \"'sendmail-auth/README'\"
  843. else
  844. echo shar: Extracting \"'sendmail-auth/README'\" \(5968 characters\)
  845. sed "s/^X//" >'sendmail-auth/README' <<'END_OF_FILE'
  846. Xsendmail-auth version 1.0, April 23, 1990.
  847. X
  848. Xsendmail is not particularly configurable, but by following the
  849. Xinstructions here you can have it generate an audit trail for all
  850. Xincoming messages. There's nothing you can do about local mail without
  851. Xrecompiling sendmail, as its local security is easy to circumvent; but
  852. Xnetwork mail forgery can be stopped.
  853. X
  854. XPlaced into public domain by Daniel J. Bernstein.
  855. X
  856. XFiles:
  857. XCHANGES         Description of changes since first distributed version
  858. XREADME          This document
  859. Xcf.include      Changes to make to /usr/lib/sendmail.cf
  860. Xrc.include      Changes to make to /etc/rc.local
  861. Xin.maild        Daemon to wrap around sendmail and log authentication
  862. Xout.mail        Script for sending out authenticated mail
  863. X
  864. XYou must have authtcp, attachport, and multitee installed first.
  865. X
  866. X1. Glance at out.mail, which will handle mail going out to the network.
  867. X   Copy it to /etc/out.mail, owner root, mode 755.
  868. X
  869. X2. Glance at in.maild, a sendmail wrapper that will log authentication.
  870. X   Copy it to /etc/in.maild, owner root, mode 755. (Depending on your
  871. X   feelings about security, you may want to hide in.maild inside another
  872. X   directory so that users can't detect changes to it.)
  873. X
  874. X3. Touch /usr/adm/in.mail.log, owner root, mode 644. This file will log
  875. X   connections and sendmail invocations. To use a different file, change
  876. X   the LOG= line at the top of in.maild. The log need not be readable,
  877. X   but users can detect forgeries more easily if it is. (The information
  878. X   can be collected in other ways anyway.)
  879. X
  880. X4. Compare rc.include to the sendmail startup lines in /etc/rc.local.
  881. X   You want to remove the -bd from sendmail, so that it doesn't accept
  882. X   SMTP connections on port 25; and put in a background attachport to
  883. X   invoke /etc/in.maild for each incoming connection. Make sure you keep
  884. X   sendmail -q30m (or whatever your queue run interval is) so that the
  885. X   mail queue is dealt with periodically.
  886. X
  887. X5. Make a backup copy of /usr/lib/sendmail.cf. Find the standard network
  888. X   mailer in /usr/lib/sendmail.cf; here it's tcp, specified on a line
  889. X   starting with Mtcp, as illustrated in cf.include. You want to replace
  890. X   the P=[IPC] with P=/etc/out.mail and A=IPC $h with A=out.mail $h. In
  891. X   fact, it may be a good idea to use scripts for all mailers in this
  892. X   fashion; that way you don't have to worry about constantly changing
  893. X   sendmail.cf.
  894. X
  895. X6. ``Freeze'' /usr/lib/sendmail.cf into /usr/lib/sendmail.fc by running
  896. X   /usr/lib/sendmail -bz.
  897. X
  898. X7. That's it! After your next reboot, all outgoing mail will go through
  899. X   /etc/out.mail, and all incoming mail (through the network, anyway)
  900. X   will go through /etc/in.maild with authentication logged.
  901. X   
  902. X   If you don't want to wait for a reboot, you might try waiting for the
  903. X   current sendmail -bd to go idle, stopping it, checking that the mail
  904. X   queue directory has no lock files (/usr/spool/mqueue/lf*), and
  905. X   finally killing the sendmail. Then execute rc.include to start the
  906. X   new daemons. This technique may not be safe; it's your machine.
  907. X
  908. X
  909. XWhat's the format of the log file? Under the current in.maild, each
  910. Xincoming connection generates a timestamp, authentication record in the
  911. Xform provided by attachport (e.g., brnstnd@128.122.128.22), and process
  912. Xid. A record is generated when sendmail starts and when it finishes; the
  913. Xsecond timestamp includes a final pid. This is often enough information
  914. Xfor users to figure out the source (or, in case of local forgeries, lack
  915. Xof source) of messages.
  916. X
  917. XUnfortunately, sendmail forks to deliver messages. The log file could
  918. Xlog the sendmail pid, but this wouldn't necessarily reflect the id added
  919. Xto messages. If two connections arrive from the same machine at the same
  920. Xtime, you can't prove by pids alone which messages were delivered from
  921. Xwhich connection. If this is a problem, add extra logging to in.maild;
  922. Xyou could, for example, log the output of the server, which will contain
  923. Xacknowledgments of senders and receivers. (Don't do this if your
  924. Xsendmail supports TURN!) A better solution would be to parse the input
  925. Xand checksum the messages with, say, Merkle's Snefru. Then again, if you
  926. Xcan do that, you might as well just add the authentication information
  927. Xto the top of the message. 'Nuff said.
  928. X
  929. XIf your log file grows rapidly you may want to rotate it and delete or
  930. Xarchive week-old logs. Check /usr/adm/daily for the messages and syslog
  931. Xrotation.
  932. X
  933. XBy changing in.maild's sleep 5 to an exit, you can simply drop all
  934. Xunauthenticated connections. Dropped connections also won't generate a
  935. Xlog file entry. Until most of the Internet adopts the Authentication
  936. XServer, this probably isn't a good idea.
  937. X
  938. X
  939. XHow should you use sendmail-auth in the real world? Good question. At a
  940. Xuniversity or other hostile environment, merely announcing the existence
  941. Xof audit trails is probably more than enough to stop forgeries. However,
  942. Xa message routed through a host not supporting authentication can't be
  943. Xtraced, and there's no easy way to warn the user reading a message that
  944. Xthe message might not be for real. Until a better mail system arrives,
  945. Xit may be worth the effort to design a protocol for remotely querying a
  946. Xsystem's logs. If anyone has any ideas on how to get the authentication
  947. Xinformation to the user without any hassle, let Dan Bernstein know at
  948. Xbrnstnd@acf10.nyu.edu.
  949. X
  950. X
  951. XCaveats? The biggest difference users will notice is that direct
  952. Xaddresses can no longer be specified as, e.g., brnstnd@[128.122.128.22],
  953. Xbecause authtcp doesn't understand the brackets. Instead, they must be
  954. Xspecified as brnstnd@128.122.128.22. If you really care, you can set up
  955. Xa rewriting rule to help the users who just can't remember to leave off
  956. Xthe brackets.
  957. X
  958. XAs sendmail doesn't have particularly straightforward mailer interfaces,
  959. Xout.mail doesn't communicate the different types of authtcp failures to
  960. Xsendmail. It simply pretends authtcp's error messages are SMTP errors
  961. Xreturned by the remote host, then drops the (non-)connection.
  962. END_OF_FILE
  963. if test 5968 -ne `wc -c <'sendmail-auth/README'`; then
  964.     echo shar: \"'sendmail-auth/README'\" unpacked with wrong size!
  965. fi
  966. # end of 'sendmail-auth/README'
  967. fi
  968. if test -f 'servers/README' -a "${1}" != "-c" ; then 
  969.   echo shar: Will not clobber existing file \"'servers/README'\"
  970. else
  971. echo shar: Extracting \"'servers/README'\" \(4778 characters\)
  972. sed "s/^X//" >'servers/README' <<'END_OF_FILE'
  973. Xservers package version 1.0, April 20, 1990.
  974. X
  975. XThese shell scripts illustrate how easily servers for standard Internet
  976. XTCP ports can be set up with attachport.
  977. X
  978. Xin.chargend version 1.0, April 20, 1990.
  979. Xin.daytimed version 1.0, April 20, 1990.
  980. Xin.echod version 1.0, April 20, 1990.
  981. Xin.fingerd version 1.0, April 20, 1990.
  982. Xin.nulld version 1.0, April 20, 1990.
  983. Xin.usersd version 1.0, April 20, 1990.
  984. Xout.finger version 1.0, April 20, 1990.
  985. Xstartservers version 1.0, April 20, 1990.
  986. XPlaced into public domain by Daniel J. Bernstein.
  987. X
  988. XFiles:
  989. XCHANGES         Description of changes since first distributed version
  990. XREADME          This document
  991. Xin.chargend     Shell script serving chargen connections
  992. Xin.daytimed     Shell script serving daytime connections
  993. Xin.echod        Shell script serving echo connections
  994. Xin.fingerd      Shell script serving finger connections
  995. Xin.nulld        Shell script serving discard connections
  996. Xin.usersd       Shell script serving users connections
  997. Xout.finger      out.finger shell script
  998. Xout.fingerlocal out.fingerlocal shell script
  999. Xout.fingernet   out.fingernet shell script
  1000. Xrc.include      Suggested additions to /etc/rc.local
  1001. Xservices        Neatly arranged /etc/services service list
  1002. Xstartservers    /etc/startservers, illustrating attachport
  1003. X
  1004. XThese scripts are not for general use other than as illustrations, so
  1005. Xthere's no man page or Makefile. Here's how you use the scripts:
  1006. X
  1007. X1. Make sure your /etc/services includes the name of every service
  1008. X   you're going to set up. You may want to replace your /etc/services
  1009. X   with the services file here, moving specialized servers to the end.
  1010. X
  1011. X2. Make sure you have attachport installed and working. Also get addcr
  1012. X   and authinit.
  1013. X
  1014. X3. If you want to run servers as any userid other than root (you do),
  1015. X   make sure you have setuid installed and working.
  1016. X
  1017. X4. Copy startservers to /etc/startservers, owner root, mode 700. Check
  1018. X   that the servers and userids listed are appropriate for your system
  1019. X   and that the path names are correct. (You don't really need path
  1020. X   names, but it's traditional to include them in startup scripts.)
  1021. X   
  1022. X   -R means ``don't bother authenticating the remote end''; -X means
  1023. X   ``don't authenticate us locally.'' -r and -x are the defaults.
  1024. X   -X is convenient and might save you a few seconds of CPU time every
  1025. X   year; but it doesn't let the remote end know who you are. (This is
  1026. X   not really a problem for standard servers.) -R will actually save a
  1027. X   bit of real time in setting up the connection, especially over slow
  1028. X   links. However, don't give -R to any server program that understands
  1029. X   (or may in a later incarnation want to understand) the PROTO/REMOTE
  1030. X   convention for identifying the remote user.
  1031. X
  1032. X   It is extremely stupid to specify -r for connections to port 113.
  1033. X   -R is the default in this case, though it isn't forced.
  1034. X
  1035. X5. Before you set up in.fingerd, you have to set up out.finger somewhere
  1036. X   accessible. out.finger will receive a single argument (unless you
  1037. X   change in.fingerd) and should print finger information suitable for
  1038. X   remote consumption. The out.finger version provided here handles
  1039. X   remote fingering even if your local finger program doesn't.
  1040. X
  1041. X6. Copy in.*d to /etc. Make sure the protections are appropriate. Check
  1042. X   through the daemons to make sure you like what they're doing before
  1043. X   you set them up. Don't you dare laugh at in.chargend.
  1044. X
  1045. X7. If you want to specify full pathnames in the server shell scripts,
  1046. X   do so now.
  1047. X
  1048. X8. Check that rc.include is appropriate for inclusion in your boot
  1049. X   sequence. You may want to redirect startservers' output to a log
  1050. X   file, say /etc/startservers.log, rather than the system console.
  1051. X
  1052. X9. Add rc.include into /etc/rc.local. Remove the obsoleted servers
  1053. X   from /etc/inetd.conf. kill -HUP the inetd process so that it will
  1054. X   use the new inetd.conf. Wait a little while for the old server
  1055. X   bindings to disappear. Finally, manually run startservers, and
  1056. X   exercise your new servers.
  1057. X
  1058. XAfter you're done with installation, move your old, buggy, insecure,
  1059. Xobsolete servers (like /etc/fingerd) to some out-of-the way place so
  1060. Xthat nobody accidentally uses them. Also send a note to Dan Bernstein,
  1061. Xbrnstnd@acf10.nyu.edu, letting him know about your experiences with auth
  1062. Xand authutil.
  1063. X
  1064. X
  1065. XOver time you can experiment with your servers. As authentication gains
  1066. Xpopularity, you may want to restrict server use to specific remote users
  1067. Xor specific hosts. You could, for example, disallow unauthenticated
  1068. Xfingering by adding
  1069. X
  1070. X  if printenv REMOTE | grep -s '^@[^@]*$'
  1071. X  then exit 0
  1072. X  fi
  1073. X
  1074. Xto the beginning of in.fingerd; you could then log the remote users, or
  1075. Xeven tell local users who's finding out about them! The same technique
  1076. Xmight be even more useful for recording network logins.
  1077. END_OF_FILE
  1078. if test 4778 -ne `wc -c <'servers/README'`; then
  1079.     echo shar: \"'servers/README'\" unpacked with wrong size!
  1080. fi
  1081. # end of 'servers/README'
  1082. fi
  1083. if test -f 'servers/in.chargend' -a "${1}" != "-c" ; then 
  1084.   echo shar: Will not clobber existing file \"'servers/in.chargend'\"
  1085. else
  1086. echo shar: Extracting \"'servers/in.chargend'\" \(7072 characters\)
  1087. sed "s/^X//" >'servers/in.chargend' <<'END_OF_FILE'
  1088. X#!/bin/sh
  1089. X# in.chargend version 1.0, 4/20/90.
  1090. X# Placed into the public domain by Daniel J. Bernstein.
  1091. Xwhile :
  1092. Xdo
  1093. X  cat << 'EOF'
  1094. X !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg
  1095. X!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh
  1096. X"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi
  1097. X#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij
  1098. X$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk
  1099. X%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl
  1100. X&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm
  1101. X'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn
  1102. X()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno
  1103. X)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop
  1104. X*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq
  1105. X+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr
  1106. X,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs
  1107. X-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst
  1108. X./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu
  1109. X/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv
  1110. X0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw
  1111. X123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx
  1112. X23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy
  1113. X3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
  1114. X456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{
  1115. X56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|
  1116. X6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
  1117. X789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  1118. X89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 
  1119. X9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !
  1120. X:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"
  1121. X;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#
  1122. X<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$
  1123. X=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%
  1124. X>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&
  1125. X?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'
  1126. X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'(
  1127. XABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()
  1128. XBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*
  1129. XCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+
  1130. XDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,
  1131. XEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-
  1132. XFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-.
  1133. XGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./
  1134. XHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0
  1135. XIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./01
  1136. XJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./012
  1137. XKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123
  1138. XLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./01234
  1139. XMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./012345
  1140. XNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456
  1141. XOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./01234567
  1142. XPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./012345678
  1143. XQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789
  1144. XRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:
  1145. XSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;
  1146. XTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<
  1147. XUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=
  1148. XVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>
  1149. XWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?
  1150. XXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@
  1151. XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@A
  1152. XZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@AB
  1153. X[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABC
  1154. X\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCD
  1155. X]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDE
  1156. X^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF
  1157. X_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG
  1158. X`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH
  1159. Xabcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI
  1160. Xbcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ
  1161. Xcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK
  1162. Xdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL
  1163. Xefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM
  1164. Xfghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN
  1165. Xghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
  1166. Xhijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP
  1167. Xijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ
  1168. Xjklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR
  1169. Xklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS
  1170. Xlmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST
  1171. Xmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU
  1172. Xnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV
  1173. Xopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW
  1174. Xpqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
  1175. Xqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY
  1176. Xrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
  1177. Xstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[
  1178. Xtuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\
  1179. Xuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]
  1180. Xvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^
  1181. Xwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
  1182. Xxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`
  1183. Xyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a
  1184. Xz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab
  1185. X{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc
  1186. X|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd
  1187. X}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde
  1188. X~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef
  1189. XEOF
  1190. Xdone
  1191. END_OF_FILE
  1192. if test 7072 -ne `wc -c <'servers/in.chargend'`; then
  1193.     echo shar: \"'servers/in.chargend'\" unpacked with wrong size!
  1194. fi
  1195. chmod +x 'servers/in.chargend'
  1196. # end of 'servers/in.chargend'
  1197. fi
  1198. if test -f 'servers/services' -a "${1}" != "-c" ; then 
  1199.   echo shar: Will not clobber existing file \"'servers/services'\"
  1200. else
  1201. echo shar: Extracting \"'servers/services'\" \(2001 characters\)
  1202. sed "s/^X//" >'servers/services' <<'END_OF_FILE'
  1203. X# Network service list, /etc/services, as used by getservbyname(3).
  1204. X# Reorganized from the service list on a BSD-derived system.
  1205. X#
  1206. X# Official TCP servers installed and operating on this host.
  1207. X#
  1208. Xecho        7/tcp
  1209. Xdiscard        9/tcp        sink null
  1210. Xsystat        11/tcp        users
  1211. Xdaytime        13/tcp
  1212. Xchargen        19/tcp        ttytst source
  1213. Xftp        21/tcp
  1214. Xtelnet        23/tcp
  1215. Xsmtp        25/tcp        mail
  1216. Xtime        37/tcp        timserver
  1217. Xfinger        79/tcp
  1218. Xauth        113/tcp        authentication
  1219. X#
  1220. X# System-specific TCP servers installed and operating on this host.
  1221. X#
  1222. Xexec        512/tcp
  1223. Xlogin        513/tcp
  1224. Xuucp        540/tcp        uucpd        # uucp daemon 251 for masscomps
  1225. Xshell        514/tcp        cmd        # no passwords used
  1226. X# 
  1227. X# Official UDP servers installed and operating on this host.
  1228. X#
  1229. Xecho        7/udp
  1230. Xdiscard        9/udp        sink null
  1231. Xdaytime        13/udp
  1232. Xchargen        19/udp        ttytst source
  1233. Xtime        37/udp        timserver
  1234. X#
  1235. X# System-specific UDP servers installed and operating on this host.
  1236. X#
  1237. Xbiff        512/udp        comsat
  1238. Xtalk        517/udp
  1239. Xntalk        518/udp
  1240. X#
  1241. X# Other official TCP services.
  1242. X#
  1243. Xnetstat        15/tcp
  1244. Xqotd        17/tcp        quote
  1245. Xnameserver    42/tcp        name        # IEN 116
  1246. Xwhois        43/tcp        nicname
  1247. Xdomain        53/tcp        nameserver    # name-domain server
  1248. Xmtp        57/tcp                # deprecated
  1249. Xrje        77/tcp        netrjs
  1250. Xlink        87/tcp        ttylink
  1251. Xsupdup        95/tcp
  1252. Xhostnames    101/tcp        hostname    # usually from sri-nic
  1253. Xpop        109/tcp        postoffice
  1254. Xsunrpc        111/tcp
  1255. Xsftp        115/tcp
  1256. Xuucp-path    117/tcp
  1257. Xnntp        119/tcp        readnews untp    # USENET News Transfer Protocol
  1258. X#
  1259. X# Other system-specific TCP services.
  1260. X#
  1261. Xprinter        515/tcp        spooler        # line printer spooler
  1262. Xefs        520/tcp                # for LucasFilm
  1263. Xtempo        526/tcp        newdate
  1264. Xcourier        530/tcp        rpc
  1265. Xconference    531/tcp        chat
  1266. Xnetnews        532/tcp        readnews
  1267. Xremotefs    556/tcp        rfs_server rfs    # Brunhoff remote filesystem
  1268. Xrfile        562/tcp        rfiled
  1269. X#
  1270. X# Other official UDP services.
  1271. X#
  1272. Xrlp        39/udp        resource    # resource location
  1273. Xdomain        53/udp        nameserver
  1274. Xtftp        69/udp
  1275. Xsunrpc        111/udp
  1276. X#
  1277. X# Other system-specific UDP services.
  1278. X#
  1279. Xwho        513/udp        whod
  1280. Xsyslog        514/udp
  1281. Xroute        520/udp        router routed
  1282. Xtimed        525/udp        timeserver
  1283. Xnetwall        533/udp                # -for emergency broadcasts
  1284. X#
  1285. X# Other services.
  1286. X#
  1287. END_OF_FILE
  1288. if test 2001 -ne `wc -c <'servers/services'`; then
  1289.     echo shar: \"'servers/services'\" unpacked with wrong size!
  1290. fi
  1291. # end of 'servers/services'
  1292. fi
  1293. if test -f 'tam/README' -a "${1}" != "-c" ; then 
  1294.   echo shar: Will not clobber existing file \"'tam/README'\"
  1295. else
  1296. echo shar: Extracting \"'tam/README'\" \(2567 characters\)
  1297. sed "s/^X//" >'tam/README' <<'END_OF_FILE'
  1298. Xtam package version 1.0, April 23, 1990.
  1299. X
  1300. XTAM - Trivial Authenticated Mail
  1301. X
  1302. Xtamd version 1.0, April 23, 1990.
  1303. Xtamsetup version 1.0, April 23, 1990.
  1304. Xtamprint version 1.0, April 23, 1990.
  1305. Xtamdel version 1.0, April 23, 1990.
  1306. Xtam2look version 1.0, April 23, 1990.
  1307. Xtam2mail version 1.0, April 23, 1990.
  1308. Xtamsend version 1.0, April 23, 1990.
  1309. XPlaced into public domain by Daniel J. Bernstein.
  1310. X
  1311. XFiles:
  1312. XCHANGES         Description of changes since first distributed version
  1313. XREADME          This document
  1314. XMakefile        Installation commands
  1315. Xrc.include      Lines to include in /etc/rc.local
  1316. Xservices.include  Lines to include in /etc/services
  1317. Xtamd            The tam daemon shell script
  1318. Xtamsetup.c      The tamsetup program
  1319. Xtamprint.c      The tamprint program
  1320. Xtamdel.c        The tamdel program
  1321. Xtam2look        The tam2look shell script
  1322. Xtam2mail        The tam2mail shell script
  1323. Xtamsend         The tamsend shell script
  1324. Xtamd.man        Documentation
  1325. Xtamdel.man      Documentation
  1326. Xtamprint.man    Documentation
  1327. Xtamsetup.man    Documentation
  1328. Xtamsend.man     Documentation
  1329. Xtam2look.man    Documentation
  1330. Xtam2mail.man    Documentation
  1331. XTAM.doc         Description of the TAM protocol
  1332. X
  1333. XEdit the options in Makefile and type make. tamsetup, tamprint, and
  1334. Xtamdel will be the executable programs; tamd, tam2look, tam2mail, and
  1335. Xtamsend are executable shell scripts; tamdel.1, tamprint.1, tamsetup.1,
  1336. Xtamsend.1, tam2look.1, tam2mail.1, and tamd.8 will be the nroff'ed
  1337. Xdocumentation.
  1338. X
  1339. XYou must have authtcp, attachport, and multitee set up before using tam.
  1340. X
  1341. XTAM runs on standard port 209. You should add this into /etc/services as
  1342. Xindicated in services.include.
  1343. X
  1344. XFor security, you should set up a new userid, tam. Uid tam should not
  1345. Xpermit logins. Its encrypted password should be something impossible,
  1346. Xlike an asterisk. Its shell should be /bin/true. Its home directory
  1347. Xshould be /nonexistent. Its uid should be unique.
  1348. X
  1349. Xtamsetup, tamprint, and tamdel should be setuid tam; check the source
  1350. Xcarefully for security holes! You also need a directory /usr/spool/tam,
  1351. Xowner tam, group irrelevant, mode 0700. If you want to use a different
  1352. Xdirectory, you must change TAMDIR in the Makefile and in the shell
  1353. Xscripts.
  1354. X
  1355. Xtamd should be set up under attachport(1) or inetd(8) to receive
  1356. Xconnections on TCP port 209. It should not be setuid tam---no scripts
  1357. Xshould ever be setuid anything!---though it will always run as tam.
  1358. X
  1359. XMake sure you put your domain into tamsend.
  1360. X
  1361. XI don't pretend to know your machine's setup so there's no make install.
  1362. X
  1363. XRead TAM.doc for a first draft of the TAM protocol.
  1364. END_OF_FILE
  1365. if test 2567 -ne `wc -c <'tam/README'`; then
  1366.     echo shar: \"'tam/README'\" unpacked with wrong size!
  1367. fi
  1368. # end of 'tam/README'
  1369. fi
  1370. if test -f 'tam/TAM.doc' -a "${1}" != "-c" ; then 
  1371.   echo shar: Will not clobber existing file \"'tam/TAM.doc'\"
  1372. else
  1373. echo shar: Extracting \"'tam/TAM.doc'\" \(3026 characters\)
  1374. sed "s/^X//" >'tam/TAM.doc' <<'END_OF_FILE'
  1375. XTAM: Trivial Authenticated Mail protocol
  1376. X
  1377. XThe TAM server on a host listens on the TAM TCP port for connections.
  1378. X
  1379. XThe TAM client on a host connects to the TAM TCP port on that or another
  1380. Xhost. It prints a single line (the ``user line'') consisting of a string
  1381. X(the ``user'') followed by a linefeed (not cr-lf). The user is meant as
  1382. Xa user on the server's host who has set up a TAMbox for receiving mail,
  1383. Xthough it can be interpreted in any way. User lines beginning with + are
  1384. Xreserved for future assigned meanings.
  1385. X
  1386. XThe server prints a single line in response, consisting of either just a
  1387. Xlinefeed (not cr-lf) for success or one or more characters followed by a
  1388. Xlinefeed (not cr-lf) for an error. Some suggested errors are as follows:
  1389. X    TAM ERROR: username: No such user
  1390. XThis might mean that the server doesn't have a TAMbox for that user.
  1391. X    TAM ERROR: Unauthenticated
  1392. XThis might mean that the server is unable to authenticate the client
  1393. Xwith the Authentication Server as specified in RFC 931. A host that does
  1394. Xnot support RFC 931 is at this time considered incompetent to use TAM,
  1395. Xthough particular TAM servers may use methods other than RFC 931 for
  1396. Xverifying the source of the message.
  1397. X
  1398. XError lines beginning with + are reserved for future assigned meanings.
  1399. XIn any case, either side may cut off the connection any time after an
  1400. Xerror (though + error lines may specify different behavior).
  1401. X
  1402. XIf the client sees a blank line from the server, it sends any text in
  1403. Xany form, then closes the connection. The server may dispose of the text
  1404. X(the ``message'') any way it wants, subject to any constraints specified
  1405. Xfor user lines beginning with +. Note that such constraints may include
  1406. Xconstraints on the form of the received message. Typically the server is
  1407. Xexpected to deliver the message to the user named in the user line, or,
  1408. Xif that isn't possible, to somehow bring the undelivered message to the
  1409. Xattention of a human.
  1410. X
  1411. XThe server is expected to cut off the connection before the client does
  1412. Xonly to conserve resources. (This can justify cutting off apparently
  1413. Xdead connections, overly long messages, etc.) The client should treat
  1414. Xthis as an error. 
  1415. X
  1416. XThe client is expected to send the message as soon and as quickly as
  1417. Xpossible after the server sends a blank error line.
  1418. X
  1419. XThe TAM TCP port is 209.
  1420. X
  1421. XExample of TAM conversation: Client is user brnstnd running on host
  1422. Xkramden.acf.nyu.edu. Server is on host stealth.acf.nyu.edu. Client sets
  1423. Xup a locally authenticated connection to server. Server checks client's
  1424. Xauthentication, finds brnstnd@128.122.142.2.
  1425. X
  1426. X  C: root\n       (\n means linefeed. Client wants to send TAM to root.)
  1427. X  S: \n           (empty line in response, means ``go ahead'')
  1428. X  C: Sent-From: brnstnd@kramden.acf.nyu.edu\n
  1429. X     Sent-To: root@stealth, brnstnd\n
  1430. X     Subject: wow, TAM works\n
  1431. X     \n
  1432. X     I'm impressed! After all, it's sooooooo complicated!\n
  1433. X          (and so on, free-form text to deliver)
  1434. X
  1435. XThe server records the message in root's TAMbox, along with the date and
  1436. Xauthentication information.
  1437. END_OF_FILE
  1438. if test 3026 -ne `wc -c <'tam/TAM.doc'`; then
  1439.     echo shar: \"'tam/TAM.doc'\" unpacked with wrong size!
  1440. fi
  1441. # end of 'tam/TAM.doc'
  1442. fi
  1443. if test -f 'tam/tamdel.c' -a "${1}" != "-c" ; then 
  1444.   echo shar: Will not clobber existing file \"'tam/tamdel.c'\"
  1445. else
  1446. echo shar: Extracting \"'tam/tamdel.c'\" \(1512 characters\)
  1447. sed "s/^X//" >'tam/tamdel.c' <<'END_OF_FILE'
  1448. X/* tamdel version 1.0, 4/23/90. */
  1449. X
  1450. X#include <stdio.h>
  1451. X#include <sys/file.h>
  1452. X#ifdef BSD
  1453. X#include <limits.h>
  1454. X#endif
  1455. X#include <pwd.h>
  1456. X
  1457. X#ifndef TAMDIR
  1458. X#define TAMDIR "/usr/spool/tam"
  1459. X#endif
  1460. X
  1461. X#ifndef BUFSIZ
  1462. X#define BUFSIZ 1024
  1463. X#endif
  1464. X
  1465. Xmain()
  1466. X{
  1467. X struct passwd *pw;
  1468. X char path[sizeof(TAMDIR) + 11];
  1469. X char pathnew[sizeof(TAMDIR) + 16];
  1470. X int fd;
  1471. X int fdnew;
  1472. X char buf[BUFSIZ];
  1473. X int r;
  1474. X
  1475. X if (!(pw = getpwuid(getuid())))
  1476. X  {
  1477. X   fprintf(stderr,"tamdel: fatal: who are you?\n");
  1478. X   exit(1);
  1479. X  }
  1480. X (void) sprintf(path,"%s/%s",TAMDIR,pw->pw_name);
  1481. X if ((fd = open(path,O_RDONLY)) == -1)
  1482. X  {
  1483. X   perror("tamdel: fatal: can't read tam spool file");
  1484. X   exit(2);
  1485. X  }
  1486. X if (flock(fd,LOCK_EX) == -1)
  1487. X  {
  1488. X   perror("tamdel: fatal: can't lock tam spool file");
  1489. X   exit(3);
  1490. X  }
  1491. X
  1492. X while ((r = read(fd,buf,sizeof(buf))) > 0)
  1493. X   if (write(1,buf,r) < r)
  1494. X    {
  1495. X     /* This may happen, incorrectly, if the output is nonblocking. */
  1496. X     /* We assume the usual convention that you never pass nonblocking fds. */
  1497. X     perror("tamdel: fatal: write error");
  1498. X     exit(5);
  1499. X    }
  1500. X if (r < 0)
  1501. X  {
  1502. X   perror("tamdel: fatal: read error");
  1503. X   exit(4);
  1504. X  }
  1505. X else
  1506. X  {
  1507. X   (void) sprintf(pathnew,"%s/%s.new!",TAMDIR,pw->pw_name);
  1508. X   if ((fdnew = open(pathnew,O_WRONLY | O_CREAT | O_EXCL,0600)) == -1)
  1509. X    {
  1510. X     perror("tamdel: fatal: can't create new tam spool file");
  1511. X     exit(6);
  1512. X    }
  1513. X   if (rename(pathnew,path) == -1)
  1514. X    {
  1515. X     perror("tamdel: fatal: can't recreate tam spool file");
  1516. X     (void) unlink(pathnew);
  1517. X     exit(7);
  1518. X    }
  1519. X  }
  1520. X exit(0);
  1521. X}
  1522. END_OF_FILE
  1523. if test 1512 -ne `wc -c <'tam/tamdel.c'`; then
  1524.     echo shar: \"'tam/tamdel.c'\" unpacked with wrong size!
  1525. fi
  1526. # end of 'tam/tamdel.c'
  1527. fi
  1528. echo shar: End of archive 2 \(of 3\).
  1529. cp /dev/null ark2isdone
  1530. MISSING=""
  1531. for I in 1 2 3 ; do
  1532.     if test ! -f ark${I}isdone ; then
  1533.     MISSING="${MISSING} ${I}"
  1534.     fi
  1535. done
  1536. if test "${MISSING}" = "" ; then
  1537.     echo You have unpacked all 3 archives.
  1538.     rm -f ark[1-9]isdone
  1539. else
  1540.     echo You still need to unpack the following archives:
  1541.     echo "        " ${MISSING}
  1542. fi
  1543. ##  End of shell archive.
  1544. exit 0
  1545. exit 0 # Just in case...
  1546.