home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / unaxcess / part3 / user.c < prev   
Encoding:
C/C++ Source or Header  |  1986-11-30  |  16.5 KB  |  620 lines

  1. /*
  2.  * %W% %E% %U% ncoast!bsa %Z%
  3.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  4.  */
  5.  
  6. #ifndef lint
  7. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  8. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  9. #endif  lint
  10.  
  11. #include "ua.h"
  12.  
  13. struct user user;
  14. struct _himsg *hicnts;
  15.  
  16. getuser(name, buf)
  17.     char *name;
  18.     struct user *buf;
  19.     {
  20.     FILE *bfd;
  21.     char line[1024], lcuname[33], *p, *q;
  22.  
  23.     if ((bfd = fopen(PASSWD, "r")) == NULL)
  24.     {
  25.     log("Error %d opening %s", errno, PASSWD);
  26.     panic("passwd");
  27.     }
  28.     for (p = name, q = lcuname; *p != '\0' && p - name <= 32; p++, q++)
  29.     *q = ToLower(*p);
  30.     *q = '\0';
  31.     while (fgets(line, sizeof line, bfd) != NULL)
  32.     if (strncmp(line, lcuname, strlen(lcuname)) == 0 && line[strlen(lcuname)] == ':')
  33.         {
  34.         fclose(bfd);
  35.         buf->u_name[0] = '\0';
  36.         buf->u_pass[0] = '\0';
  37.         buf->u_access = 0;
  38.         buf->u_login[0] = '\0';
  39.         buf->u_llen = 0;
  40.         buf->u_nbull = 0;
  41.         buf->u_lconf[0] = '\0';
  42. #ifndef SYS3
  43.         /* jpn - this used to be a scanf that didn't work on BSD */
  44.         pwparse(line, buf);
  45. #else
  46.         sscanf(line, "%[^:]:%[^:]:%hd:%[^:]:%hd:%hd:%[^:]", buf->u_name, buf->u_pass, &buf->u_access, buf->u_login, &buf->u_llen, &buf->u_nbull, buf->u_lconf);
  47. #endif
  48.         buf->u_lconf[strlen(buf->u_lconf) - 1] = '\0';
  49.         return 1;
  50.         }
  51.     fclose(bfd);
  52.     return 0;
  53.     }
  54.  
  55. #ifndef SYS3
  56. pwparse(line, buf)
  57. char *line;
  58. struct user *buf;
  59.     {
  60.     char *index();
  61.     register char *p;
  62.  
  63.     /* jpn - this used to be a single scanf that didn't work on BSD */
  64.     /* because the %[ format MUST match one character to succeed */
  65.     p = line;
  66.     sscanf(p, "%[^:]", buf->u_name);
  67.     if ((p = index(p, ':')) == 0) return; else ++p;
  68.     sscanf(p, "%[^:]", buf->u_pass);
  69.     if ((p = index(p, ':')) == 0) return; else ++p;
  70.     sscanf(p, "%hd", &buf->u_access);
  71.     if ((p = index(p, ':')) == 0) return; else ++p;
  72.     sscanf(p, "%[^:]", buf->u_login);
  73.     if ((p = index(p, ':')) == 0) return; else ++p;
  74.     sscanf(p, "%hd", &buf->u_llen);
  75.     if ((p = index(p, ':')) == 0) return; else ++p;
  76.     sscanf(p, "%hd", &buf->u_nbull);
  77.     if ((p = index(p, ':')) == 0) return; else ++p;
  78.     sscanf(p, "%[^:]", buf->u_lconf);
  79.     }
  80. #endif
  81.  
  82. putuser(name, ubuf)
  83.     char *name;
  84.     struct user *ubuf;
  85.     {
  86.     FILE *fd, *tfd;
  87.     char line[1024], *tempfile = mktemp("/tmp/UptXXXXXX"), lcname[33], *p, *q;
  88.     static char lockfile[] = "userfil.lock";
  89.     short flag;
  90.  
  91.     CRIT();
  92.     mklock(lockfile);
  93.     if ((fd = fopen(PASSWD, "r")) == NULL)
  94.     {
  95.     log("Error %d opening %s", errno, PASSWD);
  96.     panic("passwd");
  97.     }
  98.     if ((tfd = fopen(tempfile, "w")) == NULL)
  99.     {
  100.     log("Error %d opening %s", errno, tempfile);
  101.     panic("tmp");
  102.     }
  103.     flag = 0;
  104.     for (p = name, q = lcname; *p != '\0' && p - name < 33; p++, q++)
  105.     *q = ToLower(*p);
  106.     *q = 0;
  107.     while (fgets(line, sizeof line, fd) != NULL)
  108.     if (strncmp(line, lcname, strlen(lcname)) == 0 && line[strlen(lcname)] == ':')
  109.         {
  110.         fprintf(tfd, "%s:%s:%d:%s:%d:%d:%s\n", ubuf->u_name, ubuf->u_pass, ubuf->u_access, ubuf->u_login, ubuf->u_llen, (s_cmp(ubuf->u_name, "guest") == 0? 0: ubuf->u_nbull), (s_cmp(ubuf->u_name, "guest") == 0? "": ubuf->u_lconf));
  111.         flag++;
  112.         }
  113.     else
  114.         fputs(line, tfd);
  115.     if (!flag)
  116.     fprintf(tfd, "%s:%s:%d:%s:%d:%d:%s\n", ubuf->u_name, ubuf->u_pass, ubuf->u_access, ubuf->u_login, ubuf->u_llen, (s_cmp(ubuf->u_name, "guest") == 0? 0: ubuf->u_nbull), (s_cmp(ubuf->u_name, "guest") == 0? "": ubuf->u_lconf));
  117.     fclose(fd);
  118.     fclose(tfd);
  119.     unlink(PASSWD);
  120.     if (copylink(tempfile, PASSWD) < 0)
  121.     {
  122.     log("Error %d copylinking %s to %s", errno, tempfile, PASSWD);
  123.     panic("copylink");
  124.     }
  125.     unlink(tempfile);
  126.     rmlock(lockfile);
  127.     NOCRIT();
  128.     }
  129.  
  130. writehigh(hilist)
  131.     struct _himsg *hilist;
  132.     {
  133.     FILE *hp, *f;
  134.     static char line[1024], hirec[1024];    /* 68000's have limited frames */
  135.     char *tmpf = mktemp("/tmp/RcXXXXXX");
  136.     char *eofflag;
  137.     static char lockfile[] = "newmsgs.lock";
  138.     struct _himsg *hptr;
  139.  
  140.     if (s_cmp(user.u_name, "guest") == 0)
  141.         return;    /* don't write GUEST hirecs! */
  142.     CRIT();
  143.     if ((f = fopen(tmpf, "w")) == NULL)
  144.     {
  145.     log("Error %d opening %s", errno, tmpf);
  146.     panic("tmp");
  147.     }
  148.     if ((hp = fopen(NEWMSGS, "r")) == NULL)
  149.     {
  150.     log("Error %d opening %s", errno, NEWMSGS);
  151.     fclose(f);
  152.     unlink(tmpf);
  153.     panic("userind");
  154.     }
  155.     mklock(lockfile);
  156.     sprintf(line, "%s:", user.u_name);
  157.     while ((eofflag = fgets(hirec, sizeof hirec, hp)) != NULL) {
  158.     if (strncmp(hirec, line, strlen(line)) == 0)
  159.         break;
  160.     fputs(hirec, f);
  161.     }
  162.     if (!eofflag)
  163.         while ((eofflag = fgets(hirec, sizeof hirec, hp)) != NULL)
  164.             if (hirec[0] != '\t' && hirec[0] != ' ')
  165.                    break;
  166.     fputs(line, f);
  167.     putc('\n', f);
  168.     for (hptr = hilist; hptr != NULL; hptr = hptr->hi_next)
  169.         fprintf(f, "\t%s%c %d\n", hptr->hi_conf, (hptr->hi_uns == HI_UNSUB? '!': ':'), hptr->hi_num);
  170.     if (!eofflag && hirec[0] != '\t' && hirec[0] != ' ')
  171.         fputs(hirec, f);
  172.     if (!eofflag)
  173.         while (fgets(hirec, sizeof hirec, hp) != NULL)
  174.             fputs(hirec, f);
  175.     fclose(f);
  176.     fclose(hp);
  177.     unlink(NEWMSGS);
  178.     if (copylink(tmpf, NEWMSGS) < 0)
  179.     {
  180.     log("Error %d copylinking %s to %s", errno, tmpf, NEWMSGS);
  181.     panic("copylink");
  182.     }
  183.     unlink(tmpf);
  184.     rmlock(lockfile);
  185.     NOCRIT();
  186.     }
  187.  
  188. struct _himsg *readhigh(foruser)
  189.     struct user *foruser;
  190.     {
  191.     static char hirec[1024];
  192.     char uidx[40], *p, *q;
  193.     FILE *f;
  194.     struct _himsg *workp, *initp, *lastp;
  195.  
  196.     strcpy(uidx, foruser->u_name);
  197.     strcat(uidx, ":");
  198.     if ((f = fopen(NEWMSGS, "r")) == NULL)
  199.     return NULL;
  200.     while (fgets(hirec, sizeof hirec, f) != NULL)
  201.     if (strncmp(hirec, uidx, strlen(uidx)) == 0)
  202.         break;
  203.     if (feof(f))
  204.     {
  205.     fclose(f);
  206.     return NULL;
  207.     }
  208.     workp = NULL;
  209.     initp = NULL;
  210.     while (fgets(hirec, sizeof hirec, f) != NULL && (hirec[0] == ' ' || hirec[0] == '\t')) {
  211.         hirec[strlen(hirec) - 1] = '\0';
  212.     for (p = hirec; *p == ' ' || *p == '\t'; p++)
  213.             ;
  214.         for (q = uidx; *p != ' ' && *p != '\t' && *p != '\0' && *p != ':' && *p != '!'; p++)
  215.         *q++ = *p;
  216.     *q = '\0';
  217.     while (*p == ' ' || *p == '\t')
  218.         p++;
  219.         if (*p == '!') {    /* unsubscribed... */
  220.         if ((workp = (struct _himsg *) calloc((unsigned) 1, sizeof (struct _himsg))) == NULL)
  221.             {
  222.             log("Error %d allocating _himsg for %s", errno, uidx);
  223.             panic("alloc");
  224.             }
  225.         strcpy(workp->hi_conf, uidx);
  226.         workp->hi_num = atoi(++p);
  227.         workp->hi_next = initp;
  228.         workp->hi_uns = HI_UNSUB;
  229.         initp = workp;
  230.         continue;
  231.         }
  232.     if (*p != ':') {
  233.         log("Invalid format of userind record: ``%s''", hirec);
  234.         puts("Your index is garbled; some conference\nhigh-message counts may be lost.");
  235.         break;
  236.     }
  237.     if ((workp = (struct _himsg *) calloc((unsigned) 1, sizeof (struct _himsg))) == NULL)
  238.         {
  239.         log("Error %d allocating _himsg for %s", errno, uidx);
  240.         panic("alloc");
  241.         }
  242.     strcpy(workp->hi_conf, uidx);
  243.     workp->hi_num = atoi(++p);
  244.     workp->hi_next = initp;
  245.     workp->hi_uns = HI_SUBSCR;
  246.     initp = workp;
  247.     }
  248.     fclose(f);
  249.     return initp;
  250.     }
  251.  
  252. newuser()
  253.     {
  254.     struct user nubuf, junk;
  255.     char line[256], *p;
  256.  
  257.     log("Entered newuser module.");
  258.     cat(NEWUSER);
  259.  
  260. Again:
  261.     printf("\nDo you still want to become a user (N)? ");
  262.     gets(line);
  263.     log("Become user? %s", line);
  264.     if (ToLower(line[0]) != 'y')
  265.     return;
  266.     do
  267.     {
  268.     printf("What name would you like to use on this system?  It should not be\nmore than 32 letters long: ");
  269.     gets(line);
  270.     log("Name: %s", line);
  271.     if (line[0] == '\0' || line[0] == ' ')
  272.         {
  273.         line[0] = '?';
  274.         p = line;
  275.         continue;
  276.         }
  277.     for (p = line; *p != '\0'; p++)
  278.         if (*p == ':')
  279.         {
  280.         puts("Sorry, no colons allowed; they cause nasty surprises.");
  281.         log("Illegal colon in name");
  282.         break;
  283.         }
  284.     }
  285.     while (*p != NULL);
  286.     strncpy(nubuf.u_name, line, 32);
  287.     nubuf.u_name[32] = '\0';
  288.     line[0] = '\0';
  289.     do
  290.     {
  291.     if (line[0] != 0)
  292.         puts("You made a typing error.");
  293.     strcpy(line, getpass("Please enter a password of three to eight characters.\nIt will not be displayed: "));
  294.     log("Pass: %s", line);
  295.     }
  296.     while (strlen(line) < 3 || strcmp(line, getpass("Please re-enter it, just to make sure: ")) != 0);
  297.     strcpy(nubuf.u_pass, line);
  298.     do
  299.     {
  300.     printf("How many characters per line are on your terminal?\nPlease enter a number from 40 to 132, or <ENTER> for 80: ");
  301.     gets(line);
  302.     log("Line: %s", line);
  303.     if (line[0] == '\0')
  304.         nubuf.u_llen = 80;
  305.     else
  306.         nubuf.u_llen = atoi(line);
  307.     }
  308.     while (nubuf.u_llen < 40 || nubuf.u_llen > 132);
  309.     printf("\nName:\t%s\nPass:\t%s\nLine:\t%d\n\nIs this correct (N)? ", nubuf.u_name, nubuf.u_pass, nubuf.u_llen);
  310.     gets(line);
  311.     log("Okay? %s", line);
  312.     if (ToLower(line[0]) != 'y')
  313.     goto Again;
  314.     puts("Encrypting password, please wait...");
  315.     strcpy(nubuf.u_pass, crypt(nubuf.u_pass, nubuf.u_pass) + 2);
  316.     strcpy(nubuf.u_login, user.u_login);/* default login name ( guest ?) */
  317.     nubuf.u_access = user.u_llen;    /* since we don't use u_llen here */
  318.     nubuf.u_nbull = 0;            /* no bulletins read yet */
  319.     puts("Recording user information...");
  320.     for (p = nubuf.u_name; *p != '\0'; p++)
  321.     *p = ToLower(*p);
  322.     if (getuser(nubuf.u_name, &junk))
  323.     {
  324.     puts("Sorry, but that name's already in use.  Please choose another.");
  325.     goto Again;
  326.     }
  327.     putuser(nubuf.u_name, &nubuf);
  328.     user = nubuf;
  329.     }
  330.  
  331. userctl(s)
  332.     char *s;
  333.     {
  334.     char line[256], *p, *q;
  335.     struct user ubuf;
  336.     short cflag, pflag;
  337.  
  338.     if (user.u_access != A_WITNESS)
  339.     {
  340.     if (strcmp(user.u_name, "guest") == 0) {
  341.         log("Security violation:  userctl by GUEST");
  342.         puts("Sorry, but GUEST can't change himself.");
  343.         return 1;
  344.     }
  345.     pflag = 1;
  346.     log("Userctl by non-Witness; restricting control modes.");
  347.     puts("Since you're not a Fairwitness, you can only change some things about\nyourself, like your password.");
  348.     strcpy(line, user.u_name);
  349.     }
  350.     else
  351.     {
  352.     line[0] = '\0';
  353.     pflag = 0;
  354.     for (p = s; *p != '\0'; p++)
  355.         if (*p == ' ')
  356.         {
  357.         strcpy(line, ++p);
  358.         break;
  359.         }
  360.     if (line[0] == '\0')
  361.         {
  362.         printf("Examine which user: ");
  363.         gets(line);
  364.         log("User: %s", line);
  365.         if (line[0] == '\0')
  366.         return 1;
  367.         for (p = line; *p != '\0'; p++)
  368.         *p = ToLower(*p);
  369.         }
  370.     line[32] = '\0';
  371.     }
  372.     if (!getuser(line, &ubuf))
  373.     if (pflag)
  374.         {
  375.         log("Can't locate current user in the userfile.");
  376.         panic("user");
  377.         }
  378.     else
  379.         {
  380.         printf("No such user.  Create him (N)? ");
  381.         strcpy(ubuf.u_name, line);
  382.         gets(line);
  383.         log("New user? %s", line);
  384.         if (ToLower(line[0]) != 'y')
  385.         return 1;
  386.         ubuf.u_pass[0] = '\0';
  387.         ubuf.u_access = A_USER;
  388.         ubuf.u_llen = 80;
  389.         ubuf.u_nbull = 0;
  390.         cflag = 0;
  391.         }
  392.     else if (strlen(ubuf.u_pass) == 0)
  393.     cflag = 0;
  394.     else
  395.     cflag = 1;
  396.     for (;;)
  397.     {
  398.     printf("\nName:\t%s\nPass:\t%s%s\nAccess:\t%s\nLogin:\t%s\n%s:\t%d\nLogin conference: %s\n\nChange Name, Pass, Access, Login, %s,\nDefault Login Conference; Quit; or Save: ", ubuf.u_name, ubuf.u_pass,
  399.         (cflag? " (encrypted)": ""), (ubuf.u_access==A_NONE? "None": (ubuf.u_access==A_GUEST? "Guest": (ubuf.u_access==A_USER? "Ordinary user": (ubuf.u_access==A_SYSTEM? "System": (ubuf.u_access==A_FILES? "Files":
  400.         (ubuf.u_access==A_WITNESS? "Fairwitness": "User maker")))))), ubuf.u_login, (ubuf.u_access==A_MKUSER? "DftAxs": "Width"), ubuf.u_llen, ubuf.u_lconf, (ubuf.u_access==A_MKUSER? "Default Access": "Width"));
  401.     gets(line);
  402.     log("Change: %s", line);
  403.     switch (line[0])
  404.         {
  405.         case 'N':
  406.         case 'n':
  407.         if (pflag)
  408.             {
  409.             log("Security violation: Attempted to change name.");
  410.             puts("You can't do that.");
  411.             break;
  412.             }
  413.         printf("Enter new name: ");
  414.         gets(line);
  415.         log("Name: %s", line);
  416.         if (line[0] == '\0')
  417.             break;
  418.         for (p = line; *p != '\0'; p++)
  419.             if (*p == ':')
  420.             {
  421.             log("Illegal colon in name.");
  422.             puts("Can't put a colon in a user name.");
  423.             break;
  424.             }
  425.         for (p = line, q = ubuf.u_name; *p != '\0'; p++, q++)
  426.             *q = ToLower(*p);
  427.         *q = '\0';
  428.         break;
  429.         case 'P':
  430.         case 'p':
  431.         strcpy(line, getpass("Enter new password: "));
  432.         if (line[0] == '\0')
  433.             break;
  434.         strcpy(ubuf.u_pass, line);
  435.         cflag = 0;        /* it's not encrypted now */
  436.         break;
  437.         case 'A':
  438.         case 'a':
  439.         if (pflag)
  440.             {
  441.             log("Security violation: Attempted to change access level.");
  442.             puts("You can't do that.");
  443.             break;
  444.             }
  445.         printf("Access: None, Guest, User, Files, System, Witness, Makeuser? ");
  446.         gets(line);
  447.         log("Access: %s", line);
  448.         if ((ToLower(line[0]) == 'a' || ubuf.u_access == A_WITNESS) && strcmp(user.u_name, SYSOP) != 0)
  449.             {
  450.             puts("Sorry, only the sysop can administer Witness privileges.");
  451.             log("Security violation: WITNESS administering WITNESS");
  452.             break;
  453.             }
  454.         switch (line[0])
  455.             {
  456.             case 'g':
  457.             case 'G':
  458.             ubuf.u_access = A_GUEST;
  459.             break;
  460.             case 'n':
  461.             case 'N':
  462.             ubuf.u_access = A_NONE;
  463.             break;
  464.             case '\0':
  465.             break;
  466.             case 'u':
  467.             case 'U':
  468.             ubuf.u_access = A_USER;
  469.             break;
  470.             case 's':
  471.             case 'S':
  472.             ubuf.u_access = A_SYSTEM;
  473.             break;
  474.             case 'w':
  475.             case 'W':
  476.             ubuf.u_access = A_WITNESS;
  477.             break;
  478.             case 'm':
  479.             case 'M':
  480.             ubuf.u_access = A_MKUSER;
  481.             break;
  482.             case 'f':
  483.             case 'F':
  484.                 ubuf.u_access = A_FILES;
  485.                 break;
  486.             default:
  487.             puts("What?  Access unchanged.");
  488.             }
  489.         break;
  490.         case 'L':
  491.         case 'l':
  492.         printf("Enter the login name to be used: ");
  493.         gets(line);
  494.         log("Login name: %s", line);
  495.         line[8] = '\0';
  496.         strcpy(ubuf.u_login, line);
  497.         break;
  498.             case 'D':
  499.             case 'd':
  500.                 printf("Enter the default login conference: ");
  501.                 gets(line);
  502.                 log("Login conference: %s", line);
  503.                 if (!isconf(line))
  504.                     puts("That conference doesn't exist.");
  505.                 else if (uisunsub(ubuf.u_name, line))
  506.                     printf("%s isn't subscribed to %s.\n", ubuf.u_name, line);
  507.                 else
  508.                     strcpy(ubuf.u_lconf, line);
  509.                 break;
  510.         case 'W':
  511.         case 'w':
  512.         if (ubuf.u_access == A_MKUSER) {
  513.             printf("Default Access: None, Guest, User, Files, System? ");
  514.             gets(line);
  515.             log("DftAxs: %s", line);
  516.             if (ToLower(line[0]) == 'a') {
  517.                 puts("I don't think you really want to make every user a Fairwitness.");
  518.                 log("Security violation: DftAxs == A_WITNESS?");
  519.                 break;
  520.             }
  521.             switch (line[0]) {
  522.                 case 'g':
  523.                 case 'G':
  524.                 ubuf.u_llen = A_GUEST;
  525.                 break;
  526.                 case 'n':
  527.                 case 'N':
  528.                 ubuf.u_llen = A_NONE;
  529.                 break;
  530.                 case '\0':
  531.                 break;
  532.                 case 'u':
  533.                 case 'U':
  534.                 ubuf.u_llen = A_USER;
  535.                 break;
  536.                 case 's':
  537.                 case 'S':
  538.                 ubuf.u_access = A_SYSTEM;
  539.                 break;
  540.                 case 'm':
  541.                 case 'M':
  542.                 puts("Default access is user maker???");
  543.                 log("Attempted to make default access == MAKEUSER?");
  544.                 break;
  545.                 case 'f':
  546.                 case 'F':
  547.                     ubuf.u_access = A_FILES;
  548.                     break;
  549.                 default:
  550.                 puts("What?  Default access unchanged.");
  551.             }
  552.         }
  553.         else {
  554.             printf("Enter new line length, 40-132: ");
  555.             gets(line);
  556.             log("Line length: %s", line);
  557.             if (line[0] == '\0')
  558.                 break;
  559.             ubuf.u_llen = atoi(line);
  560.         }
  561.         break;
  562.         case 'Q':
  563.         case 'q':
  564.         printf("Abort user examine, are you sure (N)? ");
  565.         gets(line);
  566.         log("Abort? %s", line);
  567.         if (ToLower(line[0]) != 'y')
  568.             break;
  569.         return 1;
  570.         case 'S':
  571.         case 's':
  572.         if (!cflag)
  573.             {
  574.             puts("Encrypting password, please wait...");
  575.             strcpy(ubuf.u_pass, crypt(ubuf.u_pass, ubuf.u_pass) + 2);
  576.             }
  577.         putuser(ubuf.u_name, &ubuf);
  578.         if (strcmp(ubuf.u_name, user.u_name) == 0)
  579.             user = ubuf;
  580.         return 1;
  581.         default:
  582.         puts("What?  Please enter one of N, P, L, A, D, or S.");
  583.         }
  584.     }
  585.     }
  586.  
  587. userlist()
  588.     {
  589.     FILE *bfd;
  590.     char line[1024], *p;
  591.     short lcnt;
  592.     struct user buf;
  593.  
  594.     if ((bfd = fopen(PASSWD, "r")) == NULL)
  595.     {
  596.     log("Error %d opening %s", errno, PASSWD);
  597.     panic("passwd");
  598.     }
  599.     puts("\nList of UNaXcess users:\n");
  600.     lcnt = 0;
  601.     while (fgets(line, 1024, bfd) != NULL)
  602.     {
  603. #ifndef SYS3
  604.     pwparse(line, &buf);
  605. #else
  606.     sscanf(line, "%[^:]:%[^:]:%hd:%[^:]:%hd", buf.u_name, buf.u_pass, &buf.u_access, buf.u_login, &buf.u_llen);
  607. #endif
  608.     for (p = buf.u_name; *p != NULL; p++)
  609.         *p = ToUpper(*p);
  610.     printf("%-32.32s Access: %s\n", buf.u_name, (buf.u_access==A_NONE?
  611.         "None": (buf.u_access==A_GUEST? "Guest": (buf.u_access==A_USER?
  612.         "Normal": (buf.u_access==A_WITNESS? "Fairwitness": (buf.u_access==A_SYSTEM? "System": (user.u_access==A_FILES? "Files": "(make a user)")))))));
  613.     if (++lcnt % 16 == 0)
  614.         if (!cont())
  615.         break;
  616.     }
  617.     fclose(bfd);
  618.     return 1;
  619.     }
  620.