home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / ida / part03 < prev    next >
Encoding:
Text File  |  1987-06-22  |  53.2 KB  |  2,274 lines

  1. Path: seismo!uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i014:  The IDA Sendmail Kit, Part03/07
  5. Message-ID: <426@uunet.UU.NET>
  6. Date: 23 Jun 87 04:41:52 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 2263
  9. Approved: rs@uunet.uu.net
  10.  
  11. Mod.sources: Volume 10, Number 14
  12. Submitted by: Lennart Lovstrand <mcvax!ida.liu.se!lel>
  13. Archive-name: ida/Part03
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 3 (of 7)."
  22. # Contents:  ida/aux/dbm.c ida/aux/rmail.c ida/aux/xalparse.c
  23. #   ida/patches/alias.c.diff ida/patches/op.me.diff
  24. #   ida/patches/sendmail.h.diff
  25. # Wrapped by lenlo@prefix on Wed Jun 10 15:39:53 1987
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f ida/aux/dbm.c -a "${1}" != "-c" ; then 
  28.   echo shar: Will not over-write existing file \"ida/aux/dbm.c\"
  29. else
  30. echo shar: Extracting \"ida/aux/dbm.c\" \(10884 characters\)
  31. sed "s/^X//" >ida/aux/dbm.c <<'END_OF_ida/aux/dbm.c'
  32. X/*
  33. X**  DBM -- General dbm management tool.
  34. X**  Copyright (c) 1987 Lennart Lovstrand
  35. X**  CIS Dept, Univ of Linkoping, Sweden
  36. X**
  37. X**  Use it, abuse it, but don't sell it.
  38. X*/
  39. X
  40. X#include "useful.h"
  41. X#include <stdio.h>
  42. X#include <ctype.h>
  43. X#include <sys/file.h>
  44. X#ifdef MDBM
  45. X# include "mdbm_compat.h"
  46. X#else MDBM
  47. X# include <ndbm.h>
  48. X# define DBMFILE DBM
  49. X#endif MDBM
  50. X
  51. X#ifndef lint
  52. Xstatic char    SccsId[] = "@(#)dbm.c 2.0 (lel@ida.liu.se) 4/20/87";
  53. X#endif !lint
  54. X
  55. X#define    SAMECASE    0
  56. X#define LOWERCASE    1
  57. X#define UPPERCASE    2
  58. X
  59. X#define COMMENTCHAR    '#'
  60. X
  61. X#define streq(s, t)    (strcmp(s, t) == 0)
  62. X#define MAKEDATUM(d, s)    {(d).dptr = s; (d).dsize = strlen(s) + 1;}
  63. X
  64. Xvoid do_clear(), do_delete(), do_dump(), do_fetch(), do_load(), do_make(),
  65. X    do_parse(), do_store();
  66. X
  67. Xstruct comtab {
  68. X    char *c_name;
  69. X    void (*c_func)();
  70. X} CommandTable[] = {
  71. X    {"clear",    do_clear},
  72. X    {"delete",    do_delete},
  73. X    {"dump",    do_dump},
  74. X    {"fetch",    do_fetch},
  75. X    {"load",    do_load},
  76. X    {"make",    do_make},
  77. X    {"parse",    do_parse},
  78. X    {"store",    do_store}
  79. X};
  80. X    
  81. X/* global arguments */
  82. Xint    Argc;
  83. Xchar    **Argv;
  84. X
  85. X/* options */
  86. Xint    Appending = FALSE;
  87. Xint    Casing = SAMECASE;
  88. Xbool    Debug = FALSE;
  89. Xchar    *Outfile = NULL;
  90. Xint    Mode = 0644;
  91. Xchar    *Progname;
  92. Xbool    Senteniel = FALSE;
  93. Xint    Storeflag = DBM_INSERT;
  94. Xbool    Storewarn = TRUE;
  95. X
  96. X/* Dbm globals */
  97. XDBMFILE    *Dbm;
  98. Xchar    *Dbmfile = NULL;
  99. Xint    Dbmaccess;
  100. Xdatum    key, val;
  101. X
  102. Xmain(argc, argv)
  103. X     int argc;
  104. X     char **argv;
  105. X{
  106. X    extern int optind;
  107. X    extern char *optarg;
  108. X    char *scantoken();
  109. X    struct comtab *cmd;
  110. X    int c;
  111. X
  112. X    Argc = argc;
  113. X    Argv = argv;
  114. X
  115. X    Progname = Argv[0];
  116. X
  117. X    while ((c = getopt(Argc, Argv, "ADILRSUd:m:o:")) != EOF)
  118. X    switch (c) {
  119. X      case 'A':
  120. X        Appending = TRUE;
  121. X        break;
  122. X      case 'D':
  123. X        Debug = TRUE;
  124. X        break;
  125. X      case 'I':
  126. X        Storeflag = DBM_INSERT;
  127. X        Storewarn = FALSE;
  128. X        break;
  129. X      case 'L':
  130. X        Casing = LOWERCASE;
  131. X        break;
  132. X      case 'R':
  133. X        Storeflag = DBM_REPLACE;
  134. X        break;
  135. X      case 'S':
  136. X        Senteniel = TRUE;
  137. X        break;
  138. X      case 'U':
  139. X        Casing = UPPERCASE;
  140. X        break;
  141. X      case 'd':
  142. X        Dbmfile = optarg;
  143. X        break;
  144. X      case 'm':
  145. X        if (optarg[0] == '0')
  146. X        (void) sscanf(optarg, "%o", &Mode);
  147. X        else {
  148. X        (void) sscanf(optarg, "%d", &Mode);
  149. X        if (Mode == 0) {
  150. X            (void) fprintf(stderr, "%s: non-numeric mode: %s\n",
  151. X                   Progname, optarg);
  152. X            exit(1);
  153. X        }
  154. X        }
  155. X        break;
  156. X      case 'o':
  157. X        Outfile = optarg;
  158. X        break;
  159. X      default:
  160. X        (void) fprintf(stderr,
  161. X               "usage: %s [-ADILNRSU] [-d dbm_file] [-m mode] %s", 
  162. X               Progname, "[-o output_file] command [args]\n");
  163. X        exit(1);
  164. X    }
  165. X
  166. X    Argc -= optind;
  167. X    Argv += optind;
  168. X
  169. X    if (Argc > 0) {
  170. X    for (cmd = CommandTable; cmd < &CommandTable[sizeof(CommandTable) /
  171. X                             sizeof(*CommandTable)];
  172. X         cmd++)
  173. X        if (streq(*Argv, cmd->c_name)) {
  174. X        (*cmd->c_func)();
  175. X        exit(0);
  176. X        }
  177. X    (void) fprintf(stderr, "%s: unknown dbm command %s", Progname, *Argv);
  178. X    } else
  179. X    (void) fprintf(stderr, "%s: missing dbm command", Progname);
  180. X    (void) fprintf(stderr, ", use one of the following:\n");
  181. X    for (cmd = CommandTable; cmd < &CommandTable[sizeof(CommandTable) /
  182. X                         sizeof(*CommandTable)]; cmd++)
  183. X    (void) fprintf(stderr, "%s%s", cmd == CommandTable ? "" : "\t",
  184. X               cmd->c_name);
  185. X    (void) fprintf(stderr, "\n");
  186. X    exit(3);
  187. X}
  188. X
  189. Xopendbm(access)
  190. X     int access;
  191. X{
  192. X    if (Dbmfile == NULL) {
  193. X    if (Argc > 1) {
  194. X        /* use last argument */
  195. X        Dbmfile = Argv[Argc-1];
  196. X        Argc--;
  197. X    } else {
  198. X        (void) fprintf(stderr, "%s: dbm file not specified\n", Progname);
  199. X        exit(3);
  200. X    }
  201. X    }
  202. X    Dbm = dbm_open(Dbmfile, access, Mode);
  203. X    if (Dbm == NULL) {
  204. X    perror(Dbmfile);
  205. X    exit(4);
  206. X    }
  207. X    Dbmaccess = access;
  208. X}
  209. X
  210. Xclosedbm()
  211. X{
  212. X    if ((Dbmaccess & O_RDONLY) == 0 && Senteniel) {
  213. X    MAKEDATUM(key, "@@@");
  214. X    if (dbm_store(Dbm, key, key, DBM_REPLACE) != NULL) {
  215. X        (void) fprintf(stderr, "%s: could not store senteniel \"@@@\"\n",
  216. X               Progname);
  217. X        perror(Progname);
  218. X        exit(5);
  219. X    }
  220. X    }
  221. X    
  222. X    dbm_close(Dbm);
  223. X}
  224. X
  225. XFILE *
  226. Xopenfile(filename, access)
  227. X     char *filename;
  228. X     char *access;
  229. X{
  230. X    FILE *f;
  231. X
  232. X    if (streq(filename, "-"))
  233. X    if (streq(access, "r"))
  234. X        return stdin;
  235. X    else
  236. X        return stdout;
  237. X    else {
  238. X    f = fopen(filename, access);
  239. X    if (f == NULL) {
  240. X        perror(filename);
  241. X        exit(4);
  242. X    }
  243. X    return f;
  244. X    }
  245. X}
  246. X
  247. Xvoid
  248. Xclosefile(f)
  249. X     FILE *f;
  250. X{
  251. X    if (f != stdin && f != stdout)
  252. X    (void) fclose(f);
  253. X}
  254. X /*
  255. X**    DO_CLEAR -- Clear out database leaving it emtpy.
  256. X*/
  257. X
  258. Xvoid
  259. Xdo_clear()
  260. X{
  261. X    if (Dbmfile != NULL) {
  262. X    opendbm(O_RDWR | O_CREAT | O_TRUNC);
  263. X    closedbm();
  264. X    }
  265. X    while (Argc > 1) {
  266. X    opendbm(O_RDWR | O_CREAT | O_TRUNC);
  267. X    closedbm();
  268. X    }
  269. X}
  270. X
  271. X   
  272. X /*
  273. X**    DO_DELETE -- Delete individual entries from the database.
  274. X*/
  275. X
  276. Xvoid
  277. Xdo_delete()
  278. X{
  279. X    opendbm(O_RDWR | O_CREAT);
  280. X
  281. X    for (Argc--, Argv++; Argc > 0; Argc--, Argv++) {
  282. X    casify(*Argv, Casing);
  283. X    MAKEDATUM(key, *Argv);
  284. X    if (dbm_delete(Dbm, key) != NULL) {
  285. X        perror(*Argv);
  286. X        exit(5);
  287. X    }
  288. X    }
  289. X
  290. X    closedbm();
  291. X}
  292. X
  293. X /*
  294. X**    DO_DUMP -- List all entries in the database.
  295. X*/
  296. Xvoid
  297. Xdo_dump()
  298. X{
  299. X    FILE *output;
  300. X    
  301. X    opendbm(O_RDONLY);
  302. X
  303. X    if (Outfile == NULL)
  304. X    output = stdout;
  305. X    else
  306. X    output = openfile(Outfile, "w");
  307. X
  308. X#ifdef MDBM
  309. X    for (key = dbm_firstkey(Dbm); key.dptr != NULL; key = dbm_nextkey(Dbm, key
  310. )) {
  311. X#else MDBM
  312. X    for (key = dbm_firstkey(Dbm); key.dptr != NULL; key = dbm_nextkey(Dbm)) {
  313. X#endif MDBM
  314. X    val = dbm_fetch(Dbm, key);
  315. X    if (val.dptr == NULL)
  316. X        perror(key.dptr);
  317. X    else
  318. X        (void) fprintf(output, "%s\t%s\n", key.dptr, val.dptr);
  319. X    }
  320. X}
  321. X /*
  322. X**    DO_FETCH -- Lookup individual keys in the database.
  323. X*/
  324. Xvoid
  325. Xdo_fetch()
  326. X{
  327. X    opendbm(O_RDONLY);
  328. X
  329. X    for (Argc--, Argv++; Argc > 0; Argc--, Argv++) {
  330. X    casify(*Argv, Casing);
  331. X    MAKEDATUM(key, *Argv);
  332. X    val = dbm_fetch(Dbm, key);
  333. X    if (val.dptr == NULL)
  334. X        (void) printf("%s\t[NOT FOUND]\n", *Argv);
  335. X    else
  336. X        (void) printf("%s\t%s\n", *Argv, val.dptr);
  337. X    }
  338. X
  339. X    closedbm();
  340. X}
  341. X
  342. X /*
  343. X**    DO_STORE -- Insert individual entries into the database.
  344. X*/
  345. X
  346. Xvoid
  347. Xdo_store()
  348. X{
  349. X    /* barf if # of args - 1 is even and no dbm file has been specified */
  350. X    if (Argc & 1 == 1 && Dbmfile == NULL) {
  351. X    (void) fprintf(stderr, "%s: no dbm file specified\n", Progname);
  352. X    exit(3);
  353. X    }
  354. X
  355. X    opendbm(O_RDWR | O_CREAT);
  356. X
  357. X    for (Argc--, Argv++; Argc > 1; Argc -= 2, Argv += 2) {
  358. X    casify(Argv[0], Casing);
  359. X    MAKEDATUM(key, Argv[0]);
  360. X    MAKEDATUM(val, Argv[1]);
  361. X    if (dbm_store(Dbm, key, val, Storeflag) != NULL) {
  362. X        extern int errno;
  363. X
  364. X        if (errno != 0) {
  365. X        perror(Argv[0]);
  366. X        exit(5);
  367. X        } else if (Storewarn)
  368. X        (void) fprintf(stderr,
  369. X                   "%s: duplicate key \"%s\" => \"%s\" ignored\n",
  370. X                   Progname, Argv[0], Argv[1]);
  371. X    }
  372. X    }
  373. X    if (Argc > 0)
  374. X    (void) fprintf(stderr, "%s: no value for last key \"%s\"--ignored\n",
  375. X               Progname, Argv[0]);
  376. X
  377. X    closedbm();
  378. X}
  379. X
  380. X /*
  381. X**    DO_PARSE -- Parse a textual database file and produce key-value
  382. X**        pairs separated by a tab (suitable for input to the ``load''
  383. X**        function).
  384. X*/
  385. X
  386. Xvoid
  387. Xdo_parse()
  388. X{
  389. X    FILE *input, *output;
  390. X    
  391. X    if (Outfile == NULL)
  392. X    output = stdout;
  393. X    else
  394. X    output = openfile(Outfile, "w");
  395. X
  396. X    if (Argc == 1)
  397. X    parsefile(stdin, output);
  398. X    else
  399. X    for (Argc--, Argv++; Argc > 0; Argc--, Argv++) {
  400. X        input = openfile(*Argv, "r");
  401. X        parsefile(input, output);
  402. X        closefile(input);
  403. X    }
  404. X}
  405. X
  406. X /*
  407. X**    DO_MAKE -- Parse the textual input and load the result into
  408. X**        the database.
  409. X*/
  410. X
  411. Xvoid
  412. Xdo_make()
  413. X{
  414. X    FILE *input, *pipin, *pipout;
  415. X    int pipes[2];
  416. X
  417. X    opendbm(O_RDWR | O_CREAT | (Appending ? 0 : O_TRUNC));
  418. X
  419. X    if (pipe(pipes) != NULL) {
  420. X    perror("pipe");
  421. X    exit(9);
  422. X    }
  423. X    pipin = fdopen(pipes[0], "r");
  424. X    pipout = fdopen(pipes[1], "w");
  425. X
  426. X    if (fork() == 0) {
  427. X    /* child process */
  428. X    (void) fclose(pipout);
  429. X
  430. X    loadfile(pipin);
  431. X    } else {
  432. X    /* parent process */
  433. X    (void) fclose(pipin);
  434. X
  435. X    if (Argc == 1)
  436. X        parsefile(stdin, pipout);
  437. X    else
  438. X        for (Argc--, Argv++; Argc > 0; Argc--, Argv++) {
  439. X        input = openfile(*Argv, "r");
  440. X        parsefile(input, pipout);
  441. X        closefile(input);
  442. X        }
  443. X    }
  444. X    closedbm();
  445. X}
  446. X
  447. X /*
  448. X**    DO_LOAD -- Load the dbm database from a text file.  The input should
  449. X**        be key-value pairs separated by a tab, each on a single line.
  450. X*/
  451. X
  452. Xvoid
  453. Xdo_load()
  454. X{
  455. X    FILE *input;
  456. X
  457. X    opendbm(O_RDWR | O_CREAT | (Appending ? 0 : O_TRUNC));
  458. X
  459. X    if (Argc == 1)
  460. X    loadfile(stdin);
  461. X    else
  462. X    for (Argc--, Argv++; Argc > 0; Argc--, Argv++) {
  463. X        input = openfile(*Argv, "r");
  464. X        loadfile(input);
  465. X        closefile(input);
  466. X    }
  467. X    closedbm();
  468. X}    
  469. X
  470. X /*
  471. X**    PARSEFILE, LOADFILE
  472. X*/ 
  473. X
  474. Xparsefile(input, output)
  475. X     FILE *input, *output;
  476. X{
  477. X    extern char *index();
  478. X    char buf[BUFSIZ], *key, *val = NULL;
  479. X    register char *p;
  480. X
  481. X    while (fgets(buf, sizeof(buf), input) != NULL) {
  482. X    if (buf[0] == COMMENTCHAR || buf[0] == '\n' || buf[0] == '\0')
  483. X        continue;
  484. X    if (!isspace(buf[0])) {
  485. X        /* extract value */
  486. X        p = scantoken(buf);
  487. X        if (val != NULL)
  488. X        free(val);
  489. X        val = (char *) malloc(p - buf + 1);
  490. X        (void) strncpy(val, buf, p - buf);
  491. X        val[p - buf] = '\0';
  492. X    }
  493. X    casify(buf, Casing);
  494. X    for (p = buf; *p != '\0';) {
  495. X        while (*p != '\0' && isspace(*p)) p++;
  496. X        if (*p == '\0' || *p == COMMENTCHAR)
  497. X        break;
  498. X        key = p;
  499. X        p = scantoken(p);
  500. X        if (*p == COMMENTCHAR)
  501. X        *p = '\0';
  502. X        else if (*p != '\0')
  503. X        *p++ = '\0';
  504. X        (void) fprintf(output, "%s\t%s\n", key, val);
  505. X    }
  506. X    }
  507. X}
  508. X
  509. Xloadfile(input)
  510. X     FILE *input;
  511. X{
  512. X    char buf[BUFSIZ];
  513. X    register char *tab, *nl;
  514. X    extern char *index();
  515. X
  516. X    while (fgets(buf, sizeof(buf), input) != NULL) {
  517. X    nl = index(buf, '\n');
  518. X    if (nl != NULL)
  519. X        *nl = '\0';
  520. X
  521. X    tab = index(buf, '\t');
  522. X    if (tab == NULL) {
  523. X        (void) fprintf(stderr, "%s: missing tab in \"%s\"--ignored\n",
  524. X               Progname, buf);
  525. X        continue;
  526. X    }
  527. X    *tab++ = '\0';
  528. X    casify(buf, Casing);
  529. X    MAKEDATUM(key, buf);
  530. X    MAKEDATUM(val, tab);
  531. X    if (dbm_store(Dbm, key, val, Storeflag) != NULL && Storewarn) {
  532. X        extern int errno;
  533. X
  534. X        if (errno != 0) {
  535. X        perror(buf);
  536. X        exit(5);
  537. X        } else if (Storewarn)
  538. X        (void) fprintf(stderr,
  539. X                   "%s: duplicate key \"%s\" => \"%s\" ignored\n",
  540. X                   Progname, buf, tab);
  541. X    }
  542. X    }
  543. X}
  544. X
  545. Xchar *
  546. Xscantoken(p)
  547. X     register char *p;
  548. X{
  549. X  register bool quotedchar = FALSE, insidestring = FALSE, insideroute = FALSE;
  550. X
  551. X  /* hidious address scanner */
  552. X  while (*p != '\0' && (quotedchar || insidestring || insideroute || 
  553. X            (*p != COMMENTCHAR && !isspace(*p)))) {
  554. X    /* special quote character handling */
  555. X    if (quotedchar)
  556. X      quotedchar = FALSE;
  557. X    else {
  558. X      quotedchar = (*p == '\\');
  559. X      if (!insidestring)
  560. X    if (*p == '<')
  561. X      insideroute = TRUE;
  562. X    else if (*p == '>')
  563. X      insideroute = FALSE;
  564. X      if (*p == '"')
  565. X    insidestring = !insidestring;
  566. X    }
  567. X    p++;
  568. X  }
  569. X
  570. X  return p;
  571. X}
  572. X
  573. Xcasify(p, c)
  574. X     register char *p;
  575. X     int c;
  576. X{
  577. X    switch (c) {
  578. X      case LOWERCASE:
  579. X    for (; *p != '\0'; p++)
  580. X        if (isupper(*p))
  581. X        *p = tolower(*p);
  582. X    break;
  583. X      case UPPERCASE:
  584. X    for (; *p != '\0'; p++)
  585. X        if (islower(*p))
  586. X        *p = toupper(*p);
  587. X    break;
  588. X    }
  589. X}
  590. END_OF_ida/aux/dbm.c
  591. if test 10884 -ne `wc -c <ida/aux/dbm.c`; then
  592.     echo shar: \"ida/aux/dbm.c\" unpacked with wrong size!
  593. fi
  594. # end of overwriting check
  595. fi
  596. if test -f ida/aux/rmail.c -a "${1}" != "-c" ; then 
  597.   echo shar: Will not over-write existing file \"ida/aux/rmail.c\"
  598. else
  599. echo shar: Extracting \"ida/aux/rmail.c\" \(6732 characters\)
  600. sed "s/^X//" >ida/aux/rmail.c <<'END_OF_ida/aux/rmail.c'
  601. X/*
  602. X**  RMAIL -- Receive remote mail requests.
  603. X**  Copyright (c) 1987 Lennart Lovstrand
  604. X**  CIS Dept, Univ of Linkoping, Sweden
  605. X**
  606. X**  Use it, abuse it, but don't sell it.
  607. X**
  608. X**  Version 2.6 of 5-May-87.
  609. X**
  610. X**  This time logging selected header lines + more liberal parsing of
  611. X**  the initial from-line but not yet with accounting & like; 14-Apr-85.
  612. X**  Dbm lookup of UUCP domain names added 5-May-87.
  613. X*/
  614. X
  615. X#include <stdio.h>
  616. X#include <fcntl.h>
  617. X#include <ctype.h>
  618. X#include <sys/time.h>
  619. X#include <strings.h>
  620. X#ifdef MDBM
  621. X# include "mdbm_compat.h"
  622. X#else MDBM
  623. X# include <ndbm.h>
  624. X# define DBMFILE DBM
  625. X#endif MDBM
  626. X#include "useful.h"
  627. X
  628. X#define STRSIZ        1024
  629. X#define COMMA        ','
  630. X#define LOGFILE        "/usr/lib/uucp/rmail.log"
  631. X#define SENDMAIL    "/usr/lib/sendmail"
  632. X#define NETCHRS        "%@!:"
  633. X#define DEFAULT_HOST    "liuida"
  634. X#define DEFAULT_DOMAIN    "UUCP"
  635. X#define DOMAINTABLE    "/usr/lib/mail/domaintable"
  636. X
  637. X#define H_CC        "cc"
  638. X#define H_FROM        "from"
  639. X#define H_MESSAGE_ID    "message_id"
  640. X#define H_RETURN_PATH    "return-path"
  641. X#define H_TO        "to"
  642. X#define H_VIA        "via"
  643. X
  644. X#define MAKELC(C)    (isupper(C) ? tolower(C) : C)
  645. X#define EATSPACE(P)    while (*P == ' ') P++
  646. X
  647. XFILE *popen();
  648. Xchar *Progname;
  649. Xint Debug = FALSE;
  650. XDBMFILE    *Dbm;
  651. X
  652. Xmain(argc, argv)
  653. X    int argc;
  654. X    char **argv;
  655. X{
  656. X    char from_[STRSIZ], cmd[STRSIZ], s_mac[STRSIZ], f_opt[STRSIZ], s[STRSIZ];
  657. X    char *v_opt = "";
  658. X    char *p, *user, *host, *domain = DEFAULT_DOMAIN;
  659. X    char *acctsys = (char *) getenv("ACCTSYS");
  660. X    FILE *outf;
  661. X#ifdef LOGFILE
  662. X    FILE *logf = NULL;
  663. X#endif LOGFILE
  664. X#ifdef DOMAINTABLE
  665. X    datum key, val;
  666. X#endif DOMAINTABLE
  667. X    int insideheader, printedlast = FALSE;
  668. X    int c, errflg = FALSE;
  669. X    
  670. X    extern int optind;
  671. X    extern char *optarg;
  672. X
  673. X    Progname = argv[0];
  674. X    while ((c = getopt(argc, argv, "D:dv")) != EOF) {
  675. X    switch (c) {
  676. X      case 'D':
  677. X        domain = optarg;
  678. X        break;
  679. X      case 'd':
  680. X        Debug++;
  681. X        break;
  682. X      case 'v':
  683. X        v_opt = " -v";
  684. X        break;
  685. X      default:
  686. X        errflg = TRUE;
  687. X        break;
  688. X    }
  689. X    }
  690. X    if (errflg || optind >= argc) {
  691. X    (void) fprintf(stderr, "usage: %s [-Ddomain] user ...\n", Progname);
  692. X    exit(2);
  693. X    }
  694. X
  695. X    /*
  696. X     * set our real uid to root as well as our effective uid so
  697. X     * make sendmail accept the -oM options
  698. X     */
  699. X    (void) setreuid(0, 0);
  700. X
  701. X#ifdef DOMAINTABLE
  702. X    Dbm = dbm_open(DOMAINTABLE, O_RDONLY);
  703. X    if (Dbm == NULL)
  704. X    perror(DOMAINTABLE);
  705. X#endif DOMAINTABLE
  706. X
  707. X#ifdef LOGFILE
  708. X    if ((logf = fopen(Debug ? "/dev/tty" : LOGFILE, "a")) != NULL) {
  709. X    struct timeval t;
  710. X    int a;
  711. X
  712. X    (void) gettimeofday(&t, (struct timezone *) NULL);
  713. X    (void) fprintf(logf, "\n[%.12s] ", ctime(&t.tv_sec) + 4);
  714. X    for (a = 0; a < argc; a++)
  715. X        (void) fprintf(logf, " '%s'", argv[a]);
  716. X    (void) putc('\n', logf);
  717. X    } else
  718. X    (void) fprintf(stderr, "%s: couldn't open log file \"%s\"\n",
  719. X               Progname, LOGFILE);
  720. X#endif LOGFILE
  721. X
  722. X    user = NULL;
  723. X    host = NULL;
  724. X    (void) gets(from_);
  725. X
  726. X#ifdef LOGFILE
  727. X    if (logf != NULL)
  728. X    (void) fprintf(logf, "%s\n", from_);
  729. X#endif LOGFILE
  730. X
  731. X    if (strncmp(from_, "From ", 5) == 0 || strncmp(from_, ">From ", 6) == 0) {
  732. X    user = index(from_, ' ') + 1;
  733. X    EATSPACE(user);
  734. X    if ((p = index(user, ' ')) != NULL) {
  735. X        *p = '\0';
  736. X        while ((p = index(p + 1, 'r')) != NULL) {
  737. X        if (strncmp(p, "remote from ", 12) == 0) {
  738. X            host = p + 12;
  739. X            EATSPACE(host);
  740. X            if ((p = index(host, '\n')) != NULL)
  741. X            *p = '\0';
  742. X            if (strcmp(host, "somewhere") == 0)
  743. X            host = NULL;
  744. X            break;
  745. X        }
  746. X        }
  747. X    }
  748. X    }
  749. X
  750. X    if (acctsys == NULL)
  751. X    acctsys = host;
  752. X
  753. X    if (host)
  754. X    (void) sprintf(f_opt, " -f%s!%s", host, user);
  755. X    else if (user)
  756. X    (void) sprintf(f_opt, " -f%s", user);
  757. X    else
  758. X    *f_opt = '\0';
  759. X
  760. X    if (acctsys) {
  761. X#ifdef DOMAINTABLE
  762. X    if (Dbm != NULL) {
  763. X        key.dptr = acctsys;
  764. X        key.dsize = strlen(acctsys) + 1;
  765. X        val = dbm_fetch(Dbm, key);
  766. X        if (val.dptr != NULL)
  767. X        acctsys = val.dptr;
  768. X    }
  769. X#endif DOMAINTABLE
  770. X    if (index(acctsys, '.') == NULL)
  771. X        (void) sprintf(s_mac, " -oMs%s.%s", acctsys, domain);
  772. X    else
  773. X        (void) sprintf(s_mac, " -oMs%s", acctsys);
  774. X    } else
  775. X    *s_mac = '\0';
  776. X
  777. X    (void) sprintf(cmd, "exec %s -ee -i -oMrUUCP%s%s%s",
  778. X           SENDMAIL, s_mac, f_opt, v_opt);
  779. X
  780. X    for (; optind < argc; optind++) {
  781. X    (void) strcat(cmd, " '");
  782. X#ifdef DEFAULT_HOST
  783. X    if (anyin(argv[optind], NETCHRS) == NULL) {
  784. X        (void) strcat(cmd, DEFAULT_HOST);
  785. X        (void) strcat(cmd, "!");
  786. X    }
  787. X#endif DEFAULT_HOST
  788. X    if (*argv[optind] == '(')
  789. X        (void) strncat(cmd, &argv[optind][1], strlen(argv[optind])-2);
  790. X    else
  791. X        (void) strcat(cmd, argv[optind]);
  792. X    (void) strcat(cmd, "'");
  793. X    }
  794. X
  795. X#ifdef LOGFILE
  796. X    if (logf != NULL)
  797. X    (void) fprintf(logf, "%s\n", cmd);
  798. X#endif LOGFILE
  799. X    if (Debug)
  800. X    outf = stdout;
  801. X    else {
  802. X    outf = popen(cmd, "w");
  803. X    if (outf == NULL) {
  804. X        (void) fprintf(stderr, "%s: could not open pipe thru %s\n",
  805. X               Progname, cmd);
  806. X        exit(1);
  807. X    }
  808. X    }
  809. X
  810. X    insideheader = TRUE;
  811. X    while (gets(s)) {
  812. X    if (*s == NULL)
  813. X        insideheader = FALSE;
  814. X
  815. X#ifdef LOGFILE
  816. X    if (logf != NULL && insideheader &&
  817. X        ((printedlast && isspace(*s)) ||
  818. X         iskey(H_FROM, s) || iskey(H_TO, s) || iskey(H_CC, s) ||
  819. X         iskey(H_RETURN_PATH, s) || iskey(H_MESSAGE_ID, s))) {
  820. X         (void) fprintf(logf, "\t%s\n", s);
  821. X         printedlast = TRUE;
  822. X         } else
  823. X         printedlast = FALSE;
  824. X#endif LOGFILE
  825. X    (void) fprintf(outf, "%s\n", s);
  826. X    }
  827. X
  828. X#ifdef LOGFILE
  829. X    if (logf != NULL)
  830. X    (void) fclose(logf);
  831. X#endif LOGFILE
  832. X
  833. X    if (!Debug)
  834. X    exit((pclose(outf) >> 8) & 0377);
  835. X}
  836. X
  837. X/*
  838. X**    ANYIN -- Does the target string contain chars from the pattern string?
  839. X*/
  840. Xanyin(t, p)
  841. X    char *t;
  842. X    register char *p;
  843. X{
  844. X    for (; *p != '\0'; p++)
  845. X    if (index(t, *p) != NULL)
  846. X        return TRUE;
  847. X    return FALSE;
  848. X}
  849. X
  850. X/*
  851. X**    ISKEY -- Checks if the line is prefixed by the supplied keyword
  852. X**    (immediately followed by a colon)
  853. X*/
  854. Xiskey(key, line)
  855. X    char *key, *line;
  856. X{
  857. X    for (; *key != NULL && *line != NULL; key++, line++)
  858. X    if (MAKELC(*key) != MAKELC(*line))
  859. X        break;
  860. X
  861. X    return *key == NULL && *line == ':';
  862. X}
  863. X
  864. X/*
  865. X**    EXTRACT_ADDRESS -- Finds and extracts the machine address part
  866. X**    of an address field.
  867. X*/
  868. X
  869. Xchar *
  870. Xextract_address(field, address)
  871. X    char *field, *address;
  872. X{
  873. X    char *address_start = address;
  874. X
  875. X    while(*field && *field != COMMA && *field != '>')
  876. X    switch (*field) {
  877. X      case '<':
  878. X        return extract_address(field, address_start);
  879. X      case '(':
  880. X        while (*field && *field != ')');
  881. X        field++;
  882. X        break;
  883. X      case '"':
  884. X        do
  885. X        *address++ = *field++;
  886. X        while (*field && *field != '"');
  887. X        if (*field)
  888. X        *address++ = *field++;
  889. X        break;
  890. X      case ' ':
  891. X        *address++ = *field++;
  892. X        EATSPACE(field);
  893. X        break;
  894. X      case '\\':
  895. X        *address++ = *field++;
  896. X        /* fall through */
  897. X      default:
  898. X        *address++ = *field++;
  899. X    }
  900. X    *address = NULL;
  901. X    if (*field)
  902. X    return index(field, COMMA)+1;
  903. X    else
  904. X    return field;
  905. X}
  906. X
  907. X
  908. END_OF_ida/aux/rmail.c
  909. if test 6732 -ne `wc -c <ida/aux/rmail.c`; then
  910.     echo shar: \"ida/aux/rmail.c\" unpacked with wrong size!
  911. fi
  912. # end of overwriting check
  913. fi
  914. if test -f ida/aux/xalparse.c -a "${1}" != "-c" ; then 
  915.   echo shar: Will not over-write existing file \"ida/aux/xalparse.c\"
  916. else
  917. echo shar: Extracting \"ida/aux/xalparse.c\" \(6648 characters\)
  918. sed "s/^X//" >ida/aux/xalparse.c <<'END_OF_ida/aux/xalparse.c'
  919. X/*
  920. X**  XALPARSE -- Xaliases file parser.
  921. X**  Copyright (c) 1987 Lennart Lovstrand
  922. X**  CIS Dept, Univ of Linkoping, Sweden
  923. X**
  924. X**  Use it, abuse it, but don't sell it.
  925. X*/
  926. X
  927. X#include "useful.h"
  928. X#include <stdio.h>
  929. X#include <ctype.h>
  930. X
  931. X#ifndef lint
  932. Xstatic char    SccsId[] = "@(#)xalparse.c 1.1 (lel@ida.liu.se) 4/12/87";
  933. X#endif !lint
  934. X
  935. Xstruct alias {
  936. X  bool a_in, a_out;
  937. X  char *a_name;
  938. X};
  939. X
  940. X#define ANULL    (struct alias *) NULL
  941. X
  942. X/*
  943. X**  XPARSE -- Parse an xaliases file, producing aliases + generics files.
  944. X**
  945. X**    This program parses a file in ``xaliases'' format, producing
  946. X**    a standard aliases file + a generics file.  The xaliases input
  947. X**    file has entry of the following format:
  948. X**        generic_list: mbox_list
  949. X**    where elements in both lists are separated by commas.  In
  950. X**    addition, each element in the mbox_list may be prefixed with
  951. X**    either or both of the ``redirection characters,'' "<" and ">".
  952. X
  953. X**    In its simplest form, the generic_list has just one member and
  954. X**    the mbox_list uses no redirection characters.  This
  955. X**    corresponds exactly to the standard aliases format and
  956. X**    function.
  957. X
  958. X**    The first extention is made by allowing more than one entry on
  959. X**    the left hand side, thus making "a, b: c" as shorthand for the
  960. X**    two entries "a: c" and "b: c".
  961. X
  962. X**    The second extension is made by adding the previously
  963. X**    mentioned redirection characters to the addresses on the right
  964. X**    hand side.  These control in what direction the aliases should
  965. X**    be used.
  966. X**
  967. X**    etc.
  968. X*/
  969. X
  970. Xint iflag = FALSE, Iflag = FALSE, Oflag = FALSE;
  971. X
  972. Xmain(argc, argv)
  973. X     int argc;
  974. X     char **argv;
  975. X{
  976. X  extern int optind;
  977. X  extern char *optarg;
  978. X  char c;
  979. X  FILE *xaliases, *aliases, *generics;
  980. X
  981. X
  982. X  if (argc != 4) {
  983. X    fprintf(stderr, "usage: %s xaliases aliases generics\n", argv[0]);
  984. X    exit(1);
  985. X  }
  986. X
  987. X  if (strcmp(argv[1], "-") == 0)
  988. X    xaliases = stdin;
  989. X  else {
  990. X    xaliases = fopen(argv[1], "r");
  991. X    if (xaliases == NULL)
  992. X      perror(argv[1]), exit(2);
  993. X  }
  994. X  aliases = fopen(argv[2], "w");
  995. X  if (aliases == NULL)
  996. X    perror(argv[2]), exit(2);
  997. X  generics = fopen(argv[3], "w");
  998. X  if (generics == NULL)
  999. X    perror(argv[3]), exit(2);
  1000. X  
  1001. X  parsefile(xaliases, aliases, generics);
  1002. X  exit(0);
  1003. X}
  1004. X
  1005. Xparsefile(xaliases, aliases, generics)
  1006. X     FILE *xaliases, *aliases, *generics;
  1007. X{
  1008. X  extern char *index();
  1009. X  char line[BUFSIZ];
  1010. X  struct alias *rhs[BUFSIZ], *lhs[BUFSIZ];
  1011. X  struct alias **a, **r, **first;
  1012. X
  1013. X  while (readline(line, sizeof(line), xaliases) >= 0) {
  1014. X    parseline(line, lhs, rhs);
  1015. X
  1016. X    for (first = rhs; *first != ANULL; first++)
  1017. X      if ((*first)->a_in)
  1018. X    break;
  1019. X    if (*first != ANULL)
  1020. X      for (a = lhs; *a != ANULL; a++) {
  1021. X    fprintf(aliases, "%s:%s", (*a)->a_name, (*first)->a_name);
  1022. X    for (r = first+1; *r != ANULL; r++)
  1023. X      if ((*r)->a_in)
  1024. X        fprintf(aliases, ",%s", (*r)->a_name);
  1025. X    fprintf(aliases, "\n");
  1026. X      }
  1027. X
  1028. X    for (first = rhs; *first != ANULL; first++)
  1029. X      if ((*first)->a_out)
  1030. X    break;
  1031. X    if (*first != ANULL) {
  1032. X      fprintf(generics, "%s\t%s", lhs[0]->a_name, (*first)->a_name);
  1033. X      for (r = first+1; *r != ANULL; r++)
  1034. X    if ((*r)->a_out)
  1035. X      fprintf(generics, " %s", (*r)->a_name);
  1036. X      fprintf(generics, "\n");
  1037. X    }
  1038. X
  1039. X    freebufs(lhs, rhs);
  1040. X  }
  1041. X}
  1042. X
  1043. X/**
  1044. X **    PEEKC -- Return the next char to be read.
  1045. X **/
  1046. X
  1047. Xpeekc(stream)
  1048. X     FILE *stream;
  1049. X{
  1050. X  int c;
  1051. X
  1052. X  c = getc(stream);
  1053. X  if (c != EOF)
  1054. X    ungetc(c, stream);
  1055. X  return c;
  1056. X}
  1057. X
  1058. X/**
  1059. X **    READLINE -- Read a (logical) line and return the # of chars read
  1060. X **/
  1061. X
  1062. Xreadline(buf, bufsiz, stream)
  1063. X     char *buf;
  1064. X     int bufsiz;
  1065. X     FILE *stream;
  1066. X{
  1067. X  int len;
  1068. X  char *sharp;
  1069. X
  1070. X  if (fgets(buf, bufsiz, stream) == NULL)
  1071. X    return -1;
  1072. X  buf[strlen(buf)-1] = '\0';
  1073. X
  1074. X  /*
  1075. X  if ((sharp = index(buf, '#')) != NULL)
  1076. X    *sharp = '\0';
  1077. X  */
  1078. X  if (buf[0] == '#')
  1079. X    buf[0] = '\0';
  1080. X
  1081. X  len = strlen(buf);
  1082. X  if (isspace(peekc(stream)))
  1083. X    return len + readline(&buf[len], bufsiz-len, stream);
  1084. X  else
  1085. X    return len;
  1086. X}
  1087. X
  1088. X/**
  1089. X **    PARSETHING
  1090. X **/
  1091. X
  1092. X
  1093. X#define LHS    1
  1094. X#define RHS    2
  1095. X
  1096. Xchar *
  1097. Xparsething(line, thing, side)
  1098. X     char *line;
  1099. X     struct alias **thing;
  1100. X     int side;
  1101. X{
  1102. X  register char *s, *d;
  1103. X  register bool
  1104. X    insideroute = FALSE,
  1105. X    insidestring = FALSE,
  1106. X    quotedchar = FALSE;
  1107. X  bool i_mark, o_mark;
  1108. X  char buf[BUFSIZ];
  1109. X  extern char *malloc();
  1110. X
  1111. X  s = line;
  1112. X  d = buf;
  1113. X
  1114. X  while (*s != '\0' && isspace(*s)) s++;
  1115. X  if (side == RHS) {
  1116. X    if (o_mark = (*s == '<')) s++;
  1117. X    if (i_mark = (*s == '>')) s++;
  1118. X    i_mark = i_mark || !o_mark;            /* default to '>' */
  1119. X    while (*s != '\0' && isspace(*s)) s++;
  1120. X  }
  1121. X
  1122. X  for (;*s != '\0'; s++) {
  1123. X    /* exit if non-quoted comma (or colon & LHS) */
  1124. X    if (!insidestring && !quotedchar && !insideroute &&
  1125. X    *s == ',' || ((side == LHS) && *s == ':'))
  1126. X      break;
  1127. X
  1128. X    /* copy if not unquoted whitespace */
  1129. X    if (insidestring || quotedchar || !isspace(*s))
  1130. X      *d++ = *s;
  1131. X
  1132. X    /* special quote character handling */
  1133. X    if (quotedchar)
  1134. X      quotedchar = FALSE;
  1135. X    else {
  1136. X      quotedchar = (*s == '\\');
  1137. X      if (!insidestring)
  1138. X    if (*s == '<')
  1139. X      insideroute = TRUE;
  1140. X    else if (*s == '>')
  1141. X      insideroute = FALSE;
  1142. X      if (*s == '"')
  1143. X    insidestring = !insidestring;
  1144. X    }
  1145. X  }
  1146. X  while (d > buf && isspace(d[-1])) d--;
  1147. X  *d = '\0';
  1148. X
  1149. X  if (d == buf && *s == '\0') {
  1150. X    *thing = ANULL;
  1151. X    return NULL;
  1152. X  } else {
  1153. X    *thing = (struct alias *) malloc(sizeof(struct alias));
  1154. X    (*thing)->a_in = i_mark;
  1155. X    (*thing)->a_out = o_mark;
  1156. X    (*thing)->a_name = malloc(strlen(buf) + 1);
  1157. X    strcpy((*thing)->a_name, buf);
  1158. X    return s;
  1159. X  }
  1160. X}
  1161. X
  1162. X/**
  1163. X **    PARSELINE
  1164. X **/
  1165. X
  1166. Xparseline(line, lhs, rhs)
  1167. X     char *line;
  1168. X     struct alias **lhs, **rhs;
  1169. X{
  1170. X  line--;
  1171. X
  1172. X  while ((line = parsething(line+1, lhs++, LHS)) != NULL)
  1173. X    if (*line == ':')
  1174. X      break;
  1175. X  *lhs = NULL;
  1176. X
  1177. X  if (line != NULL)
  1178. X    while ((line = parsething(line+1, rhs++, RHS)) != NULL);
  1179. X  *rhs = ANULL;
  1180. X}
  1181. X
  1182. X/**
  1183. X **    FREEBUFS
  1184. X **/
  1185. X
  1186. Xfreebufs(lhs, rhs)
  1187. X     struct alias **lhs, **rhs;
  1188. X{
  1189. X  while (*lhs != ANULL) {
  1190. X    free((*lhs)->a_name);
  1191. X    free(*lhs);
  1192. X    lhs++;
  1193. X  }
  1194. X  while (*rhs != ANULL) {
  1195. X    free((*rhs)->a_name);
  1196. X    free(*rhs);
  1197. X    rhs++;
  1198. X  }
  1199. X}
  1200. X
  1201. X/**
  1202. X **    COMPRESSLINE -- Remove all heading & trailing whitespace around items.
  1203. X **/
  1204. X
  1205. Xcompressline(line)
  1206. X     char *line;
  1207. X{
  1208. X  register char *d, *s, *b, *e;
  1209. X
  1210. X  for (d = s = line; *s != '\0'; s++) {
  1211. X        /* eat initial whitespace */
  1212. X    while (*s != '\0' && isspace(*s)) s++;
  1213. X    if (*s == '\0')
  1214. X      break;
  1215. X        /* remember beginning of "word" and find end */
  1216. X    b = s;
  1217. X    while (*s != '\0' && *s != ',' && *s != ':') s++;
  1218. X    e = s - 1;
  1219. X        /* backspace end thru whitespace */
  1220. X    while (e >= b && isspace(*e)) e--;
  1221. X        /* copy "word" w/o whitespace */
  1222. X    while (b <= e) *d++ = *b++;
  1223. X        /* copy separator */
  1224. X    *d++ = *s;
  1225. X    if (*s == '\0')
  1226. X      return;
  1227. X  }
  1228. X  *d = '\0';
  1229. X}
  1230. END_OF_ida/aux/xalparse.c
  1231. if test 6648 -ne `wc -c <ida/aux/xalparse.c`; then
  1232.     echo shar: \"ida/aux/xalparse.c\" unpacked with wrong size!
  1233. fi
  1234. # end of overwriting check
  1235. fi
  1236. if test -f ida/patches/alias.c.diff -a "${1}" != "-c" ; then 
  1237.   echo shar: Will not over-write existing file \"ida/patches/alias.c.diff\"
  1238. else
  1239. echo shar: Extracting \"ida/patches/alias.c.diff\" \(5555 characters\)
  1240. sed "s/^X//" >ida/patches/alias.c.diff <<'END_OF_ida/patches/alias.c.diff'
  1241. X*** alias.c.orig    Fri Mar 13 18:51:08 1987
  1242. X--- alias.c    Wed May 27 02:03:20 1987
  1243. X***************
  1244. X*** 55,68 ****
  1245. X  */
  1246. X  
  1247. X  
  1248. X! #ifdef DBM
  1249. X! typedef struct
  1250. X! {
  1251. X!     char    *dptr;
  1252. X!     int    dsize;
  1253. X! } DATUM;
  1254. X  extern DATUM fetch();
  1255. X! #endif DBM
  1256. X  
  1257. X  alias(a, sendq)
  1258. X      register ADDRESS *a;
  1259. X--- 55,63 ----
  1260. X  */
  1261. X  
  1262. X  
  1263. X! #if defined(DBM) && !defined(NDBM)
  1264. X  extern DATUM fetch();
  1265. X! #endif DBM && !NDBM
  1266. X  
  1267. X  alias(a, sendq)
  1268. X      register ADDRESS *a;
  1269. X***************
  1270. X*** 122,128 ****
  1271. X  **        none.
  1272. X  **
  1273. X  **    Warnings:
  1274. X! **        The return value will be trashed across calls.
  1275. X  */
  1276. X  
  1277. X  char *
  1278. X--- 117,124 ----
  1279. X  **        none.
  1280. X  **
  1281. X  **    Warnings:
  1282. X! **        The return value will be trashed across calls
  1283. X! **        unless using a multi-file dbm (mdbm or ndbm).
  1284. X  */
  1285. X  
  1286. X  char *
  1287. X***************
  1288. X*** 131,151 ****
  1289. X  {
  1290. X  # ifdef DBM
  1291. X      DATUM rhs, lhs;
  1292. X  
  1293. X      /* create a key for fetch */
  1294. X!     lhs.dptr = name;
  1295. X      lhs.dsize = strlen(name) + 1;
  1296. X      rhs = fetch(lhs);
  1297. X      return (rhs.dptr);
  1298. X  # else DBM
  1299. X      register STAB *s;
  1300. X  
  1301. X      s = stab(name, ST_ALIAS, ST_FIND);
  1302. X      if (s == NULL)
  1303. X          return (NULL);
  1304. X      return (s->s_alias);
  1305. X  # endif DBM
  1306. X  }
  1307. X   /*
  1308. X  **  INITALIASES -- initialize for aliasing
  1309. X  **
  1310. X--- 127,204 ----
  1311. X  {
  1312. X  # ifdef DBM
  1313. X      DATUM rhs, lhs;
  1314. X+     char *lowname = xalloc(strlen(name) + 1);
  1315. X  
  1316. X      /* create a key for fetch */
  1317. X!     strcpy(lowname, name);
  1318. X!     makelower(lowname);
  1319. X!     lhs.dptr = lowname;
  1320. X      lhs.dsize = strlen(name) + 1;
  1321. X+ # ifdef DEBUG
  1322. X+     if (tTd(27, 3))
  1323. X+         printf("aliaslookup(\"%s\") => ", lhs.dptr);
  1324. X+ # endif DEBUG
  1325. X+ # ifdef NDBM
  1326. X+     rhs = dbm_fetch(AliasDbm.dbm, lhs);
  1327. X+     if (rhs.dptr != NULL)
  1328. X+         rhs.dptr = newstr(rhs.dptr);
  1329. X+ # else NDBM
  1330. X      rhs = fetch(lhs);
  1331. X+ # endif NDBM
  1332. X+ # ifdef DEBUG
  1333. X+     if (tTd(27, 3))
  1334. X+         printf("%s\n", rhs.dptr == NULL ? "NOT_FOUND" : rhs.dptr);
  1335. X+ # endif DEBUG
  1336. X+     (void) free(lowname);
  1337. X      return (rhs.dptr);
  1338. X  # else DBM
  1339. X      register STAB *s;
  1340. X  
  1341. X      s = stab(name, ST_ALIAS, ST_FIND);
  1342. X+ # ifdef DEBUG
  1343. X+     if (tTd(27, 3))
  1344. X+         printf("%s\n", s == NULL ? "NOT_FOUND" : s->s_alias);
  1345. X+ # endif DEBUG
  1346. X      if (s == NULL)
  1347. X          return (NULL);
  1348. X      return (s->s_alias);
  1349. X  # endif DBM
  1350. X  }
  1351. X+ 
  1352. X+ #ifdef NDBM
  1353. X+ /*
  1354. X+ **  NDBMINIT -- initialize the ndbm database
  1355. X+ **
  1356. X+ **    Only for use with NDBM and the keyed database table.
  1357. X+ **
  1358. X+ **    Parameters:
  1359. X+ **        aliasfile -- name of alias database file
  1360. X+ **
  1361. X+ **    Returns:
  1362. X+ **        None.
  1363. X+ **
  1364. X+ **    Side Effects:
  1365. X+ **        Opens the named database and initializes the DB_ALIAS
  1366. X+ **        entry of DbmTab.
  1367. X+ */
  1368. X+ ndbminit(aliasfile)
  1369. X+      char *aliasfile;
  1370. X+ {
  1371. X+   AliasDbm.name = aliasfile;
  1372. X+ 
  1373. X+   if (AliasDbm.dbm != DB_NOTYETOPEN)
  1374. X+     (void) dbm_close(AliasDbm.dbm);
  1375. X+ 
  1376. X+   AliasDbm.dbm = dbm_open(AliasDbm.name, O_RDWR, 0);
  1377. X+   if (AliasDbm.dbm == DB_NOSUCHFILE) {
  1378. X+     syserr("Cannot open %s", AliasDbm.name);
  1379. X+     NoAlias = TRUE;
  1380. X+     errno = 0;
  1381. X+     return;
  1382. X+   }
  1383. X+ }
  1384. X+ 
  1385. X+ #endif NDBM
  1386. X   /*
  1387. X  **  INITALIASES -- initialize for aliasing
  1388. X  **
  1389. X***************
  1390. X*** 200,206 ****
  1391. X--- 253,263 ----
  1392. X      */
  1393. X  
  1394. X      if (!init)
  1395. X+ # ifdef NDBM
  1396. X+         ndbminit(aliasfile);
  1397. X+ # else NDBM
  1398. X          dbminit(aliasfile);
  1399. X+ # endif NDBM
  1400. X      atcnt = SafeAlias * 2;
  1401. X      if (atcnt > 0)
  1402. X      {
  1403. X***************
  1404. X*** 218,224 ****
  1405. X  
  1406. X              sleep(30);
  1407. X  # ifdef NDBM
  1408. X!             dbminit(aliasfile);
  1409. X  # endif NDBM
  1410. X          }
  1411. X      }
  1412. X--- 275,281 ----
  1413. X  
  1414. X              sleep(30);
  1415. X  # ifdef NDBM
  1416. X!             ndbminit(aliasfile);
  1417. X  # endif NDBM
  1418. X          }
  1419. X      }
  1420. X***************
  1421. X*** 236,242 ****
  1422. X  
  1423. X      modtime = stb.st_mtime;
  1424. X      (void) strcpy(buf, aliasfile);
  1425. X!     (void) strcat(buf, ".pag");
  1426. X      stb.st_ino = 0;
  1427. X      if (!init && (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 
  1428. 0))
  1429. X      {
  1430. X--- 293,299 ----
  1431. X  
  1432. X      modtime = stb.st_mtime;
  1433. X      (void) strcpy(buf, aliasfile);
  1434. X!     (void) strcat(buf, DB_PAGEXT);
  1435. X      stb.st_ino = 0;
  1436. X      if (!init && (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 
  1437. 0))
  1438. X      {
  1439. X***************
  1440. X*** 356,362 ****
  1441. X      {
  1442. X          oldsigint = signal(SIGINT, SIG_IGN);
  1443. X          (void) strcpy(line, aliasfile);
  1444. X!         (void) strcat(line, ".dir");
  1445. X          if (close(creat(line, DBMMODE)) < 0)
  1446. X          {
  1447. X              syserr("cannot make %s", line);
  1448. X--- 413,419 ----
  1449. X      {
  1450. X          oldsigint = signal(SIGINT, SIG_IGN);
  1451. X          (void) strcpy(line, aliasfile);
  1452. X!         (void) strcat(line, DB_PAGEXT);
  1453. X          if (close(creat(line, DBMMODE)) < 0)
  1454. X          {
  1455. X              syserr("cannot make %s", line);
  1456. X***************
  1457. X*** 364,370 ****
  1458. X              return;
  1459. X          }
  1460. X          (void) strcpy(line, aliasfile);
  1461. X!         (void) strcat(line, ".pag");
  1462. X          if (close(creat(line, DBMMODE)) < 0)
  1463. X          {
  1464. X              syserr("cannot make %s", line);
  1465. X--- 421,427 ----
  1466. X              return;
  1467. X          }
  1468. X          (void) strcpy(line, aliasfile);
  1469. X!         (void) strcat(line, DB_DIREXT);
  1470. X          if (close(creat(line, DBMMODE)) < 0)
  1471. X          {
  1472. X              syserr("cannot make %s", line);
  1473. X***************
  1474. X*** 371,377 ****
  1475. X--- 428,438 ----
  1476. X              (void) signal(SIGINT, oldsigint);
  1477. X              return;
  1478. X          }
  1479. X+ # ifdef NDBM
  1480. X+         ndbminit(aliasfile);
  1481. X+ # else NDBM
  1482. X          dbminit(aliasfile);
  1483. X+ # endif NDBM
  1484. X      }
  1485. X  
  1486. X      /*
  1487. X***************
  1488. X*** 475,480 ****
  1489. X--- 536,542 ----
  1490. X                  break;
  1491. X              LineNumber++;
  1492. X          }
  1493. X+ 
  1494. X          if (al.q_mailer != LocalMailer)
  1495. X          {
  1496. X              syserr("cannot alias non-local names");
  1497. X***************
  1498. X*** 497,503 ****
  1499. X--- 559,569 ----
  1500. X              key.dptr = al.q_user;
  1501. X              content.dsize = rhssize;
  1502. X              content.dptr = rhs;
  1503. X+ # ifdef NDBM
  1504. X+             (void) dbm_store(AliasDbm.dbm, key, content);
  1505. X+ # else NDBM
  1506. X              store(key, content);
  1507. X+ # endif NDBM
  1508. X          }
  1509. X          else
  1510. X  # endif DBM
  1511. X***************
  1512. X*** 521,527 ****
  1513. X--- 587,597 ----
  1514. X  
  1515. X          key.dsize = 2;
  1516. X          key.dptr = "@";
  1517. X+ # ifdef NDBM
  1518. X+         (void) dbm_store(AliasDbm.dbm, key, key);
  1519. X+ # else NDBM
  1520. X          store(key, key);
  1521. X+ # endif NDBM
  1522. X  
  1523. X          /* restore the old signal */
  1524. X          (void) signal(SIGINT, oldsigint);
  1525. END_OF_ida/patches/alias.c.diff
  1526. if test 5555 -ne `wc -c <ida/patches/alias.c.diff`; then
  1527.     echo shar: \"ida/patches/alias.c.diff\" unpacked with wrong size!
  1528. fi
  1529. # end of overwriting check
  1530. fi
  1531. if test -f ida/patches/op.me.diff -a "${1}" != "-c" ; then 
  1532.   echo shar: Will not over-write existing file \"ida/patches/op.me.diff\"
  1533. else
  1534. echo shar: Extracting \"ida/patches/op.me.diff\" \(12488 characters\)
  1535. sed "s/^X//" >ida/patches/op.me.diff <<'END_OF_ida/patches/op.me.diff'
  1536. X*** op.me.orig    Fri Mar 13 18:47:47 1987
  1537. X--- op.me    Tue Apr 28 18:20:28 1987
  1538. X***************
  1539. X*** 7,13 ****
  1540. X  .\"
  1541. X  .\"    @(#)op.me    5.8 (Berkeley) 5/9/86
  1542. X  .\"
  1543. X! .\" eqn % | troff -me
  1544. X  .\"if n .ls 2
  1545. X  .\".he 'Sendmail Installation and Operation Guide''%'
  1546. X  .\".fo 'Version 5.8''Last Mod 5/9/86'
  1547. X--- 7,13 ----
  1548. X  .\"
  1549. X  .\"    @(#)op.me    5.8 (Berkeley) 5/9/86
  1550. X  .\"
  1551. X! .\" pic % | eqn | troff -me
  1552. X  .\"if n .ls 2
  1553. X  .\".he 'Sendmail Installation and Operation Guide''%'
  1554. X  .\".fo 'Version 5.8''Last Mod 5/9/86'
  1555. X***************
  1556. X*** 40,46 ****
  1557. X  Eric Allman
  1558. X  Britton-Lee, Inc.
  1559. X  .sp
  1560. X! Version 5.8
  1561. X  .)l
  1562. X  .sp 2
  1563. X  .pp
  1564. X--- 40,51 ----
  1565. X  Eric Allman
  1566. X  Britton-Lee, Inc.
  1567. X  .sp
  1568. X! .sz 8
  1569. X! Enhancements by Lennart L\o"o\(um"vstrand
  1570. X! Dept of Comp and Info Sci, U of Link\o"o\(um"ping, Sweden
  1571. X! .sz 10
  1572. X! .sp
  1573. X! Version 5.8++
  1574. X  .)l
  1575. X  .sp 2
  1576. X  .pp
  1577. X***************
  1578. X*** 524,529 ****
  1579. X--- 529,546 ----
  1580. X  will print the contents of the mail queue;
  1581. X  see below).
  1582. X  This should be a link to /usr/lib/sendmail.
  1583. X+ .sh 3 "/usr/ucb/bsmtp"
  1584. X+ .pp
  1585. X+ If
  1586. X+ .i sendmail
  1587. X+ is invoked as
  1588. X+ .q bsmtp,
  1589. X+ it will simulate the
  1590. X+ .b \-bb
  1591. X+ flag (i.e.,
  1592. X+ .i sendmail
  1593. X+ will start accepting batched SMTP commands from stdin; see below).
  1594. X+ This should be a link to /usr/lib/sendmail.
  1595. X  .sh 1 "NORMAL OPERATIONS"
  1596. X  .sh 2 "Quick Configuration Startup"
  1597. X  .pp
  1598. X***************
  1599. X*** 823,834 ****
  1600. X  .(b
  1601. X  name: name1, name2, ...
  1602. X  .)b
  1603. X! Only local names may be aliased;
  1604. X  e.g.,
  1605. X  .(b
  1606. X  eric@mit-xx: eric@berkeley.EDU
  1607. X  .)b
  1608. X! will not have the desired effect.
  1609. X  Aliases may be continued by starting any continuation lines
  1610. X  with a space or a tab.
  1611. X  Blank lines and lines beginning with a sharp sign
  1612. X--- 840,855 ----
  1613. X  .(b
  1614. X  name: name1, name2, ...
  1615. X  .)b
  1616. X! It is possible not
  1617. X! only local names may be aliased,
  1618. X! but even non-locals if the configuration file is properly set up;
  1619. X  e.g.,
  1620. X  .(b
  1621. X  eric@mit-xx: eric@berkeley.EDU
  1622. X  .)b
  1623. X! will have the desired effect if the
  1624. X! .i aliases
  1625. X! database is searched before determining mailer in ruleset 0.
  1626. X  Aliases may be continued by starting any continuation lines
  1627. X  with a space or a tab.
  1628. X  Blank lines and lines beginning with a sharp sign
  1629. X***************
  1630. X*** 1136,1141 ****
  1631. X--- 1157,1170 ----
  1632. X  it defaults to
  1633. X  .i sendmail.cf
  1634. X  in the current directory.
  1635. X+ .pp
  1636. X+ You can also specify a different frozen configuration file with the
  1637. X+ .b \-Z
  1638. X+ option.  It is used the same way as the
  1639. X+ .b \-C
  1640. X+ flag and defaults to
  1641. X+ .i sendmail.fc
  1642. X+ in the current directory.
  1643. X  .sh 2 "Changing the Values of Options"
  1644. X  .pp
  1645. X  Options can be overridden using the
  1646. X***************
  1647. X*** 1705,1712 ****
  1648. X  .ta 1i
  1649. X  Path    The pathname of the mailer
  1650. X  Flags    Special flags for this mailer
  1651. X! Sender    A rewriting set for sender addresses
  1652. X! Recipient    A rewriting set for recipient addresses
  1653. X  Argv    An argument vector to pass to this mailer
  1654. X  Eol    The end-of-line string for this mailer
  1655. X  Maxsize    The maximum message length to this mailer
  1656. X--- 1734,1741 ----
  1657. X  .ta 1i
  1658. X  Path    The pathname of the mailer
  1659. X  Flags    Special flags for this mailer
  1660. X! Sender    Rewriting sets for sender addresses
  1661. X! Recipient    Rewriting sets for recipient addresses
  1662. X  Argv    An argument vector to pass to this mailer
  1663. X  Eol    The end-of-line string for this mailer
  1664. X  Maxsize    The maximum message length to this mailer
  1665. X***************
  1666. X*** 1879,1886 ****
  1667. X  l    The format of the UNIX from line
  1668. X  n    The name of the daemon (for error messages)
  1669. X  o    The set of "operators" in addresses
  1670. X! q    default format of sender address
  1671. X  .)b
  1672. X  The
  1673. X  .b $e
  1674. X  macro is printed out when SMTP starts up.
  1675. X--- 1908,1926 ----
  1676. X  l    The format of the UNIX from line
  1677. X  n    The name of the daemon (for error messages)
  1678. X  o    The set of "operators" in addresses
  1679. X! q    Default format of sender address
  1680. X  .)b
  1681. X+ In addition, you also have the
  1682. X+ .b $k
  1683. X+ macro:
  1684. X+ .(b
  1685. X+ .ta 4n
  1686. X+ k    Your node's UUCP hostname
  1687. X+ .)b
  1688. X+ which is optional to define (it defaults to the value of
  1689. X+ .b $w,
  1690. X+ your normal hostname).
  1691. X+ .pp
  1692. X  The
  1693. X  .b $e
  1694. X  macro is printed out when SMTP starts up.
  1695. X***************
  1696. X*** 2107,2114 ****
  1697. X  \fB$*\fP    Match zero or more tokens
  1698. X  \fB$+\fP    Match one or more tokens
  1699. X  \fB$\-\fP    Match exactly one token
  1700. X! \fB$=\fP\fIx\fP    Match any token in class \fIx\fP
  1701. X! \fB$~\fP\fIx\fP    Match any token not in class \fIx\fP
  1702. X  .)b
  1703. X  If any of these match,
  1704. X  they are assigned to the symbol
  1705. X--- 2147,2154 ----
  1706. X  \fB$*\fP    Match zero or more tokens
  1707. X  \fB$+\fP    Match one or more tokens
  1708. X  \fB$\-\fP    Match exactly one token
  1709. X! \fB$=\fP\fIx\fP    Match any sequence of tokens in class \fIx\fP
  1710. X! \fB$~\fP\fIx\fP    Match any sequence of tokens not in class \fIx\fP
  1711. X  .)b
  1712. X  If any of these match,
  1713. X  they are assigned to the symbol
  1714. X***************
  1715. X*** 2141,2149 ****
  1716. X  unless they begin with a dollar sign.
  1717. X  Metasymbols are:
  1718. X  .(b
  1719. X! .ta \w'$#mailer  'u
  1720. X  \fB$\fP\fIn\fP    Substitute indefinite token \fIn\fP from LHS
  1721. X! \fB$[\fP\fIname\fP\fB$]\fP    Canonicalize \fIname\fP
  1722. X  \fB$>\fP\fIn\fP    \*(lqCall\*(rq ruleset \fIn\fP
  1723. X  \fB$#\fP\fImailer\fP    Resolve to \fImailer\fP
  1724. X  \fB$@\fP\fIhost\fP    Specify \fIhost\fP
  1725. X--- 2181,2190 ----
  1726. X  unless they begin with a dollar sign.
  1727. X  Metasymbols are:
  1728. X  .(b
  1729. X! .ta \w'$(x key$@arg$:default$)  'u
  1730. X  \fB$\fP\fIn\fP    Substitute indefinite token \fIn\fP from LHS
  1731. X! \fB$[\fP\fIname\fP\fB$:\fP\fIdefault\fP\fB$]\fP    Canonicalize \fIname\fP
  1732. X! \fB$(\fP\fIx key\fP\fB$@\fP\fIarg\fP\fB$:\fP\fIdefault\fP\fB$)\fP    Lookup 
  1733. the \fIkey\fP in database \fIx\fP, and sprintf \fIarg\fP through the result.
  1734. X  \fB$>\fP\fIn\fP    \*(lqCall\*(rq ruleset \fIn\fP
  1735. X  \fB$#\fP\fImailer\fP    Resolve to \fImailer\fP
  1736. X  \fB$@\fP\fIhost\fP    Specify \fIhost\fP
  1737. X***************
  1738. X*** 2178,2184 ****
  1739. X--- 2219,2270 ----
  1740. X  .q $[[128.32.130.2]$]
  1741. X  would become
  1742. X  .q vangogh.berkeley.edu.
  1743. X+ The
  1744. X+ .b $: \c
  1745. X+ .i default
  1746. X+ part is optional and specifies what should be substituted
  1747. X+ in case that the
  1748. X+ .i name
  1749. X+ is not known to 
  1750. X+ .i gethostent \|(3).
  1751. X  .pp
  1752. X+ General 
  1753. X+ .i dbm \|(3)
  1754. X+ databases may be searched using the
  1755. X+ .b $( \c
  1756. X+ .i "x key" \c
  1757. X+ .b $)
  1758. X+ syntax.  The expression may be supplied with an optional result argument,
  1759. X+ .b $@ \c
  1760. X+ .i arg,
  1761. X+ and a default string,
  1762. X+ .b $: \c
  1763. X+ .i default.
  1764. X+ The database is specified by a single character and defined using the
  1765. X+ .q K
  1766. X+ option as in
  1767. X+ .(b
  1768. X+ OKP/usr/lib/mail/pathtable
  1769. X+ .)b
  1770. X+ which defines database
  1771. X+ .b P
  1772. X+ to be associated with the dbm files /usr/lib/mail/pathtable.{dir,pag}.
  1773. X+ An expression like
  1774. X+ .q "$(P sun $@ soren $: backbone!sun!soren $)"
  1775. X+ would look for the string
  1776. X+ .q sun
  1777. X+ in the
  1778. X+ .q P
  1779. X+ database and sprintf
  1780. X+ .q soren
  1781. X+ through the result, or substitute
  1782. X+ .q backbone!sun!soren
  1783. X+ if the key could not be found.
  1784. X+ If no 
  1785. X+ .i default
  1786. X+ argument is supplied and the key could not be found, the whole
  1787. X+ expression is replaced with the key.
  1788. X+ .pp
  1789. X  The
  1790. X  .b $> \c
  1791. X  .i n
  1792. X***************
  1793. X*** 2191,2197 ****
  1794. X  then becomes
  1795. X  the substitution for this rule.
  1796. X  .pp
  1797. X! The
  1798. X  .b $#
  1799. X  syntax should
  1800. X  .i only
  1801. X--- 2277,2283 ----
  1802. X  then becomes
  1803. X  the substitution for this rule.
  1804. X  .pp
  1805. X! In most cases, the
  1806. X  .b $#
  1807. X  syntax should
  1808. X  .i only
  1809. X***************
  1810. X*** 2236,2252 ****
  1811. X  .b $@
  1812. X  and
  1813. X  .b $:
  1814. X! prefixes may precede a
  1815. X  .b $>
  1816. X! spec;
  1817. X  for example:
  1818. X  .(b
  1819. X  .ta 8n
  1820. X! R$+    $:$>7$1
  1821. X  .)b
  1822. X  matches anything,
  1823. X! passes that to ruleset seven,
  1824. X! and continues;
  1825. X  the
  1826. X  .b $:
  1827. X  is necessary to avoid an infinite loop.
  1828. X--- 2322,2338 ----
  1829. X  .b $@
  1830. X  and
  1831. X  .b $:
  1832. X! prefixes may precede
  1833. X  .b $>
  1834. X! specs;
  1835. X  for example:
  1836. X  .(b
  1837. X  .ta 8n
  1838. X! R$+    $:$>7$>8$1
  1839. X  .)b
  1840. X  matches anything,
  1841. X! passes that to ruleset eight and the result of that to ruleset seven,
  1842. X! and finally continues;
  1843. X  the
  1844. X  .b $:
  1845. X  is necessary to avoid an infinite loop.
  1846. X***************
  1847. X*** 2854,2859 ****
  1848. X--- 2940,2946 ----
  1849. X  Other flags are described
  1850. X  in Appendix C.
  1851. X  .pp
  1852. X+ .pp
  1853. X  The S and R fields in the mailer description
  1854. X  are per-mailer rewriting sets
  1855. X  to be applied to sender and recipient addresses
  1856. X***************
  1857. X*** 2884,2889 ****
  1858. X--- 2971,2983 ----
  1859. X  These sets can also be used
  1860. X  to do special purpose output rewriting
  1861. X  in cooperation with ruleset four.
  1862. X+ If required, the R and S rulesets may be specified independently for envelop
  1863. e
  1864. X+ and header addresses by separating them with a slash.  E.g.,
  1865. X+ .q R=13/14
  1866. X+ means that envelope recipient addresses should be sent through ruleset 13
  1867. X+ while those in the header should be passed to ruleset 14. 
  1868. X+ You can disable any mailer specific rewriting by specifying the ruleset as
  1869. X+ zero or by leaving it blank.
  1870. X  .pp
  1871. X  The E field defines the string to use
  1872. X  as an end-of-line indication.
  1873. X***************
  1874. X*** 3026,3031 ****
  1875. X--- 3120,3126 ----
  1876. X  i    Initialize the alias database
  1877. X  p    Print the mail queue
  1878. X  z    Freeze the configuration file
  1879. X+ b    Run in Batched SMTP mode
  1880. X  .)b
  1881. X  The special processing for the
  1882. X  ARPANET
  1883. X***************
  1884. X*** 3050,3055 ****
  1885. X--- 3145,3155 ----
  1886. X  .i Sendmail
  1887. X  runs as the invoking user (rather than root)
  1888. X  when this flag is specified.
  1889. X+ .ip \-Z\fIfile\fP
  1890. X+ Use a different frozen configuration file.
  1891. X+ .i Sendmail
  1892. X+ runs as the invoking user (rather than root)
  1893. X+ when this flag is specified.
  1894. X  .ip \-d\fIlevel\fP
  1895. X  Set debugging level.
  1896. X  .ip \-o\fIx\|value\fP
  1897. X***************
  1898. X*** 3166,3171 ****
  1899. X--- 3266,3285 ----
  1900. X  for SMTP.
  1901. X  .ip i
  1902. X  Ignore dots in incoming messages.
  1903. X+ .ip K\fIxfile\fP
  1904. X+ Declare the 
  1905. X+ keyed database
  1906. X+ .i x
  1907. X+ to be associated with the 
  1908. X+ .i dbm \|(3)
  1909. X+ file
  1910. X+ .i file.
  1911. X+ (\fIX\fP is a single letter.)
  1912. X+ The database
  1913. X+ .q @
  1914. X+ is always bound to the 
  1915. X+ .i aliases
  1916. X+ database.
  1917. X  .ip L\fIn\fP
  1918. X  Set the default log level to
  1919. X  .i n .
  1920. X***************
  1921. X*** 3406,3415 ****
  1922. X  will not terminate the message prematurely.
  1923. X  .ip L
  1924. X  Limit the line lengths as specified in RFC821.
  1925. X! .ip P
  1926. X  Use the return-path in the SMTP
  1927. X  .q "MAIL FROM:"
  1928. X! command
  1929. X  rather than just the return address;
  1930. X  although this is required in RFC821,
  1931. X  many hosts do not process return paths properly.
  1932. X--- 3520,3531 ----
  1933. X  will not terminate the message prematurely.
  1934. X  .ip L
  1935. X  Limit the line lengths as specified in RFC821.
  1936. X! .ip p
  1937. X  Use the return-path in the SMTP
  1938. X  .q "MAIL FROM:"
  1939. X! command or in the UUCP
  1940. X! .q From_
  1941. X! line
  1942. X  rather than just the return address;
  1943. X  although this is required in RFC821,
  1944. X  many hosts do not process return paths properly.
  1945. X***************
  1946. X*** 3450,3455 ****
  1947. X--- 3566,3587 ----
  1948. X  Escape lines beginning with
  1949. X  .q From
  1950. X  in the message with a `>' sign.
  1951. X+ .ip V
  1952. X+ Make all header addresses UUCP !-relative with respect to ourselves
  1953. X+ and the recipient host.  This means that all header lines will have
  1954. X+ working paths relative to the recipient host.  Routes through the
  1955. X+ remote host, i.e. addresses that begin with
  1956. X+ .q remote!
  1957. X+ are stripped of that part unless the ultimate
  1958. X+ recipient resides on the remote host (i.e., there are no more bangs in
  1959. X+ the address).  All other addresses are prefixed with
  1960. X+ .q ourhost!
  1961. X+ if not already there.
  1962. X+ .i Ourhost
  1963. X+ is fetched from the 
  1964. X+ .b $k
  1965. X+ macro, which defaults to your hostname as supplied by
  1966. X+ .i gethostname \|(3).
  1967. X  .+c "OTHER CONFIGURATION"
  1968. X  .rm $0
  1969. X  .nr ii 1i
  1970. X***************
  1971. X*** 3603,3608 ****
  1972. X--- 3735,3749 ----
  1973. X  that allows multiple databases will be used.
  1974. X  .q DBM
  1975. X  must also be set.
  1976. X+ .ip MDBM
  1977. X+ If set, Maryland's
  1978. X+ .i mdbm \|(3)
  1979. X+ package should be substituted for the
  1980. X+ .i ndbm \|(3)
  1981. X+ routines.  This should only be used if you want the keyed database
  1982. X+ functionality (\fB$(x key$)\fP), but don't have
  1983. X+ .i ndbm \|(3)
  1984. X+ available.
  1985. X  .ip DEBUG
  1986. X  If set, debugging information is compiled in.
  1987. X  To actually get the debugging output,
  1988. X***************
  1989. X*** 3929,3935 ****
  1990. X  .ip "/usr/lib/sendmail"
  1991. X  The binary of
  1992. X  .i sendmail .
  1993. X! .ip /usr/bin/newaliases
  1994. X  A link to /usr/lib/sendmail;
  1995. X  causes the alias database to be rebuilt.
  1996. X  Running this program is completely equivalent to giving
  1997. X--- 4070,4076 ----
  1998. X  .ip "/usr/lib/sendmail"
  1999. X  The binary of
  2000. X  .i sendmail .
  2001. X! .ip /usr/ucb/newaliases
  2002. X  A link to /usr/lib/sendmail;
  2003. X  causes the alias database to be rebuilt.
  2004. X  Running this program is completely equivalent to giving
  2005. X***************
  2006. X*** 3937,3948 ****
  2007. X  the
  2008. X  .b \-bi
  2009. X  flag.
  2010. X! .ip /usr/bin/mailq
  2011. X  Prints a listing of the mail queue.
  2012. X  This program is equivalent to using the
  2013. X  .b \-bp
  2014. X  flag to
  2015. X  .i sendmail .
  2016. X  .ip /usr/lib/sendmail.cf
  2017. X  The configuration file,
  2018. X  in textual form.
  2019. X--- 4078,4095 ----
  2020. X  the
  2021. X  .b \-bi
  2022. X  flag.
  2023. X! .ip /usr/ucb/mailq
  2024. X  Prints a listing of the mail queue.
  2025. X  This program is equivalent to using the
  2026. X  .b \-bp
  2027. X  flag to
  2028. X  .i sendmail .
  2029. X+ .ip /usr/ucb/bsmtp
  2030. X+ A link to /usr/lib/sendmail; starts up
  2031. X+ .i sendmail
  2032. X+ in Batched SMTP mode (as if supplied with the
  2033. X+ .b \-bb
  2034. X+ option).
  2035. X  .ip /usr/lib/sendmail.cf
  2036. X  The configuration file,
  2037. X  in textual form.
  2038. END_OF_ida/patches/op.me.diff
  2039. if test 12488 -ne `wc -c <ida/patches/op.me.diff`; then
  2040.     echo shar: \"ida/patches/op.me.diff\" unpacked with wrong size!
  2041. fi
  2042. # end of overwriting check
  2043. fi
  2044. if test -f ida/patches/sendmail.h.diff -a "${1}" != "-c" ; then 
  2045.   echo shar: Will not over-write existing file \"ida/patches/sendmail.h.diff\"
  2046. else
  2047. echo shar: Extracting \"ida/patches/sendmail.h.diff\" \(5801 characters\)
  2048. sed "s/^X//" >ida/patches/sendmail.h.diff <<'END_OF_ida/patches/sendmail.h.diff
  2049. '
  2050. X*** sendmail.h.orig    Fri Mar 13 18:51:00 1987
  2051. X--- sendmail.h    Wed May 27 01:58:25 1987
  2052. X***************
  2053. X*** 32,38 ****
  2054. X  # include "useful.h"
  2055. X  
  2056. X  # ifdef LOG
  2057. X! # include <sys/syslog.h>
  2058. X  # endif LOG
  2059. X  
  2060. X  # ifdef DAEMON
  2061. X--- 32,42 ----
  2062. X  # include "useful.h"
  2063. X  
  2064. X  # ifdef LOG
  2065. X! #  ifdef vax
  2066. X! #   include <sys/syslog.h>
  2067. X! #  else vax
  2068. X! #   include <syslog.h>
  2069. X! #  endif vax
  2070. X  # endif LOG
  2071. X  
  2072. X  # ifdef DAEMON
  2073. X***************
  2074. X*** 121,128 ****
  2075. X      BITMAP    m_flags;    /* status flags, see below */
  2076. X      short    m_mno;        /* mailer number internally */
  2077. X      char    **m_argv;    /* template argument vector */
  2078. X!     short    m_s_rwset;    /* rewriting set for sender addresses */
  2079. X!     short    m_r_rwset;    /* rewriting set for recipient addresses */
  2080. X      char    *m_eol;        /* end of line string */
  2081. X      long    m_maxsize;    /* size limit on message to this mailer */
  2082. X  };
  2083. X--- 125,134 ----
  2084. X      BITMAP    m_flags;    /* status flags, see below */
  2085. X      short    m_mno;        /* mailer number internally */
  2086. X      char    **m_argv;    /* template argument vector */
  2087. X!     short    m_se_rwset;    /* rewriting ruleset for envelope senders */
  2088. X!     short    m_sh_rwset;    /* rewriting ruleset for header senders */
  2089. X!     short    m_re_rwset;    /* rewriting ruleset for envelope recipients */
  2090. X!     short    m_rh_rwset;    /* rewriting ruleset for header recipient */
  2091. X      char    *m_eol;        /* end of line string */
  2092. X      long    m_maxsize;    /* size limit on message to this mailer */
  2093. X  };
  2094. X***************
  2095. X*** 130,135 ****
  2096. X--- 136,142 ----
  2097. X  typedef struct mailer    MAILER;
  2098. X  
  2099. X  /* bits for m_flags */
  2100. X+ # define M_BSMTP    'B'    /* don't wait for SMTP responses */
  2101. X  # define M_CANONICAL    'C'    /* make addresses canonical "u@dom" */
  2102. X  # define M_EXPENSIVE    'e'    /* it costs to use this mailer.... */
  2103. X  # define M_ESCFROM    'E'    /* escape From lines to >From */
  2104. X***************
  2105. X*** 147,152 ****
  2106. X--- 154,160 ----
  2107. X  # define M_RESTR    'S'    /* must be daemon to execute */
  2108. X  # define M_USR_UPPER    'u'    /* preserve user case distinction */
  2109. X  # define M_UGLYUUCP    'U'    /* this wants an ugly UUCP from line */
  2110. X+ # define M_RELATIVIZE    'V'    /* !-relativize all addresses */
  2111. X  # define M_XDOT        'X'    /* use hidden-dot algorithm */
  2112. X  
  2113. X  EXTERN MAILER    *Mailer[MAXMAILERS+1];
  2114. X***************
  2115. X*** 317,326 ****
  2116. X  # define CONDELSE    '\033'    /* conditional else */
  2117. X  # define CONDFI        '\034'    /* conditional fi */
  2118. X  
  2119. X! /* bracket characters for host name lookup */
  2120. X  # define HOSTBEGIN    '\035'    /* hostname lookup begin */
  2121. X  # define HOSTEND    '\036'    /* hostname lookup end */
  2122. X  
  2123. X  /* \001 is also reserved as the macro expansion character */
  2124. X   /*
  2125. X  **  Information about hosts that we have looked up recently.
  2126. X--- 325,338 ----
  2127. X  # define CONDELSE    '\033'    /* conditional else */
  2128. X  # define CONDFI        '\034'    /* conditional fi */
  2129. X  
  2130. X! /* bracket characters for host name & database keyed lookup */
  2131. X  # define HOSTBEGIN    '\035'    /* hostname lookup begin */
  2132. X  # define HOSTEND    '\036'    /* hostname lookup end */
  2133. X+ # define KEYBEGIN    '\037'    /* keyed lookup begin */
  2134. X+ # define KEYEND        '\017'    /* keyed lookup end */
  2135. X  
  2136. X+ /*
  2137. X+ 
  2138. X  /* \001 is also reserved as the macro expansion character */
  2139. X   /*
  2140. X  **  Information about hosts that we have looked up recently.
  2141. X***************
  2142. X*** 379,384 ****
  2143. X--- 391,401 ----
  2144. X  # define ST_ALIAS    4    /* an alias */
  2145. X  # define ST_HOST    5    /* host information */
  2146. X  
  2147. X+ /* s_host is defined is /usr/include/whatever on sun's */
  2148. X+ # ifdef s_host
  2149. X+ #  undef s_host
  2150. X+ # endif
  2151. X+ 
  2152. X  # define s_class    s_value.sv_class
  2153. X  # define s_address    s_value.sv_addr
  2154. X  # define s_mailer    s_value.sv_mailer
  2155. X***************
  2156. X*** 438,443 ****
  2157. X--- 455,461 ----
  2158. X  #define MD_INITALIAS    'i'        /* initialize alias database */
  2159. X  #define MD_PRINT    'p'        /* print the queue */
  2160. X  #define MD_FREEZE    'z'        /* freeze the configuration file */
  2161. X+ #define MD_BSMTP    'b'        /* batched smtp mode */
  2162. X  
  2163. X  
  2164. X  EXTERN char    SendMode;    /* send mode, see below */
  2165. X***************
  2166. X*** 465,470 ****
  2167. X--- 483,525 ----
  2168. X   */
  2169. X  #define    MAX_ERRNO    100
  2170. X   /*
  2171. X+ **  Database ([n]dbm) definitions.
  2172. X+ */
  2173. X+ 
  2174. X+ #ifdef DBM
  2175. X+ 
  2176. X+ typedef struct {
  2177. X+     char    *dptr;
  2178. X+     int    dsize;
  2179. X+ } DATUM;
  2180. X+ 
  2181. X+ # define DB_DIREXT    ".dir"
  2182. X+ # define DB_PAGEXT    ".pag"
  2183. X+ 
  2184. X+ # ifdef NDBM
  2185. X+ 
  2186. X+ #  undef DBM            /* while including ndbm.h */
  2187. X+ #  include <ndbm.h>        /* DBM is typedef'ed here */
  2188. X+ typedef DBM DBMFILE;        /* move typedef to DBMFILE */
  2189. X+ #  define DBM            /* and restore DBM definition */
  2190. X+ #  include <fcntl.h>        /* needed for dbm_open */
  2191. X+ 
  2192. X+ #  define DATUM datum        /* use the definition in ndbm.h */
  2193. X+ 
  2194. X+ struct dbm_table {
  2195. X+   char *name;            /* database file name */
  2196. X+   DBMFILE *dbm;        /* dbm file descriptor */
  2197. X+ };
  2198. X+ 
  2199. X+ #  define DB_NOSUCHFILE    ((DBMFILE *)  0) /* file could not be found */
  2200. X+ #  define DB_NOTYETOPEN    ((DBMFILE *) -1) /* file has not yet been opene
  2201. d */
  2202. X+ 
  2203. X+ #  define DB_ALIAS    '@'    /* "name" of aliases database */
  2204. X+ #  define AliasDbm    DbmTab[DB_ALIAS]
  2205. X+ 
  2206. X+ # endif NDBM
  2207. X+ #endif DBM
  2208. X+  /*
  2209. X  **  Global variables.
  2210. X  */
  2211. X  
  2212. X***************
  2213. X*** 525,534 ****
  2214. X--- 580,593 ----
  2215. X  EXTERN int    WkClassFact;    /* multiplier for message class -> priority */
  2216. X  EXTERN int    WkRecipFact;    /* multiplier for # of recipients -> priority *
  2217. /
  2218. X  EXTERN int    WkTimeFact;    /* priority offset each time this job is run */
  2219. X+ EXTERN bool    SplitRewriting;    /* use split envelope/header rewriting */
  2220. X  EXTERN int    CheckPointLimit;    /* deliveries before checkpointing */
  2221. X  EXTERN char    *PostMasterCopy;    /* address to get errs cc's */
  2222. X  EXTERN char    *TrustedUsers[MAXTRUST+1];    /* list of trusted users */
  2223. X  EXTERN char    *UserEnviron[MAXUSERENVIRON+1];    /* saved user environment */
  2224. X+ #ifdef NDBM
  2225. X+ EXTERN struct dbm_table DbmTab[128];    /* keyed database table */
  2226. X+ #endif NDBM
  2227. X   /*
  2228. X  **  Trace information
  2229. X  */
  2230. X***************
  2231. X*** 572,574 ****
  2232. X--- 631,645 ----
  2233. X  extern char    *sfgets();
  2234. X  extern char    *queuename();
  2235. X  extern time_t    curtime();
  2236. X+ 
  2237. X+ /*
  2238. X+ **  Metamacro definitions.
  2239. X+ */
  2240. X+ 
  2241. X+ struct metamac
  2242. X+ {
  2243. X+     char    metaname;
  2244. X+     char    metaval;
  2245. X+ };
  2246. X+ 
  2247. X+ extern struct metamac    MetaMacros[];
  2248. END_OF_ida/patches/sendmail.h.diff
  2249. if test 5801 -ne `wc -c <ida/patches/sendmail.h.diff`; then
  2250.     echo shar: \"ida/patches/sendmail.h.diff\" unpacked with wrong size!
  2251. fi
  2252. # end of overwriting check
  2253. fi
  2254. echo shar: End of archive 3 \(of 7\).
  2255. cp /dev/null ark3isdone
  2256. MISSING=""
  2257. for I in 1 2 3 4 5 6 7 ; do
  2258.     if test ! -f ark${I}isdone ; then
  2259.     MISSING="${MISSING} ${I}"
  2260.     fi
  2261. done
  2262. if test "${MISSING}" = "" ; then
  2263.     echo You have unpacked all 7 archives.
  2264.     echo "See ida/README and ida/INSTALL for further instructions."
  2265.     rm -f ark[1-9]isdone
  2266. else
  2267.     echo You still need to unpack the following archives:
  2268.     echo "        " ${MISSING}
  2269. fi
  2270. ##  End of shell archive.
  2271. exit 0
  2272.