char *address;
char *phone;
char *phone2;
- int highid;
};
struct entry *get_next_entry(FILE *in);
void process_entry(struct entry *e);
void newuser(struct entry *e);
int set_next_users_id(int limit);
-int set_next_uid(int high);
+int set_next_uid(void);
void sqlexit(void);
void dbmserr(char *where, int what);
char *whoami;
-int highid = 0;
#define sqlfail() (sqlca.sqlcode && sqlca.sqlcode != 1403)
#define SQL_DUPLICATE -2112
{
if (!strcmp(argv[i], "-w"))
wait++;
- else if (!strcmp(argv[i], "-h"))
- highid++;
else if (file)
fprintf(stderr, "Usage: %s [-w] [-D] [-n] inputfile\n", whoami);
else
e.title = strtrim(title);
e.class = "MITS";
- e.highid = highid;
if (strstr(e.title, "PROF") || strstr(e.title, "LECTURE"))
e.class = "FACULTY";
if (!strcmp(e.dept, "LINCOLN LAB"))
- {
- e.class = "LINCOLN";
- e.highid = 1;
- }
+ e.class = "LINCOLN";
return &e;
}
dept[USERS_DEPARTMENT_SIZE - 1] = '\0';
id = set_next_users_id(0);
- uid = set_next_uid(e->highid);
+ uid = set_next_uid();
sprintf(login, "#%d", uid);
last = e->last;
first = e->first;
com_err(whoami, 0, "adding user %s %s", e->first, e->last);
EXEC SQL INSERT INTO users
- (login, users_id, unix_uid, shell, last, first, middle, status,
- clearid, type, modtime, modby, modwith, fullname, office_addr,
- office_phone, department, fmodtime, fmodby, fmodwith,
+ (login, users_id, unix_uid, shell, winconsoleshell, last, first,
+ middle, status, clearid, type, modtime, modby, modwith, fullname,
+ office_addr, office_phone, department, fmodtime, fmodby, fmodwith,
potype, xname, xdept, xtitle, xaddress, xphone1, xphone2, xmodtime)
- VALUES (:login, :id, :uid, '/bin/athena/tcsh',
+ VALUES (:login, :id, :uid, '/bin/athena/tcsh', 'cmd',
NVL(:last, CHR(0)), NVL(:first, CHR(0)), NVL(:middle, CHR(0)),
:st, NVL(:sid, CHR(0)), NVL(:class, CHR(0)), SYSDATE, :who, :prog,
NVL(:fullname, CHR(0)), NVL(:oaddr, CHR(0)), NVL(:ophone, CHR(0)),
return retval;
}
-int set_next_uid(int high)
+int set_next_uid(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int flag, initial, value, retval;
char *name;
EXEC SQL END DECLARE SECTION;
- if (high)
- name = "high_uid";
- else
- name = "unix_uid";
-
EXEC SQL SELECT value INTO :initial FROM numvalues
- WHERE name = :name;
+ WHERE name = 'unix_uid';
if (sqlfail())
sqlexit();
if (sqlca.sqlerrd[2] != 1)
while (flag)
{
value++;
- if (!high && value > MAX_ID_VALUE)
+#ifdef ULTRIX_ID_HOLE
+ if (value > 31999 && value < 32768)
+ value = 32768;
+#endif
+ if (value > MAX_ID_VALUE)
value = MIN_ID_VALUE;
if (value == initial)
{
}
retval = value++;
- if (!high && value > MAX_ID_VALUE)
+ if (value > MAX_ID_VALUE)
value = MIN_ID_VALUE;
- EXEC SQL UPDATE numvalues SET value = :value WHERE name = :name;
+ EXEC SQL UPDATE numvalues SET value = :value WHERE name = 'unix_uid';
if (sqlca.sqlcode)
{
dbmserr("assigning ID", sqlca.sqlcode);