PWEDIT, update passwd entries

Syntax:

pwedit user1 user2 … userN
pwedit -c command
pwedit -c -

The pwedit command replaces the old vipw command. It is used to update the passwd entries for a list of users or to pass commands directly to the pwsync dæmons. If the "-c command" option is supplied, the single command is sent to the pwsync dæmons. If "-c -" is supplied, standard input is read for multiple commands. In the first form of the command where a list of users are specified, the information for these users is extracted from the pwsync database and then presented in an edit file. After editing, any changes are converted into pwsync set commands and passed to the pwsync dæmon. If there are any errors the edit file is presented again with the error messages included to allow correction. The edit file for a typical (actually, quiet atypical) user appears as:

U:4001     A:2B314469   N:noyd       P:MWlJQdaJvoxaE    G:15       C:6
 I:Steven Jones,4545 15th NE #306,5435852,5245778
 M:/bin/sh
 XA: /ux01/noyd                 /usr/local/bin/psh
 XB: /bk01/d23/noyd             /bin/csh
 XD: /da03/d01/noyd             /usr/local/bin/psh
 XE: /ux01/noyd                 /usr/local/bin/psh
 XF: /franklin01/d01/noyd       /usr/bin/csh
 XG: /u/noyd                    /bin/csh
 XH: /rc21/d42/noyd             /usr/local/bin/psh
 XI: /ux01/noyd                 /bin/csh
 XK: /hk1/noyd                  /bin/csh
 XL: /u/noyd                    /bin/csh
 XM: /ua21/d45/noyd             /usr/bin/csh
 XN: /ux01/noyd                 /bin/csh
 XP: /bp01/d61/u04001           /usr/local/bin/psh
 XQ: /mailer2/d61/u04001        /usr/local/bin/psh
 XS: /ua21/d45/noyd             /usr/bin/csh
 XV: /u/noyd                    /bin/csh
-----

The first line contains the UID, account, login id, encrypted password, GID and cflag fields. The UID cannot be changed (to change an account's UID, edit both UIDs and use copy/paste (remembering to update all the other databases)). The second line contains the gecos entry with the "I" indicator. The third line contains the global shell modifiers with the "M" indicator. The shell modifiers should be adjusted with the disuser/reuser command rather than pwedit. The shell modifiers, if any, are always followed by the dummy "/bin/sh" shell. The remainder of the lines with "Xx" are the home directory and shell for each of the clusters where this user has an account. Accounts can be deleted by removing one of these lines. If all lines from this section are removed the entire record will be removed from the pwsync database. Accounts can be created by adding a new line to this section. New ones must be added at the end or in the proper alphabetical ordering.

Pwedit generates two files, one that is given to the editor and one that is used as a reference copy. After the editor exits, pwedit compares the edited file with the reference copy to see what changed. It makes one full pass to verify that there are no syntax errors and then makes a second pass, actually sending commands to pwsync. If pwsync complains about something, pwedit will insert the command and the response into the edit file and reinvoke the editor. If multiple users are edited in the same instance of the pwedit command, the first one may work and the second one may fail. Pwedit inserts the keyword "Done" to indicate that the changes to the indicated user completed. When pwedit sees the "Done" keyword it will skip that user. Pwedit processes the following keywords:

Cluster codes

The cluster letter abbreviations currently in effect are:
     A: Aagaard                M: Mead/Goodall
     B: Becker                 N: News/Servers
     C: Carson (not used)      O: Not used
     D: Dante                  P: Bp (Dante mailer)
     E: Ep (Aagaard mailer)    Q: Mailer
     F: Franklin               R: Not used
     G: Daffy                  S: Saul
     H: Homer                  T: Not used
     I: Inpho                  U: Ashur/Nineveh
     J: Not used               V: Melville
     K: Hawking                W: Veron (Homer Web)
     L: Haley                  X: Boca (Dante Web)

     Y-Za-e: Not used

C Flags

The "C flag" is a set of bit-wise ORed flags that can be found in the /tulsa/include/uwpw.h file as PC_name. The current flags in use are:
#define PC_NOPW         0x00001 /* @ Password has not been established */
#define PC_SUPER        0x00002 /* A Super user privileged */
#define PC_RESEARCH     0x00004 /* B Has real account on mead */
#define PC_NULLPWOK     0x00008 /* C Okay to have null password */
#define PC_VALGCG       0x00010 /* D McClintock account okay */
#define PC_VALBA        0x00020 /* E Mead3 account okay */
#define PC_SHADOW       0x00040 /* F Force encrypted PW in shadow file */
/*efine PC_RESERVED     0xff000 ** L-S Reserved for shell modifiers */
/*efine PC_NOT       0xfff00f80 ** G-K,T-e Unused bits */