]> andersk Git - moira.git/blobdiff - clients/moira/lists.c
Need to fill in the "user" variable with mrcl_krb_user().
[moira.git] / clients / moira / lists.c
index eef4c747e0ad791ef6cb9b7d091ab9bd92325e84..b839836fb6a5f09908d636b3395d8b5f646dab77 100644 (file)
@@ -232,30 +232,56 @@ char **AskListInfo(char **info, Bool name)
        return NULL;
     }
 
-  if (GetTypeFromUser("What Type of Administrator", "ace_type",
-                     &info[L_ACE_TYPE]) == SUB_ERROR)
-    return NULL;
-  if (strcasecmp(info[L_ACE_TYPE], "NONE") &&
-      strcasecmp(info[L_ACE_TYPE], "none"))
+  do {
+    if (GetTypeFromUser("What Type of Administrator", "ace_type",
+                       &info[L_ACE_TYPE]) == SUB_ERROR)
+      return NULL;
+    if (strcasecmp(info[L_ACE_TYPE], "none"))
+      {
+       sprintf(temp_buf, "Which %s will be the administrator of this list: ",
+               info[L_ACE_TYPE]);
+       if (GetValueFromUser(temp_buf, &info[L_ACE_NAME]) == SUB_ERROR)
+         return NULL;
+      }
+    else
+      {
+       Put_message("Setting the administrator of this list to 'NONE'");
+       Put_message("will make you unable to further modify the list.");
+       if (YesNoQuestion("Do you really want to do this?", FALSE) == TRUE)
+         break;
+      }
+  } while (!strcasecmp(info[L_ACE_TYPE], "none"));
+       
+  if (!strcasecmp(info[L_ACE_TYPE], "kerberos"))
     {
-      sprintf(temp_buf, "Which %s will be the administrator of this list: ",
-             info[L_ACE_TYPE]);
-      if (GetValueFromUser(temp_buf, &info[L_ACE_NAME]) == SUB_ERROR)
-       return NULL;
+      char *canon;
+      
+      mrcl_validate_kerberos_member(info[L_ACE_NAME], &canon);
+      if (mrcl_get_message())
+       Put_message(mrcl_get_message());
+      free(info[L_ACE_NAME]);
+      info[L_ACE_NAME] = canon;
     }
-
   if (GetTypeFromUser("What Type of Membership Administrator", "ace_type",
                      &info[L_MEMACE_TYPE]) == SUB_ERROR)
     return NULL;
-  if (strcasecmp(info[L_MEMACE_TYPE], "NONE") &&
-      strcasecmp(info[L_MEMACE_TYPE], "none"))
+  if (strcasecmp(info[L_MEMACE_TYPE], "none"))
     {
       sprintf(temp_buf, "Which %s will be the membership administrator of this list: ",
              info[L_MEMACE_TYPE]);
       if (GetValueFromUser(temp_buf, &info[L_MEMACE_NAME]) == SUB_ERROR)
        return NULL;
     }
+  if (!strcasecmp(info[L_MEMACE_TYPE], "kerberos"))
+    {
+      char *canon;
 
+      mrcl_validate_kerberos_member(info[L_MEMACE_NAME], &canon);
+      if (mrcl_get_message())
+       Put_message(mrcl_get_message());
+      free(info[L_MEMACE_NAME]);
+      info[L_MEMACE_NAME] = canon;
+    }
   if (GetValueFromUser("Description: ", &info[L_DESC]) == SUB_ERROR)
     return NULL;
 
@@ -677,11 +703,11 @@ int AddMember(int argc, char **argv)
 
   if (!strcmp(args[LM_TYPE], "STRING"))
     {
-      if (mrcl_validate_string_member(args[LM_MEMBER]) != MRCL_SUCCESS)
-       {
-         Put_message(mrcl_get_message());
-         return DM_NORMAL;
-       }
+      status = mrcl_validate_string_member(args[LM_MEMBER]);
+      if (status != MRCL_SUCCESS)
+       Put_message(mrcl_get_message());
+      if (status == MRCL_REJECT)
+       return DM_NORMAL;
     }
   else if (!strcmp(args[LM_TYPE], "KERBEROS"))
     {
@@ -887,10 +913,18 @@ int ListByMember(int argc, char **argv)
   if (GetValueFromUser(buf, &name) == SUB_ERROR)
     return DM_NORMAL;
 
-  /* What we really want is a recursive search */
-  sprintf(temp_buf, "R%s", type);
-  free(type);
-  type = strdup(temp_buf);
+  switch (YesNoQuestion("Do you want a recursive search (y/n)", TRUE))
+    {
+    case TRUE:
+      sprintf(temp_buf, "R%s", type);  /* "USER" to "RUSER" etc. */
+      free(type);
+      type = strdup(temp_buf);
+      break;
+    case FALSE:
+      break;
+    default:
+      return DM_NORMAL;
+    }
 
   if ((maillist = YesNoQuestion("Show Lists that are Maillists (y/n) ?",
                                TRUE)) == -1)
This page took 0.108712 seconds and 4 git commands to generate.