/* open the database */
## ingres sms
## set lockmode session where level = table, timeout = query_timeout
+## set lockmode on capacls where readlock = shared
+## set lockmode on alias where readlock = shared
return ingres_errno;
}
register struct validate *v = q->validate;
register int i;
register int privileged = 0;
+ int len;
/* copy the arguments into a local argv that we can modify */
if (argc >= QMAXARGS)
return(SMS_ARGS);
for (i = 0; i < argc; i++) {
- if (strlen(argv_ro[i]) < ARGLEN)
+ if ((len = strlen(argv_ro[i])) < ARGLEN)
strcpy(Argv[i], argv_ro[i]);
else
return(SMS_ARG_TOO_LONG);
+ if (Argv[i][len-1] == '\\')
+ return(SMS_BAD_CHAR);
}
/* check initial query access */
}
/* check for default access */
-## range of m is members
+## range of m is imembers
## repeat retrieve (exists = any(m.#member_id where m.list_id = @acl_id and
## m.member_type = "USER" and m.#member_id = def_uid))
if (exists) return(SMS_SUCCESS);
return(SMS_SUCCESS);
##}
-##find_member(list_type, list_id, member_type, member_id, sq)
+##find_member(list_type, list_id, member_type, member_id)
char *list_type;
## int list_id;
## char *member_type;
## int member_id;
- struct save_queue *sq;
##{
-## int exists;
-## int sublist;
- int child;
- struct save_queue *sq_create();
+## int exists, errorno;
if (!strcmp(strtrim(list_type), strtrim(member_type)) &&
list_id == member_id)
return(1);
/* see if client is a direct member of list */
+## range of m is imembers
## repeat retrieve (exists = any(m.#member_id where
## m.#list_id = @list_id and
## m.#member_type = @member_type and
## m.#member_id = @member_id))
- if (exists) return(1);
-
- /* are there any sub-lists? */
-## repeat retrieve (exists = any(m.#member_id where m.#list_id = @list_id and
-## m.#member_type = "LIST"))
- if (!exists) return(0);
-
- /* yes; now recurse through sublists */
-
- /* create a save queue */
- if (sq == (struct save_queue *)0) {
- sq = sq_create();
- child = 0;
- } else {
- child = 1;
- }
-
- /* save all sublist ids */
-## range of m is members
-## retrieve (sublist = m.#member_id)
-## where m.#list_id = list_id and m.#member_type = "LIST"
-## {
- sq_save_unique_data(sq, sublist);
-## }
-
- if (child) return(0);
-
- /* at top-level, check sub-lists for client (breadth-first search) */
- while (sq_get_data(sq, &sublist)) {
- exists = find_member(list_type, sublist, member_type, member_id, sq);
- if (exists) {
- sq_destroy(sq);
- return(1);
- }
- }
- sq_destroy(sq);
- return(0);
+## inquire_equel(errorno = "errorno")
+ if (errorno == 0)
+ return(exists);
+ else
+ return(0);
##}
{
register int i;
int maxv = 0, maxa = 0;
+#ifdef MULTIPROTOCOLS
extern int QueryCount1, QueryCount2;
extern struct query Queries1[], Queries2[];
+#else
+ extern int QueryCount2;
+ extern struct query Queries2[];
+#endif MULTIPROTOCOLS
+
#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#ifdef MULTIPROTOCOLS
for (i = 0; i < QueryCount1; i++) {
maxv = MAX(maxv, Queries1[i].vcnt);
maxa = MAX(maxa, Queries1[i].argc);
}
+#endif MULTIPROTOCOLS
for (i = 0; i < QueryCount2; i++) {
maxv = MAX(maxv, Queries2[i].vcnt);
maxa = MAX(maxa, Queries2[i].argc);