3 * This generates a master /etc/passwd containing all active (status != 0)
14 char *ingres_date_and_time();
15 char *whoami = "passwd.gen";
23 char *outf, outft[64];
25 ## char login[9], shell[33], fullname[33], oa[17], op[13], hp[17], *filetime;
26 ## int uid, error, flag;
33 if (stat(argv[1], &sb) == 0) {
34 filetime = ingres_date_and_time(sb.st_mtime);
35 ## retrieve (flag = int4(interval("min", tblstats.modtime - filetime)))
36 ## where tblstats.table = "users"
38 fprintf(stderr, "File %s does not need to be rebuilt.\n",
44 sprintf(outft, "%s~", outf);
45 if ((out = fopen(outft, "w")) == NULL) {
46 fprintf(stderr, "unable to open %s for output\n", outf);
49 } else if (argc != 1) {
50 fprintf(stderr, "usage: %s [outfile]\n", argv[0]);
56 ## set lockmode on users where readlock = nolock
58 ## range of u is users
59 ## retrieve (login = u.#login, uid = u.#uid, shell = u.#shell,
60 ## fullname = u.#fullname, oa = u.office_addr,
61 ## op = u.office_phone, hp = u.home_phone)
62 ## where u.status = 1 {
69 fprintf(out, "%s:*:%d:101:%s,%s,%s,%s:/mit/%s:%s\n",
70 login, uid, fullname, oa, op, hp, login, shell);
72 ## inquire_equel(error = "errorno")
74 fprintf(out, "Ingres error %d\n", error);
81 perror("close failed");
91 * ingerr: (supposedly) called when Ingres indicates an error.
92 * I have not yet been able to get this to work to intercept a
93 * database open error.
95 #define INGRES_DEADLOCK 4700
97 static int ingerr(num)
104 case INGRES_DEADLOCK:
105 ingres_errno = SMS_DEADLOCK;
108 ingres_errno = SMS_INGRES_ERR;
110 com_err(whoami, SMS_INGRES_ERR, " code %d\n", *num);
111 critical_alert("DCM", "Passwd build encountered INGRES ERROR %d", *num);