]> andersk Git - moira.git/blobdiff - clients/moira/zephyr.c
Fix typo.
[moira.git] / clients / moira / zephyr.c
index 96322cc4f11a209f2c4d90bbc6f0ccc83e5830c0..5d704c15ca2972c389dba60b3bb5b252791f5ff5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id $
+/* $Id$
  *
  * Zephyr ACL routines for the Moira client
  *
@@ -27,14 +27,14 @@ void RealDeleteZephyr(char **info, Bool one_item);
 static char **SetDefaults(char **info, char *name)
 {
   info[ZA_CLASS] = strdup(name);
-  info[ZA_XMT_TYPE] = strdup("LIST");
-  info[ZA_SUB_TYPE] = strdup("LIST");
-  info[ZA_IWS_TYPE] = strdup("LIST");
-  info[ZA_IUI_TYPE] = strdup("LIST");
-  info[ZA_XMT_ID] = strdup("empty");
-  info[ZA_SUB_ID] = strdup("empty");
-  info[ZA_IWS_ID] = strdup("empty");
-  info[ZA_IUI_ID] = strdup("empty");
+  info[ZA_XMT_TYPE] = strdup("NONE");
+  info[ZA_SUB_TYPE] = strdup("NONE");
+  info[ZA_IWS_TYPE] = strdup("NONE");
+  info[ZA_IUI_TYPE] = strdup("NONE");
+  info[ZA_XMT_ID] = strdup("");
+  info[ZA_SUB_ID] = strdup("");
+  info[ZA_IWS_ID] = strdup("");
+  info[ZA_IUI_ID] = strdup("");
   info[ZA_MODTIME] = info[ZA_MODBY] = info[ZA_MODWITH] = NULL;
   info[ZA_END] = NULL;
   return info;
@@ -43,10 +43,10 @@ static char **SetDefaults(char **info, char *name)
 
 /* Get info from database */
 
-static struct qelem *GetZephyrInfo(char *name)
+static struct mqelem *GetZephyrInfo(char *name)
 {
   int stat;
-  struct qelem *elem = NULL;
+  struct mqelem *elem = NULL;
 
   if ((stat = do_mr_query("get_zephyr_class", 1, &name, StoreInfo, &elem)))
     {
@@ -70,35 +70,15 @@ static char *PrintZephyrInfo(char **info)
     }
   sprintf(buf, "        Zephyr class: %s", info[ZA_CLASS]);
   Put_message(buf);
-  if (!strcmp(info[ZA_XMT_ID], "WILDCARD"))
-    {
-      free(info[ZA_XMT_ID]);
-      info[ZA_XMT_ID] = strdup("*.*@*");
-    }
   sprintf(buf, "Transmit ACL:           %s %s", info[ZA_XMT_TYPE],
          strcasecmp(info[ZA_XMT_TYPE], "NONE") ? info[ZA_XMT_ID] : "");
   Put_message(buf);
-  if (!strcmp(info[ZA_SUB_ID], "WILDCARD"))
-    {
-      free(info[ZA_SUB_ID]);
-      info[ZA_SUB_ID] = strdup("*.*@*");
-    }
   sprintf(buf, "Subscription ACL:       %s %s", info[ZA_SUB_TYPE],
          strcasecmp(info[ZA_SUB_TYPE], "NONE") ? info[ZA_SUB_ID] : "");
   Put_message(buf);
-  if (!strcmp(info[ZA_IWS_ID], "WILDCARD"))
-    {
-      free(info[ZA_IWS_ID]);
-      info[ZA_IWS_ID] = strdup("*.*@*");
-    }
   sprintf(buf, "Instance Wildcard ACL:  %s %s", info[ZA_IWS_TYPE],
          strcasecmp(info[ZA_IWS_TYPE], "NONE") ? info[ZA_IWS_ID] : "");
   Put_message(buf);
-  if (!strcmp(info[ZA_IUI_ID], "WILDCARD"))
-    {
-      free(info[ZA_IUI_ID]);
-      info[ZA_IUI_ID] = strdup("*.*@*");
-    }
   sprintf(buf, "Instance Indentity ACL: %s %s", info[ZA_IUI_TYPE],
          strcasecmp(info[ZA_IUI_TYPE], "NONE") ? info[ZA_IUI_ID] : "");
   Put_message(buf);
@@ -133,81 +113,45 @@ static char **AskZephyrInfo(char **info, Bool rename)
        }
     }
 
