]> andersk Git - moira.git/blobdiff - server/qsupport.pc
Initialize a few more things to NULL.
[moira.git] / server / qsupport.pc
index c133a0ee6a25d945a40322c7a1e71508631aaaaa..c18d94d40a092525b9e750e2c586720ae247611b 100644 (file)
@@ -1474,7 +1474,8 @@ int register_user(struct query *q, char **argv, client *cl)
   /* find user */
   EXEC SQL SELECT users_id, status INTO :users_id, :ostatus
     FROM users
-    WHERE unix_uid = :uid AND (status = 0 OR status = 5 OR status = 6);
+    WHERE unix_uid = :uid AND
+    (status = 0 OR status = 5 OR status = 6 OR status = 9);
 
   if (sqlca.sqlerrd[2] == 0)
     return MR_NO_MATCH;
@@ -1510,7 +1511,7 @@ int register_user(struct query *q, char **argv, client *cl)
        WHERE label = :login || '.po';
       if (dbms_errno)
        return mr_errcode;
-      if ((ostatus == 0) || (tmp != users_id))
+      if ((ostatus == 0 || ostatus == 9) || (tmp != users_id))
        return MR_IN_USE;
       else
        po_exists = 1;
@@ -1657,7 +1658,7 @@ int register_user(struct query *q, char **argv, client *cl)
   sprintf(buffer, "u.users_id = %d", users_id);
   incremental_before(USERS_TABLE, buffer, 0);
   nstatus = 2;
-  if (ostatus == 5 || ostatus == 6)
+  if (ostatus == 5 || ostatus == 6 || ostatus == 9)
     nstatus = 1;
   EXEC SQL UPDATE users SET login = :login, status = :nstatus,
     modtime = SYSDATE, modby = :who, modwith = :entity,
@@ -1890,7 +1891,7 @@ int get_user_by_reservation(struct query *q, char **argv, client *cl,
 int update_container(struct query *q, char *argv[], client *cl)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  int cnt_id, acl_id, memacl_id, who;
+  int cnt_id, acl_id, memacl_id, who, flag;
   char name[CONTAINERS_NAME_SIZE], newchildname[CONTAINERS_NAME_SIZE];
   char* newname, *entity, *description, *location, *contact, *acl_type, *memacl_type;
   EXEC SQL END DECLARE SECTION;
@@ -1898,16 +1899,21 @@ int update_container(struct query *q, char *argv[], client *cl)
   int cnt, childid;
   char childname[CONTAINERS_NAME_SIZE];
   char *qual;
+  int index = 0;
 
-  cnt_id = *(int *)argv[0];
-  newname = argv[1];
-  description = argv[2];
-  location = argv[3];
-  contact = argv[4];
-  acl_type = argv[5];
-  acl_id = *(int *)argv[6];
-  memacl_type = argv[7];
-  memacl_id = *(int *)argv[8];
+  cnt_id = *(int *)argv[index++];
+  newname = argv[index++];
+
+  if (q->version >= 9)
+    flag = atoi(argv[index++]);
+
+  description = argv[index++];
+  location = argv[index++];
+  contact = argv[index++];
+  acl_type = argv[index++];
+  acl_id = *(int *)argv[index++];
+  memacl_type = argv[index++];
+  memacl_id = *(int *)argv[index++];
   entity = cl->entity;
   who = cl->client_id;
 
@@ -1986,12 +1992,24 @@ int update_container(struct query *q, char *argv[], client *cl)
   }
 
   /* update the remaining fields */
-  EXEC SQL UPDATE containers 
-    SET description = NVL(:description, CHR(0)), location = NVL(:location, CHR(0)), 
-      contact = NVL(:contact, CHR(0)), acl_type = :acl_type, acl_id = :acl_id, 
-      memacl_type = :memacl_type, memacl_id = :memacl_id, 
-      modtime = SYSDATE, modby = :who, modwith = :entity
-    WHERE cnt_id = :cnt_id;
+  if (q->version >= 9)
+  {
+       EXEC SQL UPDATE containers
+               SET publicflg= :flag, description = NVL(:description, CHR(0)), location = NVL(:location, CHR(0)),
+                       contact = NVL(:contact, CHR(0)), acl_type = :acl_type, acl_id = :acl_id,
+                       memacl_type = :memacl_type, memacl_id = :memacl_id,
+                       modtime = SYSDATE, modby = :who, modwith = :entity
+               WHERE cnt_id = :cnt_id;
+  }
+  else
+  {
+    EXEC SQL UPDATE containers
+               SET publicflg= :flag, description = NVL(:description, CHR(0)), location = NVL(:location, CHR(0)),
+                       contact = NVL(:contact, CHR(0)), acl_type = :acl_type, acl_id = :acl_id,
+                       memacl_type = :memacl_type, memacl_id = :memacl_id,
+                       modtime = SYSDATE, modby = :who, modwith = :entity
+               WHERE cnt_id = :cnt_id;
+  }
 
   if (dbms_errno)
     return mr_errcode;
@@ -2036,7 +2054,8 @@ int get_machines_of_container(struct query *q, char *argv[], client *cl,
   if (!isrecursive)
     sprintf(tmp, "AND b.cnt_id = %d ", cnt_id);
   else
-    sprintf(tmp, "AND (b.cnt_id = %d OR b.name LIKE '%s/%%') ", cnt_id, containername);
+    sprintf(tmp, "AND (b.cnt_id = %d OR LOWER(b.name) LIKE LOWER('%s/%%')) ", 
+           cnt_id, containername);
 
   strcat(querystring, tmp);
   strcat(querystring, "ORDER BY b.name, a.name");
@@ -2094,10 +2113,10 @@ int get_subcontainers_of_container(struct query *q, char *argv[], client *cl,
   strcpy(querystring, "SELECT name FROM containers ");
   
   if (!isrecursive)
-    sprintf(tmp, "WHERE name LIKE '%s/%%' and name NOT LIKE '%s/%%/%%' ", containername, 
-        containername);
+    sprintf(tmp, "WHERE LOWER(name) LIKE LOWER('%s/%%') and LOWER(name) NOT LIKE LOWER('%s/%%/%%') ",
+           containername, containername);
   else
-    sprintf(tmp, "WHERE name LIKE '%s/%%' ", containername);
+    sprintf(tmp, "WHERE LOWER(name) LIKE LOWER('%s/%%') ", containername);
 
   strcat(querystring, tmp);
   strcat(querystring, "ORDER BY name");
@@ -2124,3 +2143,19 @@ int get_subcontainers_of_container(struct query *q, char *argv[], client *cl,
     return MR_NO_MATCH;
   return MR_SUCCESS;
 }
+
+int set_container_list(struct query *q, char *argv[], client *cl)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int cnt_id, list_id;
+  EXEC SQL END DECLARE SECTION;
+
+  cnt_id = *(int *)argv[0];
+  list_id = *(int *)argv[1];
+
+  EXEC SQL UPDATE containers SET list_id = :list_id WHERE cnt_id = :cnt_id;
+  if (dbms_errno)
+    return mr_errcode;
+
+  return MR_SUCCESS;
+}
This page took 0.039601 seconds and 4 git commands to generate.