home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / unaxcess2 / part03 < prev    next >
Encoding:
Internet Message Format  |  1987-02-04  |  45.7 KB

  1. Subject:  v08i039:  UNaXcess Conferencing, version 1.00.02, Part03/04
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by: abic!cwruecmp!allbery%ncoast.UUCP
  6. Mod.sources: Volume 8, Issue 39
  7. Archive-name: unaxcess2/Part03
  8.  
  9. #--------------------------------CUT HERE-------------------------------------
  10. #! /bin/sh
  11. #
  12. # This is a shell archive.  Save this into a file, edit it
  13. # and delete all lines above this comment.  Then give this
  14. # file to sh by executing the command "sh file".  The files
  15. # will be extracted into the current directory owned by
  16. # you with default permissions.
  17. #
  18. # The files contained herein are:
  19. #
  20. # -rw-rw-rw-   1 allbery  System     17681 Feb  3 21:33 user.c
  21. # -rw-rw-rw-   1 allbery  System      1424 Feb  3 21:34 user.h
  22. # -rw-rw-rw-   1 allbery  System      1802 Feb  3 21:34 uwho.c
  23. # -rw-rw-rw-   1 allbery  System      2501 Feb  3 21:45 Makefile
  24. # -rw-rw-rw-   1 allbery  System     12568 Feb  3 21:28 install.sh
  25. # -rw-r--r--   1 allbery  System      1184 Feb  3 21:30 reinstall.sh
  26. # -rw-rw-rw-   1 allbery  System      1294 Nov 22 19:37 adminmenu.help
  27. # -rw-rw-rw-   1 allbery  System      1082 Sep  7 22:15 mainmenu.help
  28. # -rw-rw-rw-   1 allbery  System      1827 Sep  7 21:37 msgbase.help
  29. # -rw-rw-rw-   1 allbery  System      1121 Sep  7 20:14 readcmds.help
  30. #
  31. echo 'x - user.c'
  32. sed 's/^X//' << '________This_Is_The_END________' > user.c
  33. X/*
  34. X *    @(#)user.c    1.2 (TDI) 2/3/87
  35. X *    @(#)Copyright (C) 1984, 85, 86, 87 by Brandon S. Allbery.
  36. X *    @(#)This file is part of UNaXcess version 1.0.2.
  37. X *
  38. X *    Permission is hereby granted to copy and distribute this program
  39. X *    freely.  Permission is NOT given to modify this program or distribute
  40. X *    it at cost, except for charging a reasonable media/copying fee.
  41. X */
  42. X
  43. X#ifndef lint
  44. Xstatic char _FileID_[] = "@(#)user.c    1.2 (TDI) 2/3/87";
  45. Xstatic char _UAID_[]   = "@(#)UNaXcess version 1.0.2";
  46. X#endif lint
  47. X
  48. X#include "ua.h"
  49. X
  50. Xstruct user user;
  51. Xstruct _himsg *hicnts;
  52. X
  53. Xgetuser(name, buf)
  54. Xchar *name;
  55. Xstruct user *buf; {
  56. X    FILE *bfd;
  57. X    char line[1024], lcuname[33], *p, *q;
  58. X    int ncolon;
  59. X
  60. X    if ((bfd = fopen(PASSWD, "r")) == NULL) {
  61. X        log("Error %d opening %s", errno, PASSWD);
  62. X        panic("passwd");
  63. X    }
  64. X    for (p = name, q = lcuname; *p != '\0' && p - name <= 32; p++, q++)
  65. X        *q = ToLower(*p);
  66. X    *q = '\0';
  67. X    while (fgets(line, sizeof line, bfd) != NULL)
  68. X        if (strncmp(line, lcuname, strlen(lcuname)) == 0 && line[strlen(lcuname)] == ':') {
  69. X            fclose(bfd);
  70. X            buf->u_name[0] = '\0';
  71. X            buf->u_pass[0] = '\0';
  72. X            buf->u_access = A_NONE;
  73. X            buf->u_login[0] = '\0';
  74. X            buf->u_llen = 32;
  75. X            buf->u_nbull = 0;
  76. X            strcpy(buf->u_lconf, "general");
  77. X            buf->u_lines = 16;
  78. X            ncolon = 0;
  79. X            for (p = line; *p != '\0'; p++)
  80. X                if (*p == ':')
  81. X                    ncolon++;
  82. X            if (ncolon < 5) {
  83. X                log("Bad userfile entry for %s", lcuname);
  84. X                return 0;
  85. X            }
  86. X            for (p = line, q = buf->u_name; *p != ':'; p++, q++)
  87. X                *q = *p;
  88. X            *q = '\0';
  89. X            for (p++, q = buf->u_pass; *p != ':'; p++, q++)
  90. X                *q = *p;
  91. X            *q = '\0';
  92. X            for (p++, q = lcuname; *p != ':'; p++, q++)
  93. X                *q = *p;
  94. X            *q = '\0';
  95. X            buf->u_access = atoi(lcuname);
  96. X            for (p++, q = buf->u_login; *p != ':'; p++, q++)
  97. X                *q = *p;
  98. X            *q = '\0';
  99. X            for (p++, q = lcuname; *p != ':'; p++, q++)
  100. X                *q = *p;
  101. X            *q = '\0';
  102. X            buf->u_llen = atoi(lcuname);
  103. X            for (p++, q = lcuname; *p != ':'; p++, q++)
  104. X                *q = *p;
  105. X            *q = '\0';
  106. X            buf->u_nbull = atoi(lcuname);
  107. X            if (ncolon >= 6) {
  108. X                for (p++, q = buf->u_lconf; *p != '\n' && *p != ':'; p++, q++)
  109. X                    *q = *p;
  110. X                *q = '\0';
  111. X            }
  112. X            if (ncolon >= 7) {
  113. X                for (p++, q = lcuname; *p != '\n'; p++, q++)
  114. X                    *q = *p;
  115. X                *q = '\0';
  116. X                buf->u_lines = atoi(lcuname);
  117. X            }
  118. X            return 1;
  119. X        }
  120. X    fclose(bfd);
  121. X    return 0;
  122. X}
  123. X
  124. Xputuser(name, ubuf)
  125. Xchar *name;
  126. Xstruct user *ubuf; {
  127. X    FILE *fd, *tfd;
  128. X    char line[1024], *tempfile = mktemp("/tmp/UptXXXXXX"), lcname[33], *p, *q;
  129. X    static char lockfile[] = "userfil.lock";
  130. X    short flag;
  131. X
  132. X    if (s_cmp(user.u_name, "guest") == 0)
  133. X        return;
  134. X    CRIT();
  135. X    mklock(lockfile);
  136. X    if ((fd = fopen(PASSWD, "r")) == NULL) {
  137. X        log("Error %d opening %s", errno, PASSWD);
  138. X        panic("passwd");
  139. X    }
  140. X    if ((tfd = fopen(tempfile, "w")) == NULL) {
  141. X        log("Error %d opening %s", errno, tempfile);
  142. X        panic("tmp");
  143. X    }
  144. X    flag = 0;
  145. X    for (p = name, q = lcname; *p != '\0' && p - name < 33; p++, q++)
  146. X        *q = ToLower(*p);
  147. X    *q = 0;
  148. X    while (fgets(line, sizeof line, fd) != NULL)
  149. X        if (strncmp(line, lcname, strlen(lcname)) == 0 && line[strlen(lcname)] == ':') {
  150. X            if (ubuf != (struct user *) 0)    /* not deleting */
  151. X                fprintf(tfd, "%s:%s:%d:%s:%d:%d:%s:%d\n", ubuf->u_name, ubuf->u_pass, ubuf->u_access, ubuf->u_login, ubuf->u_llen, ubuf->u_nbull, ubuf->u_lconf, ubuf->u_lines);
  152. X            flag++;
  153. X        }
  154. X        else
  155. X            fputs(line, tfd);
  156. X    if (!flag && ubuf != (struct user *) 0)
  157. X        fprintf(tfd, "%s:%s:%d:%s:%d:%d:%s:%d\n", ubuf->u_name, ubuf->u_pass, ubuf->u_access, ubuf->u_login, ubuf->u_llen, ubuf->u_nbull, ubuf->u_lconf, ubuf->u_lines);
  158. X    fclose(fd);
  159. X    fclose(tfd);
  160. X    unlink(PASSWD);
  161. X    if (copylink(tempfile, PASSWD) < 0) {
  162. X        log("Error %d copylinking %s to %s", errno, tempfile, PASSWD);
  163. X        panic("copylink");
  164. X    }
  165. X    unlink(tempfile);
  166. X    rmlock(lockfile);
  167. X    NOCRIT();
  168. X}
  169. X
  170. Xwritehigh(hilist)
  171. Xstruct _himsg *hilist; {
  172. X    FILE *hp, *f;
  173. X    static char line[1024], hirec[1024];    /* 68000's have limited frames */
  174. X    char *tmpf = mktemp("/tmp/RcXXXXXX");
  175. X    char *eofflag;
  176. X    static char lockfile[] = "newmsgs.lock";
  177. X    struct _himsg *hptr;
  178. X
  179. X    if (s_cmp(user.u_name, "guest") == 0)
  180. X        return;    /* don't write GUEST hirecs! */
  181. X    CRIT();
  182. X    if ((f = fopen(tmpf, "w")) == NULL) {
  183. X        log("Error %d opening %s", errno, tmpf);
  184. X        panic("tmp");
  185. X    }
  186. X    if ((hp = fopen(NEWMSGS, "r")) == NULL) {
  187. X        log("Error %d opening %s", errno, NEWMSGS);
  188. X        fclose(f);
  189. X        unlink(tmpf);
  190. X        panic("userind");
  191. X    }
  192. X    mklock(lockfile);
  193. X    sprintf(line, "%s:", user.u_name);
  194. X    while ((eofflag = fgets(hirec, sizeof hirec, hp)) != NULL) {
  195. X        if (strncmp(hirec, line, strlen(line)) == 0)
  196. X            break;
  197. X        fputs(hirec, f);
  198. X    }
  199. X    if (eofflag != NULL)
  200. X        while ((eofflag = fgets(hirec, sizeof hirec, hp)) != NULL)
  201. X            if (hirec[0] != '\t' && hirec[0] != ' ')
  202. X                   break;
  203. X    fputs(line, f);
  204. X    putc('\n', f);
  205. X    for (hptr = hilist; hptr != NULL; hptr = hptr->hi_next)
  206. X        fprintf(f, "\t%s%c %d\n", hptr->hi_conf, (hptr->hi_uns == HI_UNSUB? '!': ':'), hptr->hi_num);
  207. X    if (eofflag != NULL && hirec[0] != '\t' && hirec[0] != ' ')
  208. X        fputs(hirec, f);
  209. X    if (eofflag != NULL)
  210. X        while (fgets(hirec, sizeof hirec, hp) != NULL)
  211. X            fputs(hirec, f);
  212. X    fclose(f);
  213. X    fclose(hp);
  214. X    unlink(NEWMSGS);
  215. X    if (copylink(tmpf, NEWMSGS) < 0) {
  216. X        log("Error %d copylinking %s to %s", errno, tmpf, NEWMSGS);
  217. X        panic("copylink");
  218. X    }
  219. X    unlink(tmpf);
  220. X    rmlock(lockfile);
  221. X    NOCRIT();
  222. X}
  223. X
  224. Xstruct _himsg *readhigh(foruser)
  225. Xstruct user *foruser; {
  226. X    static char hirec[1024];
  227. X    char uidx[40], *p, *q;
  228. X    FILE *f;
  229. X    struct _himsg *workp, *initp;
  230. X
  231. X    strcpy(uidx, foruser->u_name);
  232. X    strcat(uidx, ":");
  233. X    if ((f = fopen(NEWMSGS, "r")) == NULL)
  234. X        return NULL;
  235. X    while (fgets(hirec, sizeof hirec, f) != NULL)
  236. X        if (strncmp(hirec, uidx, strlen(uidx)) == 0)
  237. X            break;
  238. X    if (feof(f)) {
  239. X        fclose(f);
  240. X        return NULL;
  241. X    }
  242. X    workp = NULL;
  243. X    initp = NULL;
  244. X    while (fgets(hirec, sizeof hirec, f) != NULL && (hirec[0] == ' ' || hirec[0] == '\t')) {
  245. X        hirec[strlen(hirec) - 1] = '\0';
  246. X        for (p = hirec; *p == ' ' || *p == '\t'; p++)
  247. X            ;
  248. X        for (q = uidx; *p != ' ' && *p != '\t' && *p != '\0' && *p != ':' && *p != '!'; p++)
  249. X            *q++ = *p;
  250. X        *q = '\0';
  251. X        while (*p == ' ' || *p == '\t')
  252. X            p++;
  253. X        if (*p == '!') {    /* unsubscribed... */
  254. X            if ((workp = (struct _himsg *) calloc((unsigned) 1, sizeof (struct _himsg))) == NULL) {
  255. X                log("Error %d allocating _himsg for %s", errno, uidx);
  256. X                panic("alloc");
  257. X            }
  258. X            strcpy(workp->hi_conf, uidx);
  259. X            workp->hi_num = atoi(++p);
  260. X            workp->hi_next = initp;
  261. X            workp->hi_uns = HI_UNSUB;
  262. X            initp = workp;
  263. X            continue;
  264. X        }
  265. X        if (*p != ':') {
  266. X            log("Invalid format of userind record: ``%s''", hirec);
  267. X            writes("Your index is garbled; some conference\nhigh-message counts may be lost.");
  268. X            break;
  269. X        }
  270. X        if ((workp = (struct _himsg *) calloc((unsigned) 1, sizeof (struct _himsg))) == NULL) {
  271. X            log("Error %d allocating _himsg for %s", errno, uidx);
  272. X            panic("alloc");
  273. X        }
  274. X        strcpy(workp->hi_conf, uidx);
  275. X        workp->hi_num = atoi(++p);
  276. X        workp->hi_next = initp;
  277. X        workp->hi_uns = HI_SUBSCR;
  278. X        initp = workp;
  279. X    }
  280. X    fclose(f);
  281. X    return initp;
  282. X}
  283. X
  284. Xnewuser() {
  285. X    struct user nubuf, junk;
  286. X    char line[256], addr[256], cityst[256], phone[256], uname[256], ckpass[256];
  287. X    char *p;
  288. X    FILE *newp;
  289. X
  290. X    dolog();
  291. X    log("Entered newuser module.");
  292. X    cat(NEWUSER);
  293. X    writef("\nDo you still want to become a user? N\b");
  294. X    line[0] = readc();
  295. X    log("Become user? %c", line[0]);
  296. X    if (line[0] != 'Y') {
  297. X        writes("OK.  Goodbye, then.\n\n");
  298. X        nolog();
  299. X        cleanup();
  300. X    }
  301. X
  302. XAgain:
  303. X    do {
  304. X        writef("What name would you like to use on this system?  It should not be\nmore than 32 letters long: ");
  305. X        reads(line);
  306. X        log("Name: %s", line);
  307. X        if (line[0] == '\0' || line[0] == ' ') {
  308. X            line[0] = '?';
  309. X            p = line;
  310. X            continue;
  311. X        }
  312. X        for (p = line; *p != '\0'; p++)
  313. X            if (*p == ':') {
  314. X                writes("Sorry, no colons allowed; they cause nasty surprises.");
  315. X                log("Illegal colon in name");
  316. X                break;
  317. X            }
  318. X    } while (*p != NULL);
  319. X    if (getuser(nubuf.u_name, &junk)) {
  320. X        writes("Sorry, but that name's already in use.  Please choose another.");
  321. X        goto Again;
  322. X    }
  323. X    strncpy(nubuf.u_name, line, 32);
  324. X    nubuf.u_name[32] = '\0';
  325. X    writef("Please enter your street address: ");
  326. X    reads(addr);
  327. X    writef("Please enter your city and state: ");
  328. X    reads(cityst);
  329. X    writef("Please enter your home phone number: ");
  330. X    reads(phone);
  331. X    line[0] = '\0';
  332. X    xecho();
  333. X    do {
  334. X        if (line[0] != 0)
  335. X            writes("You made a typing error, or it's too short or too long.");
  336. X        writef("Please enter a password of three to eight characters.\nIt will not be displayed: ");
  337. X        reads(line);
  338. X        log("Pass: %s", line);
  339. X        writef("Please re-enter it, just to make sure: ");
  340. X        reads(ckpass);
  341. X        log("Ckpass: %s", ckpass);
  342. X    } while (strlen(line) < 3 || strlen(line) > 8 || strcmp(line, ckpass) != 0);
  343. X    doecho();
  344. X    strcpy(nubuf.u_pass, line);
  345. X    do {
  346. X        writef("How many characters per line are on your terminal?  Please enter a number from 32 to 132, or <ENTER> for 80: ");
  347. X        reads(line);
  348. X        log("Line: %s", line);
  349. X        if (line[0] == '\0')
  350. X            nubuf.u_llen = 80;
  351. X        else
  352. X            nubuf.u_llen = atoi(line);
  353. X    } while (nubuf.u_llen < 32 || nubuf.u_llen > 132);
  354. X    do {
  355. X        writef("How many lines are on your terminal?  Please enter a number from 0 to 66, or <ENTER> for 24: ");
  356. X        reads(line);
  357. X        log("Line: %s", line);
  358. X        if (line[0] == '\0')
  359. X            nubuf.u_lines = 24;
  360. X        else
  361. X            nubuf.u_lines = atoi(line);
  362. X    } while (nubuf.u_lines < 0 || nubuf.u_lines > 66);
  363. X    writef("If you are a regular (shell) user of this system, please enter your login name.  The sysop will verify it and grant you SYSTEM-level access.  If you are not a regular user, just press RETURN (ENTER).\n\nWhat is your Unix(R) login name on this sy
  364.  
  365. stem? ");
  366. X    reads(uname);
  367. X    writef("\nName:\t\t%s\nAddress:\t%s\nCity/State:\t%s\nPhone:\t\t%s\nPass:\t\t%s\nLine:\t\t%d\nScreen:\t\t%d\nLogname:\t%s\n\nIs this correct? N\b", nubuf.u_name, addr, cityst, phone, nubuf.u_pass, nubuf.u_llen, nubuf.u_lines, uname);
  368. X    line[0] = readc();
  369. X    log("Okay? %c", line[0]);
  370. X    if (line[0] != 'Y')
  371. X        goto Again;
  372. X    writes("Encrypting password, please wait...");
  373. X    strcpy(nubuf.u_pass, crypt(nubuf.u_pass, nubuf.u_pass) + 2);
  374. X    strcpy(nubuf.u_login, user.u_login);/* default login name ( guest ?) */
  375. X    nubuf.u_access = parms.ua_vaxs;
  376. X    nubuf.u_nbull = 0;            /* no bulletins read yet */
  377. X    strcpy(nubuf.u_lconf, "general");
  378. X    writes("Recording user information...");
  379. X    for (p = nubuf.u_name; *p != '\0'; p++)
  380. X        *p = ToLower(*p);
  381. X    putuser(nubuf.u_name, &nubuf);
  382. X    CRIT();
  383. X    mklock("newuser.lock");
  384. X    if ((newp = fopen("newuser.log", "a")) == (FILE *) 0) {
  385. X        log("Error %d opening newuser.log", errno);
  386. X        panic("newlog");
  387. X    }
  388. X    fprintf(newp, "%s:%s:%s:%s:%s\n", nubuf.u_name, addr, cityst, phone, uname);
  389. X    fclose(newp);
  390. X    rmlock("newuser.lock");
  391. X    NOCRIT();
  392. X    user = nubuf;
  393. X    nolog();
  394. X}
  395. X
  396. Xuserlist() {
  397. X    FILE *bfd, *wfd;
  398. X    char line[1024], *p, *q, dbuf[20];
  399. X    short ncolon;
  400. X    struct user buf;
  401. X
  402. X    if ((bfd = fopen(PASSWD, "r")) == NULL) {
  403. X        log("Error %d opening %s", errno, PASSWD);
  404. X        panic("passwd");
  405. X    }
  406. X    if (user.u_access == A_WITNESS)
  407. X        wfd = fopen("newuser.log", "r");
  408. X    else
  409. X        wfd = (FILE *) 0;
  410. X    writes("\nList of UNaXcess users:\n");
  411. X    while (fgets(line, 1024, bfd) != NULL) {
  412. X        buf.u_name[0] = '\0';
  413. X        buf.u_pass[0] = '\0';
  414. X        buf.u_access = 0;
  415. X        buf.u_login[0] = '\0';
  416. X        buf.u_llen = 0;
  417. X        buf.u_nbull = 0;
  418. X        buf.u_lconf[0] = '\0';
  419. X        ncolon = 0;
  420. X        for (p = line; *p != '\0'; p++)
  421. X            if (*p == ':')
  422. X                ncolon++;
  423. X        if (ncolon < 5) {
  424. X            log("Bad usefile entry %.*s", strlen(line) - 1, line);
  425. X            continue;
  426. X        }
  427. X        for (p = line, q = buf.u_name; *p != ':'; p++, q++)
  428. X            *q = *p;
  429. X        *q = '\0';
  430. X        for (p++, q = buf.u_pass; *p != ':'; p++, q++)
  431. X            *q = *p;
  432. X        *q = '\0';
  433. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  434. X            *q = *p;
  435. X        *q = '\0';
  436. X        buf.u_access = atoi(dbuf);
  437. X        for (p++, q = buf.u_login; *p != ':'; p++, q++)
  438. X            *q = *p;
  439. X        *q = '\0';
  440. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  441. X            *q = *p;
  442. X        *q = '\0';
  443. X        buf.u_llen = atoi(dbuf);
  444. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  445. X            *q = *p;
  446. X        *q = '\0';
  447. X        buf.u_nbull = atoi(dbuf);
  448. X        if (ncolon >= 6) {
  449. X            for (p++, q = buf.u_lconf; *p != '\n'; p++, q++)
  450. X                *q = *p;
  451. X            *q = '\0';
  452. X        }
  453. X        if (buf.u_access == A_NONE || buf.u_access == A_MKUSER)
  454. X            continue;
  455. X        writef("%-32.32s  %s\n", upstr(buf.u_name), ua_acl(buf.u_access));
  456. X        if (wfd != (FILE *) 0) {
  457. X            rewind(wfd);
  458. X            do {
  459. X                if (fgets(line, sizeof line, wfd) == (char *) 0) {
  460. X                    buf.u_name[0] = '\0';
  461. X                    break;
  462. X                }
  463. X            } while (strncmp(line, buf.u_name, strlen(buf.u_name)) != 0 || line[strlen(buf.u_name)] != ':');
  464. X            if (buf.u_name[0] == '\0')
  465. X                continue;
  466. X            p = &line[strlen(buf.u_name) + 1];
  467. X            for (q = p; *q != ':'; q++)
  468. X                ;
  469. X            *q++ = '\0';
  470. X            writef("\t%s\n", p);
  471. X            p = q;
  472. X            for (q = p; *q != ':'; q++)
  473. X                ;
  474. X            *q++ = '\0';
  475. X            writef("\t%s\n", p);
  476. X            p = q;
  477. X            for (q = p; *q != ':'; q++)
  478. X                ;
  479. X            *q++ = '\0';
  480. X            writef("\tPhone: %s\n\n", p);
  481. X        }
  482. X    }
  483. X    fclose(bfd);
  484. X    return 1;
  485. X}
  486. X
  487. Xchar *ua_acl(acl) {
  488. X    switch (acl) {
  489. X    case A_NONE:
  490. X        return "Denied access";
  491. X    case A_GUEST:
  492. X        return "Guest";
  493. X    case A_USER:
  494. X        return "Messages";
  495. X    case A_FILES:
  496. X        return "File UDL";
  497. X    case A_SYSTEM:
  498. X        return "System";
  499. X    case A_WITNESS:
  500. X        return "Fairwitness";
  501. X    case A_MKUSER:
  502. X        return "New User";
  503. X    default:
  504. X        log("Invalid access level %d in userfile", acl);
  505. X        return "???";
  506. X    }
  507. X}
  508. X
  509. Xvalidate() {
  510. X    FILE *bfd, *wfd, *vfd;
  511. X    struct user buf;
  512. X    char line[1024], dbuf[20];
  513. X    short ncolon;
  514. X    char *p, *q, *vfile;
  515. X    char ch;
  516. X
  517. X    if (user.u_access != A_WITNESS) {
  518. X        log("Non-Witness attempted to validate users.");
  519. X        writes("You aren't authorized to validate users.\n");
  520. X        return 1;
  521. X    }
  522. X    if ((bfd = fopen(PASSWD, "r")) == NULL) {
  523. X        log("Error %d opening %s", errno, PASSWD);
  524. X        panic("passwd");
  525. X    }
  526. X    if ((wfd = fopen("newuser.log", "r")) == (FILE *) 0) {
  527. X        log("Error %d opening newuser.log", errno);
  528. X        panic("nuserlog");
  529. X    }
  530. X    vfile = mktemp("/tmp/uaVXXXXXX");
  531. X    if ((vfd = fopen(vfile, "w")) == (FILE *) 0) {
  532. X        log("Error %d opening %s", errno, vfile);
  533. X        panic("valtemp");
  534. X    }
  535. X    while (fgets(line, sizeof line, bfd) != NULL) {    /* OOPS!  2/3/87 ++bsa */
  536. X        buf.u_name[0] = '\0';
  537. X        buf.u_pass[0] = '\0';
  538. X        buf.u_access = 0;
  539. X        buf.u_login[0] = '\0';
  540. X        buf.u_llen = 0;
  541. X        buf.u_nbull = 0;
  542. X        buf.u_lconf[0] = '\0';
  543. X        ncolon = 0;
  544. X        for (p = line; *p != '\0'; p++)
  545. X            if (*p == ':')
  546. X                ncolon++;
  547. X        if (ncolon < 5) {
  548. X            log("Bad userfile entry %.*s", strlen(line) - 1, line);
  549. X            continue;
  550. X        }
  551. X        for (p = line, q = buf.u_name; *p != ':'; p++, q++)
  552. X            *q = *p;
  553. X        *q = '\0';
  554. X        for (p++, q = buf.u_pass; *p != ':'; p++, q++)
  555. X            *q = *p;
  556. X        *q = '\0';
  557. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  558. X            *q = *p;
  559. X        *q = '\0';
  560. X        buf.u_access = atoi(dbuf);
  561. X        for (p++, q = buf.u_login; *p != ':'; p++, q++)
  562. X            *q = *p;
  563. X        *q = '\0';
  564. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  565. X            *q = *p;
  566. X        *q = '\0';
  567. X        buf.u_llen = atoi(dbuf);
  568. X        for (p++, q = dbuf; *p != ':'; p++, q++)
  569. X            *q = *p;
  570. X        *q = '\0';
  571. X        buf.u_nbull = atoi(dbuf);
  572. X        if (ncolon >= 6) {
  573. X            for (p++, q = buf.u_lconf; *p != '\n'; p++, q++)
  574. X                *q = *p;
  575. X            *q = '\0';
  576. X        }
  577. X        if (buf.u_access != parms.ua_vaxs)
  578. X            continue;
  579. X        rewind(wfd);
  580. X        do {
  581. X            if (fgets(line, sizeof line, wfd) == (char *) 0) {
  582. X                buf.u_name[0] = '\0';
  583. X                break;
  584. X            }
  585. X        } while (strncmp(line, buf.u_name, strlen(buf.u_name)) != 0 || line[strlen(buf.u_name)] != ':');
  586. X        if (buf.u_name[0] == '\0')
  587. X            continue;
  588. X        writef("\n%-32.32s  %s\n", upstr(buf.u_name), ua_acl(buf.u_access));
  589. X        writef("\tUNIX(R) name: `%s'\n\n", buf.u_login);
  590. X        p = &line[strlen(buf.u_name) + 1];
  591. X        for (q = p; *q != ':'; q++)
  592. X            ;
  593. X        *q++ = '\0';
  594. X        writef("\t%s\n", p);
  595. X        p = q;
  596. X        for (q = p; *q != ':'; q++)
  597. X            ;
  598. X        *q++ = '\0';
  599. X        writef("\t%s\n", p);
  600. X        p = q;
  601. X        for (q = p; *q != ':'; q++)
  602. X            ;
  603. X        *q++ = '\0';
  604. X        writef("\tPhone: %s\n", p);
  605. X        log("Validating %s", buf.u_name);
  606. X
  607. Xvcmdloop:
  608. X        writef("\nValidate, Kill, Deny access, Hold, Shell, Quit? ");
  609. X        ch = readc();
  610. X        log("V/K/D/H/S/Q? %c", ch);
  611. X        switch (ch) {
  612. X        case 'V':
  613. X            writef("Validate for: Guest, Messages, Files, System, Witness? ");
  614. X            ch = readc();
  615. X            log("Access? %c", ch);
  616. X            switch (ch) {
  617. X            case 'G':
  618. X                buf.u_access = A_GUEST;
  619. X                break;
  620. X            case 'M':
  621. X                buf.u_access = A_USER;
  622. X                break;
  623. X            case 'F':
  624. X                buf.u_access = A_FILES;
  625. X                break;
  626. X            case 'S':
  627. X                buf.u_access = A_SYSTEM;
  628. X                break;
  629. X            case 'W':
  630. X                buf.u_access = A_WITNESS;
  631. X                break;
  632. X            default:
  633. X                writes("Unknown access level -- command aborted.");
  634. X                goto vcmdloop;
  635. X            }
  636. X            fprintf(vfd, "%s:%d\n", buf.u_name, buf.u_access);
  637. X            break;
  638. X        case 'K':
  639. X            writef("Kill user? N\b");
  640. X            if (readc() != 'Y')
  641. X                goto vcmdloop;
  642. X            log("User killed.");
  643. X            fprintf(vfd, "%s:-1\n", buf.u_name);
  644. X            break;
  645. X        case 'D':
  646. X            log("Access set to A_NONE.");
  647. X            buf.u_access = A_NONE;
  648. X            fprintf(vfd, "%s:%d\n", buf.u_name, A_NONE);
  649. X            break;
  650. X        case 'H':
  651. X            log("User held.");
  652. X            break;
  653. X        case 'S':
  654. X            shell();
  655. X            goto vcmdloop;
  656. X        case 'Q':
  657. X            fclose(bfd);
  658. X            fclose(wfd);
  659. X            fclose(vfd);
  660. X            vinstall(vfile);
  661. X            unlink(vfile);
  662. X            return 1;
  663. X        default:
  664. X            writes("Please enter one of V, K, D, H, S, or Q.");
  665. X            goto vcmdloop;
  666. X        }
  667. X    }
  668. X    if (ferror(bfd))
  669. X        log("Error %d on userfile\n", errno);
  670. X    fclose(bfd);
  671. X    fclose(wfd);
  672. X    fclose(vfd);
  673. X    vinstall(vfile);
  674. X    unlink(vfile);
  675. X    return 1;
  676. X}
  677. X
  678. Xvinstall(vfile)
  679. Xchar *vfile; {
  680. X    FILE *vfd;
  681. X    struct user vuser;
  682. X    char vline[1024], vuname[33];
  683. X    int vaccess;
  684. X    
  685. X    writec('\n');
  686. X    if ((vfd = fopen(vfile, "r")) == (FILE *) 0) {
  687. X        log("Error %d opening %s", errno, vfile);
  688. X        writes("Can't open validation file.");
  689. X        return;
  690. X    }
  691. X    while (fgets(vline, sizeof vline, vfd) != (char *) 0) {
  692. X        sscanf(vline, "%[^:]:%d", vuname, &vaccess);
  693. X        if (!getuser(vuname, &vuser)) {
  694. X            writef("Lost user: %s\n", upstr(vuname));
  695. X            continue;
  696. X        }
  697. X        if (vaccess == -1) {
  698. X            putuser(vuname, (struct user *) 0);
  699. X            writef("Killed user %s...\n", upstr(vuname));
  700. X            continue;
  701. X        }
  702. X        vuser.u_access = vaccess;
  703. X        putuser(vuname, &vuser);
  704. X        if (vaccess == A_NONE)
  705. X            writef("Denied access to user %s...\n", upstr(vuname));
  706. X        else
  707. X            writef("Validated user %s for %s access...\n", upstr(vuname), ua_acl(vaccess));
  708. X    }
  709. X    fclose(vfd);
  710. X}
  711. ________This_Is_The_END________
  712. echo 'x - user.h'
  713. sed 's/^X//' << '________This_Is_The_END________' > user.h
  714. X/*
  715. X *    @(#)user.h    1.1 (TDI) 2/3/87
  716. X *    @(#)Copyright (C) 1984, 85, 86, 87 by Brandon S. Allbery.
  717. X *    @(#)This file is part of UNaXcess version 1.0.2.
  718. X *
  719. X *    Permission is hereby granted to copy and distribute this program
  720. X *    freely.  Permission is NOT given to modify this program or distribute
  721. X *    it at cost, except for charging a reasonable media/copying fee.
  722. X */
  723. X
  724. Xstruct user {
  725. X    char u_name[33];        /* user name */
  726. X    char u_pass[12];        /* password */
  727. X    short u_access;            /* can killmsg() or shell() ? */
  728. X    char u_login[9];        /* Intended for system login name */
  729. X    short u_llen;            /* line length, or default u_access */
  730. X    short u_nbull;            /* highest numbered bulletin read */
  731. X    char u_lconf[33];        /* login conference (dft = general) */
  732. X    short u_lines;            /* lines per screen */
  733. X};                    /* current user */
  734. X
  735. Xextern struct user user;
  736. X
  737. X/* access modes, in u_access */
  738. X
  739. X#define A_NONE        0        /* invalidated login */
  740. X#define A_GUEST        1        /* read-only access */
  741. X#define A_USER        2        /* standard access */
  742. X#define A_FILES        3        /* can udl() */
  743. X#define A_SYSTEM    4        /* can system() */
  744. X#define A_WITNESS    5        /* Fairwitness */
  745. X#define A_MKUSER    6        /* Special: user creator */
  746. X
  747. Xstruct _himsg {
  748. X    char hi_conf[33];        /* conference this record refers to */
  749. X    char hi_uns;            /* unsubscribed to this conference */
  750. X    short hi_num;            /* high message in this conference */
  751. X    struct _himsg *hi_next;
  752. X};
  753. X
  754. Xextern struct _himsg *hicnts;
  755. X
  756. X#define HI_SUBSCR    0
  757. X#define HI_UNSUB    1
  758. ________This_Is_The_END________
  759. echo 'x - uwho.c'
  760. sed 's/^X//' << '________This_Is_The_END________' > uwho.c
  761. X/*
  762. X *    @(#)uwho.c    1.1 (TDI) 2/3/87
  763. X *    @(#)Copyright (C) 1984, 85, 86, 87 by Brandon S. Allbery.
  764. X *    @(#)This file is part of UNaXcess version 1.0.2.
  765. X *
  766. X *    Permission is hereby granted to copy and distribute this program
  767. X *    freely.  Permission is NOT given to modify this program or distribute
  768. X *    it at cost, except for charging a reasonable media/copying fee.
  769. X */
  770. X
  771. X#ifndef lint
  772. Xstatic char _FileID_[] = "@(#)uwho.c    1.1 (TDI) 2/3/87";
  773. Xstatic char _UAID_[]   = "@(#)UNaXcess version 1.0.2";
  774. X#endif lint
  775. X
  776. X#include <stdio.h>
  777. X#include <pwd.h>
  778. X#include <sys/types.h>
  779. X#include <utmp.h>
  780. X
  781. X#ifndef NOAUTOPATH
  782. Xstruct passwd *getpwuid();
  783. X#endif  NOAUTOPATH
  784. X
  785. X#define TTYLIST "/etc/utmp"
  786. X
  787. Xmain(argc, argv)
  788. Xchar **argv; {
  789. X    int cnt, flg, users;
  790. X    struct utmp user;
  791. X    char tty[16];
  792. X
  793. X    if ((users = open(TTYLIST, 0)) < 0) {
  794. X        fprintf(stderr, "%s: can't open %s\n", argv[0], TTYLIST);
  795. X        exit(1);
  796. X    }
  797. X    flg = 0;
  798. X    while (read(users, &user, sizeof user) > 0) {
  799. X#ifdef SYS5
  800. X        if (user.ut_type != USER_PROCESS)
  801. X            continue;
  802. X#else  SYS5
  803. X        if (user.ut_name[0] == '\0')
  804. X            continue;
  805. X#endif SYS5
  806. X        sprintf(tty, "/dev/%.*s", sizeof user.ut_line, user.ut_line);
  807. X        if (argc < 2)
  808. X            showme(&tty[5]);
  809. X        else
  810. X            for (cnt = 1; argv[cnt] != NULL; cnt++)
  811. X                if (strcmp(&tty[5], argv[cnt]) == 0) {
  812. X                    showme(&tty[5]);
  813. X                    break;
  814. X                }
  815. X    }
  816. X    exit(0);
  817. X}
  818. X
  819. Xshowme(ttyf)
  820. Xchar *ttyf;
  821. X{
  822. X    FILE *fp;
  823. X    char line[1024];
  824. X#ifndef NOAUTOPATH
  825. X    static char home[1024] = "";
  826. X#endif NOAUTOPATH
  827. X
  828. X#ifdef NOAUTOPATH
  829. X    sprintf(line, "%s/%s", NOAUTOPATH, ttyf);
  830. X#else
  831. X    if (home[0] == '\0')
  832. X        strcpy(home, getpwuid(geteuid())->pw_dir);
  833. X    sprintf(line, "%s/%s", home, ttyf);
  834. X#endif NOAUTOPATH
  835. X    if ((fp = fopen(line, "r")) == NULL)    /* not in use on this tty */
  836. X        return;
  837. X    fgets(line, 1024, fp);
  838. X    printf("%s: %s", ttyf, line);        /* line already has newline */
  839. X    fclose(fp);
  840. X}
  841. ________This_Is_The_END________
  842. echo 'x - Makefile'
  843. sed 's/^X//' << '________This_Is_The_END________' > Makefile
  844. X#
  845. X# Makefile for UNaXcess Conferencing, version 1.00.02
  846. X#
  847. X
  848. XSHELL = /bin/sh
  849. X# make on sys3 is not very nice when it comes to standard shell interfaces...
  850. X
  851. X# ``make SYSTEM=(SYS3|SYS5|V7|BSD|XENIX|XENIX3|XENIX5) all''
  852. X# Use V7     for V7, XENIX 2.x, and BSD pre-4.2 (+ bastardizations of same)
  853. X#     BSD    for BSD 4.2 and 4.3
  854. X#     SYS3   for real AT&T System III
  855. X#     SYS5   for real AT&T System V revisions 1 and 2
  856. X#     XENIX3 for Xenix v3.x, Unisoft System III, and other bastardized V7's
  857. X#     XENIX5 for Xenix V5.x and other bastardized V7's with System V libraries
  858. X#            (If Xenix 5.x has /etc/inittab, then I messed up; use SYS5.)
  859. X# You're on your own if it's a really odd combo.
  860. X# Pyramid 90x:  use either universe.  SYS5 is best tested; BSD has bigger
  861. X# conference names and many performance pluses (extra-fast conference
  862. X# creation; I don't know if the 4.2 directory stuff is implemented in kernel
  863. X# or not, so I don't know if you gain -- but libndir is SLOW!).
  864. X
  865. XCFLAGS = -D$(SYSTEM) -O
  866. XLINT = 
  867. X# the above line should be modified on systems other than USG Unix(R), as
  868. X# USG Unix(R) defaults to the major checks.  Don't bother with -p, as UNaXcess
  869. X# is definitely not designed to work anywhere other than Unix(R).
  870. X
  871. XOBJS = ua.o message.o conference.o date.o bulletin.o system.o user.o dir.o \
  872. X       fileudl.o io.o
  873. XSRC  = ua.c message.c conference.c date.c bulletin.c system.c user.c dir.c \
  874. X       fileudl.c io.c
  875. XHDR  = ua.h user.h system.h dir.h
  876. XUTIL = install.sh mkconf.c udate.c uwho.c
  877. XSRCS = $(SRC) $(UTIL)
  878. X
  879. Xall: system ua uwho udate mkconf mvmsg guide
  880. Xlint: system lintcheck
  881. X
  882. Xinstall: all
  883. X    -sh install.sh
  884. X
  885. Xua: $(OBJS)
  886. X    $(CC) -o ua $(OBJS)
  887. X
  888. Xudate: udate.o date.o
  889. X    cc -O -o udate udate.o date.o
  890. X
  891. X$(OBJS): $(HDR)
  892. X
  893. Xclean:
  894. X    rm -f ua uwho udate upost mkconf umotd *.o tags core ua.shar* mvmsg unaxcess.tar
  895. X
  896. Xtags: $(SRC) $(HDR)
  897. X    ctags $(SRC) $(HDR)
  898. X
  899. Xshar:
  900. X    mkshar -v -s 65000 -h ua.shar README *.[chl] Makefile *.sh *.help *.man
  901. X
  902. Xtar:
  903. X    tar cvf unaxcess.tar README *.[chl] Makefile *.sh *.help *.man
  904. X
  905. Xedall: %edall
  906. X    for file in *.[chl] Makefile *.sh; do\
  907. X        sh %edall $$file;\
  908. X    done
  909. X
  910. Xsystem:
  911. X    expr    "$(SYSTEM)" = V7 \| \
  912. X        "$(SYSTEM)" = SYS3 \| \
  913. X        "$(SYSTEM)" = SYS5 \| \
  914. X        "$(SYSTEM)" = BSD \| \
  915. X        "$(SYSTEM)" = XENIX \| \
  916. X        "$(SYSTEM)" = XENIX3 \| \
  917. X        "$(SYSTEM)" = XENIX5
  918. X
  919. Xlintcheck:
  920. X    lint $(LINT) -D$(SYSTEM) $(SRC)
  921. X
  922. Xguide: guide.man
  923. X    nroff -man guide.man > guide
  924. X
  925. Xuwho: uwho.o
  926. X    $(CC) -o uwho uwho.o
  927. X
  928. Xmkconf: mkconf.o
  929. X    $(CC) -o mkconf mkconf.o
  930. X
  931. Xmvmsg: mvmsg.o
  932. X    $(CC) -o mvmsg mvmsg.o
  933. ________This_Is_The_END________
  934. echo 'x - install.sh'
  935. sed 's/^X//' << '________This_Is_The_END________' > install.sh
  936. X:
  937. X: install.sh
  938. X: install UNaXcess 1.00.02
  939. X: Brandon S. Allbery
  940. X: This script is not copyrighted
  941. X:
  942. X
  943. XPATH=:/bin:/usr/bin:/usr/ucb:/etc:/usr/plx
  944. Xcat - << --EOF--
  945. X
  946. X            UNaXcess 1.00.02 Installation Script
  947. X            ------------------------------------
  948. X
  949. X    This script requires that (1) you have NOAUTOPATH defined, or
  950. X    (2) you be running as root.  If you are not running as root,
  951. X    the "mkconf" program cannot be installed.
  952. X
  953. X    (On BSD systems, root permissions are required only if the
  954. X    UNaXcess owner does not exist.  Note that if you are not running
  955. X    as root, you will receive spurious error messages from chown.
  956. X    You may ignore these messages.)
  957. X
  958. X--EOF--
  959. Xgrep NOAUTOPATH Makefile > /dev/null 2>&1
  960. Xcase "$?" in
  961. X1)      autopath=y
  962. X    ;;
  963. X0)      autopath=n
  964. X    UAHOME="`grep NOAUTOPATH Makefile | sed -n 's/.*[       ]-DAUTOPATH=[^-A-Za-z\/.]*\([-A-Za-z\/.][-A-Za-z\/.]*\).*$/\1/p'`"
  965. X    if test ! -w "$UAHOME"; then
  966. X        echo "No write permission in $UAHOME.  Installation aborted."
  967. X        exit 1
  968. X    fi
  969. X    UAOWNER=${LOGNAME-${USER?'Who are you?'}}
  970. X    ;;
  971. X2)      echo "Please re-run install.sh from the installation directory."
  972. X    exit 1
  973. X    ;;
  974. X*)      echo "Your grep does funny things.  You'll have to install UNaXcess by hand."
  975. X    exit 1
  976. X    ;;
  977. Xesac
  978. Xcase $autopath in
  979. Xy)      if test ! -f /vmunix -a ! -w /etc/passwd; then
  980. X        echo "Root permissions are required.  Installation aborted."
  981. X        exit 1
  982. X    fi
  983. X    echo "Please enter the username of the owner of this UNaXcess system."
  984. X    echo "(Press RETURN to abort installation.)"
  985. X    read UAOWNER
  986. X    case "$UAOWNER" in
  987. X    "")     echo "Installation aborted."
  988. X        exit 1
  989. X        ;;
  990. X    esac
  991. X    if grep "^$UAOWNER:" /etc/passwd >/dev/null 2>&1; then
  992. X        echo "User $UAOWNER already exists.  Do you want to use it (Y/N)?"
  993. X        read yesno
  994. X        case "$yesno" in
  995. X        y*|Y*)  ;;
  996. X        *)      echo "Installation aborted."
  997. X            exit 1
  998. X            ;;
  999. X        esac
  1000. X    else
  1001. X        if test -f /vmunix -a ! -w /etc/passwd; then
  1002. X            echo "Please create the user and re-run install.sh.  Installation aborted."
  1003. X            exit 1
  1004. X        fi
  1005. X        echo "Create $UAOWNER (Y/N)?"
  1006. X        read yesno
  1007. X        case "$yesno" in
  1008. X        y*|Y*)  ;;
  1009. X        *)      echo "Installation aborted."
  1010. X            exit 1
  1011. X            ;;
  1012. X        esac
  1013. X        UAUID=`sed 's/^[^:]*:[^:]*:\([^:]*\):.*$/\1/' < /etc/passwd | sort -n | tail -1`
  1014. X        UAUID=`expr $UAUID + 1`
  1015. X        echo "The BBS directory will be /usr/$UAOWNER.  Press RETURN to accept, or"
  1016. X        echo "enter a directory name."
  1017. X        read home
  1018. X        case "$home" in
  1019. X        "")     home=/usr/$UAOWNER
  1020. X            ;;
  1021. X        esac
  1022. X        if test -r $home; then
  1023. X            echo "$home exists.  Please choose a different directory.  Installation aborted."
  1024. X            exit 1
  1025. X        fi
  1026. X        echo "$UAOWNER::$UAUID:1:UNaXcess Control Login:$home:" >> /etc/passwd
  1027. X        mkdir $home
  1028. X        chown $UAOWNER $home
  1029. X        echo "Please give $UAOWNER a password.  DON'T LEAVE IT UNPROTECTED!!!"
  1030. X        passwd $UAOWNER
  1031. X    fi
  1032. X    echo ""
  1033. X    UAHOME="`sed -n '/^'$UAOWNER':/s=^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*\$=\1=p' < /etc/passwd`"
  1034. X    ;;
  1035. Xn)      ;;
  1036. Xesac
  1037. Xecho "UNaXcess will be installed in $UAHOME.  Is this okay (Y/N)?"
  1038. Xread yesno
  1039. Xcase "$yesno" in
  1040. Xy*|Y*)  ;;
  1041. X*)      echo "Please check /etc/passwd for $UAOWNER's home directory, and fix it."
  1042. X    echo "Then type 'sh install.sh' to try installation again."
  1043. X    exit 1
  1044. X    ;;
  1045. Xesac
  1046. X#chmod 711 $UAHOME || echo "Please inspect the permissions on $UAHOME; they should be -rwx--x--x."
  1047. Xif test ! -d $UAHOME/msgdir; then
  1048. Xecho "Creating $UAHOME/msgdir..."
  1049. X    rm -f $UAHOME/msgdir
  1050. X    mkdir $UAHOME/msgdir
  1051. X    chown $UAOWNER $UAHOME/msgdir
  1052. Xfi
  1053. Xif test ! -d $UAHOME/motd; then
  1054. X    echo "Creating $UAHOME/motd..."
  1055. X    rm -f $UAHOME/motd
  1056. X    mkdir $UAHOME/motd
  1057. X    chown $UAOWNER $UAHOME/motd
  1058. Xfi
  1059. Xif test ! -d $UAHOME/library; then
  1060. X    echo "Creating $UAHOME/library..."
  1061. X    rm -f $UAHOME/library
  1062. X    mkdir $UAHOME/library
  1063. X    chown $UAOWNER $UAHOME/library
  1064. Xfi
  1065. Xif test ! -d $UAHOME/uploads; then
  1066. X    echo "Creating $UAHOME/uploads..."
  1067. X    rm -f $UAHOME/uploads
  1068. X    mkdir $UAHOME/uploads
  1069. X    chown $UAOWNER $UAHOME/uploads
  1070. Xfi
  1071. Xecho "Creating $UAHOME/Logfile..."
  1072. Xrm -f $UAHOME/Logfile
  1073. Xchown $UAOWNER $UAHOME/Logfile > $UAHOME/Logfile
  1074. Xif test ! -f $UAHOME/userind; then
  1075. X    echo "Creating $UAHOME/userind..."
  1076. X    rm -rf $OAHOME/userind
  1077. X    chown $UAOWNER $UAHOME/userind > $UAHOME/userind
  1078. Xfi
  1079. Xif test ! -d $UAHOME/lock; then
  1080. X    echo "Creating $UAHOME/lock..."
  1081. X    rm -f $UAHOME/lock
  1082. X    mkdir $UAHOME/lock
  1083. X    chown $UAOWNER $UAHOME/lock
  1084. Xfi
  1085. Xif test ! -d $UAHOME/members; then
  1086. X    echo "Creating $UAHOME/members..."
  1087. X    rm -f $UAHOME/members
  1088. X    mkdir $UAHOME/members
  1089. X    chown $UAOWNER $UAHOME/members
  1090. Xfi
  1091. Xif test ! -d $UAHOME/msgdir/general; then
  1092. X    echo "Creating conference general..."
  1093. X    rm -f $UAHOME/msgdir/general
  1094. X    mkdir $UAHOME/msgdir/general
  1095. X    chown $UAOWNER $UAHOME/msgdir/general
  1096. X    echo 1 > $UAHOME/msgdir/general/himsg
  1097. X    chown $UAOWNER $UAHOME/msgdir/general/himsg
  1098. X    cat << --general/1-- > $UAHOME/msgdir/general/1
  1099. XDate: `./udate`
  1100. XFrom: SYSOP
  1101. XTo: All
  1102. XSubject: This BBS
  1103. X
  1104. XWelcome to UNaXcess V1.00.02 -- a computer bulletin board system designed for the UNIX(R) operating system.  You're using the ONLY BBS which is designed to USE Unix's unique features to their fullest potential.
  1105. X
  1106. XThis conference is the general-purpose conference.  Use it for discussions that don't fit in any of the existing conferences.  But if it's liable to be large, consider making a new conference for it.
  1107. X
  1108. XThe basic UNaXcess commands are:
  1109. X
  1110. XM - Enter the Message Base menu.
  1111. XG - Exit UNaXcess.
  1112. XF - Enter the File UDL Section.  UNaXcess is capable of file uploading and downloading with ASCII, Xmodem and Kermit (not all may be available on all systems).
  1113. X? - Help.  Press it once for one-line descriptions, press it again for the help file.
  1114. X
  1115. XPress BREAK or CONTROL C to stop a command.
  1116. XPress CONTROL-\ (CONTROL plus backslash) for a fast logout.
  1117. X
  1118. XThe UNaXcess User's Guide is available in the File UDL Area for those who have File UDL access.
  1119. X
  1120. X--SYSOP
  1121. X--general/1--
  1122. Xfi
  1123. Xif test ! -d $UAHOME/msgdir/guest; then
  1124. X        echo "Creating conference guest..."
  1125. X        rm -rf $UAHOME/msgdir/guest
  1126. X        mkdir $UAHOME/msgdir/guest
  1127. X        chown $UAOWNER $UAHOME/msgdir/guest
  1128. X        echo 1 > $UAHOME/msgdir/guest/himsg
  1129. X        chown $UAOWNER $UAHOME/msgdir/guest/himsg
  1130. X        cat << --guest/1-- > $UAHOME/msgdir/guest/1
  1131. XDate: `./udate`
  1132. XFrom: SYSOP
  1133. XTo: All
  1134. XSubject: This conference
  1135. X
  1136. XThis conference is for any and all users of UNaXcess.  ANYONE may post messages to the guest conference at any time.
  1137. X
  1138. X--SYSOP
  1139. X--guest/1--
  1140. Xfi
  1141. Xecho "The programs will be placed in /usr/bin.  Press RETURN to accept, or enter"
  1142. Xecho "a different directory."
  1143. Xread BIN
  1144. Xcase "$BIN" in
  1145. X"")    BIN=/usr/bin
  1146. X    ;;
  1147. X*)    ;;
  1148. Xesac
  1149. Xif test ! -d $BIN; then
  1150. X    echo "$BIN does not exist.  Please create it.  Installation stopped."
  1151. X    exit 1
  1152. Xfi
  1153. Xecho "The UNaXcess program will be called ua.  Press RETURN to accept, or enter"
  1154. Xecho "a different name."
  1155. Xread ua
  1156. Xcase "$ua" in
  1157. X"")    ua="ua"
  1158. Xesac
  1159. Xecho "The user lister will be called uwho.  Press ENTER to accept, or enter a"
  1160. Xecho "different name."
  1161. Xread uwho
  1162. Xcase "$uwho" in
  1163. X"")    uwho="uwho"
  1164. Xesac
  1165. Xecho "Creating $BIN/$ua..."
  1166. Xcp ua $BIN/$ua
  1167. Xchown $UAOWNER $BIN/$ua
  1168. Xchmod 711 $BIN/$ua
  1169. Xcase $autopath in
  1170. Xy)    chmod 4711 $BIN/$ua
  1171. X    ;;
  1172. Xesac
  1173. Xecho "Creating $BIN/$uwho..."
  1174. Xcp uwho $BIN/$uwho
  1175. Xchmod 711 $BIN/$uwho
  1176. Xcase $autopath in
  1177. Xy)      chown $UAOWNER $BIN/$uwho
  1178. X    chmod 4711 $BIN/$uwho
  1179. X    if test ! -f /vmunix; then
  1180. X        echo "Creating $UAHOME/mkconf..."
  1181. X        cp mkconf $UAHOME/mkconf
  1182. X        chown root $UAHOME/mkconf
  1183. X        chmod 4711 $UAHOME/mkconf
  1184. X    fi
  1185. X    ;;
  1186. Xesac
  1187. Xecho "The conference maintenance utility will be called mvmsg.  Press RETURN to"
  1188. Xecho "accept, or enter a different name."
  1189. Xread mvmsg
  1190. Xcase "$mvmsg" in
  1191. X"")     mvmsg="mvmsg"
  1192. X    ;;
  1193. Xesac
  1194. Xecho "Creating $BIN/$mvmsg..."
  1195. Xcp mvmsg $BIN/$mvmsg
  1196. Xcase $autopath in
  1197. Xy)    chown $UAOWNER $BIN/$mvmsg
  1198. X    chmod 4700 $BIN/$mvmsg
  1199. X    ;;
  1200. Xesac
  1201. Xcat - << --CONF--
  1202. X
  1203. XYou will be asked a series of configuration questions.  If you have not read
  1204. Xthe UNaXcess Installation Manual, please do so before answering them.  You
  1205. Xmay hit DEL (or CONTROL-C or etc.) to exit this script if you need to.
  1206. X
  1207. X--CONF--
  1208. Xecho "Do you want to allow READ-ONLY conferences (Y)?"
  1209. Xread yesno
  1210. Xcase "$yesno" in
  1211. Xn*|N*)    readonly=NO
  1212. X    ;;
  1213. X*)      readonly=YES
  1214. X    ;;
  1215. Xesac
  1216. Xecho "Do you want to allow restricted conferences (N)?"
  1217. Xread yesno
  1218. Xcase "$yesno" in
  1219. Xy*|Y*)    xrated=YES
  1220. X    ;;
  1221. X*)      xrated=NO
  1222. Xesac
  1223. Xecho "The default shell for the C command will be /bin/sh.  Press RETURN to accept,"
  1224. Xecho "or enter an alternative shell."
  1225. Xread shell
  1226. Xcase "$shell" in
  1227. X"")     shell=/bin/sh
  1228. X    ;;
  1229. Xesac
  1230. Xif test ! -f "$shell"; then
  1231. X    echo "The shell $shell does not exist.  Installation stopped."
  1232. X    exit 1
  1233. Xfi
  1234. Xecho "Do you want UNaXcess to check the user's environment for a preferred"
  1235. Xecho "shell (Y)?"
  1236. Xread env
  1237. Xcase "$env" in
  1238. XN*|n*)  env=NO
  1239. X    ;;
  1240. X*)      env=YES
  1241. X    ;;
  1242. Xesac
  1243. Xecho "Enter the UNIX login names of all logins which will run UNaXcess as the"
  1244. Xecho "login shell.  Press RETURN if there will be none."
  1245. Xread bbsuser
  1246. Xwhile :; do
  1247. X    echo "Enter the time limit for UNaXcess users, in minutes; 0 for no limit (30):"
  1248. X    read tlimit
  1249. X    case "$tlimit" in
  1250. X    "")     tlimit=30
  1251. X    esac
  1252. X    check="`echo \"$tlimit\" | sed 's/[0-9]//gp'`"
  1253. X    if test -n "$check" -o $tlimit -gt 32000; then
  1254. X        echo "Please enter a number between 0 and 32000."
  1255. X    else
  1256. X        break
  1257. X    fi
  1258. Xdone
  1259. Xecho "The SYSOP's UNaXcess login name will be SYSOP.  Press RETURN to accept, or"
  1260. Xecho "enter a different name."
  1261. Xread sysop
  1262. Xcase "$sysop" in
  1263. X"")     sysop="sysop"
  1264. X    ;;
  1265. Xesac
  1266. Xsysop="`echo \"$sysop\" | sed 's/://g
  1267. X                   s/^\(................................\).*$/\1/'`"
  1268. Xecho "Do you want to allow private messages (Y)?"
  1269. Xread private
  1270. Xcase "$private" in
  1271. XN*|n*)  private=NO
  1272. X    ;;
  1273. X*)      private=YES
  1274. X    ;;
  1275. Xesac
  1276. Xecho "Do you want to enable logging (N)?"
  1277. Xread logging
  1278. Xcase "$logging" in
  1279. XY*|y*)  logging=YES
  1280. X    ;;
  1281. X*)      logging=NO
  1282. X    ;;
  1283. Xesac
  1284. Xwhile :; do
  1285. X    echo "How many tries should a user get to log in -- 0 means no limit (3)?"
  1286. X    read logtries
  1287. X    case "$logtries" in
  1288. X    "")     logtries=3
  1289. X    esac
  1290. X    check="`echo \"$logtries\" | sed 's/[0-9]//gp'`"
  1291. X    if test -n "$check" -o "$logtries" -gt 32000; then
  1292. X        echo "Please enter a number between 0 and 32000."
  1293. X    else
  1294. X        break
  1295. X    fi
  1296. Xdone
  1297. Xecho ""
  1298. Xecho "Creating $UAHOME/ua-config..."
  1299. Xcat << --CONFIG-- > $UAHOME/ua-config
  1300. Xreadonly    $readonly
  1301. Xrestricted    $xrated
  1302. Xshell        $shell
  1303. Xread-env    $env
  1304. Xbbs-user    $bbsuser
  1305. Xtime-limit      $tlimit
  1306. Xsysop        "$sysop"
  1307. Xprivate-msgs    $private
  1308. Xlogging        $logging
  1309. Xbanner        ""
  1310. Xlogin-msg    ""
  1311. Xlogin-tries    $logtries
  1312. Xvalidation-level    1
  1313. X--CONFIG--
  1314. Xchown $UAOWNER $UAHOME/ua-config
  1315. Xchmod 644 $UAHOME/ua-config
  1316. Xecho ""
  1317. Xecho "You can edit the config file yourself to change these and other options."
  1318. Xecho "Read the UNaXcess Administration manual for details."
  1319. Xecho ""
  1320. Xif test ! -f $UAHOME/userfile; then
  1321. X    echo "Creating $UAHOME/userfile..."
  1322. X    rm -rf $UAHOME/userfile
  1323. X    cat << --USERFILE-- > $UAHOME/userfile
  1324. X$sysop::5::80:0:general:24
  1325. Xnew::6::2:0::0
  1326. Xguest::1::40:0:guest:16
  1327. X--USERFILE--
  1328. X    chown $UAOWNER $UAHOME/userfile
  1329. X    chmod 644 $UAHOME/userfile
  1330. Xfi
  1331. Xecho ""
  1332. Xif test ! -r $UAHOME/directory; then
  1333. X    rm -rf $UAHOME/directory
  1334. X    today="at-install"    # OOPS! 2 lines deleted, this line changed
  1335. X                # 2/3/87 ++bsa
  1336. X    echo "Creating $UAHOME/directory..."
  1337. X    cat << --LIBCATLG-- > $UAHOME/directory
  1338. XGENERAL file branch; $today by $sysop: General up/downloading
  1339. XGENERAL file GUIDE.UA; $today by $sysop: The UNaXcess User's Guide
  1340. X--LIBCATLG--
  1341. X    chown $UAOWNER $UAHOME/directory
  1342. X    chmod 644 $UAHOME/directory
  1343. Xfi
  1344. Xif test ! -f $UAHOME/upload-log; then
  1345. X    rm -rf $UAHOME/upload-log
  1346. X    echo "Creating $UAHOME/upload-log..."
  1347. X    cp /dev/null $UAHOME/upload-log
  1348. X    chown $UAOWNER $UAHOME/upload-log
  1349. X    chmod 644 $UAHOME/upload-log
  1350. Xfi
  1351. Xif test ! -d $UAHOME/library/general; then
  1352. X    echo "Creating File UDL branch general..."
  1353. X    rm -f $UAHOME/library/general
  1354. X    mkdir $UAHOME/library/general
  1355. X    cp guide $UAHOME/library/general/guide.ua
  1356. Xfi
  1357. Xif test ! -f $UAHOME/NewMessage; then
  1358. X    echo ""
  1359. X    echo "Creating the new-user bulletin.  See the UNaXcess Administrator's Manual"
  1360. X    echo "in order to change it."
  1361. X    echo ""
  1362. X    echo "Creating $UAHOME/NewMessage..."
  1363. Xcat << --NEWMESSAGE-- > $UAHOME/NewMessage
  1364. X
  1365. XWelcome to UNaXcess 1.00.02, Copyright (C) 1984-1987 by Brandon S. Allbery.  This UNaXcess was installed `./udate`.
  1366. X
  1367. XYou are requested to register with your full name, and give your full address and phone number.
  1368. X
  1369. X--NEWMESSAGE--
  1370. X    chown $UAOWNER $UAHOME/NewMessage
  1371. X    chmod 644 $UAHOME/NewMessage
  1372. Xfi
  1373. Xif test ! -f $UAHOME/motd/himotd; then
  1374. X    echo "Creating $UAHOME/motd/himotd..."
  1375. X    echo 0 > $UAHOME/motd/himotd
  1376. X    chown $UAOWNER $UAHOME/motd/himotd
  1377. X    chmod 644 $UAHOME/motd/himotd
  1378. Xfi
  1379. Xif test -d $UAHOME/help; then
  1380. X    rm -rf $UAHOME/help
  1381. Xfi
  1382. Xecho "Creating $UAHOME/help..."
  1383. Xmkdir $UAHOME/help
  1384. Xcp mainmenu.help $UAHOME/help/mainmenu
  1385. Xcp msgbase.help $UAHOME/help/msgbase
  1386. Xcp adminmenu.help $UAHOME/help/adminmenu
  1387. Xcp readcmds.help $UAHOME/help/readcmds
  1388. Xecho ""
  1389. Xecho "UNaXcess Conferencing 1.00.02 Installation complete."
  1390. Xexit 0
  1391. ________This_Is_The_END________
  1392. echo 'x - reinstall.sh'
  1393. sed 's/^X//' << '________This_Is_The_END________' > reinstall.sh
  1394. X: reinstall script
  1395. X: used to upgrade V1.00.00 to 1.00.01 or later
  1396. Xcd "$1" || {
  1397. X    echo "usage: sh reinstall.sh bbs-directory" >&2
  1398. X    exit 1
  1399. X}
  1400. Xtest -w ua-config || {
  1401. X    echo "reinstall.sh: wrong directory or wrong user; must be able to write config files" >&2
  1402. X    exit 1
  1403. X}
  1404. Xbbsdir="`grep '^bbs-directory[     ]' ua-config | sed 's/^bbs-directory[     ][     ]*\"*\([^\"][^\"]*\).*$/\1/`"
  1405. Xcase "$bbsdir" in
  1406. X"")    bbsdir="$1"
  1407. X    ;;
  1408. Xesac
  1409. Xed - ua-config << \EOF:ua_config
  1410. Xg/^x-rated[     ]/s//restricted    /
  1411. X$a
  1412. Xvalidation-level    1
  1413. X.
  1414. Xw
  1415. Xq
  1416. XEOF:ua-config
  1417. Xcd "$bbsdir" || {
  1418. X    echo "reinstall.sh: the BBS directory specified by ua-config is bad"
  1419. X    exit 1
  1420. X}
  1421. Xed - userfile << \EOF:userfile
  1422. Xg/^\([^:][^:]*:[^:][^:]*:0*5\):[0-9][0-9]*:\([0-9][0-9]*:[^:][^:]*\):.*$/s//\1:40:\2:16/
  1423. Xw
  1424. Xq
  1425. XEOF:userfile
  1426. Xcat << EOF:message
  1427. XThe system new-user validation level has been set to Guest (1); you may change
  1428. Xit by editing the "validation-level" parameter in the ua-config file.  (See the
  1429. XUNaXcess Administration Guide for more information.)
  1430. X
  1431. XAll new-user logins have been set to 16 lines of 40 characters.  These may be
  1432. Xchanged via the Alter command of UNaXcess; again, see the UNaXcess Adminis-
  1433. Xtration Guide for details.
  1434. XEOF:message
  1435. Xexit 0
  1436. ________This_Is_The_END________
  1437. echo 'x - adminmenu.help'
  1438. sed 's/^X//' << '________This_Is_The_END________' > adminmenu.help
  1439. XUNaXcess Administration Commands
  1440. X--------------------------------
  1441. X
  1442. XA - Alter or examine a user.  For non-Fairwitnesses, you can only look at yourself.  FWs can look at any user.  It's most commomly used by FWs to validate users, and by other users to look at their access level, change their password or terminal informat
  1443.  
  1444. ion (lines/screen, line length).
  1445. X
  1446. XB - Enter a bulletin.  Only Fairwitnesses (and the Sysop) can do this.
  1447. X
  1448. XC - Command access.  This command, for users of System access and higher, runs a shell.  Type CONTROL-D to return to UNaXcess.
  1449. X
  1450. XE - Edit conference restrictions.  Only Fairwitnesses may use this command; in addition, only the Sysop or a Fairwitness who is a member of a restricted conference may change the restrictions on the conference.  Only the Sysop may restrict or un-restrict
  1451.  
  1452.  a conference.
  1453. X
  1454. XG - Goodbye.  If executed from the "read loop" via the Xecute command -- the prompt displayed after a message -- you will be returned to the read loop.  Otherwise, you will be asked if you really want to log out, and if so you will be logged out.
  1455. X
  1456. XV - Validate new users.  Only Fairwitnesses (and the Sysop) may use this command.
  1457. X
  1458. XW - Who's been on.  This shows the userlog, including names and access levels. Fairwitnesses can see addresses and phone numbers as well.
  1459. ________This_Is_The_END________
  1460. echo 'x - mainmenu.help'
  1461. sed 's/^X//' << '________This_Is_The_END________' > mainmenu.help
  1462. XUNaXcess Main Menu Commands
  1463. X---------------------------
  1464. X
  1465. XA - The Administration Menu.  Type ? from the administration menu for help.  Some commands (notable the Alter command), are of use to all UNaXcess users.
  1466. X
  1467. XB - Redisplay the latest UNaXcess bulletins.
  1468. X
  1469. XC - Command access.  This command, for users of System access and higher, runs a shell.  Type CONTROL-D to return to UNaXcess.
  1470. X
  1471. XF - File UDL area (upload/download).  Users who have less than File UDL access may look at the available files for downloading, including downloading the file lists.  File UDL access or greater is required for uploading or downloading.
  1472. X
  1473. XG - Goodbye.  If executed from the "read loop" via the Xecute command -- the prompt displayed after a message -- you will be returned to the read loop.  Otherwise, you will be asked if you really want to log out, and if so you will be logged out.
  1474. X
  1475. XM - The Message Base Menu.  Type ? from the message base menu for help.
  1476. X
  1477. XW - Who's been on.  This shows the userlog, including names and access levels. Fairwitnesses can see addresses and phone numbers as well.
  1478. ________This_Is_The_END________
  1479. echo 'x - msgbase.help'
  1480. sed 's/^X//' << '________This_Is_The_END________' > msgbase.help
  1481. XUNaXcess Message Base Commands
  1482. X------------------------------
  1483. X
  1484. XD - Set your default conference, otherwise known as your login conference.  When you log in to UNaXcess, you will be placed in this conference; for new users, it is set to "general".
  1485. X
  1486. XE - Enter a message.  You are prompted for the recipient, the subject, and the destination conference (the default is the current conference).  On some systems you may be asked whether it is a private message.
  1487. X
  1488. XG - Goodbye.  This command logs you out.
  1489. X
  1490. XI - Index of conferences.  For each conference, you are informed of the number of messages in the conference, the number you have read, whether you are subscribed or not, and whether it is restricted or not.
  1491. X
  1492. XJ - Join a different conference.  If you are not subscribed to the conference (see the U command), you will be asked if you want to resubscribe.  You can also create a new conference by attempting to join it; you will be asked if you really intend to cre
  1493.  
  1494. ate a new conference.
  1495. X
  1496. XK - Kill a message in the current conference.  You are prompted for the message to kill.
  1497. X
  1498. XN - Read all new messages.  This command visits every conference in order and reads the new messages in each; after each message you may continue, skip to the next conference, kill the current message, reply to it, enter a new message, unsubscribe from i
  1499.  
  1500. ts conference, or enter the Main Menu temporarily.  (Whew!)
  1501. X
  1502. XR - Read menu (new messages, scan, read, quick scan).  See the help file for this menu for details.
  1503. X
  1504. XU - Unsubscribe from a conference.  If you unsubscribe from a conference, its messages will not be shown to you by the N command.  You can resubscribe by joining the conference (J command).  If you unsubscribe from the current conference, it will take ef
  1505.  
  1506. fect after you log out or join another conference.
  1507. X
  1508. XX - Return to the Main Menu.
  1509. ________This_Is_The_END________
  1510. echo 'x - readcmds.help'
  1511. sed 's/^X//' << '________This_Is_The_END________' > readcmds.help
  1512. XUNaXcess Read Commands
  1513. X----------------------
  1514. X
  1515. XG - Goodbye.  This command logs you out.
  1516. X
  1517. XN - Read all new messages.  This command visits every conference in order and reads the new messages in each; after each message you may continue, skip to the next conference, kill the current message, reply to it, enter a new message, unsubscribe from i
  1518.  
  1519. ts conference, or enter the Main Menu temporarily.  (Whew!)
  1520. X
  1521. XQ - Quick Scan.  Only subjects of messages are shown.  See the S command for more details.
  1522. X
  1523. XR - Read messages in the current conference.  You will be asked if you wish to read Forward, Backward, an Individual message, or New messages.  The Forward and Backward options ask for lower and upper limits.  Messages will be displayed, and you will rec
  1524.  
  1525. eive the "read loop" prompt (see the N command) after each message.
  1526. X
  1527. XS - Scan messages in the current conference.  This displays the headers (from, to, subject) of the messages.  You may read Forward, Backward, an Individual message, or New messages.  If you choose Forward or Backward, you will be asked the lower and uppe
  1528.  
  1529. r limits.
  1530. X
  1531. XX - Return to the Message Base Menu.
  1532. ________This_Is_The_END________
  1533. exit 0
  1534. --
  1535. ++Brandon (Resident Elf @ ncoast.UUCP)
  1536.  ____   ______________
  1537. /    \ / __   __   __ \   Brandon S. Allbery        <backbone>!ncoast!allbery
  1538.  ___  | /__> /  \ /  \    aXcess Co., Consulting    ncoast!allbery@Case.CSNET
  1539. /   \ | |    `--, `--,    6615 Center St. #A1-105        (...@relay.CS.NET)
  1540. |     | \__/ \__/ \__/    Mentor, OH 44060-4101     
  1541. \____/ \______________/   +1 216 781 6201
  1542.  
  1543.  
  1544.