-  if (GetTypeFromUser("What kind of transmit restriction", "ace_type",
+  if (GetTypeFromUser("What kind of transmit restriction", "zace_type",
                      &info[ZA_XMT_TYPE]) == SUB_ERROR)
     return NULL;
-  if (strcasecmp(info[ZA_XMT_TYPE], "NONE"))
+  if (strcasecmp(info[ZA_XMT_TYPE], "NONE") &&
+      strcasecmp(info[ZA_XMT_TYPE], "ALL"))
     {
-      if (!strcmp(info[ZA_XMT_ID], "WILDCARD"))
-       {
-         free(info[ZA_XMT_ID]);
-         info[ZA_XMT_ID] = strdup("*.*@*");
-       }
       sprintf(buf, "Which %s: ", info[ZA_XMT_TYPE]);
       if (GetValueFromUser(buf, &info[ZA_XMT_ID]) == SUB_ERROR)
        return NULL;
-      if (!strcmp(info[ZA_XMT_ID], "*.*@*"))
-       {
-         free(info[ZA_XMT_ID]);
-         info[ZA_XMT_ID] = strdup("WILDCARD");
-       }
     }
-  if (GetTypeFromUser("What kind of subscription restriction", "ace_type",
+  if (GetTypeFromUser("What kind of subscription restriction", "zace_type",
                      &info[ZA_SUB_TYPE]) == SUB_ERROR)
     return NULL;
-  if (strcasecmp(info[ZA_SUB_TYPE], "NONE"))
+  if (strcasecmp(info[ZA_SUB_TYPE], "NONE") &&
+      strcasecmp(info[ZA_SUB_TYPE], "ALL"))
     {
-      if (!strcmp(info[ZA_SUB_ID], "WILDCARD"))
-       {
-         free(info[ZA_SUB_ID]);
-         info[ZA_SUB_ID] = strdup("*.*@*");
-       }
       sprintf(buf, "Which %s: ", info[ZA_SUB_TYPE]);
       if (GetValueFromUser(buf, &info[ZA_SUB_ID]) == SUB_ERROR)
        return NULL;
-      if (!strcmp(info[ZA_SUB_ID], "*.*@*"))
-       {
-         free(info[ZA_SUB_ID]);
-         info[ZA_SUB_ID] = strdup("WILDCARD");
-       }
     }
   if (GetTypeFromUser("What kind of wildcard instance restriction",
-                     "ace_type", &info[ZA_IWS_TYPE]) == SUB_ERROR)
+                     "zace_type", &info[ZA_IWS_TYPE]) == SUB_ERROR)
     return NULL;
-  if (strcasecmp(info[ZA_IWS_TYPE], "NONE") != 0)
+  if (strcasecmp(info[ZA_IWS_TYPE], "NONE") &&
+      strcasecmp(info[ZA_IWS_TYPE], "ALL"))
     {
-      if (!strcmp(info[ZA_IWS_ID], "WILDCARD"))
-       {
-         free(info[ZA_IWS_ID]);
-         info[ZA_IWS_ID] = strdup("*.*@*");
-       }
       sprintf(buf, "Which %s: ", info[ZA_IWS_TYPE]);
       if (GetValueFromUser(buf, &info[ZA_IWS_ID]) == SUB_ERROR)
        return NULL;
-      if (!strcmp(info[ZA_IWS_ID], "*.*@*"))
-       {
-         free(info[ZA_IWS_ID]);
-         info[ZA_IWS_ID] = strdup("WILDCARD");
-       }
     }
   if (GetTypeFromUser("What kind of instance identity restriction",
-                     "ace_type", &info[ZA_IUI_TYPE]) == SUB_ERROR)
+                     "zace_type", &info[ZA_IUI_TYPE]) == SUB_ERROR)
     return NULL;
-  if (strcasecmp(info[ZA_IUI_TYPE], "NONE"))
+  if (strcasecmp(info[ZA_IUI_TYPE], "NONE") &&
+      strcasecmp(info[ZA_IUI_TYPE], "ALL"))
     {
-      if (!strcmp(info[ZA_IUI_ID], "WILDCARD"))
-       {
-         free(info[ZA_IUI_ID]);
-         info[ZA_IUI_ID] = strdup("*.*@*");
-       }
       sprintf(buf, "Which %s: ", info[ZA_IUI_TYPE]);
       if (GetValueFromUser(buf, &info[ZA_IUI_ID]) == SUB_ERROR)
        return NULL;
-      if (!strcmp(info[ZA_IUI_ID], "*.*@*"))
-       {
-         free(info[ZA_IUI_ID]);
-         info[ZA_IUI_ID] = strdup("WILDCARD");
-       }
     }
   FreeAndClear(&info[ZA_MODTIME], TRUE);
   FreeAndClear(&info[ZA_MODBY], TRUE);
@@ -222,10 +166,10 @@ static char **AskZephyrInfo(char **info, Bool rename)
 /* Menu entry for get zephyr */
 int GetZephyr(int argc, char **argv)
 {
-  struct qelem *top;
+  struct mqelem *top;
 
   top = GetZephyrInfo(argv[1]);
-  Loop(top, (void *) PrintZephyrInfo);
+  Loop(top, (void (*)(char **)) PrintZephyrInfo);
   FreeQueue(top);
   return DM_NORMAL;
 }
@@ -249,7 +193,7 @@ void RealDeleteZephyr(char **info, Bool one_item)
 
 int DeleteZephyr(int argc, char **argv)
 {
-  struct qelem *elem = GetZephyrInfo(argv[1]);
+  struct mqelem *elem = GetZephyrInfo(argv[1]);
   QueryLoop(elem, PrintZephyrInfo, RealDeleteZephyr,
            "Delete Zephyr class restriction for class ");
   FreeQueue(elem);
@@ -321,7 +265,7 @@ static void RealUpdateZephyr(char **info, Bool junk)
 
 int ChngZephyr(int argc, char **argv)
 {
-  struct qelem *top;
+  struct mqelem *top;
 
   top = GetZephyrInfo(argv[1]);
   QueryLoop(top, NullPrint, RealUpdateZephyr, "Update class");
This page took 0.037097 seconds and 4 git commands to generate.