* the table whose name field matches argv[0].
*/
-int set_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_modtime(struct query *q, char *argv[], client *cl)
{
- char *name, *entity, *table;
- int who;
+ char *name, *entity, *table;
+ int who;
- entity = cl->entity;
- who = cl->client_id;
- table = table_name[q->rtable];
- name = argv[0];
+ entity = cl->entity;
+ who = cl->client_id;
+ table = table_name[q->rtable];
+ name = argv[0];
- sprintf(stmt_buf,"UPDATE %s SET modtime = SYSDATE, modby = %d, modwith = '%s' WHERE name = '%s'",table,who,entity,name);
- EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
+ sprintf(stmt_buf, "UPDATE %s SET modtime = SYSDATE, modby = %d, "
+ "modwith = '%s' WHERE name = '%s'", table, who, entity, name);
+ EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
/* generic set_modtime_by_id routine. This takes the table id from
* the table whose id matches argv[0].
*/
-int set_modtime_by_id(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_modtime_by_id(struct query *q, char *argv[], client *cl)
{
- char *entity, *table, *id_name;
- int who, id;
-
- entity = cl->entity;
- who = cl->client_id;
- table = table_name[q->rtable];
- id_name = q->validate->object_id;
-
- id = *(int *)argv[0];
- sprintf(stmt_buf,"UPDATE %s SET modtime = SYSDATE, modby = %d, \
-modwith = '%s' WHERE %s = %d",table,who,entity,id_name,id);
- EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
- return(MR_SUCCESS);
+ char *entity, *table, *id_name;
+ int who, id;
+
+ entity = cl->entity;
+ who = cl->client_id;
+ table = table_name[q->rtable];
+ id_name = q->validate->object_id;
+
+ id = *(int *)argv[0];
+ sprintf(stmt_buf, "UPDATE %s SET modtime = SYSDATE, modby = %d, "
+ "modwith = '%s' WHERE %s = %d", table, who, entity, id_name, id);
+ EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
+ return MR_SUCCESS;
}
/* Sets the finger modtime on a user record. The users_id will be in argv[0].
*/
-int set_finger_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_finger_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int users_id, who;
- char *entity;
- EXEC SQL END DECLARE SECTION;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int users_id, who;
+ char *entity;
+ EXEC SQL END DECLARE SECTION;
- entity = cl->entity;
- who = cl->client_id;
- users_id = *(int *)argv[0];
+ entity = cl->entity;
+ who = cl->client_id;
+ users_id = *(int *)argv[0];
- EXEC SQL UPDATE users SET fmodtime=SYSDATE, fmodby = :who,
- fmodwith = :entity WHERE users_id = :users_id;
+ EXEC SQL UPDATE users SET fmodtime = SYSDATE, fmodby = :who,
+ fmodwith = :entity WHERE users_id = :users_id;
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
/* Sets the pobox modtime on a user record. The users_id will be in argv[0].
*/
-int set_pobox_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_pobox_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int users_id, who;
- char *entity;
- EXEC SQL END DECLARE SECTION;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int users_id, who;
+ char *entity;
+ EXEC SQL END DECLARE SECTION;
- entity = cl->entity;
- who = cl->client_id;
- users_id = *(int *)argv[0];
+ entity = cl->entity;
+ who = cl->client_id;
+ users_id = *(int *)argv[0];
- EXEC SQL UPDATE users SET pmodtime=SYSDATE, pmodby = :who,
- pmodwith = :entity WHERE users_id = :users_id;
+ EXEC SQL UPDATE users SET pmodtime = SYSDATE, pmodby = :who,
+ pmodwith = :entity WHERE users_id = :users_id;
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
/* Like set_modtime, but uppercases the name first.
*/
-int set_uppercase_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_uppercase_modtime(struct query *q, char *argv[], client *cl)
{
- char *name, *entity, *table;
- int who;
+ char *name, *entity, *table;
+ int who;
- entity = cl->entity;
- who = cl->client_id;
- table = table_name[q->rtable];
- name = argv[0];
+ entity = cl->entity;
+ who = cl->client_id;
+ table = table_name[q->rtable];
+ name = argv[0];
- sprintf(stmt_buf,"UPDATE %s SET modtime = SYSDATE, modby = %d, modwith = '%s' WHERE name = UPPER('%s')",table,who,entity,name);
- EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
+ sprintf(stmt_buf, "UPDATE %s SET modtime = SYSDATE, modby = %d, "
+ "modwith = '%s' WHERE name = UPPER('%s')", table, who, entity, name);
+ EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
* operates on is "mcm", not "machine".
*/
-int set_mach_modtime_by_id(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_mach_modtime_by_id(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *entity;
- int who, id;
- EXEC SQL END DECLARE SECTION;
-
- entity = cl->entity;
- who = cl->client_id;
- id = *(int *)argv[0];
- EXEC SQL UPDATE machine SET modtime=SYSDATE, modby = :who,
- modwith = :entity WHERE mach_id = :id;
-
- return(MR_SUCCESS);
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *entity;
+ int who, id;
+ EXEC SQL END DECLARE SECTION;
+
+ entity = cl->entity;
+ who = cl->client_id;
+ id = *(int *)argv[0];
+ EXEC SQL UPDATE machine SET modtime = SYSDATE, modby = :who,
+ modwith = :entity WHERE mach_id = :id;
+
+ return MR_SUCCESS;
}
* table that query operates on is "svc", not "cluster".
*/
-int set_cluster_modtime_by_id(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_cluster_modtime_by_id(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *entity;
- int who, id;
- EXEC SQL END DECLARE SECTION;
-
- entity = cl->entity;
- who = cl->client_id;
-
- id = *(int *)argv[0];
- EXEC SQL UPDATE clusters SET modtime=SYSDATE, modby = :who,
- modwith = :entity WHERE clu_id = :id;
- return(MR_SUCCESS);
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *entity;
+ int who, id;
+ EXEC SQL END DECLARE SECTION;
+
+ entity = cl->entity;
+ who = cl->client_id;
+
+ id = *(int *)argv[0];
+ EXEC SQL UPDATE clusters SET modtime = SYSDATE, modby = :who,
+ modwith = :entity WHERE clu_id = :id;
+ return MR_SUCCESS;
}
* and the mach_id is in argv[1].
*/
-int set_serverhost_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_serverhost_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *entity, *serv;
- int who, id;
- EXEC SQL END DECLARE SECTION;
-
- entity = cl->entity;
- who = cl->client_id;
-
- serv = argv[0];
- id = *(int *)argv[1];
- EXEC SQL UPDATE serverhosts
- SET modtime = SYSDATE, modby = :who, modwith = :entity
- WHERE service = :serv AND mach_id = :id;
- return(MR_SUCCESS);
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *entity, *serv;
+ int who, id;
+ EXEC SQL END DECLARE SECTION;
+
+ entity = cl->entity;
+ who = cl->client_id;
+
+ serv = argv[0];
+ id = *(int *)argv[1];
+ EXEC SQL UPDATE serverhosts
+ SET modtime = SYSDATE, modby = :who, modwith = :entity
+ WHERE service = :serv AND mach_id = :id;
+ return MR_SUCCESS;
}
* directory name is in argv[1].
*/
-int set_nfsphys_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_nfsphys_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *entity, *dir;
- int who, id;
- EXEC SQL END DECLARE SECTION;
-
- entity = cl->entity;
- who = cl->client_id;
-
- id = *(int *)argv[0];
- dir = argv[1];
- EXEC SQL UPDATE nfsphys SET modtime = SYSDATE, modby = :who,
- modwith = :entity WHERE dir = :dir AND mach_id = :id;
- return(MR_SUCCESS);
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *entity, *dir;
+ int who, id;
+ EXEC SQL END DECLARE SECTION;
+
+ entity = cl->entity;
+ who = cl->client_id;
+
+ id = *(int *)argv[0];
+ dir = argv[1];
+ EXEC SQL UPDATE nfsphys SET modtime = SYSDATE, modby = :who,
+ modwith = :entity WHERE dir = :dir AND mach_id = :id;
+ return MR_SUCCESS;
}
* label.
*/
-int set_filesys_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_filesys_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *label, *entity;
- int who;
- extern int _var_phys_id;
-
- EXEC SQL END DECLARE SECTION;
-
- entity = cl->entity;
- who = cl->client_id;
-
- label = argv[0];
- if (!strcmp(q->shortname, "ufil"))
- label = argv[1];
-
- EXEC SQL UPDATE filesys SET modtime = SYSDATE, modby = :who,
- modwith = :entity, phys_id = :_var_phys_id
- WHERE label = :label;
- return(MR_SUCCESS);
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *label, *entity;
+ int who;
+ extern int _var_phys_id;
+ EXEC SQL END DECLARE SECTION;
+
+ entity = cl->entity;
+ who = cl->client_id;
+
+ label = argv[0];
+ if (!strcmp(q->shortname, "ufil"))
+ label = argv[1];
+
+ EXEC SQL UPDATE filesys SET modtime = SYSDATE, modby = :who,
+ modwith = :entity, phys_id = :_var_phys_id
+ WHERE label = :label;
+ return MR_SUCCESS;
}
* name.
*/
-int set_zephyr_modtime(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int set_zephyr_modtime(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- char *class, *entity;
- int who;
- EXEC SQL END DECLARE SECTION;
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *class, *entity;
+ int who;
+ EXEC SQL END DECLARE SECTION;
- entity = cl->entity;
- who = cl->client_id;
+ entity = cl->entity;
+ who = cl->client_id;
- class = argv[0];
+ class = argv[0];
- EXEC SQL UPDATE zephyr SET modtime = SYSDATE, modby = :who,
- modwith = :entity WHERE class = :class;
+ EXEC SQL UPDATE zephyr SET modtime = SYSDATE, modby = :who,
+ modwith = :entity WHERE class = :class;
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
* passed as a pointer to an integer. This will either turn it into a
* username, or # + the users_id.
*/
-int followup_fix_modby(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_fix_modby(struct query *q, struct save_queue *sq,
+ struct validate *v, int (*action)(), int actarg,
+ client *cl)
{
- register int i, j;
- char **argv;
- int id, status;
-
- i = q->vcnt - 2;
- while (sq_get_data(sq, &argv)) {
- id = atoi(argv[i]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
- (*action)(q->vcnt, argv, actarg);
- for (j = 0; j < q->vcnt; j++)
- free(argv[j]);
- free(argv);
+ register int i, j;
+ char **argv;
+ int id, status;
+
+ i = q->vcnt - 2;
+ while (sq_get_data(sq, &argv))
+ {
+ id = atoi(argv[i]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+ (*action)(q->vcnt, argv, actarg);
+ for (j = 0; j < q->vcnt; j++)
+ free(argv[j]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* these are ones with U_END return values. "gub*" queries also use this
* routine but don't have a signature.
*/
-int followup_guax(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- register int i, j;
- char **argv;
+ register int i, j;
+ char **argv;
#ifdef GDSS
- unsigned char sigbuf[256];
- char *kname;
- SigInfo si;
- EXEC SQL BEGIN DECLARE SECTION;
- int timestamp, who, siglen;
- char *login;
- char rsig[256];
- EXEC SQL VAR rsig IS STRING(256);
- EXEC SQL END DECLARE SECTION;
+ unsigned char sigbuf[256];
+ char *kname;
+ SigInfo si;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int timestamp, who, siglen;
+ char *login;
+ char rsig[256];
+ EXEC SQL VAR rsig IS STRING(256);
+ EXEC SQL END DECLARE SECTION;
#endif /* GDSS */
- int id, status;
-
- i = q->vcnt - 2;
- while (sq_get_data(sq, &argv)) {
- id = atoi(argv[i]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
+ int id, status;
+
+ i = q->vcnt - 2;
+ while (sq_get_data(sq, &argv))
+ {
+ id = atoi(argv[i]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
#ifdef GDSS
- if (q->vcnt == U_END && strlen(argv[U_SIGNATURE])) {
- login = strtrim(argv[U_NAME]);
- EXEC SQL SELECT signature, sigdate, sigwho
- INTO :rsig, :timestamp, :who FROM users
- WHERE login = :login;
- if(dbms_errno) return mr_errcode;
- kname = malloc(1);
- status = id_to_name(who, STRINGS_TABLE, &kname);
- si.timestamp = timestamp;
- si.SigInfoVersion = 0; /* XXXXX this isn't used */
- kname_parse(si.pname, si.pinst, si.prealm, kname);
- free(kname);
- si.rawsig = (unsigned char *)strsave(rsig);
- if (log_flags & LOG_GDSS)
- com_err(whoami, 0, "rawsig length = %d, sig=\"%s\"", strlen(si.rawsig), si.rawsig);
- GDSS_Recompose(&si, sigbuf);
- free(si.rawsig);
- free(argv[U_SIGNATURE]);
- argv[U_SIGNATURE] = strsave(sigbuf);
- if (log_flags & LOG_GDSS)
- com_err(whoami, 0, "generated signature length %d", strlen(sigbuf));
+ if (q->vcnt == U_END && strlen(argv[U_SIGNATURE]))
+ {
+ login = strtrim(argv[U_NAME]);
+ EXEC SQL SELECT signature, sigdate, sigwho
+ INTO :rsig, :timestamp, :who FROM users
+ WHERE login = :login;
+ if (dbms_errno)
+ return mr_errcode;
+ kname = malloc(1);
+ status = id_to_name(who, STRINGS_TABLE, &kname);
+ si.timestamp = timestamp;
+ si.SigInfoVersion = 0; /* XXXXX this isn't used */
+ kname_parse(si.pname, si.pinst, si.prealm, kname);
+ free(kname);
+ si.rawsig = (unsigned char *)strsave(rsig);
+ if (log_flags & LOG_GDSS)
+ com_err(whoami, 0, "rawsig length = %d, sig=\"%s\"",
+ strlen(si.rawsig), si.rawsig);
+ GDSS_Recompose(&si, sigbuf);
+ free(si.rawsig);
+ free(argv[U_SIGNATURE]);
+ argv[U_SIGNATURE] = strsave(sigbuf);
+ if (log_flags & LOG_GDSS)
+ com_err(whoami, 0, "generated signature length %d",
+ strlen(sigbuf));
}
#endif /* GDSS */
- (*action)(q->vcnt, argv, actarg);
- for (j = 0; j < q->vcnt; j++)
- free(argv[j]);
- free(argv);
+ (*action)(q->vcnt, argv, actarg);
+ for (j = 0; j < q->vcnt; j++)
+ free(argv[j]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
**
**/
-int followup_ausr(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int followup_ausr(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int who, status;
- char *login, *entity, *name;
- char fullname[129];
- EXEC SQL END DECLARE SECTION;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int who, status;
+ char *login, *entity, *name;
+ char fullname[129];
+ EXEC SQL END DECLARE SECTION;
#ifdef GDSS
- char databuf[32], *kname_unparse();
- EXEC SQL BEGIN DECLARE SECTION;
- char rawsig[128];
- int sigwho, timestamp;
- EXEC SQL END DECLARE SECTION;
- SigInfo si;
+ char databuf[32], *kname_unparse();
+ EXEC SQL BEGIN DECLARE SECTION;
+ char rawsig[128];
+ int sigwho, timestamp;
+ EXEC SQL END DECLARE SECTION;
+ SigInfo si;
#endif /* GDSS */
- /* build fullname */
- if (strlen(argv[4]) && strlen(argv[5]))
- sprintf(fullname, "%s %s %s", argv[4], argv[5], argv[3]);
- else if (strlen(argv[4]))
- sprintf(fullname, "%s %s", argv[4], argv[3]);
- else
- sprintf(fullname, "%s", argv[3]);
+ /* build fullname */
+ if (strlen(argv[4]) && strlen(argv[5]))
+ sprintf(fullname, "%s %s %s", argv[4], argv[5], argv[3]);
+ else if (strlen(argv[4]))
+ sprintf(fullname, "%s %s", argv[4], argv[3]);
+ else
+ sprintf(fullname, "%s", argv[3]);
#ifdef GDSS
- if (q->vcnt == U_END && *argv[U_SIGNATURE]) {
- sprintf(databuf, "%s:%s", argv[U_NAME], argv[U_MITID]);
- /* skip bytes for timestamp & kname */
- si.rawsig = (unsigned char *) rawsig;
- status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE], &si);
- if (strlen(rawsig) > mr_sig_length) {
- com_err(whoami, 0, "GDSS signature would be truncated."); /** untested **/
- return(MR_INTERNAL);
+ if (q->vcnt == U_END && *argv[U_SIGNATURE])
+ {
+ sprintf(databuf, "%s:%s", argv[U_NAME], argv[U_MITID]);
+ /* skip bytes for timestamp & kname */
+ si.rawsig = (unsigned char *) rawsig;
+ status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE], &si);
+ if (strlen(rawsig) > mr_sig_length)
+ {
+ com_err(whoami, 0, "GDSS signature would be truncated.");
+ return MR_INTERNAL;
}
- if (status == 0) {
- name = kname_unparse(si.pname, si.pinst, si.prealm);
- status = name_to_id(name, STRINGS_TABLE, &sigwho);
- if (status == MR_NO_MATCH) {
- sigwho=add_string(name);
- } else if (status)
- return(status);
- timestamp = si.timestamp;
- } else {
- if (log_flags & LOG_GDSS)
- hex_dump(argv[U_SIGNATURE]);
- return(gdss2et(status));
+ if (status == 0)
+ {
+ name = kname_unparse(si.pname, si.pinst, si.prealm);
+ status = name_to_id(name, STRINGS_TABLE, &sigwho);
+ if (status == MR_NO_MATCH)
+ sigwho = add_string(name);
+ else if (status)
+ return status;
+ timestamp = si.timestamp;
+ }
+ else
+ {
+ if (log_flags & LOG_GDSS)
+ hex_dump(argv[U_SIGNATURE]);
+ return gdss2et(status);
}
- } else {
- rawsig[0] = 0;
- sigwho = 0;
- timestamp = 0;
- }
+ }
+ else
+ {
+ rawsig[0] = '\0';
+ sigwho = 0;
+ timestamp = 0;
+ }
#endif /* GDSS */
- login = argv[0];
- who = cl->client_id;
- entity = cl->entity;
+ login = argv[0];
+ who = cl->client_id;
+ entity = cl->entity;
- /* create finger entry, pobox & set modtime on user */
+ /* create finger entry, pobox & set modtime on user */
#ifdef GDSS
- EXEC SQL UPDATE users
- SET modtime=SYSDATE, modby=:who, modwith = :entity,
- fullname = NVL(:fullname,CHR(0)), affiliation = type,
- signature = NVL(:rawsig,CHR(0)), sigdate = :timestamp,
- sigwho = :sigwho, fmodtime=SYSDATE, fmodby = :who,
- fmodwith = :entity, potype='NONE', pmodtime=SYSDATE,
- pmodby = :who, pmodwith = :entity
- WHERE login = :login;
+ EXEC SQL UPDATE users
+ SET modtime = SYSDATE, modby = :who, modwith = :entity,
+ fullname = NVL(:fullname, CHR(0)), affiliation = type,
+ signature = NVL(:rawsig, CHR(0)), sigdate = :timestamp,
+ sigwho = :sigwho, fmodtime = SYSDATE, fmodby = :who,
+ fmodwith = :entity, potype = 'NONE', pmodtime = SYSDATE,
+ pmodby = :who, pmodwith = :entity
+ WHERE login = :login;
#else /* GDSS */
- EXEC SQL UPDATE users
- SET modtime=SYSDATE, modby=:who, modwith = :entity,
- fullname = NVL(:fullname,CHR(0)), affiliation = type,
- fmodtime=SYSDATE, fmodby = :who, fmodwith = :entity,
- potype='NONE', pmodtime=SYSDATE, pmodby = :who, pmodwith = :entity
- WHERE login = :login;
+ EXEC SQL UPDATE users
+ SET modtime = SYSDATE, modby = :who, modwith = :entity,
+ fullname = NVL(:fullname, CHR(0)), affiliation = type,
+ fmodtime = SYSDATE, fmodby = :who, fmodwith = :entity,
+ potype = 'NONE', pmodtime = SYSDATE, pmodby = :who, pmodwith = :entity
+ WHERE login = :login;
#endif /* GDSS */
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
**
**/
-int followup_uuac(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int followup_uuac(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int who, status, id;
- char *entity, *name;
- EXEC SQL END DECLARE SECTION;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int who, status, id;
+ char *entity, *name;
+ EXEC SQL END DECLARE SECTION;
#ifdef GDSS
- char databuf[32], *kname_unparse();
- EXEC SQL BEGIN DECLARE SECTION;
- char rawsig[128];
- char *login;
- int sigwho, timestamp;
- EXEC SQL END DECLARE SECTION;
- SigInfo si;
+ char databuf[32], *kname_unparse();
+ EXEC SQL BEGIN DECLARE SECTION;
+ char rawsig[128];
+ char *login;
+ int sigwho, timestamp;
+ EXEC SQL END DECLARE SECTION;
+ SigInfo si;
#endif /* GDSS */
-
- id = *(int *)argv[0];
- who = cl->client_id;
- entity = cl->entity;
-
+
+ id = *(int *)argv[0];
+ who = cl->client_id;
+ entity = cl->entity;
+
#ifdef GDSS
- if (q->vcnt == U_MODTIME && *argv[U_SIGNATURE + 1]) {
- login = malloc(1);
- status = id_to_name(id, USERS_TABLE, &login);
- sprintf(databuf, "%s:%s", login, argv[U_MITID+1]);
- free(login);
- /* skip bytes for timestamp & kname */
- si.rawsig = (unsigned char *) rawsig;
- status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE+1], &si);
- if (strlen(rawsig) > mr_sig_length) {
- com_err(whoami, 0, "GDSS signature would be truncated."); /** untested **/
- return(MR_INTERNAL);
+ if (q->vcnt == U_MODTIME && *argv[U_SIGNATURE + 1])
+ {
+ login = malloc(1);
+ status = id_to_name(id, USERS_TABLE, &login);
+ sprintf(databuf, "%s:%s", login, argv[U_MITID + 1]);
+ free(login);
+ /* skip bytes for timestamp & kname */
+ si.rawsig = (unsigned char *) rawsig;
+ status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE + 1],
+ &si);
+ if (strlen(rawsig) > mr_sig_length)
+ {
+ com_err(whoami, 0, "GDSS signature would be truncated.");
+ return MR_INTERNAL;
}
- if (status == 0) {
- name = kname_unparse(si.pname, si.pinst, si.prealm);
- status = name_to_id(name, STRINGS_TABLE, &sigwho);
- if (status == MR_NO_MATCH) {
- sigwho=add_string(name);
- } else if (status)
- return(status);
- timestamp = si.timestamp;
- } else {
- if (log_flags & LOG_GDSS)
- hex_dump(argv[U_SIGNATURE+1]);
- return(gdss2et(status));
+ if (status == 0)
+ {
+ name = kname_unparse(si.pname, si.pinst, si.prealm);
+ status = name_to_id(name, STRINGS_TABLE, &sigwho);
+ if (status == MR_NO_MATCH)
+ sigwho = add_string(name);
+ else if (status)
+ return status;
+ timestamp = si.timestamp;
+ }
+ else
+ {
+ if (log_flags & LOG_GDSS)
+ hex_dump(argv[U_SIGNATURE + 1]);
+ return gdss2et(status);
}
- } else {
- rawsig[0] = 0;
- sigwho = 0;
- timestamp = 0;
+ }
+ else
+ {
+ rawsig[0] = '\0';
+ sigwho = 0;
+ timestamp = 0;
}
#endif /* GDSS */
-
- /* create finger entry, pobox & set modtime on user */
+
+ /* create finger entry, pobox & set modtime on user */
#ifdef GDSS
- EXEC SQL UPDATE users SET modtime=SYSDATE, modby = :who, modwith = :entity,
- signature = NVL(:rawsig,CHR(0)), sigdate = :timestamp, sigwho = :sigwho
- WHERE users_id = :id;
+ EXEC SQL UPDATE users SET modtime = SYSDATE, modby = :who, modwith = :entity,
+ signature = NVL(:rawsig, CHR(0)), sigdate = :timestamp, sigwho = :sigwho
+ WHERE users_id = :id;
#else /* GDSS */
- EXEC SQL UPDATE users SET modtime=SYSDATE, modby = :who, modwith = :entity
- WHERE users_id = :id;
+ EXEC SQL UPDATE users SET modtime = SYSDATE, modby = :who, modwith = :entity
+ WHERE users_id = :id;
#endif /* GDSS */
- return(MR_SUCCESS);
+ return MR_SUCCESS;
}
-
+
/* followup_gpob: fixes argv[2] based on the IDs currently there and the
* type in argv[1]. Then completes the upcall to the user.
*
* are skipped.
*/
-int followup_gpob(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)();
- int actarg;
- client *cl;
+int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- char **argv;
- char *ptype, *p;
- int mid, sid, status, i;
-
- /* for each row */
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(2, argv);
- ptype = argv[1];
- p = strchr(argv[2], ':');
- *p++ = 0;
- mid = atoi(argv[2]);
- sid = atoi(p);
-
- if (!strcmp(ptype, "POP")) {
- status = id_to_name(mid, MACHINE_TABLE, &argv[2]);
- if (status == MR_NO_MATCH)
- return(MR_MACHINE);
- } else if (!strcmp(ptype, "SMTP")) {
- status = id_to_name(sid, STRINGS_TABLE, &argv[2]);
- if (status == MR_NO_MATCH)
- return(MR_STRING);
- } else /* ptype == "NONE" */ {
- goto skip;
+ char **argv;
+ char *ptype, *p;
+ int mid, sid, status, i;
+
+ /* for each row */
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(2, argv);
+ ptype = argv[1];
+ p = strchr(argv[2], ':');
+ *p++ = '\0';
+ mid = atoi(argv[2]);
+ sid = atoi(p);
+
+ if (!strcmp(ptype, "POP"))
+ {
+ status = id_to_name(mid, MACHINE_TABLE, &argv[2]);
+ if (status == MR_NO_MATCH)
+ return MR_MACHINE;
+ }
+ else if (!strcmp(ptype, "SMTP"))
+ {
+ status = id_to_name(sid, STRINGS_TABLE, &argv[2]);
+ if (status == MR_NO_MATCH)
+ return MR_STRING;
}
- if (status) return(status);
-
- if (!strcmp(q->shortname, "gpob")) {
- sid = atoi(argv[4]);
- if (sid > 0)
- status = id_to_name(sid, USERS_TABLE, &argv[4]);
- else
- status = id_to_name(-sid, STRINGS_TABLE, &argv[4]);
+ else /* ptype == "NONE" */
+ goto skip;
+ if (status)
+ return status;
+
+ if (!strcmp(q->shortname, "gpob"))
+ {
+ sid = atoi(argv[4]);
+ if (sid > 0)
+ status = id_to_name(sid, USERS_TABLE, &argv[4]);
+ else
+ status = id_to_name(-sid, STRINGS_TABLE, &argv[4]);
}
- if (status && status != MR_NO_MATCH) return(status);
+ if (status && status != MR_NO_MATCH)
+ return status;
- (*action)(q->vcnt, argv, actarg);
+ (*action)(q->vcnt, argv, actarg);
skip:
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return (MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* Also fixes the modby field by called followup_fix_modby.
*/
-int followup_gsnt(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- char **argv, *type;
- int id, i, idx, status;
-
- idx = 8;
-
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(q->vcnt, argv);
-
- id = atoi(argv[i = q->vcnt - 2]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- id = atoi(argv[idx]);
- type = argv[idx - 1];
-
- if (!strcmp(type, "LIST")) {
- status = id_to_name(id, LIST_TABLE, &argv[idx]);
- } else if (!strcmp(type, "USER")) {
- status = id_to_name(id, USERS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "KERBEROS")) {
- status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "NONE")) {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("NONE");
- } else {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("???");
+ char **argv, *type;
+ int id, i, idx, status;
+
+ idx = 8;
+
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(q->vcnt, argv);
+
+ id = atoi(argv[i = q->vcnt - 2]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ id = atoi(argv[idx]);
+ type = argv[idx - 1];
+
+ if (!strcmp(type, "LIST"))
+ status = id_to_name(id, LIST_TABLE, &argv[idx]);
+ else if (!strcmp(type, "USER"))
+ status = id_to_name(id, USERS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "KERBEROS"))
+ status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "NONE"))
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("NONE");
+ }
+ else
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("???");
}
- if (status && status != MR_NO_MATCH)
- return(status);
+ if (status && status != MR_NO_MATCH)
+ return status;
- /* send the data */
- (*action)(q->vcnt, argv, actarg);
+ /* send the data */
+ (*action)(q->vcnt, argv, actarg);
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return (MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* Also fixes the modby field by called followup_fix_modby.
*/
-int followup_ghst(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- char **argv, *type;
- int id, i, idx, status;
-
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(q->vcnt, argv);
-
- id = atoi(argv[i = q->vcnt - 2]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- id = atoi(argv[13]);
- status = id_to_name(id, STRINGS_TABLE, &argv[13]);
- if (status) return(status);
- id = atoi(argv[14]);
- status = id_to_name(id, STRINGS_TABLE, &argv[14]);
- if (status) return(status);
- id = atoi(argv[16]);
- if (id < 0)
- status = id_to_name(-id, STRINGS_TABLE, &argv[16]);
- else
- status = id_to_name(id, USERS_TABLE, &argv[16]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- idx = 12;
- id = atoi(argv[idx]);
- type = strtrim(argv[idx - 1]);
-
- if (!strcmp(type, "LIST")) {
- status = id_to_name(id, LIST_TABLE, &argv[idx]);
- } else if (!strcmp(type, "USER")) {
- status = id_to_name(id, USERS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "KERBEROS")) {
- status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "NONE")) {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("NONE");
- } else {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("???");
+ char **argv, *type;
+ int id, i, idx, status;
+
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(q->vcnt, argv);
+
+ id = atoi(argv[i = q->vcnt - 2]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ id = atoi(argv[13]);
+ status = id_to_name(id, STRINGS_TABLE, &argv[13]);
+ if (status)
+ return status;
+ id = atoi(argv[14]);
+ status = id_to_name(id, STRINGS_TABLE, &argv[14]);
+ if (status)
+ return status;
+ id = atoi(argv[16]);
+ if (id < 0)
+ status = id_to_name(-id, STRINGS_TABLE, &argv[16]);
+ else
+ status = id_to_name(id, USERS_TABLE, &argv[16]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ idx = 12;
+ id = atoi(argv[idx]);
+ type = strtrim(argv[idx - 1]);
+
+ if (!strcmp(type, "LIST"))
+ status = id_to_name(id, LIST_TABLE, &argv[idx]);
+ else if (!strcmp(type, "USER"))
+ status = id_to_name(id, USERS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "KERBEROS"))
+ status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "NONE"))
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("NONE");
}
- if (status && status != MR_NO_MATCH)
- return(status);
+ else
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("???");
+ }
+ if (status && status != MR_NO_MATCH)
+ return status;
- /* send the data */
- (*action)(q->vcnt, argv, actarg);
+ /* send the data */
+ (*action)(q->vcnt, argv, actarg);
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return (MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* Also fixes the modby field by called followup_fix_modby.
*/
-int followup_glin(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- char **argv, *type;
- int id, i, idx, status;
-
- idx = 8;
- if (!strcmp(q->shortname, "gsin"))
- idx = 12;
-
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(q->vcnt, argv);
-
- id = atoi(argv[i = q->vcnt - 2]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- id = atoi(argv[idx]);
- type = argv[idx - 1];
-
- if (!strcmp(type, "LIST")) {
- status = id_to_name(id, LIST_TABLE, &argv[idx]);
- } else if (!strcmp(type, "USER")) {
- status = id_to_name(id, USERS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "KERBEROS")) {
- status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
- } else if (!strcmp(type, "NONE")) {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("NONE");
- } else {
- status = 0;
- free(argv[idx]);
- argv[idx] = strsave("???");
+ char **argv, *type;
+ int id, i, idx, status;
+
+ idx = 8;
+ if (!strcmp(q->shortname, "gsin"))
+ idx = 12;
+
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(q->vcnt, argv);
+
+ id = atoi(argv[i = q->vcnt - 2]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ id = atoi(argv[idx]);
+ type = argv[idx - 1];
+
+ if (!strcmp(type, "LIST"))
+ status = id_to_name(id, LIST_TABLE, &argv[idx]);
+ else if (!strcmp(type, "USER"))
+ status = id_to_name(id, USERS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "KERBEROS"))
+ status = id_to_name(id, STRINGS_TABLE, &argv[idx]);
+ else if (!strcmp(type, "NONE"))
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("NONE");
}
- if (status && status != MR_NO_MATCH)
- return(status);
+ else
+ {
+ status = 0;
+ free(argv[idx]);
+ argv[idx] = strsave("???");
+ }
+ if (status && status != MR_NO_MATCH)
+ return status;
- if (!strcmp(q->shortname, "glin") && atoi(argv[6]) == -1) {
- argv[6] = realloc(argv[6], strlen(UNIQUE_GID) + 1);
- strcpy(argv[6], UNIQUE_GID);
+ if (!strcmp(q->shortname, "glin") && atoi(argv[6]) == -1)
+ {
+ argv[6] = realloc(argv[6], strlen(UNIQUE_GID) + 1);
+ strcpy(argv[6], UNIQUE_GID);
}
- /* send the data */
- (*action)(q->vcnt, argv, actarg);
+ /* send the data */
+ (*action)(q->vcnt, argv, actarg);
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return (MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* argv[3] = ascii(quota)
*/
-int followup_gqot(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- register int j;
- char **argv;
- EXEC SQL BEGIN DECLARE SECTION;
- int id;
- char *name, *label;
- EXEC SQL END DECLARE SECTION;
- int status, idx;
-
- if (!strcmp(q->name, "get_quota") ||
- !strcmp(q->name, "get_quota_by_filesys"))
- idx = 4;
- else
- idx = 3;
- while (sq_get_data(sq, &argv)) {
- if (idx == 4) {
- switch (argv[1][0]) {
+ register int j;
+ char **argv;
+ EXEC SQL BEGIN DECLARE SECTION;
+ int id;
+ char *name, *label;
+ EXEC SQL END DECLARE SECTION;
+ int status, idx;
+
+ if (!strcmp(q->name, "get_quota") ||
+ !strcmp(q->name, "get_quota_by_filesys"))
+ idx = 4;
+ else
+ idx = 3;
+ while (sq_get_data(sq, &argv))
+ {
+ if (idx == 4)
+ {
+ switch (argv[1][0])
+ {
case 'U':
- status = id_to_name(atoi(argv[2]), USERS_TABLE, &argv[2]);
- break;
+ status = id_to_name(atoi(argv[2]), USERS_TABLE, &argv[2]);
+ break;
case 'G':
case 'L':
- status = id_to_name(atoi(argv[2]), LIST_TABLE, &argv[2]);
- break;
+ status = id_to_name(atoi(argv[2]), LIST_TABLE, &argv[2]);
+ break;
case 'A':
- free(argv[2]);
- argv[2] = strsave("system:anyuser");
- break;
+ free(argv[2]);
+ argv[2] = strsave("system:anyuser");
+ break;
default:
- id = atoi(argv[2]);
- argv[2] = malloc(8);
- sprintf(argv[2], "%d", id);
+ id = atoi(argv[2]);
+ argv[2] = malloc(8);
+ sprintf(argv[2], "%d", id);
}
}
- id = atoi(argv[idx]);
- free(argv[idx]);
- argv[idx] = malloc(256);
- name = argv[idx];
- if (id == 0) {
- label = argv[0];
- EXEC SQL SELECT name INTO :name FROM filesys
- WHERE label = :label;
- } else {
- EXEC SQL SELECT dir INTO :name FROM nfsphys
- WHERE nfsphys_id = :id;
+ id = atoi(argv[idx]);
+ free(argv[idx]);
+ argv[idx] = malloc(256);
+ name = argv[idx];
+ if (id == 0)
+ {
+ label = argv[0];
+ EXEC SQL SELECT name INTO :name FROM filesys
+ WHERE label = :label;
}
- if (sqlca.sqlerrd[2] != 1) {
- sprintf(argv[idx], "#%d", id);
+ else
+ {
+ EXEC SQL SELECT dir INTO :name FROM nfsphys
+ WHERE nfsphys_id = :id;
}
-
- id = atoi(argv[idx+3]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[idx+3]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[idx+3]);
- if (status && status != MR_NO_MATCH)
- return(status);
- (*action)(q->vcnt, argv, actarg);
- for (j = 0; j < q->vcnt; j++)
- free(argv[j]);
- free(argv);
+ if (sqlca.sqlerrd[2] != 1)
+ sprintf(argv[idx], "#%d", id);
+
+ id = atoi(argv[idx + 3]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[idx + 3]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[idx + 3]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+ (*action)(q->vcnt, argv, actarg);
+ for (j = 0; j < q->vcnt; j++)
+ free(argv[j]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
* argv[3 or 2] = ascii(quota)
*/
-int followup_aqot(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int followup_aqot(struct query *q, char *argv[], client *cl)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int quota, id, fs, who, physid, table;
- char *entity, *qtype, *tname;
- EXEC SQL END DECLARE SECTION;
- char incr_qual[60];
- char *incr_argv[2];
- int status;
-
- table=q->rtable;
- tname=table_name[table];
- fs = *(int *)argv[0];
- EXEC SQL SELECT phys_id INTO :physid FROM filesys
- WHERE filsys_id = :fs;
- if(dbms_errno)
- return(mr_errcode);
-
- if (!strcmp(q->shortname, "aqot") || !strcmp(q->shortname, "uqot")) {
- qtype = argv[1];
- id = *(int *)argv[2];
- quota = atoi(argv[3]);
- sprintf(incr_qual,"q.filsys_id = %d",fs);
- } else {
- qtype = "USER";
- id = *(int *)argv[1];
- quota = atoi(argv[2]);
- sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
- fs,qtype,id);
+ EXEC SQL BEGIN DECLARE SECTION;
+ int quota, id, fs, who, physid, table;
+ char *entity, *qtype, *tname;
+ EXEC SQL END DECLARE SECTION;
+ char incr_qual[60];
+ char *incr_argv[2];
+ int status;
+
+ table = q->rtable;
+ tname = table_name[table];
+ fs = *(int *)argv[0];
+ EXEC SQL SELECT phys_id INTO :physid FROM filesys
+ WHERE filsys_id = :fs;
+ if (dbms_errno)
+ return mr_errcode;
+
+ if (!strcmp(q->shortname, "aqot") || !strcmp(q->shortname, "uqot"))
+ {
+ qtype = argv[1];
+ id = *(int *)argv[2];
+ quota = atoi(argv[3]);
+ sprintf(incr_qual, "q.filsys_id = %d", fs);
+ }
+ else
+ {
+ qtype = "USER";
+ id = *(int *)argv[1];
+ quota = atoi(argv[2]);
+ sprintf(incr_qual, "q.filsys_id = %d AND q.type = '%s' AND "
+ "q.entity_id = %d", fs, qtype, id);
}
- /* quota case of incremental_{before|after} only looks at slot 1 */
- incr_argv[1]=qtype;
-
- /* Follows one of many possible gross hacks to fix these particular
- * conflicts between what is possible in the query table and what
- * is possible in SQL.
- */
- if(q->type==APPEND) {
- incremental_clear_before();
- EXEC SQL INSERT INTO quota
- (filsys_id, type, entity_id, quota, phys_id)
- VALUES (:fs, NVL(:qtype,CHR(0)), :id, :quota, :physid);
- incremental_after(table, incr_qual, incr_argv);
- } else {
- incremental_before(table, incr_qual, incr_argv);
- EXEC SQL UPDATE quota SET quota = :quota
- WHERE filsys_id = :fs AND type = :qtype AND entity_id = :id;
- status = mr_errcode;
- incremental_after(table, incr_qual, incr_argv);
+ /* quota case of incremental_{before|after} only looks at slot 1 */
+ incr_argv[1] = qtype;
+
+ /* Follows one of many possible gross hacks to fix these particular
+ * conflicts between what is possible in the query table and what
+ * is possible in SQL.
+ */
+ if (q->type == APPEND)
+ {
+ incremental_clear_before();
+ EXEC SQL INSERT INTO quota
+ (filsys_id, type, entity_id, quota, phys_id)
+ VALUES (:fs, NVL(:qtype, CHR(0)), :id, :quota, :physid);
+ incremental_after(table, incr_qual, incr_argv);
+ }
+ else
+ {
+ incremental_before(table, incr_qual, incr_argv);
+ EXEC SQL UPDATE quota SET quota = :quota
+ WHERE filsys_id = :fs AND type = :qtype AND entity_id = :id;
+ status = mr_errcode;
+ incremental_after(table, incr_qual, incr_argv);
}
- if (dbms_errno)
- return(mr_errcode);
- flush_name(argv[0], table);
- if(q->type==APPEND) {
- EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = SYSDATE
- WHERE table_name = :tname;
- } else {
- EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = SYSDATE
- WHERE table_name = :tname;
+ if (dbms_errno)
+ return mr_errcode;
+ flush_name(argv[0], table);
+ if (q->type == APPEND)
+ {
+ EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = SYSDATE
+ WHERE table_name = :tname;
+ }
+ else
+ {
+ EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = SYSDATE
+ WHERE table_name = :tname;
}
-
- /* Proceed with original followup */
- who = cl->client_id;
- entity = cl->entity;
-
- EXEC SQL UPDATE quota
- SET modtime = SYSDATE, modby = :who, modwith = :entity
- WHERE filsys_id = :fs and type = :qtype and entity_id = :id;
- EXEC SQL UPDATE nfsphys SET allocated = allocated + :quota
- WHERE nfsphys_id = :physid;
- if (dbms_errno) return(mr_errcode);
- return(MR_SUCCESS);
+
+ /* Proceed with original followup */
+ who = cl->client_id;
+ entity = cl->entity;
+
+ EXEC SQL UPDATE quota
+ SET modtime = SYSDATE, modby = :who, modwith = :entity
+ WHERE filsys_id = :fs and type = :qtype and entity_id = :id;
+ EXEC SQL UPDATE nfsphys SET allocated = allocated + :quota
+ WHERE nfsphys_id = :physid;
+ if (dbms_errno)
+ return mr_errcode;
+ return MR_SUCCESS;
}
/* Necessitated by the requirement of a correlation name by the incremental
- * routines, since query table deletes don't provide one.
+ * routines, since query table deletes don't provide one.
*/
-int followup_dqot(q, argv, cl)
- struct query *q;
- char **argv;
- client *cl;
+int followup_dqot(struct query *q, char **argv, client *cl)
{
- char *qtype;
- int id, fs, table;
- char *incr_argv[2];
- EXEC SQL BEGIN DECLARE SECTION;
- char incr_qual[80], *tname;
- EXEC SQL END DECLARE SECTION;
-
- table=q->rtable;
- tname=table_name[table];
- fs = *(int *)argv[0];
- if (!strcmp(q->shortname, "dqot")) {
- qtype = argv[1];
- id = *(int *)argv[2];
- } else {
- qtype = "USER";
- id = *(int *)argv[1];
+ char *qtype;
+ int id, fs, table;
+ char *incr_argv[2];
+ EXEC SQL BEGIN DECLARE SECTION;
+ char incr_qual[80], *tname;
+ EXEC SQL END DECLARE SECTION;
+
+ table = q->rtable;
+ tname = table_name[table];
+ fs = *(int *)argv[0];
+ if (!strcmp(q->shortname, "dqot"))
+ {
+ qtype = argv[1];
+ id = *(int *)argv[2];
+ }
+ else
+ {
+ qtype = "USER";
+ id = *(int *)argv[1];
}
- sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
- fs,qtype,id);
+ sprintf(incr_qual, "q.filsys_id = %d AND q.type = '%s' AND q.entity_id = %d",
+ fs, qtype, id);
- /* quota case of incremental_{before|after} only looks at slot 1 */
- incr_argv[1]=qtype;
+ /* quota case of incremental_{before|after} only looks at slot 1 */
+ incr_argv[1] = qtype;
- incremental_before(table, incr_qual, incr_argv);
- EXEC SQL DELETE FROM quota q WHERE q.filsys_id=:fs AND q.type=:qtype
- AND q.entity_id=:id;
- incremental_clear_after();
+ incremental_before(table, incr_qual, incr_argv);
+ EXEC SQL DELETE FROM quota q WHERE q.filsys_id = :fs AND q.type = :qtype
+ AND q.entity_id = :id;
+ incremental_clear_after();
- if (dbms_errno)
- return(mr_errcode);
- flush_name(argv[0], table);
+ if (dbms_errno)
+ return mr_errcode;
+ flush_name(argv[0], table);
- EXEC SQL UPDATE tblstats SET deletes = deletes + 1, modtime = SYSDATE
- WHERE table_name = :tname;
- return(MR_SUCCESS);
+ EXEC SQL UPDATE tblstats SET deletes = deletes + 1, modtime = SYSDATE
+ WHERE table_name = :tname;
+ return MR_SUCCESS;
}
-int followup_gpce(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_gpce(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- register int i, j;
- char **argv;
- int id, status;
-
- i = q->vcnt - 2;
- while (sq_get_data(sq, &argv)) {
- id = atoi(argv[PCAP_QSERVER]);
- status = id_to_name(id, MACHINE_TABLE, &argv[PCAP_QSERVER]);
- if (status) return (status);
- id = atoi(argv[i]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
- (*action)(q->vcnt, argv, actarg);
- for (j = 0; j < q->vcnt; j++)
- free(argv[j]);
- free(argv);
+ register int i, j;
+ char **argv;
+ int id, status;
+
+ i = q->vcnt - 2;
+ while (sq_get_data(sq, &argv))
+ {
+ id = atoi(argv[PCAP_QSERVER]);
+ status = id_to_name(id, MACHINE_TABLE, &argv[PCAP_QSERVER]);
+ if (status)
+ return status;
+ id = atoi(argv[i]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+ (*action)(q->vcnt, argv, actarg);
+ for (j = 0; j < q->vcnt; j++)
+ free(argv[j]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
/* followup_gzcl:
*/
-int followup_gzcl(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- int id, i, status;
- char **argv;
-
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(q->vcnt, argv);
-
- id = atoi(argv[i = q->vcnt - 2]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[i]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- for (i = 1; i < 8; i+=2) {
- id = atoi(argv[i+1]);
- if (!strcmp(argv[i], "LIST")) {
- status = id_to_name(id, LIST_TABLE, &argv[i+1]);
- } else if (!strcmp(argv[i], "USER")) {
- status = id_to_name(id, USERS_TABLE, &argv[i+1]);
- } else if (!strcmp(argv[i], "KERBEROS")) {
- status = id_to_name(id, STRINGS_TABLE, &argv[i+1]);
- } else if (!strcmp(argv[i], "NONE")) {
- status = 0;
- free(argv[i+1]);
- argv[i+1] = strsave("NONE");
- } else {
- status = 0;
- free(argv[i+1]);
- argv[i+1] = strsave("???");
+ int id, i, status;
+ char **argv;
+
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(q->vcnt, argv);
+
+ id = atoi(argv[i = q->vcnt - 2]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[i]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ for (i = 1; i < 8; i += 2)
+ {
+ id = atoi(argv[i + 1]);
+ if (!strcmp(argv[i], "LIST"))
+ status = id_to_name(id, LIST_TABLE, &argv[i + 1]);
+ else if (!strcmp(argv[i], "USER"))
+ status = id_to_name(id, USERS_TABLE, &argv[i + 1]);
+ else if (!strcmp(argv[i], "KERBEROS"))
+ status = id_to_name(id, STRINGS_TABLE, &argv[i + 1]);
+ else if (!strcmp(argv[i], "NONE"))
+ {
+ status = 0;
+ free(argv[i + 1]);
+ argv[i + 1] = strsave("NONE");
}
- if (status && status != MR_NO_MATCH)
- return(status);
+ else
+ {
+ status = 0;
+ free(argv[i + 1]);
+ argv[i + 1] = strsave("???");
+ }
+ if (status && status != MR_NO_MATCH)
+ return status;
}
- /* send the data */
- (*action)(q->vcnt, argv, actarg);
+ /* send the data */
+ (*action)(q->vcnt, argv, actarg);
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
/* followup_gsha:
*/
-int followup_gsha(q, sq, v, action, actarg, cl)
- struct query *q;
- struct save_queue *sq;
- struct validate *v;
- int (*action)(), actarg;
- client *cl;
+int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
+ int (*action)(), int actarg, client *cl)
{
- char **argv;
- int i, id, status;
-
- while (sq_get_data(sq, &argv)) {
- mr_trim_args(q->vcnt, argv);
-
- id = atoi(argv[4]);
- if (id > 0)
- status = id_to_name(id, USERS_TABLE, &argv[4]);
- else
- status = id_to_name(-id, STRINGS_TABLE, &argv[4]);
- if (status && status != MR_NO_MATCH)
- return(status);
-
- id = atoi(argv[2]);
- if (!strcmp(argv[1], "LIST")) {
- status = id_to_name(id, LIST_TABLE, &argv[2]);
- } else if (!strcmp(argv[1], "USER")) {
- status = id_to_name(id, USERS_TABLE, &argv[2]);
- } else if (!strcmp(argv[1], "KERBEROS")) {
- status = id_to_name(id, STRINGS_TABLE, &argv[2]);
- } else if (!strcmp(argv[1], "NONE")) {
- status = 0;
- free(argv[2]);
- argv[2] = strsave("NONE");
- } else {
- status = 0;
- free(argv[2]);
- argv[2] = strsave("???");
+ char **argv;
+ int i, id, status;
+
+ while (sq_get_data(sq, &argv))
+ {
+ mr_trim_args(q->vcnt, argv);
+
+ id = atoi(argv[4]);
+ if (id > 0)
+ status = id_to_name(id, USERS_TABLE, &argv[4]);
+ else
+ status = id_to_name(-id, STRINGS_TABLE, &argv[4]);
+ if (status && status != MR_NO_MATCH)
+ return status;
+
+ id = atoi(argv[2]);
+ if (!strcmp(argv[1], "LIST"))
+ status = id_to_name(id, LIST_TABLE, &argv[2]);
+ else if (!strcmp(argv[1], "USER"))
+ status = id_to_name(id, USERS_TABLE, &argv[2]);
+ else if (!strcmp(argv[1], "KERBEROS"))
+ status = id_to_name(id, STRINGS_TABLE, &argv[2]);
+ else if (!strcmp(argv[1], "NONE"))
+ {
+ status = 0;
+ free(argv[2]);
+ argv[2] = strsave("NONE");
+ }
+ else
+ {
+ status = 0;
+ free(argv[2]);
+ argv[2] = strsave("???");
}
- if (status && status != MR_NO_MATCH)
- return(status);
+ if (status && status != MR_NO_MATCH)
+ return status;
- /* send the data */
- (*action)(q->vcnt, argv, actarg);
+ /* send the data */
+ (*action)(q->vcnt, argv, actarg);
- /* free saved data */
- for (i = 0; i < q->vcnt; i++)
- free(argv[i]);
- free(argv);
+ /* free saved data */
+ for (i = 0; i < q->vcnt; i++)
+ free(argv[i]);
+ free(argv);
}
- sq_destroy(sq);
- return(MR_SUCCESS);
+ sq_destroy(sq);
+ return MR_SUCCESS;
}
-int _sdl_followup(q, argv, cl)
- struct query *q;
- char *argv[];
- client *cl;
+int _sdl_followup(struct query *q, char *argv[], client *cl)
{
- int i;
- i = atoi(argv[0]);
- log_flags = i;
-
- if (i & LOG_SQL) {
- EXEC SQL ALTER SESSION SET SQL_TRACE TRUE;
- } else {
- EXEC SQL ALTER SESSION SET SQL_TRACE FALSE;
- }
-
- return(MR_SUCCESS);
+ int i;
+ i = atoi(argv[0]);
+ log_flags = i;
+
+ if (i & LOG_SQL)
+ EXEC SQL ALTER SESSION SET SQL_TRACE TRUE;
+ else
+ EXEC SQL ALTER SESSION SET SQL_TRACE FALSE;
+
+ return MR_SUCCESS;
}
-static void hex_dump(p)
- unsigned char *p;
+static void hex_dump(unsigned char *p)
{
- fprintf(stderr, "Size: %d\n", strlen(p));
- while (strlen(p) >= 8) {
- fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
- p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
- p += 8;
+ fprintf(stderr, "Size: %d\n", strlen(p));
+ while (strlen(p) >= 8)
+ {
+ fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
+ p += 8;
}
- switch (strlen(p)) {
+ switch (strlen(p))
+ {
case 7:
- fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x\n",
- p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
- break;
+ fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x\n",
+ p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
+ break;
case 6:
- fprintf(stderr, "%02x %02x %02x %02x %02x %02x\n",
- p[0], p[1], p[2], p[3], p[4], p[5]);
- break;
+ fprintf(stderr, "%02x %02x %02x %02x %02x %02x\n",
+ p[0], p[1], p[2], p[3], p[4], p[5]);
+ break;
case 5:
- fprintf(stderr, "%02x %02x %02x %02x %02x\n",
+ fprintf(stderr, "%02x %02x %02x %02x %02x\n",
p[0], p[1], p[2], p[3], p[4]);
- break;
+ break;
case 4:
- fprintf(stderr, "%02x %02x %02x %02x\n",
- p[0], p[1], p[2], p[3]);
+ fprintf(stderr, "%02x %02x %02x %02x\n",
+ p[0], p[1], p[2], p[3]);
break;
case 3:
- fprintf(stderr, "%02x %02x %02x\n",
- p[0], p[1], p[2]);
- break;
+ fprintf(stderr, "%02x %02x %02x\n",
+ p[0], p[1], p[2]);
+ break;
case 2:
- fprintf(stderr, "%02x %02x\n",
- p[0], p[1]);
- break;
+ fprintf(stderr, "%02x %02x\n",
+ p[0], p[1]);
+ break;
case 1:
- fprintf(stderr, "%02x\n",
- p[0]);
- break;
+ fprintf(stderr, "%02x\n",
+ p[0]);
+ break;
default:
- return;
+ return;
}
}