3 * This generates a master /etc/passwd containing all active (status != 0)
6 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
7 * For copying and distribution information, please see the file
11 #include <mit-copyright.h>
14 #include <sys/types.h>
19 char *ingres_date_and_time();
20 char *whoami = "passwd.gen";
28 char *outf, outft[64];
30 ## char login[9], shell[33], fullname[33], oa[17], op[13], hp[17], *filetime;
32 ## int uid, error, flag;
37 ## set lockmode session where level = table
40 if (stat(argv[1], &sb) == 0) {
41 filetime = ingres_date_and_time(sb.st_mtime);
42 ## retrieve (flag = int4(interval("min", tblstats.modtime - filetime)))
43 ## where tblstats.table = "users"
45 fprintf(stderr, "File %s does not need to be rebuilt.\n",
51 sprintf(outft, "%s~", outf);
52 if ((out = fopen(outft, "w")) == NULL) {
53 fprintf(stderr, "unable to open %s for output\n", outf);
56 } else if (argc != 1) {
57 fprintf(stderr, "usage: %s [outfile]\n", argv[0]);
63 ## range of u is users
64 ## retrieve (login = u.#login, uid = u.#uid, shell = u.#shell,
65 ## fullname = u.#fullname, oa = u.office_addr,
66 ## nickname = u.#nickname,
67 ## op = u.office_phone, hp = u.home_phone)
68 ## where u.status = 1 {
76 fprintf(out, "%s:*:%d:101:%s,%s,%s,%s,%s:/mit/%s:%s\n",
77 login, uid, fullname, nickname, oa, op, hp, login, shell);
79 ## inquire_equel(error = "errorno")
81 fprintf(out, "Ingres error %d\n", error);
88 perror("close failed");
98 * ingerr: (supposedly) called when Ingres indicates an error.
99 * I have not yet been able to get this to work to intercept a
100 * database open error.
102 #define INGRES_DEADLOCK 4700
104 static int ingerr(num)
111 case INGRES_DEADLOCK:
112 ingres_errno = SMS_DEADLOCK;
115 ingres_errno = SMS_INGRES_ERR;
117 com_err(whoami, SMS_INGRES_ERR, " code %d\n", *num);
118 critical_alert("DCM", "Passwd build encountered INGRES ERROR %d", *num);