]> andersk Git - moira.git/blobdiff - server/qrtn.pc
Implement glic query for returning the container associated with a given
[moira.git] / server / qrtn.pc
index cfcd0226643c8de446dcf881b841621718dbb6f0..bdb16f1619fc34f919df23c2e17267af1eef74dc 100644 (file)
@@ -44,7 +44,7 @@ extern int QueryCount, max_version;
 extern struct query Queries[];
 
 /* Put this in a variable so that we can patch it if necessary */
-int max_row_count = 4096;
+int max_row_count = 8192;
 
 int mr_verify_query(client *cl, struct query *q, int argc, char *argv_ro[]);
 int do_retrieve(struct query *q, char *pqual,
@@ -425,7 +425,8 @@ char *build_qual(char *fmt_buf, int argc, char *argv[])
 
   while (*fmt)
     {
-      if (!like && !arg)
+      
+      if ((!like && !arg) || argc == 0)
        {
          /* only plain text remains */
          strcpy(res, fmt);
@@ -558,20 +559,16 @@ int mr_verify_query(client *cl, struct query *q, int argc, char *argv_ro[])
       if (*fr)
        return MR_ARG_TOO_LONG;
       *to = '\0';
-
-      if (to > Argv[i] && *--to == '\\')
-       return MR_BAD_CHAR;
     }
 
-  /* check initial query access, unless we're acting as a proxy */
-  if (!cl->proxy_id)
-    {
-      status = check_query_access(q, Argv, cl);
-      if (status != MR_SUCCESS && status != MR_PERM)
-       return status;
-      if (status == MR_SUCCESS)
-       privileged++;
-    }
+  /* Check initial query access.  If we're acting as a proxy, only allow
+   * access if the query has "default" as a capacl.
+   */
+  status = check_query_access(q, Argv, cl);
+  if (status != MR_SUCCESS && status != MR_PERM)
+    return status;
+  if (status == MR_SUCCESS && (!cl->proxy_id || q->everybody))
+      privileged++;
 
   /* validate arguments */
   if (v && v->valobj)
@@ -1010,6 +1007,10 @@ int name_to_id(char *name, enum tables type, int *id)
        }
       EXEC SQL SELECT string_id INTO :j FROM strings WHERE string = :iname;
       break;
+    case CONTAINERS_TABLE:
+      EXEC SQL SELECT cnt_id INTO :j FROM containers WHERE LOWER(name) = 
+       LOWER(:iname);
+      break;
     default:
       return MR_INTERNAL;
     }
@@ -1064,6 +1065,9 @@ int id_to_name(int id, enum tables type, char **name)
     case STRINGS_TABLE:
       EXEC SQL SELECT string INTO :iname FROM strings WHERE string_id = :j;
       break;
+    case CONTAINERS_TABLE:
+      EXEC SQL SELECT name INTO :iname FROM containers WHERE cnt_id = :j;
+      break;
     default:
       return MR_INTERNAL;
     }
This page took 0.050801 seconds and 4 git commands to generate.