From: danw Date: Tue, 11 Nov 1997 23:04:18 +0000 (+0000) Subject: Remove `delete_user_by_uid' since it's never been used in any logs we have, X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/1b05b2b5dd5b220115e1ff80c58e8b26267c642e Remove `delete_user_by_uid' since it's never been used in any logs we have, and it requires special handling. A few sanity fixes to queries2.c --- diff --git a/server/qsupport.pc b/server/qsupport.pc index dbae9311..e443b849 100644 --- a/server/qsupport.pc +++ b/server/qsupport.pc @@ -69,9 +69,7 @@ int set_pobox(q, argv, cl) if (!strcmp(argv[1], "POP")) { status = name_to_id(box, MACHINE_TABLE, &id); - if (status == MR_NO_MATCH) - return(MR_MACHINE); - else if (status) + if (status) return(status); EXEC SQL UPDATE users SET potype = 'POP', pop_id = :id WHERE users_id = :user; diff --git a/server/queries2.c b/server/queries2.c index 1961e294..90ffd527 100644 --- a/server/queries2.c +++ b/server/queries2.c @@ -128,7 +128,7 @@ static struct valobj VOclu0[] = { }; static struct valobj VOsnet0[] = { - {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_CLUSTER}, + {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_SUBNET}, }; static struct valobj VOlist0[] = { @@ -139,10 +139,6 @@ static struct valobj VOfilsys0[] = { {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS}, }; -static struct valobj VOchar0[] = { - {V_CHAR, 0}, -}; - /* Validations * Commonly used validation records defined here so that they may @@ -352,7 +348,7 @@ static char *rusr_fields[] = { static struct valobj rusr_valobj[] = { {V_NUM, 0}, - {V_CHAR, 1}, + {V_CHAR, 1, USERS_TABLE, "login"}, {V_NUM, 2}, }; @@ -496,26 +492,6 @@ static struct validate dusr_validate = { 0, }; -static char *dubu_fields[] = { - "uid", -}; - -static struct valobj dubu_valobj[] = { - {V_ID, 0, USERS_TABLE, "uid", "users_id", MR_USER} -}; - -static struct validate dubu_validate = { - dubu_valobj, - 1, - 0, - 0, - 0, - 0, - 0, - setup_dusr, - 0, -}; - static char *gkum_fields[] = { "login", "kerberos", "login", "kerberos" }; @@ -2765,22 +2741,6 @@ struct query Queries2[] = { &dusr_validate, }, - { - /* Q_DUBU - DELETE_USER_BY_UID */ - "delete_user_by_uid", - "dubu", - DELETE, - "u", - USERS_TABLE, - (char *)0, - dubu_fields, - 0, - "users_id = %d", - 1, - 0, - &dubu_validate, - }, - { /* Q_GKUM - GET_KERBEROS_USER_MAP */ "get_kerberos_user_map", diff --git a/server/qvalidate.pc b/server/qvalidate.pc index 3372e5d7..70309450 100644 --- a/server/qvalidate.pc +++ b/server/qvalidate.pc @@ -206,7 +206,7 @@ int validate_id(q, argv, vo) register struct valobj *vo; { EXEC SQL BEGIN DECLARE SECTION; - char *name, *namefield, *idfield; + char *name; int id, rowcount, tbl; EXEC SQL END DECLARE SECTION; int status; @@ -214,39 +214,23 @@ int validate_id(q, argv, vo) name = argv[vo->index]; tbl = vo->table; - namefield = vo->namefield; - idfield = vo->idfield; - if ((tbl==USERS_TABLE && !strcmp(namefield, "login")) || - tbl==MACHINE_TABLE || tbl==SUBNET_TABLE || tbl==FILESYS_TABLE || - tbl==LIST_TABLE || tbl==CLUSTER_TABLE || tbl==STRINGS_TABLE) { - if (tbl==MACHINE_TABLE || tbl==SUBNET_TABLE) + if (tbl==MACHINE_TABLE || tbl==SUBNET_TABLE) for (c = name; *c; c++) if (islower(*c)) *c = toupper(*c); - status = name_to_id(name, tbl, &id); - if (status == 0) { + status = name_to_id(name, tbl, &id); + if (status == 0) { *(int *)argv[vo->index] = id; return(MR_EXISTS); - } else if (status == MR_NO_MATCH && tbl==STRINGS_TABLE && - (q->type == APPEND || q->type == UPDATE)) { + } else if (status == MR_NO_MATCH && tbl==STRINGS_TABLE && + (q->type == APPEND || q->type == UPDATE)) { id=add_string(name); cache_entry(name, STRINGS_TABLE, id); *(int *)argv[vo->index] = id; return(MR_EXISTS); - } else if (status == MR_NO_MATCH || status == MR_NOT_UNIQUE) + } else if (status == MR_NO_MATCH || status == MR_NOT_UNIQUE) return(vo->error); - else + else return(status); - } else { - /* else, it's `dubu', which uses unix_uid from users */ - EXEC SQL SELECT COUNT(*) INTO :rowcount FROM users - WHERE unix_uid = :name; - if (dbms_errno) return(mr_errcode); - if (rowcount != 1) return(vo->error); - EXEC SQL SELECT users_id INTO :id FROM users - WHERE unix_uid = :name; - *(int *)argv[vo->index] = id; - return(MR_EXISTS); - } } int validate_name(argv, vo)