From: danw Date: Fri, 30 Jul 1999 02:16:07 +0000 (+0000) Subject: High uids are now fair game for everyone, always. X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/658cc871e1ff44317252c9b4d1ce782192346982 High uids are now fair game for everyone, always. --- diff --git a/regtape/staff.pc b/regtape/staff.pc index aac56316..b4be2002 100644 --- a/regtape/staff.pc +++ b/regtape/staff.pc @@ -74,19 +74,17 @@ struct entry { 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 @@ -115,8 +113,6 @@ int main(int argc, char **argv) { 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 @@ -285,14 +281,10 @@ struct entry *get_next_entry(FILE *in) 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; } @@ -517,7 +509,7 @@ void newuser(struct entry *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; @@ -610,20 +602,15 @@ int set_next_users_id(int limit) 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) @@ -642,7 +629,11 @@ int set_next_uid(int high) 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) { @@ -658,9 +649,9 @@ int set_next_uid(int high) } 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);