From: mar Date: Mon, 4 Jan 1988 12:02:13 +0000 (+0000) Subject: moved transaction start before pre-routines (wesommer) X-Git-Tag: BETA5-24-88~32 X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/d353058b057b1ce4b6bedfb43e421a9ea11b1e2d moved transaction start before pre-routines (wesommer) --- diff --git a/server/qrtn.qc b/server/qrtn.qc index 10e31d36..10f14079 100644 --- a/server/qrtn.qc +++ b/server/qrtn.qc @@ -6,10 +6,16 @@ * Copyright (C) 1987 by the Massachusetts Institute of Technology * * $Log$ - * Revision 1.12 1987-09-12 20:42:11 wesommer - * Clean up after Gretzinger: cl->kname is not valid unless cl->clname is - * non-NULL. + * Revision 1.13 1988-01-04 12:02:13 mar + * moved transaction start before pre-routines (wesommer) * + * Revision 1.13 87/11/12 18:13:12 wesommer + * Move transaction boundary to include the pre routine. + * + * Revision 1.12 87/09/12 20:42:11 wesommer + * Clean up after Gretzinger: cl->kname is not valid unless cl->clname is + * non-NULL. + * * Revision 1.12 87/09/12 20:06:46 wesommer * Fix security hole/null dereference bug: if clname is NULL, return * permission denied in get_client. @@ -199,36 +205,40 @@ sms_process_query(cl, name, argc, argv_ro, action, actarg) if (q == (struct query *)0) return(SMS_NO_HANDLE); v = q->validate; - /* check query access */ + if (q->type != RETRIEVE) +## begin transaction + + /* check query access */ status = check_query_access(q, Argv, cl); privileged = (status == SMS_SUCCESS) ? 1 : 0; if (!privileged && !(status == SMS_PERM && (v && (v->pre_rtn == access_user || v->pre_rtn == access_pop || v->pre_rtn == access_list)))) - return(status); + goto out; /* check argument count */ argreq = q->argc; if (q->type == UPDATE || q->type == APPEND) argreq += q->vcnt; - if (argc != argreq) return(SMS_ARGS); + if (argc != argreq) { + status = SMS_ARGS; + goto out; + } + /* validate arguments */ if (v && v->valobj) { status = validate_fields(q, Argv, v->valobj, v->objcnt); - if (status != SMS_SUCCESS) return(status); + if (status != SMS_SUCCESS) goto out; } /* perform any special query pre-processing */ if (v && v->pre_rtn) { status = (*v->pre_rtn)(q, Argv, cl, 0); if (status != SMS_SUCCESS && (status != SMS_PERM || !privileged)) - return(status); + goto out; } - if (q->type != RETRIEVE) -## begin transaction - switch (q->type) { case RETRIEVE: /* for queries that do not permit wildcarding, check if row @@ -311,7 +321,10 @@ sms_process_query(cl, name, argc, argv_ro, action, actarg) } /* increment id number if necessary */ - if (v->object_id) set_next_object_id(v->object_id); + if (v->object_id) { + status = set_next_object_id(v->object_id); + if (status != SMS_SUCCESS) break; + } /* build "where" clause if needed */ if (q->qual) { @@ -361,11 +374,12 @@ sms_process_query(cl, name, argc, argv_ro, action, actarg) } +out: if (q->type != RETRIEVE) { if (status == SMS_SUCCESS) { -## end transaction +## end transaction /* commit to this */ } else { -## abort +## abort /* it never happened */ } }