home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume16 / ida2 / part03 < prev    next >
Text File  |  1988-11-13  |  57KB  |  2,278 lines

  1. Subject:  v16i075:  IDA Sendmail kit, Part03/08
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Lennart Lovstrand <lovstran@arisia.xerox.com>
  7. Posting-number: Volume 16, Issue 75
  8. Archive-name: ida2/part03
  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 3 (of 8)."
  17. # Contents:  ida/aux/rmail.c ida/aux/xalparse.c
  18. #   ida/patches/alias.c.diff ida/patches/deliver.c.diff
  19. #   ida/patches/main.c.diff ida/patches/recipient.c.diff
  20. #   ida/patches/sendmail.h.diff
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f ida/aux/rmail.c -a "${1}" != "-c" ; then 
  23.   echo shar: Will not over-write existing file \"ida/aux/rmail.c\"
  24. else
  25. echo shar: Extracting \"ida/aux/rmail.c\" \(7381 characters\)
  26. sed "s/^X//" >ida/aux/rmail.c <<'END_OF_ida/aux/rmail.c'
  27. X/*
  28. X**  RMAIL -- Receive remote mail requests.
  29. X**  Copyright (c) 1987 Lennart Lovstrand
  30. X**  CIS Dept, Univ of Linkoping, Sweden
  31. X**
  32. X**  Use it, abuse it, but don't sell it.
  33. X**
  34. X**  Version 2.6 of 5-May-87.
  35. X**
  36. X**  This time logging selected header lines + more liberal parsing of
  37. X**  the initial from-line but not yet with accounting & like; 14-Apr-85.
  38. X**  Dbm lookup of UUCP domain names added 5-May-87.
  39. X**
  40. X**  The following definitions below are optional:
  41. X**    LOGFILE -- If defined, should be the name of a file in which to
  42. X**        log the raw addresses of each message.
  43. X**    DEFAULT_HOST -- If no host is found in the envelope recipients,
  44. X**        this host is assumed [defaults to your local host].
  45. X**    DEFAULT_DOMAIN -- If the sending host is unqualifed, add this
  46. X**        domain to the host for use in the Received: line.
  47. X**    DOMAINTABLE -- If defined, should point to your local domain
  48. X**        lookup database.  It is used for the same purpose as
  49. X**        the DEFAULT_DOMAIN.
  50. X*/
  51. X
  52. X#include <stdio.h>
  53. X#include <fcntl.h>
  54. X#include <ctype.h>
  55. X#include <sys/time.h>
  56. X#include <strings.h>
  57. X#ifdef MDBM
  58. X# include "mdbm_compat.h"
  59. X#else MDBM
  60. X# include <ndbm.h>
  61. X# define DBMFILE DBM
  62. X#endif MDBM
  63. X#include "useful.h"
  64. X
  65. X#define STRSIZ        1024
  66. X#define COMMA        ','
  67. X/* #define LOGFILE        "/usr/lib/uucp/rmail.log" */
  68. X#define SENDMAIL    "/usr/lib/sendmail"
  69. X#define NETCHRS        "%@!:"
  70. X/* #define DEFAULT_HOST    "liuida" */
  71. X#define DEFAULT_DOMAIN    "UUCP"
  72. X/* #define DOMAINTABLE    "/usr/lib/mail/domaintable" */
  73. X
  74. X#define H_CC        "cc"
  75. X#define H_FROM        "from"
  76. X#define H_MESSAGE_ID    "message_id"
  77. X#define H_RETURN_PATH    "return-path"
  78. X#define H_TO        "to"
  79. X#define H_VIA        "via"
  80. X
  81. X#define MAKELC(C)    (isupper(C) ? tolower(C) : C)
  82. X#define EATSPACE(P)    while (*P == ' ') P++
  83. X
  84. XFILE *popen();
  85. Xchar *Progname;
  86. Xint Debug = FALSE;
  87. XDBMFILE    *Dbm;
  88. X
  89. Xmain(argc, argv)
  90. X    int argc;
  91. X    char **argv;
  92. X{
  93. X    char from_[STRSIZ], cmd[STRSIZ], s_mac[STRSIZ], f_opt[STRSIZ], s[STRSIZ];
  94. X    char *v_opt = "";
  95. X    char *p, *user, *host, *domain = "";
  96. X    char *acctsys = (char *) getenv("ACCTSYS");
  97. X    FILE *outf;
  98. X#ifdef LOGFILE
  99. X    FILE *logf = NULL;
  100. X#endif LOGFILE
  101. X#ifdef DOMAINTABLE
  102. X    datum key, val;
  103. X#endif DOMAINTABLE
  104. X    int insideheader, printedlast = FALSE;
  105. X    int c, errflg = FALSE;
  106. X    
  107. X    extern int optind;
  108. X    extern char *optarg;
  109. X
  110. X#ifdef DEFAULT_DOMAIN
  111. X    domain = DEFAULT_DOMAIN;
  112. X#endif DEFAULT_DOMAIN
  113. X
  114. X    Progname = argv[0];
  115. X    while ((c = getopt(argc, argv, "D:dv")) != EOF) {
  116. X    switch (c) {
  117. X      case 'D':
  118. X        domain = optarg;
  119. X        break;
  120. X      case 'd':
  121. X        Debug++;
  122. X        break;
  123. X      case 'v':
  124. X        v_opt = " -v";
  125. X        break;
  126. X      default:
  127. X        errflg = TRUE;
  128. X        break;
  129. X    }
  130. X    }
  131. X    if (errflg || optind >= argc) {
  132. X    (void) fprintf(stderr, "usage: %s [-Ddomain] user ...\n", Progname);
  133. X    exit(2);
  134. X    }
  135. X
  136. X    /*
  137. X     * set our real uid to root as well as our effective uid so
  138. X     * make sendmail accept the -oM options
  139. X     */
  140. X    (void) setreuid(0, 0);
  141. X
  142. X#ifdef DOMAINTABLE
  143. X    Dbm = dbm_open(DOMAINTABLE, O_RDONLY);
  144. X    if (Dbm == NULL)
  145. X    perror(DOMAINTABLE);
  146. X#endif DOMAINTABLE
  147. X
  148. X#ifdef LOGFILE
  149. X    if ((logf = fopen(Debug ? "/dev/tty" : LOGFILE, "a")) != NULL) {
  150. X    struct timeval t;
  151. X    int a;
  152. X
  153. X    (void) gettimeofday(&t, (struct timezone *) NULL);
  154. X    (void) fprintf(logf, "\n[%.12s] ", ctime(&t.tv_sec) + 4);
  155. X    for (a = 0; a < argc; a++)
  156. X        (void) fprintf(logf, " '%s'", argv[a]);
  157. X    (void) putc('\n', logf);
  158. X    } else
  159. X    (void) fprintf(stderr, "%s: couldn't open log file \"%s\"\n",
  160. X               Progname, LOGFILE);
  161. X#endif LOGFILE
  162. X
  163. X    user = NULL;
  164. X    host = NULL;
  165. X    (void) gets(from_);
  166. X
  167. X#ifdef LOGFILE
  168. X    if (logf != NULL)
  169. X    (void) fprintf(logf, "%s\n", from_);
  170. X#endif LOGFILE
  171. X
  172. X    if (strncmp(from_, "From ", 5) == 0 || strncmp(from_, ">From ", 6) == 0) {
  173. X    user = index(from_, ' ') + 1;
  174. X    EATSPACE(user);
  175. X    if ((p = index(user, ' ')) != NULL) {
  176. X        *p = '\0';
  177. X        while ((p = index(p + 1, 'r')) != NULL) {
  178. X        if (strncmp(p, "remote from ", 12) == 0) {
  179. X            host = p + 12;
  180. X            EATSPACE(host);
  181. X            if ((p = index(host, '\n')) != NULL)
  182. X            *p = '\0';
  183. X            if (strcmp(host, "somewhere") == 0)
  184. X            host = NULL;
  185. X            break;
  186. X        }
  187. X        }
  188. X    }
  189. X    }
  190. X
  191. X    if (acctsys == NULL)
  192. X    acctsys = host;
  193. X
  194. X    if (host)
  195. X    (void) sprintf(f_opt, " -f%s!%s", host, user);
  196. X    else if (user)
  197. X    (void) sprintf(f_opt, " -f%s", user);
  198. X    else
  199. X    *f_opt = '\0';
  200. X
  201. X    if (acctsys) {
  202. X#ifdef DOMAINTABLE
  203. X    if (Dbm != NULL) {
  204. X        key.dptr = acctsys;
  205. X        key.dsize = strlen(acctsys) + 1;
  206. X        val = dbm_fetch(Dbm, key);
  207. X        if (val.dptr != NULL)
  208. X        acctsys = val.dptr;
  209. X    }
  210. X#endif DOMAINTABLE
  211. X    if (index(acctsys, '.') == NULL && *domain != '\0')
  212. X        (void) sprintf(s_mac, " -oMs%s.%s", acctsys, domain);
  213. X    else
  214. X        (void) sprintf(s_mac, " -oMs%s", acctsys);
  215. X    } else
  216. X    *s_mac = '\0';
  217. X
  218. X    (void) sprintf(cmd, "exec %s -ee -i -oMrUUCP%s%s%s",
  219. X           SENDMAIL, s_mac, f_opt, v_opt);
  220. X
  221. X    for (; optind < argc; optind++) {
  222. X    (void) strcat(cmd, " '");
  223. X#ifdef DEFAULT_HOST
  224. X    if (anyin(argv[optind], NETCHRS) == NULL) {
  225. X        (void) strcat(cmd, DEFAULT_HOST);
  226. X        (void) strcat(cmd, "!");
  227. X    }
  228. X#endif DEFAULT_HOST
  229. X    if (*argv[optind] == '(')
  230. X        (void) strncat(cmd, &argv[optind][1], strlen(argv[optind])-2);
  231. X    else
  232. X        (void) strcat(cmd, argv[optind]);
  233. X    (void) strcat(cmd, "'");
  234. X    }
  235. X
  236. X#ifdef LOGFILE
  237. X    if (logf != NULL)
  238. X    (void) fprintf(logf, "%s\n", cmd);
  239. X#endif LOGFILE
  240. X    if (Debug)
  241. X    outf = stdout;
  242. X    else {
  243. X    outf = popen(cmd, "w");
  244. X    if (outf == NULL) {
  245. X        (void) fprintf(stderr, "%s: could not open pipe thru %s\n",
  246. X               Progname, cmd);
  247. X        exit(1);
  248. X    }
  249. X    }
  250. X
  251. X    insideheader = TRUE;
  252. X    while (gets(s)) {
  253. X    if (*s == NULL)
  254. X        insideheader = FALSE;
  255. X
  256. X#ifdef LOGFILE
  257. X    if (logf != NULL && insideheader &&
  258. X        ((printedlast && isspace(*s)) ||
  259. X         iskey(H_FROM, s) || iskey(H_TO, s) || iskey(H_CC, s) ||
  260. X         iskey(H_RETURN_PATH, s) || iskey(H_MESSAGE_ID, s))) {
  261. X         (void) fprintf(logf, "\t%s\n", s);
  262. X         printedlast = TRUE;
  263. X         } else
  264. X         printedlast = FALSE;
  265. X#endif LOGFILE
  266. X    (void) fprintf(outf, "%s\n", s);
  267. X    }
  268. X
  269. X#ifdef LOGFILE
  270. X    if (logf != NULL)
  271. X    (void) fclose(logf);
  272. X#endif LOGFILE
  273. X
  274. X    if (!Debug)
  275. X    exit((pclose(outf) >> 8) & 0377);
  276. X}
  277. X
  278. X/*
  279. X**    ANYIN -- Does the target string contain chars from the pattern string?
  280. X*/
  281. Xanyin(t, p)
  282. X    char *t;
  283. X    register char *p;
  284. X{
  285. X    for (; *p != '\0'; p++)
  286. X    if (index(t, *p) != NULL)
  287. X        return TRUE;
  288. X    return FALSE;
  289. X}
  290. X
  291. X/*
  292. X**    ISKEY -- Checks if the line is prefixed by the supplied keyword
  293. X**    (immediately followed by a colon)
  294. X*/
  295. Xiskey(key, line)
  296. X    char *key, *line;
  297. X{
  298. X    for (; *key != NULL && *line != NULL; key++, line++)
  299. X    if (MAKELC(*key) != MAKELC(*line))
  300. X        break;
  301. X
  302. X    return *key == NULL && *line == ':';
  303. X}
  304. X
  305. X/*
  306. X**    EXTRACT_ADDRESS -- Finds and extracts the machine address part
  307. X**    of an address field.
  308. X*/
  309. X
  310. Xchar *
  311. Xextract_address(field, address)
  312. X    char *field, *address;
  313. X{
  314. X    char *address_start = address;
  315. X
  316. X    while(*field && *field != COMMA && *field != '>')
  317. X    switch (*field) {
  318. X      case '<':
  319. X        return extract_address(field, address_start);
  320. X      case '(':
  321. X        while (*field && *field != ')');
  322. X        field++;
  323. X        break;
  324. X      case '"':
  325. X        do
  326. X        *address++ = *field++;
  327. X        while (*field && *field != '"');
  328. X        if (*field)
  329. X        *address++ = *field++;
  330. X        break;
  331. X      case ' ':
  332. X        *address++ = *field++;
  333. X        EATSPACE(field);
  334. X        break;
  335. X      case '\\':
  336. X        *address++ = *field++;
  337. X        /* fall through */
  338. X      default:
  339. X        *address++ = *field++;
  340. X    }
  341. X    *address = NULL;
  342. X    if (*field)
  343. X    return index(field, COMMA)+1;
  344. X    else
  345. X    return field;
  346. X}
  347. X
  348. X
  349. END_OF_ida/aux/rmail.c
  350. if test 7381 -ne `wc -c <ida/aux/rmail.c`; then
  351.     echo shar: \"ida/aux/rmail.c\" unpacked with wrong size!
  352. fi
  353. # end of overwriting check
  354. fi
  355. if test -f ida/aux/xalparse.c -a "${1}" != "-c" ; then 
  356.   echo shar: Will not over-write existing file \"ida/aux/xalparse.c\"
  357. else
  358. echo shar: Extracting \"ida/aux/xalparse.c\" \(6648 characters\)
  359. sed "s/^X//" >ida/aux/xalparse.c <<'END_OF_ida/aux/xalparse.c'
  360. X/*
  361. X**  XALPARSE -- Xaliases file parser.
  362. X**  Copyright (c) 1987 Lennart Lovstrand
  363. X**  CIS Dept, Univ of Linkoping, Sweden
  364. X**
  365. X**  Use it, abuse it, but don't sell it.
  366. X*/
  367. X
  368. X#include "useful.h"
  369. X#include <stdio.h>
  370. X#include <ctype.h>
  371. X
  372. X#ifndef lint
  373. Xstatic char    SccsId[] = "@(#)xalparse.c 1.1 (lel@ida.liu.se) 4/12/87";
  374. X#endif !lint
  375. X
  376. Xstruct alias {
  377. X  bool a_in, a_out;
  378. X  char *a_name;
  379. X};
  380. X
  381. X#define ANULL    (struct alias *) NULL
  382. X
  383. X/*
  384. X**  XPARSE -- Parse an xaliases file, producing aliases + generics files.
  385. X**
  386. X**    This program parses a file in ``xaliases'' format, producing
  387. X**    a standard aliases file + a generics file.  The xaliases input
  388. X**    file has entry of the following format:
  389. X**        generic_list: mbox_list
  390. X**    where elements in both lists are separated by commas.  In
  391. X**    addition, each element in the mbox_list may be prefixed with
  392. X**    either or both of the ``redirection characters,'' "<" and ">".
  393. X
  394. X**    In its simplest form, the generic_list has just one member and
  395. X**    the mbox_list uses no redirection characters.  This
  396. X**    corresponds exactly to the standard aliases format and
  397. X**    function.
  398. X
  399. X**    The first extention is made by allowing more than one entry on
  400. X**    the left hand side, thus making "a, b: c" as shorthand for the
  401. X**    two entries "a: c" and "b: c".
  402. X
  403. X**    The second extension is made by adding the previously
  404. X**    mentioned redirection characters to the addresses on the right
  405. X**    hand side.  These control in what direction the aliases should
  406. X**    be used.
  407. X**
  408. X**    etc.
  409. X*/
  410. X
  411. Xint iflag = FALSE, Iflag = FALSE, Oflag = FALSE;
  412. X
  413. Xmain(argc, argv)
  414. X     int argc;
  415. X     char **argv;
  416. X{
  417. X  extern int optind;
  418. X  extern char *optarg;
  419. X  char c;
  420. X  FILE *xaliases, *aliases, *generics;
  421. X
  422. X
  423. X  if (argc != 4) {
  424. X    fprintf(stderr, "usage: %s xaliases aliases generics\n", argv[0]);
  425. X    exit(1);
  426. X  }
  427. X
  428. X  if (strcmp(argv[1], "-") == 0)
  429. X    xaliases = stdin;
  430. X  else {
  431. X    xaliases = fopen(argv[1], "r");
  432. X    if (xaliases == NULL)
  433. X      perror(argv[1]), exit(2);
  434. X  }
  435. X  aliases = fopen(argv[2], "w");
  436. X  if (aliases == NULL)
  437. X    perror(argv[2]), exit(2);
  438. X  generics = fopen(argv[3], "w");
  439. X  if (generics == NULL)
  440. X    perror(argv[3]), exit(2);
  441. X  
  442. X  parsefile(xaliases, aliases, generics);
  443. X  exit(0);
  444. X}
  445. X
  446. Xparsefile(xaliases, aliases, generics)
  447. X     FILE *xaliases, *aliases, *generics;
  448. X{
  449. X  extern char *index();
  450. X  char line[BUFSIZ];
  451. X  struct alias *rhs[BUFSIZ], *lhs[BUFSIZ];
  452. X  struct alias **a, **r, **first;
  453. X
  454. X  while (readline(line, sizeof(line), xaliases) >= 0) {
  455. X    parseline(line, lhs, rhs);
  456. X
  457. X    for (first = rhs; *first != ANULL; first++)
  458. X      if ((*first)->a_in)
  459. X    break;
  460. X    if (*first != ANULL)
  461. X      for (a = lhs; *a != ANULL; a++) {
  462. X    fprintf(aliases, "%s:%s", (*a)->a_name, (*first)->a_name);
  463. X    for (r = first+1; *r != ANULL; r++)
  464. X      if ((*r)->a_in)
  465. X        fprintf(aliases, ",%s", (*r)->a_name);
  466. X    fprintf(aliases, "\n");
  467. X      }
  468. X
  469. X    for (first = rhs; *first != ANULL; first++)
  470. X      if ((*first)->a_out)
  471. X    break;
  472. X    if (*first != ANULL) {
  473. X      fprintf(generics, "%s\t%s", lhs[0]->a_name, (*first)->a_name);
  474. X      for (r = first+1; *r != ANULL; r++)
  475. X    if ((*r)->a_out)
  476. X      fprintf(generics, " %s", (*r)->a_name);
  477. X      fprintf(generics, "\n");
  478. X    }
  479. X
  480. X    freebufs(lhs, rhs);
  481. X  }
  482. X}
  483. X
  484. X/**
  485. X **    PEEKC -- Return the next char to be read.
  486. X **/
  487. X
  488. Xpeekc(stream)
  489. X     FILE *stream;
  490. X{
  491. X  int c;
  492. X
  493. X  c = getc(stream);
  494. X  if (c != EOF)
  495. X    ungetc(c, stream);
  496. X  return c;
  497. X}
  498. X
  499. X/**
  500. X **    READLINE -- Read a (logical) line and return the # of chars read
  501. X **/
  502. X
  503. Xreadline(buf, bufsiz, stream)
  504. X     char *buf;
  505. X     int bufsiz;
  506. X     FILE *stream;
  507. X{
  508. X  int len;
  509. X  char *sharp;
  510. X
  511. X  if (fgets(buf, bufsiz, stream) == NULL)
  512. X    return -1;
  513. X  buf[strlen(buf)-1] = '\0';
  514. X
  515. X  /*
  516. X  if ((sharp = index(buf, '#')) != NULL)
  517. X    *sharp = '\0';
  518. X  */
  519. X  if (buf[0] == '#')
  520. X    buf[0] = '\0';
  521. X
  522. X  len = strlen(buf);
  523. X  if (isspace(peekc(stream)))
  524. X    return len + readline(&buf[len], bufsiz-len, stream);
  525. X  else
  526. X    return len;
  527. X}
  528. X
  529. X/**
  530. X **    PARSETHING
  531. X **/
  532. X
  533. X
  534. X#define LHS    1
  535. X#define RHS    2
  536. X
  537. Xchar *
  538. Xparsething(line, thing, side)
  539. X     char *line;
  540. X     struct alias **thing;
  541. X     int side;
  542. X{
  543. X  register char *s, *d;
  544. X  register bool
  545. X    insideroute = FALSE,
  546. X    insidestring = FALSE,
  547. X    quotedchar = FALSE;
  548. X  bool i_mark, o_mark;
  549. X  char buf[BUFSIZ];
  550. X  extern char *malloc();
  551. X
  552. X  s = line;
  553. X  d = buf;
  554. X
  555. X  while (*s != '\0' && isspace(*s)) s++;
  556. X  if (side == RHS) {
  557. X    if (o_mark = (*s == '<')) s++;
  558. X    if (i_mark = (*s == '>')) s++;
  559. X    i_mark = i_mark || !o_mark;            /* default to '>' */
  560. X    while (*s != '\0' && isspace(*s)) s++;
  561. X  }
  562. X
  563. X  for (;*s != '\0'; s++) {
  564. X    /* exit if non-quoted comma (or colon & LHS) */
  565. X    if (!insidestring && !quotedchar && !insideroute &&
  566. X    *s == ',' || ((side == LHS) && *s == ':'))
  567. X      break;
  568. X
  569. X    /* copy if not unquoted whitespace */
  570. X    if (insidestring || quotedchar || !isspace(*s))
  571. X      *d++ = *s;
  572. X
  573. X    /* special quote character handling */
  574. X    if (quotedchar)
  575. X      quotedchar = FALSE;
  576. X    else {
  577. X      quotedchar = (*s == '\\');
  578. X      if (!insidestring)
  579. X    if (*s == '<')
  580. X      insideroute = TRUE;
  581. X    else if (*s == '>')
  582. X      insideroute = FALSE;
  583. X      if (*s == '"')
  584. X    insidestring = !insidestring;
  585. X    }
  586. X  }
  587. X  while (d > buf && isspace(d[-1])) d--;
  588. X  *d = '\0';
  589. X
  590. X  if (d == buf && *s == '\0') {
  591. X    *thing = ANULL;
  592. X    return NULL;
  593. X  } else {
  594. X    *thing = (struct alias *) malloc(sizeof(struct alias));
  595. X    (*thing)->a_in = i_mark;
  596. X    (*thing)->a_out = o_mark;
  597. X    (*thing)->a_name = malloc(strlen(buf) + 1);
  598. X    strcpy((*thing)->a_name, buf);
  599. X    return s;
  600. X  }
  601. X}
  602. X
  603. X/**
  604. X **    PARSELINE
  605. X **/
  606. X
  607. Xparseline(line, lhs, rhs)
  608. X     char *line;
  609. X     struct alias **lhs, **rhs;
  610. X{
  611. X  line--;
  612. X
  613. X  while ((line = parsething(line+1, lhs++, LHS)) != NULL)
  614. X    if (*line == ':')
  615. X      break;
  616. X  *lhs = NULL;
  617. X
  618. X  if (line != NULL)
  619. X    while ((line = parsething(line+1, rhs++, RHS)) != NULL);
  620. X  *rhs = ANULL;
  621. X}
  622. X
  623. X/**
  624. X **    FREEBUFS
  625. X **/
  626. X
  627. Xfreebufs(lhs, rhs)
  628. X     struct alias **lhs, **rhs;
  629. X{
  630. X  while (*lhs != ANULL) {
  631. X    free((*lhs)->a_name);
  632. X    free(*lhs);
  633. X    lhs++;
  634. X  }
  635. X  while (*rhs != ANULL) {
  636. X    free((*rhs)->a_name);
  637. X    free(*rhs);
  638. X    rhs++;
  639. X  }
  640. X}
  641. X
  642. X/**
  643. X **    COMPRESSLINE -- Remove all heading & trailing whitespace around items.
  644. X **/
  645. X
  646. Xcompressline(line)
  647. X     char *line;
  648. X{
  649. X  register char *d, *s, *b, *e;
  650. X
  651. X  for (d = s = line; *s != '\0'; s++) {
  652. X        /* eat initial whitespace */
  653. X    while (*s != '\0' && isspace(*s)) s++;
  654. X    if (*s == '\0')
  655. X      break;
  656. X        /* remember beginning of "word" and find end */
  657. X    b = s;
  658. X    while (*s != '\0' && *s != ',' && *s != ':') s++;
  659. X    e = s - 1;
  660. X        /* backspace end thru whitespace */
  661. X    while (e >= b && isspace(*e)) e--;
  662. X        /* copy "word" w/o whitespace */
  663. X    while (b <= e) *d++ = *b++;
  664. X        /* copy separator */
  665. X    *d++ = *s;
  666. X    if (*s == '\0')
  667. X      return;
  668. X  }
  669. X  *d = '\0';
  670. X}
  671. END_OF_ida/aux/xalparse.c
  672. if test 6648 -ne `wc -c <ida/aux/xalparse.c`; then
  673.     echo shar: \"ida/aux/xalparse.c\" unpacked with wrong size!
  674. fi
  675. # end of overwriting check
  676. fi
  677. if test -f ida/patches/alias.c.diff -a "${1}" != "-c" ; then 
  678.   echo shar: Will not over-write existing file \"ida/patches/alias.c.diff\"
  679. else
  680. echo shar: Extracting \"ida/patches/alias.c.diff\" \(9228 characters\)
  681. sed "s/^X//" >ida/patches/alias.c.diff <<'END_OF_ida/patches/alias.c.diff'
  682. X*** alias.c.orig    Sat Apr  2 01:22:15 1988
  683. X--- alias.c    Tue Aug 30 04:19:45 1988
  684. X***************
  685. X*** 58,71 ****
  686. X  */
  687. X  
  688. X  
  689. X! #ifdef DBM
  690. X! typedef struct
  691. X! {
  692. X!     char    *dptr;
  693. X!     int    dsize;
  694. X! } DATUM;
  695. X  extern DATUM fetch();
  696. X! #endif DBM
  697. X  
  698. X  alias(a, sendq)
  699. X      register ADDRESS *a;
  700. X--- 58,66 ----
  701. X  */
  702. X  
  703. X  
  704. X! #if defined(DBM) && !defined(NDBM)
  705. X  extern DATUM fetch();
  706. X! #endif DBM && !NDBM
  707. X  
  708. X  alias(a, sendq)
  709. X      register ADDRESS *a;
  710. X***************
  711. X*** 76,82 ****
  712. X  
  713. X  # ifdef DEBUG
  714. X      if (tTd(27, 1))
  715. X!         printf("alias(%s)\n", a->q_paddr);
  716. X  # endif
  717. X  
  718. X      /* don't realias already aliased names */
  719. X--- 71,77 ----
  720. X  
  721. X  # ifdef DEBUG
  722. X      if (tTd(27, 1))
  723. X!         printf("alias(%s)\n", a->q_user);
  724. X  # endif
  725. X  
  726. X      /* don't realias already aliased names */
  727. X***************
  728. X*** 125,131 ****
  729. X  **        none.
  730. X  **
  731. X  **    Warnings:
  732. X! **        The return value will be trashed across calls.
  733. X  */
  734. X  
  735. X  char *
  736. X--- 120,127 ----
  737. X  **        none.
  738. X  **
  739. X  **    Warnings:
  740. X! **        The return value will be trashed across calls
  741. X! **        unless NDBM is defined and we're using mapkey().
  742. X  */
  743. X  
  744. X  char *
  745. X***************
  746. X*** 133,149 ****
  747. X      char *name;
  748. X  {
  749. X  # ifdef DBM
  750. X      DATUM rhs, lhs;
  751. X  
  752. X      /* create a key for fetch */
  753. X!     lhs.dptr = name;
  754. X      lhs.dsize = strlen(name) + 1;
  755. X      rhs = fetch(lhs);
  756. X      return (rhs.dptr);
  757. X  # else DBM
  758. X      register STAB *s;
  759. X  
  760. X      s = stab(name, ST_ALIAS, ST_FIND);
  761. X      if (s == NULL)
  762. X          return (NULL);
  763. X      return (s->s_alias);
  764. X--- 129,178 ----
  765. X      char *name;
  766. X  {
  767. X  # ifdef DBM
  768. X+ # ifdef NDBM
  769. X+     char *newname;
  770. X+ 
  771. X+ # ifdef DEBUG
  772. X+     if (tTd(27, 3))
  773. X+         printf("aliaslookup(\"%s\") => ", name);
  774. X+ # endif DEBUG
  775. X+     newname = (char *) mapkey(DB_ALIAS, name, 0, 0);
  776. X+ # ifdef DEBUG
  777. X+     if (tTd(27, 3))
  778. X+         printf("%s\n", newname == NULL ? "NOT_FOUND" : newname);
  779. X+ # endif DEBUG
  780. X+     return newname;
  781. X+ 
  782. X+ # else NDBM
  783. X+ 
  784. X      DATUM rhs, lhs;
  785. X+     char *lowname = xalloc(strlen(name) + 1); /* potential space hog */
  786. X  
  787. X      /* create a key for fetch */
  788. X!     (void) strcpy(lowname, name);
  789. X!     (void) makelower(lowname);
  790. X!     lhs.dptr = lowname;
  791. X      lhs.dsize = strlen(name) + 1;
  792. X+ # ifdef DEBUG
  793. X+     if (tTd(27, 3))
  794. X+         printf("aliaslookup(\"%s\") => ", lhs.dptr);
  795. X+ # endif DEBUG
  796. X      rhs = fetch(lhs);
  797. X+ # ifdef DEBUG
  798. X+     if (tTd(27, 3))
  799. X+         printf("%s\n", rhs.dptr == NULL ? "NOT_FOUND" : rhs.dptr);
  800. X+ # endif DEBUG
  801. X+     (void) free(lowname);
  802. X      return (rhs.dptr);
  803. X+ # endif !NDBM
  804. X  # else DBM
  805. X      register STAB *s;
  806. X  
  807. X      s = stab(name, ST_ALIAS, ST_FIND);
  808. X+ # ifdef DEBUG
  809. X+     if (tTd(27, 3))
  810. X+         printf("%s\n", s == NULL ? "NOT_FOUND" : s->s_alias);
  811. X+ # endif DEBUG
  812. X      if (s == NULL)
  813. X          return (NULL);
  814. X      return (s->s_alias);
  815. X***************
  816. X*** 155,161 ****
  817. X  **    Very different depending on whether we are running DBM or not.
  818. X  **
  819. X  **    Parameters:
  820. X- **        aliasfile -- location of aliases.
  821. X  **        init -- if set and if DBM, initialize the DBM files.
  822. X  **
  823. X  **    Returns:
  824. X--- 184,189 ----
  825. X***************
  826. X*** 169,176 ****
  827. X  
  828. X  # define DBMMODE    0666
  829. X  
  830. X! initaliases(aliasfile, init)
  831. X!     char *aliasfile;
  832. X      bool init;
  833. X  {
  834. X  #ifdef DBM
  835. X--- 197,203 ----
  836. X  
  837. X  # define DBMMODE    0666
  838. X  
  839. X! initaliases(init)
  840. X      bool init;
  841. X  {
  842. X  #ifdef DBM
  843. X***************
  844. X*** 186,195 ****
  845. X          return;
  846. X      initialized = TRUE;
  847. X  
  848. X!     if (aliasfile == NULL || stat(aliasfile, &stb) < 0)
  849. X      {
  850. X!         if (aliasfile != NULL && init)
  851. X!             syserr("Cannot open %s", aliasfile);
  852. X          NoAlias = TRUE;
  853. X          errno = 0;
  854. X          return;
  855. X--- 213,229 ----
  856. X          return;
  857. X      initialized = TRUE;
  858. X  
  859. X!     if (AliasFile == NULL ||
  860. X! #ifdef YPMARK
  861. X!         (AliasFile[0] != YPMARK &&
  862. X! #endif YPMARK
  863. X!          stat(AliasFile, &stb) < 0)
  864. X! #ifdef YPMARK
  865. X!         )
  866. X! #endif YPMARK
  867. X      {
  868. X!         if (AliasFile != NULL && init)
  869. X!             syserr("Cannot open %s", AliasFile);
  870. X          NoAlias = TRUE;
  871. X          errno = 0;
  872. X          return;
  873. X***************
  874. X*** 202,230 ****
  875. X      **    to us to rebuild it.
  876. X      */
  877. X  
  878. X      if (!init)
  879. X!         dbminit(aliasfile);
  880. X      atcnt = SafeAlias * 2;
  881. X      if (atcnt > 0)
  882. X-     {
  883. X          while (!init && atcnt-- >= 0 && aliaslookup("@") == NULL)
  884. X-         {
  885. X-             /*
  886. X-             **  Reinitialize alias file in case the new
  887. X-             **  one is mv'ed in instead of cp'ed in.
  888. X-             **
  889. X-             **    Only works with new DBM -- old one will
  890. X-             **    just consume file descriptors forever.
  891. X-             **    If you have a dbmclose() it can be
  892. X-             **    added before the sleep(30).
  893. X-             */
  894. X- 
  895. X              sleep(30);
  896. X- # ifdef NDBM
  897. X-             dbminit(aliasfile);
  898. X- # endif NDBM
  899. X-         }
  900. X-     }
  901. X      else
  902. X          atcnt = 1;
  903. X  
  904. X--- 236,249 ----
  905. X      **    to us to rebuild it.
  906. X      */
  907. X  
  908. X+ #ifndef NDBM
  909. X      if (!init)
  910. X!         dbminit(AliasFile);
  911. X! #endif !NDBM
  912. X      atcnt = SafeAlias * 2;
  913. X      if (atcnt > 0)
  914. X          while (!init && atcnt-- >= 0 && aliaslookup("@") == NULL)
  915. X              sleep(30);
  916. X      else
  917. X          atcnt = 1;
  918. X  
  919. X***************
  920. X*** 238,247 ****
  921. X      */
  922. X  
  923. X      modtime = stb.st_mtime;
  924. X!     (void) strcpy(buf, aliasfile);
  925. X!     (void) strcat(buf, ".pag");
  926. X      stb.st_ino = 0;
  927. X!     if (!init && (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 0))
  928. X      {
  929. X          errno = 0;
  930. X          if (AutoRebuild && stb.st_ino != 0 &&
  931. X--- 257,270 ----
  932. X      */
  933. X  
  934. X      modtime = stb.st_mtime;
  935. X!     (void) strcpy(buf, AliasFile);
  936. X!     (void) strcat(buf, DB_PAGEXT);
  937. X      stb.st_ino = 0;
  938. X!     if (!init &&
  939. X! #ifdef YPMARK
  940. X!         AliasFile[0] != YPMARK &&
  941. X! #endif YPMARK
  942. X!         (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 0))
  943. X      {
  944. X          errno = 0;
  945. X          if (AutoRebuild && stb.st_ino != 0 &&
  946. X***************
  947. X*** 282,291 ****
  948. X                  automatic ? "auto" : "", username());
  949. X          }
  950. X  #endif LOG
  951. X!         readaliases(aliasfile, TRUE);
  952. X      }
  953. X  # else DBM
  954. X!     readaliases(aliasfile, init);
  955. X  # endif DBM
  956. X  }
  957. X   /*
  958. X--- 305,314 ----
  959. X                  automatic ? "auto" : "", username());
  960. X          }
  961. X  #endif LOG
  962. X!         readaliases(TRUE);
  963. X      }
  964. X  # else DBM
  965. X!     readaliases(init);
  966. X  # endif DBM
  967. X  }
  968. X   /*
  969. X***************
  970. X*** 295,301 ****
  971. X  **    when we are not going to use the DBM stuff.
  972. X  **
  973. X  **    Parameters:
  974. X- **        aliasfile -- the pathname of the alias file master.
  975. X  **        init -- if set, initialize the DBM stuff.
  976. X  **
  977. X  **    Returns:
  978. X--- 318,323 ----
  979. X***************
  980. X*** 302,314 ****
  981. X  **        none.
  982. X  **
  983. X  **    Side Effects:
  984. X! **        Reads aliasfile into the symbol table.
  985. X  **        Optionally, builds the .dir & .pag files.
  986. X  */
  987. X  
  988. X  static
  989. X! readaliases(aliasfile, init)
  990. X!     char *aliasfile;
  991. X      bool init;
  992. X  {
  993. X      register char *p;
  994. X--- 324,335 ----
  995. X  **        none.
  996. X  **
  997. X  **    Side Effects:
  998. X! **        Reads AliasFile into the symbol table.
  999. X  **        Optionally, builds the .dir & .pag files.
  1000. X  */
  1001. X  
  1002. X  static
  1003. X! readaliases(init)
  1004. X      bool init;
  1005. X  {
  1006. X      register char *p;
  1007. X***************
  1008. X*** 321,331 ****
  1009. X      register STAB *s;
  1010. X      char line[BUFSIZ];
  1011. X  
  1012. X!     if ((af = fopen(aliasfile, "r")) == NULL)
  1013. X      {
  1014. X  # ifdef DEBUG
  1015. X          if (tTd(27, 1))
  1016. X!             printf("Can't open %s\n", aliasfile);
  1017. X  # endif
  1018. X          errno = 0;
  1019. X          NoAlias++;
  1020. X--- 342,364 ----
  1021. X      register STAB *s;
  1022. X      char line[BUFSIZ];
  1023. X  
  1024. X! # ifdef YPMARK
  1025. X!     if (AliasFile[0] == YPMARK) {
  1026. X! # ifdef DEBUG
  1027. X!         if (tTd(27, 1))
  1028. X!         printf("Can't reinit YP databases: \"%s\"\n", AliasFile);
  1029. X! # endif
  1030. X!         /* reuse old aliases */
  1031. X!         errno = 0;
  1032. X!         return;
  1033. X!     }
  1034. X! # endif YPMARK
  1035. X! 
  1036. X!     if ((af = fopen(AliasFile, "r")) == NULL)
  1037. X      {
  1038. X  # ifdef DEBUG
  1039. X          if (tTd(27, 1))
  1040. X!             printf("Can't open %s\n", AliasFile);
  1041. X  # endif
  1042. X          errno = 0;
  1043. X          NoAlias++;
  1044. X***************
  1045. X*** 356,363 ****
  1046. X      if (init)
  1047. X      {
  1048. X          oldsigint = signal(SIGINT, SIG_IGN);
  1049. X!         (void) strcpy(line, aliasfile);
  1050. X!         (void) strcat(line, ".dir");
  1051. X          if (close(creat(line, DBMMODE)) < 0)
  1052. X          {
  1053. X              syserr("cannot make %s", line);
  1054. X--- 389,396 ----
  1055. X      if (init)
  1056. X      {
  1057. X          oldsigint = signal(SIGINT, SIG_IGN);
  1058. X!         (void) strcpy(line, AliasFile);
  1059. X!         (void) strcat(line, DB_PAGEXT);
  1060. X          if (close(creat(line, DBMMODE)) < 0)
  1061. X          {
  1062. X              syserr("cannot make %s", line);
  1063. X***************
  1064. X*** 364,371 ****
  1065. X              (void) signal(SIGINT, oldsigint);
  1066. X              return;
  1067. X          }
  1068. X!         (void) strcpy(line, aliasfile);
  1069. X!         (void) strcat(line, ".pag");
  1070. X          if (close(creat(line, DBMMODE)) < 0)
  1071. X          {
  1072. X              syserr("cannot make %s", line);
  1073. X--- 397,404 ----
  1074. X              (void) signal(SIGINT, oldsigint);
  1075. X              return;
  1076. X          }
  1077. X!         (void) strcpy(line, AliasFile);
  1078. X!         (void) strcat(line, DB_DIREXT);
  1079. X          if (close(creat(line, DBMMODE)) < 0)
  1080. X          {
  1081. X              syserr("cannot make %s", line);
  1082. X***************
  1083. X*** 372,378 ****
  1084. X              (void) signal(SIGINT, oldsigint);
  1085. X              return;
  1086. X          }
  1087. X!         dbminit(aliasfile);
  1088. X      }
  1089. X  
  1090. X      /*
  1091. X--- 405,415 ----
  1092. X              (void) signal(SIGINT, oldsigint);
  1093. X              return;
  1094. X          }
  1095. X! # ifdef NDBM
  1096. X!         mapinit(DB_ALIAS);
  1097. X! # else NDBM
  1098. X!         dbminit(AliasFile);
  1099. X! # endif NDBM
  1100. X      }
  1101. X  
  1102. X      /*
  1103. X***************
  1104. X*** 379,385 ****
  1105. X      **  Read and interpret lines
  1106. X      */
  1107. X  
  1108. X!     FileName = aliasfile;
  1109. X      LineNumber = 0;
  1110. X      naliases = bytes = longest = 0;
  1111. X      skipping = FALSE;
  1112. X--- 416,422 ----
  1113. X      **  Read and interpret lines
  1114. X      */
  1115. X  
  1116. X!     FileName = AliasFile;
  1117. X      LineNumber = 0;
  1118. X      naliases = bytes = longest = 0;
  1119. X      skipping = FALSE;
  1120. X***************
  1121. X*** 498,504 ****
  1122. X--- 535,545 ----
  1123. X              key.dptr = al.q_user;
  1124. X              content.dsize = rhssize;
  1125. X              content.dptr = rhs;
  1126. X+ # ifdef NDBM
  1127. X+             (void) dbm_store(AliasDbm, key, content);
  1128. X+ # else NDBM
  1129. X              store(key, content);
  1130. X+ # endif NDBM
  1131. X          }
  1132. X          else
  1133. X  # endif DBM
  1134. X***************
  1135. X*** 522,528 ****
  1136. X--- 563,573 ----
  1137. X  
  1138. X          key.dsize = 2;
  1139. X          key.dptr = "@";
  1140. X+ # ifdef NDBM
  1141. X+         (void) dbm_store(AliasDbm, key, key);
  1142. X+ # else NDBM
  1143. X          store(key, key);
  1144. X+ # endif NDBM
  1145. X  
  1146. X          /* restore the old signal */
  1147. X          (void) signal(SIGINT, oldsigint);
  1148. END_OF_ida/patches/alias.c.diff
  1149. if test 9228 -ne `wc -c <ida/patches/alias.c.diff`; then
  1150.     echo shar: \"ida/patches/alias.c.diff\" unpacked with wrong size!
  1151. fi
  1152. # end of overwriting check
  1153. fi
  1154. if test -f ida/patches/deliver.c.diff -a "${1}" != "-c" ; then 
  1155.   echo shar: Will not over-write existing file \"ida/patches/deliver.c.diff\"
  1156. else
  1157. echo shar: Extracting \"ida/patches/deliver.c.diff\" \(6664 characters\)
  1158. sed "s/^X//" >ida/patches/deliver.c.diff <<'END_OF_ida/patches/deliver.c.diff'
  1159. X*** deliver.c.orig    Thu May  5 20:40:23 1988
  1160. X--- deliver.c    Fri Sep 23 19:56:56 1988
  1161. X***************
  1162. X*** 28,33 ****
  1163. X--- 28,85 ----
  1164. X  #include <resolv.h>
  1165. X  
  1166. X  /*
  1167. X+ **  Status error messages
  1168. X+ */
  1169. X+ #define MAXENDERR    (sizeof(Enderr) / sizeof(*Enderr))
  1170. X+ char *Enderr[] = {
  1171. X+     "IMPOSSIBLE",
  1172. X+     /* SIGHUP */    "hangup",
  1173. X+     /* SIGINT */    "interrupt",
  1174. X+     /* SIGQUIT */    "quit",
  1175. X+     /* SIGILL */    "illegal instruction",
  1176. X+     /* SIGTRAP */    "trace trap",
  1177. X+     /* SIGIOT */    "IOT instruction",
  1178. X+     /* SIGEMT */    "EMT instruction",
  1179. X+     /* SIGFPE */    "floating point exception",
  1180. X+     /* SIGKILL */    "kill",
  1181. X+     /* SIGBUS */    "bus error",
  1182. X+     /* SIGSEGV */    "segmentation violation",
  1183. X+     /* SIGSYS */    "bad argument to system call",
  1184. X+     /* SIGPIPE */    "write on a pipe with no one to read it",
  1185. X+     /* SIGALRM */    "alarm clock",
  1186. X+     /* SIGTERM */    "software termination signal",
  1187. X+     /* SIGURG */    "urgent condition present on socket",
  1188. X+     /* SIGSTOP */    "stop",
  1189. X+     /* SIGTSTP */    "stop signal generated from keyboard",
  1190. X+     /* SIGCONT */    "continue after stop",
  1191. X+     /* SIGCHLD */     "child status has changed",
  1192. X+     /* SIGTTIN */    "background read attempted from control terminal",
  1193. X+     /* SIGTTOU */    "background write attempted to control terminal",
  1194. X+     /* SIGIO */    "I/O is possible on a descriptor",
  1195. X+     /* SIGXCPU */    "cpu time limit exceeded",
  1196. X+     /* SIGXFSZ */    "file size limit exceeded",
  1197. X+     /* SIGVTALRM */    "virtual time alarm",
  1198. X+     /* SIGPROF */    "profiling timer alarm",
  1199. X+     /* SIGWINCH */    "window changed",
  1200. X+     /* SIGLOST */    "resource lost",
  1201. X+     /* SIGUSR1 */    "user-defined signal 1",
  1202. X+     /* SIGUSR2 */    "user-defined signal 2"
  1203. X+ };
  1204. X+ 
  1205. X+ /*
  1206. X+ **  Name server error messages
  1207. X+ */
  1208. X+ #define MAXH_ERR        (sizeof(H_Errmsg) / sizeof(*H_Errmsg))
  1209. X+ char *H_Errmsg[] = {
  1210. X+     /* XXX */        "[Unknown error]",
  1211. X+     /* HOST_NOT_FOUND */    "Authoritative answer from name server",
  1212. X+     /* TRY_AGAIN */        "Non-authoritiatve answer or name server failure",
  1213. X+     /* NO_RECOVERY */    "Non recoverable name server error",
  1214. X+     /* NO_DATA */        "Valid name but no data [address]"
  1215. X+ };
  1216. X+ 
  1217. X+ 
  1218. X+ /*
  1219. X  **  DELIVER -- Deliver a message to a list of addresses.
  1220. X  **
  1221. X  **    This routine delivers to everyone on the same host as the
  1222. X***************
  1223. X*** 131,137 ****
  1224. X  
  1225. X      /* rewrite from address, using rewriting rules */
  1226. X      expand("\001f", buf, &buf[sizeof buf - 1], e);
  1227. X!     (void) strcpy(tfrombuf, remotename(buf, m, TRUE, TRUE));
  1228. X  
  1229. X      define('g', tfrombuf, e);        /* translated sender address */
  1230. X      define('h', host, e);            /* to host */
  1231. X--- 183,189 ----
  1232. X  
  1233. X      /* rewrite from address, using rewriting rules */
  1234. X      expand("\001f", buf, &buf[sizeof buf - 1], e);
  1235. X!     (void) strcpy(tfrombuf, remotename(buf, m, TRUE, TRUE, FALSE));
  1236. X  
  1237. X      define('g', tfrombuf, e);        /* translated sender address */
  1238. X      define('h', host, e);            /* to host */
  1239. X***************
  1240. X*** 371,377 ****
  1241. X  
  1242. X      if (ctladdr == NULL)
  1243. X          ctladdr = &e->e_from;
  1244. X!     _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);        /* XXX */
  1245. X  #ifdef SMTP
  1246. X      if (clever) {
  1247. X          expand("\001w", buf, &buf[sizeof(buf) - 1], e);
  1248. X--- 423,429 ----
  1249. X  
  1250. X      if (ctladdr == NULL)
  1251. X          ctladdr = &e->e_from;
  1252. X!     /* _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);        /* XXX */
  1253. X  #ifdef SMTP
  1254. X      if (clever) {
  1255. X          expand("\001w", buf, &buf[sizeof(buf) - 1], e);
  1256. X***************
  1257. X*** 421,427 ****
  1258. X          message(Arpa_Info, "Connecting to %s (%s)...", host, m->m_name);
  1259. X          rcode = sendoff(e, m, pv, ctladdr);
  1260. X      }
  1261. X!     _res.options |= RES_DEFNAMES | RES_DNSRCH;    /* XXX */
  1262. X  
  1263. X      /*
  1264. X      **  Do final status disposal.
  1265. X--- 473,479 ----
  1266. X          message(Arpa_Info, "Connecting to %s (%s)...", host, m->m_name);
  1267. X          rcode = sendoff(e, m, pv, ctladdr);
  1268. X      }
  1269. X!     /* _res.options |= RES_DEFNAMES | RES_DNSRCH;    /* XXX */
  1270. X  
  1271. X      /*
  1272. X      **  Do final status disposal.
  1273. X***************
  1274. X*** 647,653 ****
  1275. X      /* see if it died a horrid death */
  1276. X      if ((st & 0377) != 0)
  1277. X      {
  1278. X!         syserr("mailer %s died with signal %o", name, st);
  1279. X          ExitStat = EX_TEMPFAIL;
  1280. X          return (EX_TEMPFAIL);
  1281. X      }
  1282. X--- 699,707 ----
  1283. X      /* see if it died a horrid death */
  1284. X      if ((st & 0377) != 0)
  1285. X      {
  1286. X!         syserr("%s died because of %s (%d)--requeueing message",
  1287. X!                name, ((st >= 0) && (st < MAXENDERR)) ?
  1288. X!                Enderr[st] : "unknown error code", st);
  1289. X          ExitStat = EX_TEMPFAIL;
  1290. X          return (EX_TEMPFAIL);
  1291. X      }
  1292. X***************
  1293. X*** 1006,1013 ****
  1294. X          message(Arpa_Info, &statmsg[4]);
  1295. X      else
  1296. X      {
  1297. X          Errors++;
  1298. X!         usrerr(statmsg);
  1299. X      }
  1300. X  
  1301. X      /*
  1302. X--- 1060,1073 ----
  1303. X          message(Arpa_Info, &statmsg[4]);
  1304. X      else
  1305. X      {
  1306. X+         extern char Arpa_Usrerr[];
  1307. X+ 
  1308. X          Errors++;
  1309. X!         if (stat == EX_NOHOST && h_errno != 0)
  1310. X!             usrerr("%s (%s)", statmsg,
  1311. X!                 H_Errmsg[h_errno > MAXH_ERR ? 0 : h_errno]);
  1312. X!         else
  1313. X!             usrerr(statmsg);
  1314. X      }
  1315. X  
  1316. X      /*
  1317. X***************
  1318. X*** 1079,1110 ****
  1319. X      register FILE *fp;
  1320. X      register MAILER *m;
  1321. X  {
  1322. X!     char *template = "\001l\n";
  1323. X      char buf[MAXLINE];
  1324. X  
  1325. X      if (bitnset(M_NHDR, m->m_flags))
  1326. X          return;
  1327. X  
  1328. X  # ifdef UGLYUUCP
  1329. X      if (bitnset(M_UGLYUUCP, m->m_flags))
  1330. X      {
  1331. X          char *bang;
  1332. X-         char xbuf[MAXLINE];
  1333. X  
  1334. X          expand("\001g", buf, &buf[sizeof buf - 1], CurEnv);
  1335. X          bang = index(buf, '!');
  1336. X          if (bang == NULL)
  1337. X!             syserr("No ! in UUCP! (%s)", buf);
  1338. X          else
  1339. X          {
  1340. X              *bang++ = '\0';
  1341. X!             (void) sprintf(xbuf, "From %s  \001d remote from %s\n", bang, buf);
  1342. X!             template = xbuf;
  1343. X          }
  1344. X      }
  1345. X  # endif UGLYUUCP
  1346. X      expand(template, buf, &buf[sizeof buf - 1], CurEnv);
  1347. X      putline(buf, fp, m);
  1348. X  }
  1349. X   /*
  1350. X  **  PUTBODY -- put the body of a message.
  1351. X--- 1139,1192 ----
  1352. X      register FILE *fp;
  1353. X      register MAILER *m;
  1354. X  {
  1355. X!     extern char *macvalue();
  1356. X!     char *oldg = macvalue('g', CurEnv);
  1357. X!     char template[MAXLINE];
  1358. X!     char newg[MAXLINE];
  1359. X      char buf[MAXLINE];
  1360. X  
  1361. X+     strcpy(template, "\001l\n");
  1362. X+ 
  1363. X      if (bitnset(M_NHDR, m->m_flags))
  1364. X          return;
  1365. X  
  1366. X+     /* construct path through us if needed */
  1367. X+     if (bitnset(M_FROMPATH, m->m_flags)) {
  1368. X+         char myname[MAXLINE];
  1369. X+ 
  1370. X+         expand("\001k", myname, &myname[sizeof myname - 1], CurEnv);
  1371. X+         if (index(oldg, '!') == NULL
  1372. X+             || strncmp(oldg, myname, strlen(myname)) != 0) {
  1373. X+             sprintf(newg, "%s!%s", myname, oldg);
  1374. X+             define('g', newg, CurEnv);
  1375. X+         }
  1376. X+     }
  1377. X+ 
  1378. X  # ifdef UGLYUUCP
  1379. X      if (bitnset(M_UGLYUUCP, m->m_flags))
  1380. X      {
  1381. X          char *bang;
  1382. X  
  1383. X          expand("\001g", buf, &buf[sizeof buf - 1], CurEnv);
  1384. X          bang = index(buf, '!');
  1385. X          if (bang == NULL)
  1386. X!             syserr("No `!' in UUCP envelope \"from\" address! (%s)",
  1387. X!                    buf);
  1388. X          else
  1389. X          {
  1390. X              *bang++ = '\0';
  1391. X!             (void) sprintf(template,
  1392. X!                        "From %s  \001d remote from %s\n",
  1393. X!                        bang, buf);
  1394. X          }
  1395. X      }
  1396. X  # endif UGLYUUCP
  1397. X      expand(template, buf, &buf[sizeof buf - 1], CurEnv);
  1398. X      putline(buf, fp, m);
  1399. X+ 
  1400. X+     /* redefine old from address */
  1401. X+     if (bitnset(M_FROMPATH, m->m_flags))
  1402. X+         define('g', oldg, CurEnv);
  1403. X  }
  1404. X   /*
  1405. X  **  PUTBODY -- put the body of a message.
  1406. END_OF_ida/patches/deliver.c.diff
  1407. if test 6664 -ne `wc -c <ida/patches/deliver.c.diff`; then
  1408.     echo shar: \"ida/patches/deliver.c.diff\" unpacked with wrong size!
  1409. fi
  1410. # end of overwriting check
  1411. fi
  1412. if test -f ida/patches/main.c.diff -a "${1}" != "-c" ; then 
  1413.   echo shar: Will not over-write existing file \"ida/patches/main.c.diff\"
  1414. else
  1415. echo shar: Extracting \"ida/patches/main.c.diff\" \(8294 characters\)
  1416. sed "s/^X//" >ida/patches/main.c.diff <<'END_OF_ida/patches/main.c.diff'
  1417. X*** main.c.orig    Tue Apr 19 21:40:01 1988
  1418. X--- main.c    Fri Aug 26 03:10:02 1988
  1419. X***************
  1420. X*** 110,116 ****
  1421. X      bool queuemode = FALSE;        /* process queue requests */
  1422. X      bool nothaw;
  1423. X      static bool reenter = FALSE;
  1424. X!     char jbuf[30];            /* holds MyHostName */
  1425. X      extern bool safefile();
  1426. X      extern time_t convtime();
  1427. X      extern putheader(), putbody();
  1428. X--- 110,116 ----
  1429. X      bool queuemode = FALSE;        /* process queue requests */
  1430. X      bool nothaw;
  1431. X      static bool reenter = FALSE;
  1432. X!     char jbuf[60];            /* holds MyHostName */
  1433. X      extern bool safefile();
  1434. X      extern time_t convtime();
  1435. X      extern putheader(), putbody();
  1436. X***************
  1437. X*** 118,123 ****
  1438. X--- 118,124 ----
  1439. X      extern intsig();
  1440. X      extern char **myhostname();
  1441. X      extern char *arpadate();
  1442. X+     extern char *index();
  1443. X      extern char **environ;
  1444. X  
  1445. X      /*
  1446. X***************
  1447. X*** 134,140 ****
  1448. X--- 135,143 ----
  1449. X      reenter = TRUE;
  1450. X  
  1451. X      /* Enforce use of local time */
  1452. X+ #ifndef sun
  1453. X      unsetenv("TZ");
  1454. X+ #endif !sun
  1455. X  
  1456. X      /*
  1457. X      **  Be sure we have enough file descriptors.
  1458. X***************
  1459. X*** 187,192 ****
  1460. X--- 190,203 ----
  1461. X          }
  1462. X          else if (strncmp(p, "-bz", 3) == 0)
  1463. X              nothaw = TRUE;
  1464. X+         else if (strncmp(p, "-Z", 2) == 0)
  1465. X+         {
  1466. X+             FreezeFile = &p[2];
  1467. X+             if (FreezeFile[0] == '\0')
  1468. X+                 FreezeFile = "sendmail.fc";
  1469. X+             (void) setgid(getrgid());
  1470. X+             (void) setuid(getruid());
  1471. X+         }
  1472. X  # ifdef DEBUG
  1473. X          else if (strncmp(p, "-d", 2) == 0)
  1474. X          {
  1475. X***************
  1476. X*** 236,242 ****
  1477. X--- 247,257 ----
  1478. X      FullName = getenv("NAME");
  1479. X  
  1480. X  # ifdef LOG
  1481. X+ #ifndef sun
  1482. X      openlog("sendmail", LOG_PID, LOG_MAIL);
  1483. X+ #else
  1484. X+     openlog("sendmail", LOG_PID);
  1485. X+ #endif
  1486. X  # endif LOG
  1487. X      errno = 0;
  1488. X      from = NULL;
  1489. X***************
  1490. X*** 257,262 ****
  1491. X--- 272,281 ----
  1492. X              p = newstr(jbuf);
  1493. X              define('w', p, CurEnv);
  1494. X              setclass('w', p);
  1495. X+             if ((p = index(jbuf, '.')) != NULL)
  1496. X+                 *p = '\0';
  1497. X+             makelower(jbuf);
  1498. X+             define('k', newstr(jbuf), CurEnv);
  1499. X          }
  1500. X          while (av != NULL && *av != NULL)
  1501. X          {
  1502. X***************
  1503. X*** 288,293 ****
  1504. X--- 307,314 ----
  1505. X          OpMode = MD_PRINT;
  1506. X      else if (strcmp(p, "smtpd") == 0)
  1507. X          OpMode = MD_DAEMON;
  1508. X+     else if (strcmp(p, "bsmtp") == 0)
  1509. X+         OpMode = MD_BSMTP;
  1510. X      while ((p = *++av) != NULL && p[0] == '-')
  1511. X      {
  1512. X          switch (p[1])
  1513. X***************
  1514. X*** 301,306 ****
  1515. X--- 322,328 ----
  1516. X                  break;
  1517. X  # endif DAEMON
  1518. X                case MD_SMTP:
  1519. X+               case MD_BSMTP:
  1520. X  # ifndef SMTP
  1521. X                  syserr("I don't speak SMTP");
  1522. X                  break;
  1523. X***************
  1524. X*** 324,335 ****
  1525. X            case 'C':    /* select configuration file (already done) */
  1526. X              break;
  1527. X  
  1528. X  #ifdef DEBUG
  1529. X            case 'd':    /* debugging -- redo in case frozen */
  1530. X              tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
  1531. X              tTflag(&p[2]);
  1532. X              setbuf(stdout, (char *) NULL);
  1533. X!             _res.options |= RES_DEBUG;
  1534. X              break;
  1535. X  #endif
  1536. X  
  1537. X--- 346,361 ----
  1538. X            case 'C':    /* select configuration file (already done) */
  1539. X              break;
  1540. X  
  1541. X+           case 'Z':    /* select frozen config file (already done) */
  1542. X+             break;
  1543. X+ 
  1544. X  #ifdef DEBUG
  1545. X            case 'd':    /* debugging -- redo in case frozen */
  1546. X              tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
  1547. X              tTflag(&p[2]);
  1548. X              setbuf(stdout, (char *) NULL);
  1549. X!             if (tTd(8, 8))
  1550. X!                 _res.options |= RES_DEBUG;
  1551. X              break;
  1552. X  #endif
  1553. X  
  1554. X***************
  1555. X*** 496,502 ****
  1556. X  
  1557. X        case MD_INITALIAS:
  1558. X          /* initialize alias database */
  1559. X!         initaliases(AliasFile, TRUE);
  1560. X          exit(EX_OK);
  1561. X  
  1562. X        case MD_DAEMON:
  1563. X--- 522,528 ----
  1564. X  
  1565. X        case MD_INITALIAS:
  1566. X          /* initialize alias database */
  1567. X!         initaliases(TRUE);
  1568. X          exit(EX_OK);
  1569. X  
  1570. X        case MD_DAEMON:
  1571. X***************
  1572. X*** 505,511 ****
  1573. X  
  1574. X        default:
  1575. X          /* open the alias database */
  1576. X!         initaliases(AliasFile, FALSE);
  1577. X          break;
  1578. X      }
  1579. X  
  1580. X--- 531,537 ----
  1581. X  
  1582. X        default:
  1583. X          /* open the alias database */
  1584. X!         initaliases(FALSE);
  1585. X          break;
  1586. X      }
  1587. X  
  1588. X***************
  1589. X*** 521,529 ****
  1590. X  
  1591. X              if (m == NULL)
  1592. X                  continue;
  1593. X!             printf("mailer %d (%s): P=%s S=%d R=%d M=%ld F=", i, m->m_name,
  1594. X!                 m->m_mailer, m->m_s_rwset, m->m_r_rwset,
  1595. X!                 m->m_maxsize);
  1596. X              for (j = '\0'; j <= '\177'; j++)
  1597. X                  if (bitnset(j, m->m_flags))
  1598. X                      (void) putchar(j);
  1599. X--- 547,556 ----
  1600. X  
  1601. X              if (m == NULL)
  1602. X                  continue;
  1603. X!             printf("mailer %d (%s): P=%s S=%d/%d R=%d/%d M=%ld F=",
  1604. X!                 i, m->m_name, m->m_mailer,
  1605. X!                 m->m_se_rwset, m->m_sh_rwset,
  1606. X!                 m->m_re_rwset, m->m_rh_rwset, m->m_maxsize);
  1607. X              for (j = '\0'; j <= '\177'; j++)
  1608. X                  if (bitnset(j, m->m_flags))
  1609. X                      (void) putchar(j);
  1610. X***************
  1611. X*** 550,555 ****
  1612. X--- 577,583 ----
  1613. X          char buf[MAXLINE];
  1614. X  
  1615. X          printf("ADDRESS TEST MODE\nEnter <ruleset> <address>\n");
  1616. X+         printf("[Note: No initial ruleset 3 call]\n");
  1617. X          for (;;)
  1618. X          {
  1619. X              register char **pvp;
  1620. X***************
  1621. X*** 576,582 ****
  1622. X                  pvp = prescan(++p, ',', pvpbuf);
  1623. X                  if (pvp == NULL)
  1624. X                      continue;
  1625. X!                 rewrite(pvp, 3);
  1626. X                  p = q;
  1627. X                  while (*p != '\0')
  1628. X                  {
  1629. X--- 604,610 ----
  1630. X                  pvp = prescan(++p, ',', pvpbuf);
  1631. X                  if (pvp == NULL)
  1632. X                      continue;
  1633. X!                 /* rewrite(pvp, 3); */
  1634. X                  p = q;
  1635. X                  while (*p != '\0')
  1636. X                  {
  1637. X***************
  1638. X*** 654,661 ****
  1639. X      **  commands.  This will never return.
  1640. X      */
  1641. X  
  1642. X!     if (OpMode == MD_SMTP)
  1643. X!         smtp();
  1644. X  # endif SMTP
  1645. X  
  1646. X      /*
  1647. X--- 682,694 ----
  1648. X      **  commands.  This will never return.
  1649. X      */
  1650. X  
  1651. X!     if (OpMode == MD_SMTP || OpMode == MD_BSMTP) {
  1652. X!         bool batched = (OpMode == MD_BSMTP);
  1653. X!         OpMode = MD_SMTP;
  1654. X!         /* have to run unbuffered or else will lose synchronization */
  1655. X!         setbuf(InChannel, (char *) NULL);
  1656. X!         smtp(batched);
  1657. X!     }
  1658. X  # endif SMTP
  1659. X  
  1660. X      /*
  1661. X***************
  1662. X*** 794,805 ****
  1663. X  **        initializes several macros to be themselves.
  1664. X  */
  1665. X  
  1666. X- struct metamac
  1667. X- {
  1668. X-     char    metaname;
  1669. X-     char    metaval;
  1670. X- };
  1671. X- 
  1672. X  struct metamac    MetaMacros[] =
  1673. X  {
  1674. X      /* LHS pattern matching characters */
  1675. X--- 827,832 ----
  1676. X***************
  1677. X*** 812,820 ****
  1678. X      /* the conditional operations */
  1679. X      '?', CONDIF,    '|', CONDELSE,    '.', CONDFI,
  1680. X  
  1681. X!     /* and finally the hostname lookup characters */
  1682. X      '[', HOSTBEGIN,    ']', HOSTEND,
  1683. X  
  1684. X      '\0'
  1685. X  };
  1686. X  
  1687. X--- 839,855 ----
  1688. X      /* the conditional operations */
  1689. X      '?', CONDIF,    '|', CONDELSE,    '.', CONDFI,
  1690. X  
  1691. X!     /* and finally the hostname and database lookup characters */
  1692. X      '[', HOSTBEGIN,    ']', HOSTEND,
  1693. X+     '(', KEYBEGIN,    ')', KEYEND,
  1694. X  
  1695. X+ #ifdef MACVALUE
  1696. X+     /* run-time macro expansion, not at freeze time */
  1697. X+     '&', MACVALUE,
  1698. X+ #endif
  1699. X+ #ifdef QUOTE822
  1700. X+     '!', QUOTE822,    /* quote next macro if RFC822 requires it */
  1701. X+ #endif
  1702. X      '\0'
  1703. X  };
  1704. X  
  1705. X***************
  1706. X*** 863,868 ****
  1707. X--- 898,904 ----
  1708. X          char    *frzedata;    /* address of edata */
  1709. X          char    *frzend;    /* address of end */
  1710. X          char    frzver[252];    /* sendmail version */
  1711. X+         char    frzdatecompiled[64];    /* sendmail compilation date */
  1712. X      } frzinfo;
  1713. X  };
  1714. X  
  1715. X***************
  1716. X*** 874,879 ****
  1717. X--- 910,916 ----
  1718. X      extern char edata, end;
  1719. X      extern char *sbrk();
  1720. X      extern char Version[];
  1721. X+     extern char datecompiled[];
  1722. X  
  1723. X      if (freezefile == NULL)
  1724. X          return;
  1725. X***************
  1726. X*** 893,898 ****
  1727. X--- 930,936 ----
  1728. X      fhdr.frzinfo.frzedata = &edata;
  1729. X      fhdr.frzinfo.frzend = &end;
  1730. X      (void) strcpy(fhdr.frzinfo.frzver, Version);
  1731. X+     (void) strcpy(fhdr.frzinfo.frzdatecompiled, datecompiled);
  1732. X  
  1733. X      /* write out the freeze header */
  1734. X      if (write(f, (char *) &fhdr, sizeof fhdr) != sizeof fhdr ||
  1735. X***************
  1736. X*** 926,931 ****
  1737. X--- 964,970 ----
  1738. X      union frz fhdr;
  1739. X      extern char edata, end;
  1740. X      extern char Version[];
  1741. X+     extern char datecompiled[];
  1742. X      extern caddr_t brk();
  1743. X  
  1744. X      if (freezefile == NULL)
  1745. X***************
  1746. X*** 943,949 ****
  1747. X      if (read(f, (char *) &fhdr, sizeof fhdr) < sizeof fhdr ||
  1748. X          fhdr.frzinfo.frzedata != &edata ||
  1749. X          fhdr.frzinfo.frzend != &end ||
  1750. X!         strcmp(fhdr.frzinfo.frzver, Version) != 0)
  1751. X      {
  1752. X          (void) close(f);
  1753. X          return (FALSE);
  1754. X--- 982,989 ----
  1755. X      if (read(f, (char *) &fhdr, sizeof fhdr) < sizeof fhdr ||
  1756. X          fhdr.frzinfo.frzedata != &edata ||
  1757. X          fhdr.frzinfo.frzend != &end ||
  1758. X!         strcmp(fhdr.frzinfo.frzver, Version) != 0 ||
  1759. X!         strcmp(fhdr.frzinfo.frzdatecompiled, datecompiled) != 0)
  1760. X      {
  1761. X          (void) close(f);
  1762. X          return (FALSE);
  1763. X***************
  1764. X*** 1010,1016 ****
  1765. X  
  1766. X      /* we can't communicate with our caller, so.... */
  1767. X      HoldErrs = TRUE;
  1768. X!     ErrorMode = EM_MAIL;
  1769. X      Verbose = FALSE;
  1770. X  
  1771. X      /* all input from /dev/null */
  1772. X--- 1050,1056 ----
  1773. X  
  1774. X      /* we can't communicate with our caller, so.... */
  1775. X      HoldErrs = TRUE;
  1776. X!     setoption('e', "m", TRUE, TRUE);
  1777. X      Verbose = FALSE;
  1778. X  
  1779. X      /* all input from /dev/null */
  1780. END_OF_ida/patches/main.c.diff
  1781. if test 8294 -ne `wc -c <ida/patches/main.c.diff`; then
  1782.     echo shar: \"ida/patches/main.c.diff\" unpacked with wrong size!
  1783. fi
  1784. # end of overwriting check
  1785. fi
  1786. if test -f ida/patches/recipient.c.diff -a "${1}" != "-c" ; then 
  1787.   echo shar: Will not over-write existing file \"ida/patches/recipient.c.diff\"
  1788. else
  1789. echo shar: Extracting \"ida/patches/recipient.c.diff\" \(5359 characters\)
  1790. sed "s/^X//" >ida/patches/recipient.c.diff <<'END_OF_ida/patches/recipient.c.diff'
  1791. X*** recipient.c.orig    Mon Mar 14 05:31:54 1988
  1792. X--- recipient.c    Wed Aug 24 16:44:19 1988
  1793. X***************
  1794. X*** 306,311 ****
  1795. X--- 306,312 ----
  1796. X              if (pw == NULL)
  1797. X              {
  1798. X                  a->q_flags |= QBADADDR;
  1799. X+                 errno = 0;    /* no special error */
  1800. X                  giveresponse(EX_NOUSER, m, CurEnv);
  1801. X              }
  1802. X              else
  1803. X***************
  1804. X*** 351,356 ****
  1805. X--- 352,360 ----
  1806. X  **        may modify name.
  1807. X  */
  1808. X  
  1809. X+ #define WORST_MATCH    -2        /* even worse than no match */
  1810. X+ #define NO_UID        -999        /* any "impossible" uid will do */
  1811. X+ 
  1812. X  struct passwd *
  1813. X  finduser(name)
  1814. X      char *name;
  1815. X***************
  1816. X*** 357,365 ****
  1817. X--- 361,374 ----
  1818. X  {
  1819. X      register struct passwd *pw;
  1820. X      register char *p;
  1821. X+     int best_match = WORST_MATCH;
  1822. X+     int best_uid = NO_UID;
  1823. X      extern struct passwd *getpwent();
  1824. X      extern struct passwd *getpwnam();
  1825. X+     extern struct passwd *getpwuid();
  1826. X  
  1827. X+     errno = 0;
  1828. X+ 
  1829. X      /* map upper => lower case */
  1830. X      for (p = name; *p != '\0'; p++)
  1831. X      {
  1832. X***************
  1833. X*** 367,395 ****
  1834. X              *p = tolower(*p);
  1835. X      }
  1836. X  
  1837. X      /* look up this login name using fast path */
  1838. X      if ((pw = getpwnam(name)) != NULL)
  1839. X          return (pw);
  1840. X  
  1841. X!     /* search for a matching full name instead */
  1842. X!     for (p = name; *p != '\0'; p++)
  1843. X!     {
  1844. X!         if (*p == (SpaceSub & 0177) || *p == '_')
  1845. X!             *p = ' ';
  1846. X!     }
  1847. X      (void) setpwent();
  1848. X      while ((pw = getpwent()) != NULL)
  1849. X      {
  1850. X          char buf[MAXNAME];
  1851. X  
  1852. X!         buildfname(pw->pw_gecos, pw->pw_name, buf);
  1853. X!         if (index(buf, ' ') != NULL && !strcasecmp(buf, name))
  1854. X!         {
  1855. X!             message(Arpa_Info, "sending to login name %s", pw->pw_name);
  1856. X!             return (pw);
  1857. X          }
  1858. X      }
  1859. X!     return (NULL);
  1860. X  }
  1861. X   /*
  1862. X  **  WRITABLE -- predicate returning if the file is writable.
  1863. X--- 376,521 ----
  1864. X              *p = tolower(*p);
  1865. X      }
  1866. X  
  1867. X+ # ifdef DEBUG
  1868. X+     if (tTd(26, 6))
  1869. X+         printf("%s password entry for \"%s\"\n",
  1870. X+                getpwnam(name) ? "found" : "can't find", name);
  1871. X+ # endif DEBUG
  1872. X+ 
  1873. X      /* look up this login name using fast path */
  1874. X      if ((pw = getpwnam(name)) != NULL)
  1875. X          return (pw);
  1876. X  
  1877. X! # ifdef DEBUG
  1878. X!     if (tTd(26, 6))
  1879. X!         printf("looking for partial match to \"%s\"\n", name);
  1880. X! # endif DEBUG
  1881. X      (void) setpwent();
  1882. X      while ((pw = getpwent()) != NULL)
  1883. X      {
  1884. X          char buf[MAXNAME];
  1885. X+         register int this_match;
  1886. X  
  1887. X!         if (strcasecmp(pw->pw_name, name) == 0) {
  1888. X! # ifdef DEBUG
  1889. X!             if (tTd(26, 6))
  1890. X!             printf("found password entry for \"%s\" as \"%s\"\n",
  1891. X!                    name, pw->pw_name);
  1892. X! # endif DEBUG
  1893. X!             return (pw);
  1894. X          }
  1895. X+ 
  1896. X+         buildfname(pw->pw_gecos, pw->pw_name, buf);
  1897. X+         this_match = partialstring(buf, name);
  1898. X+ # ifdef DEBUG
  1899. X+         if (tTd(26, 6 && this_match >= 0))
  1900. X+             printf("matched on level %d with \"%s\"\n",
  1901. X+                    this_match, buf);
  1902. X+ # endif DEBUG
  1903. X+         if (this_match < best_match)
  1904. X+             continue;
  1905. X+         else if (this_match > best_match) {
  1906. X+             best_match = this_match;
  1907. X+             best_uid = pw->pw_uid;
  1908. X+         } else if (best_uid != pw->pw_uid)
  1909. X+             best_uid = NO_UID;
  1910. X      }
  1911. X! # ifdef DEBUG
  1912. X!         if (tTd(26, 6))
  1913. X!             if (best_match == WORST_MATCH)
  1914. X!                 printf("no match, failing...\n");
  1915. X!             else if (best_uid == NO_UID)
  1916. X!                 printf("ambiguous match, failing...\n");
  1917. X!             else
  1918. X!                 printf("succeding on level %d...\n",
  1919. X!                        best_match);
  1920. X! # endif DEBUG
  1921. X! 
  1922. X!     if (best_uid == NO_UID)
  1923. X!         return (NULL);
  1924. X! 
  1925. X!     pw = getpwuid(best_uid);
  1926. X!     message(Arpa_Info, "sending to login name %s", pw->pw_name);
  1927. X!     return (pw);
  1928. X! }
  1929. X!  /*
  1930. X! **  PARTIALSTRING -- is one string of words contained by another?
  1931. X! **
  1932. X! **    See if one string of words can be found as part of
  1933. X! **    another string of words.  All substrings delimited by
  1934. X! **    one or more non-alphanumeric characters are considered
  1935. X! **    "words", and a partial match is such that all the words
  1936. X! **    of the pattern string are either full prefixes
  1937. X! **    of the target string.  Upper or lower case letters are
  1938. X! **    considered equal.
  1939. X! **
  1940. X! **    Parameters:
  1941. X! **        target -- target string
  1942. X! **        pattern -- pattern string
  1943. X! **
  1944. X! **    Returns:
  1945. X! **        The number of fully matched words, or -1 if none.
  1946. X! **
  1947. X! **    Side Effects:
  1948. X! **        None.
  1949. X! **
  1950. X! */
  1951. X! 
  1952. X! partialstring(target, pattern)
  1953. X!     char *target;
  1954. X!     char *pattern;
  1955. X! {
  1956. X!     register char *t, *p, *q;
  1957. X!     int full_words = 0;
  1958. X! 
  1959. X!     /* skip initial delimiters */
  1960. X!     for (t = target; *t != '\0' && !isalnum(*t); t++);
  1961. X!     for (p = pattern; *p != '\0' && !isalnum(*p); p++);
  1962. X!     q = p;
  1963. X! 
  1964. X!     while (*t != '\0' && *p != '\0') {
  1965. X!     /*
  1966. X!      * if at end of pattern word, find next, remember it,
  1967. X!      * and eat the current target word
  1968. X!      */
  1969. X!     if (!isalnum(*p)) {
  1970. X!         while (*p != '\0' && !isalnum(*p)) p++;
  1971. X!         if (*p == '\0')
  1972. X!         continue;
  1973. X!         q = p;
  1974. X!         if (!isalnum(*t)) {
  1975. X!         full_words++;
  1976. X!         }
  1977. X!         while (*t != '\0' && isalnum(*t)) t++;
  1978. X!         while (*t != '\0' && !isalnum(*t)) t++;
  1979. X!         continue;
  1980. X!     }
  1981. X! 
  1982. X!     /*
  1983. X!      * if match, advance both pointers
  1984. X!      */
  1985. X!     if ((isupper(*t) ? tolower(*t) : *t) ==
  1986. X!         (isupper(*p) ? tolower(*p) : *p)) {
  1987. X!         t++, p++;
  1988. X!         continue;
  1989. X!     }
  1990. X! 
  1991. X!     /*
  1992. X!      * if no match, backtrack to last unmatched pattern word and
  1993. X!      * eat current target word
  1994. X!      */
  1995. X!     p = q;
  1996. X!     while (*t != '\0' && isalnum(*t)) t++;
  1997. X!     while (*t != '\0' && !isalnum(*t)) t++;
  1998. X!     }
  1999. X! 
  2000. X!     /*
  2001. X!      * now, the pattern should be fully consumed if there was a match
  2002. X!      */
  2003. X!     if (*p == '\0')
  2004. X!     return isalnum(*t) ? full_words : full_words + 1;
  2005. X!     else
  2006. X!     return -1;
  2007. X  }
  2008. X   /*
  2009. X  **  WRITABLE -- predicate returning if the file is writable.
  2010. END_OF_ida/patches/recipient.c.diff
  2011. if test 5359 -ne `wc -c <ida/patches/recipient.c.diff`; then
  2012.     echo shar: \"ida/patches/recipient.c.diff\" unpacked with wrong size!
  2013. fi
  2014. # end of overwriting check
  2015. fi
  2016. if test -f ida/patches/sendmail.h.diff -a "${1}" != "-c" ; then 
  2017.   echo shar: Will not over-write existing file \"ida/patches/sendmail.h.diff\"
  2018. else
  2019. echo shar: Extracting \"ida/patches/sendmail.h.diff\" \(7004 characters\)
  2020. sed "s/^X//" >ida/patches/sendmail.h.diff <<'END_OF_ida/patches/sendmail.h.diff'
  2021. X*** sendmail.h.orig    Mon Mar 28 09:24:51 1988
  2022. X--- sendmail.h    Fri Aug 26 03:59:10 1988
  2023. X***************
  2024. X*** 37,43 ****
  2025. X  # include "useful.h"
  2026. X  
  2027. X  # ifdef LOG
  2028. X! # include <sys/syslog.h>
  2029. X  # endif LOG
  2030. X  
  2031. X  # ifdef DAEMON
  2032. X--- 37,47 ----
  2033. X  # include "useful.h"
  2034. X  
  2035. X  # ifdef LOG
  2036. X! #  ifdef vax
  2037. X! #   include <sys/syslog.h>
  2038. X! #  else vax
  2039. X! #   include <syslog.h>
  2040. X! #  endif vax
  2041. X  # endif LOG
  2042. X  
  2043. X  # ifdef DAEMON
  2044. X***************
  2045. X*** 126,133 ****
  2046. X      BITMAP    m_flags;    /* status flags, see below */
  2047. X      short    m_mno;        /* mailer number internally */
  2048. X      char    **m_argv;    /* template argument vector */
  2049. X!     short    m_s_rwset;    /* rewriting set for sender addresses */
  2050. X!     short    m_r_rwset;    /* rewriting set for recipient addresses */
  2051. X      char    *m_eol;        /* end of line string */
  2052. X      long    m_maxsize;    /* size limit on message to this mailer */
  2053. X  };
  2054. X--- 130,139 ----
  2055. X      BITMAP    m_flags;    /* status flags, see below */
  2056. X      short    m_mno;        /* mailer number internally */
  2057. X      char    **m_argv;    /* template argument vector */
  2058. X!     short    m_se_rwset;    /* rewriting ruleset for envelope senders */
  2059. X!     short    m_sh_rwset;    /* rewriting ruleset for header senders */
  2060. X!     short    m_re_rwset;    /* rewriting ruleset for envelope recipients */
  2061. X!     short    m_rh_rwset;    /* rewriting ruleset for header recipient */
  2062. X      char    *m_eol;        /* end of line string */
  2063. X      long    m_maxsize;    /* size limit on message to this mailer */
  2064. X  };
  2065. X***************
  2066. X*** 135,140 ****
  2067. X--- 141,147 ----
  2068. X  typedef struct mailer    MAILER;
  2069. X  
  2070. X  /* bits for m_flags */
  2071. X+ # define M_BSMTP    'B'    /* don't wait for SMTP responses */
  2072. X  # define M_CANONICAL    'C'    /* make addresses canonical "u@dom" */
  2073. X  # define M_EXPENSIVE    'e'    /* it costs to use this mailer.... */
  2074. X  # define M_ESCFROM    'E'    /* escape From lines to >From */
  2075. X***************
  2076. X*** 152,157 ****
  2077. X--- 159,165 ----
  2078. X  # define M_RESTR    'S'    /* must be daemon to execute */
  2079. X  # define M_USR_UPPER    'u'    /* preserve user case distinction */
  2080. X  # define M_UGLYUUCP    'U'    /* this wants an ugly UUCP from line */
  2081. X+ # define M_RELATIVIZE    'V'    /* !-relativize all addresses */
  2082. X  # define M_XDOT        'X'    /* use hidden-dot algorithm */
  2083. X  
  2084. X  EXTERN MAILER    *Mailer[MAXMAILERS+1];
  2085. X***************
  2086. X*** 249,254 ****
  2087. X--- 257,265 ----
  2088. X  #define EF_RESPONSE    000200        /* this is an error or return receipt */
  2089. X  #define EF_RESENT    000400        /* this message is being forwarded */
  2090. X  
  2091. X+ /* special shadowing null for e_macro's */
  2092. X+ #define MACNULL        ((char *) 1)    /* don't check parent's value */
  2093. X+ 
  2094. X  EXTERN ENVELOPE    *CurEnv;    /* envelope currently being processed */
  2095. X   /*
  2096. X  **  Message priority classes.
  2097. X***************
  2098. X*** 322,331 ****
  2099. X  # define CONDELSE    '\033'    /* conditional else */
  2100. X  # define CONDFI        '\034'    /* conditional fi */
  2101. X  
  2102. X! /* bracket characters for host name lookup */
  2103. X  # define HOSTBEGIN    '\035'    /* hostname lookup begin */
  2104. X  # define HOSTEND    '\036'    /* hostname lookup end */
  2105. X  
  2106. X  /* \001 is also reserved as the macro expansion character */
  2107. X   /*
  2108. X  **  Information about hosts that we have looked up recently.
  2109. X--- 333,348 ----
  2110. X  # define CONDELSE    '\033'    /* conditional else */
  2111. X  # define CONDFI        '\034'    /* conditional fi */
  2112. X  
  2113. X! /* bracket characters for host name & database keyed lookup */
  2114. X  # define HOSTBEGIN    '\035'    /* hostname lookup begin */
  2115. X  # define HOSTEND    '\036'    /* hostname lookup end */
  2116. X+ # define KEYBEGIN    '\037'    /* keyed lookup begin */
  2117. X+ # define KEYEND        '\017'    /* keyed lookup end */
  2118. X  
  2119. X+ /* other miscellaneous */
  2120. X+ # define MACVALUE    '\016'    /* delayed macro expansion $& */
  2121. X+ # define QUOTE822    '\015'    /* quote next macro if RFC822 requires it */
  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***************
  2127. X*** 384,389 ****
  2128. X--- 401,411 ----
  2129. X  # define ST_ALIAS    4    /* an alias */
  2130. X  # define ST_HOST    5    /* host information */
  2131. X  
  2132. X+ /* s_host is defined is /usr/include/whatever on Suns */
  2133. X+ # ifdef s_host
  2134. X+ #  undef s_host
  2135. X+ # endif
  2136. X+ 
  2137. X  # define s_class    s_value.sv_class
  2138. X  # define s_address    s_value.sv_addr
  2139. X  # define s_mailer    s_value.sv_mailer
  2140. X***************
  2141. X*** 446,451 ****
  2142. X--- 468,474 ----
  2143. X  
  2144. X  
  2145. X  EXTERN char    SendMode;    /* send mode, see below */
  2146. X+ #define MD_BSMTP    'b'        /* batched smtp mode */
  2147. X  
  2148. X  #define SM_DELIVER    'i'        /* interactive delivery */
  2149. X  #define SM_QUICKD    'j'        /* deliver w/o queueing */
  2150. X***************
  2151. X*** 470,475 ****
  2152. X--- 493,537 ----
  2153. X   */
  2154. X  #define    MAX_ERRNO    100
  2155. X   /*
  2156. X+ **  Database ([n]dbm) definitions.
  2157. X+ */
  2158. X+ 
  2159. X+ #ifdef DBM
  2160. X+ 
  2161. X+ typedef struct {
  2162. X+     char    *dptr;
  2163. X+     int    dsize;
  2164. X+ } DATUM;
  2165. X+ 
  2166. X+ # define DB_DIREXT    ".dir"
  2167. X+ # define DB_PAGEXT    ".pag"
  2168. X+ 
  2169. X+ # ifdef NDBM
  2170. X+ 
  2171. X+ #  undef DBM            /* while including ndbm.h */
  2172. X+ #  include <ndbm.h>        /* DBM is typedef'ed here */
  2173. X+ typedef DBM DBMFILE;        /* move typedef to DBMFILE */
  2174. X+ #  define DBM            /* and restore DBM definition */
  2175. X+ #  include <fcntl.h>        /* needed for dbm_open */
  2176. X+ 
  2177. X+ #  define DATUM datum        /* use the definition in ndbm.h */
  2178. X+ 
  2179. X+ struct dbm_table {
  2180. X+   char *db_name;        /* database file name */
  2181. X+   time_t db_mtime;        /* last modify time */
  2182. X+   DBMFILE *db_dbm;        /* dbm file descriptor */
  2183. X+ };
  2184. X+ 
  2185. X+ #  define DB_NOSUCHFILE    ((DBMFILE *)  0) /* file could not be found */
  2186. X+ #  define DB_NOTYETOPEN    ((DBMFILE *) -1) /* file has not yet been opened */
  2187. X+ 
  2188. X+ #  define DB_ALIAS    '@'    /* "name" of aliases database */
  2189. X+ #  define AliasFile    DbmTab[DB_ALIAS].db_name
  2190. X+ #  define AliasDbm    DbmTab[DB_ALIAS].db_dbm
  2191. X+ 
  2192. X+ # endif NDBM
  2193. X+ #endif DBM
  2194. X+  /*
  2195. X  **  Global variables.
  2196. X  */
  2197. X  
  2198. X***************
  2199. X*** 511,517 ****
  2200. X--- 573,581 ----
  2201. X  EXTERN int    RefuseLA;    /* load average refusing connections are */
  2202. X  EXTERN int    QueueFactor;    /* slope of queue function */
  2203. X  EXTERN time_t    QueueIntvl;    /* intervals between running the queue */
  2204. X+ #ifndef NDBM
  2205. X  EXTERN char    *AliasFile;    /* location of alias file */
  2206. X+ #endif !NDBM
  2207. X  EXTERN char    *HelpFile;    /* location of SMTP help file */
  2208. X  EXTERN char    *StatFile;    /* location of statistics summary */
  2209. X  EXTERN char    *QueueDir;    /* location of queue directory */
  2210. X***************
  2211. X*** 533,538 ****
  2212. X--- 597,603 ----
  2213. X  EXTERN int    CheckPointLimit;    /* deliveries before checkpointing */
  2214. X  EXTERN int    Nmx;            /* number of MX RRs */
  2215. X  EXTERN char    *PostMasterCopy;    /* address to get errs cc's */
  2216. X+ EXTERN bool    SplitRewriting;    /* use split envelope/header rewriting */
  2217. X  EXTERN char    *MxHosts[MAXMXHOSTS+1];    /* for MX RRs */
  2218. X  EXTERN char    *TrustedUsers[MAXTRUST+1];    /* list of trusted users */
  2219. X  EXTERN char    *UserEnviron[MAXUSERENVIRON+1];    /* saved user environment */
  2220. X***************
  2221. X*** 539,544 ****
  2222. X--- 604,615 ----
  2223. X   /*
  2224. X  **  Trace information
  2225. X  */
  2226. X+ #ifdef NDBM
  2227. X+ EXTERN struct dbm_table DbmTab[128];    /* keyed database table */
  2228. X+ #ifdef YP
  2229. X+ #define YPMARK    '%'            /* yellow pages indicator */
  2230. X+ #endif YP
  2231. X+ #endif NDBM
  2232. X  
  2233. X  /* trace vector and macros for debugging flags */
  2234. X  EXTERN u_char    tTdvect[100];
  2235. X***************
  2236. X*** 579,581 ****
  2237. X--- 650,664 ----
  2238. X  extern char    *sfgets();
  2239. X  extern char    *queuename();
  2240. X  extern time_t    curtime();
  2241. X+ 
  2242. X+ /*
  2243. X+ **  Metamacro definitions.
  2244. X+ */
  2245. X+ 
  2246. X+ struct metamac
  2247. X+ {
  2248. X+     char    metaname;
  2249. X+     char    metaval;
  2250. X+ };
  2251. X+ 
  2252. X+ extern struct metamac    MetaMacros[];
  2253. END_OF_ida/patches/sendmail.h.diff
  2254. if test 7004 -ne `wc -c <ida/patches/sendmail.h.diff`; then
  2255.     echo shar: \"ida/patches/sendmail.h.diff\" unpacked with wrong size!
  2256. fi
  2257. # end of overwriting check
  2258. fi
  2259. echo shar: End of archive 3 \(of 8\).
  2260. cp /dev/null ark3isdone
  2261. MISSING=""
  2262. for I in 1 2 3 4 5 6 7 8 ; do
  2263.     if test ! -f ark${I}isdone ; then
  2264.     MISSING="${MISSING} ${I}"
  2265.     fi
  2266. done
  2267. if test "${MISSING}" = "" ; then
  2268.     echo You have unpacked all 8 archives.
  2269.     echo "See ida/README and ida/INSTALL for further directions."
  2270.     rm -f ark[1-9]isdone
  2271. else
  2272.     echo You still need to unpack the following archives:
  2273.     echo "        " ${MISSING}
  2274. fi
  2275. ##  End of shell archive.
  2276. exit 0
  2277.  
  2278.