]> andersk Git - moira.git/commitdiff
Allow spaces in container names.
authorzacheiss <zacheiss>
Sun, 12 Aug 2001 19:29:34 +0000 (19:29 +0000)
committerzacheiss <zacheiss>
Sun, 12 Aug 2001 19:29:34 +0000 (19:29 +0000)
clients/moira/cluster.c
incremental/winad/winad.c

index 635000a61cb5fd5e709e6064bea6279eb3e54884..6ce6c0d1c26ab9cc377184a220b6a4ebf12affab 100644 (file)
@@ -2070,8 +2070,18 @@ int AddContainer(int argc, char **argv)
   char **args, *info[MAX_ARGS_SIZE], *name = argv[1];
   int stat;
 
-  if (!ValidName(name))
-    return DM_NORMAL;
+  /* Can't use ValidName() because spaces are allowed in container names */
+  if (IS_EMPTY(name))
+    {
+      Put_message("Please use a non-empty name.");
+      return DM_NORMAL;
+    }
+
+  if (strchr(name, '*') || strchr(name, '?'))
+    {
+      Put_message("Wildcards not accepted here.");
+      return DM_NORMAL;
+    }
 
   /* Check if this cluster already exists. */
   if ((stat = do_mr_query("get_container", 1, &name, NULL, NULL))
index a396d7b176e7eb07baaf88a6c948f4f1091aad32..cf1700601838b410c4fe4dc1daa7a62ad9299018 100755 (executable)
@@ -351,6 +351,7 @@ int populate_group(LDAP *ldap_handle, char *dn_path, char *group_name,
                    int group_security_flag, char *MoiraId);
 int sid_update(LDAP *ldap_handle, char *dn_path);
 int check_string(char *s);
+int check_container_name(char* s);
 void convert_b_to_a(char *string, UCHAR *binary, int length);
 int mr_connect_cl(char *server, char *client, int version, int auth);
 
@@ -3100,6 +3101,24 @@ int check_string(char *s)
   return 1;
 }
 
+int check_container_name(char *s)
+{
+  char  character;
+
+  for (; *s; s++)
+    {
+      character = *s;
+      if (isupper(character))
+        character = tolower(character);
+
+         if (character == ' ')
+                 continue;
+      if (illegalchars[(unsigned) character])
+        return 0;
+    }
+  return 1;
+}
+
 int mr_connect_cl(char *server, char *client, int version, int auth)
 {
   int   status;
@@ -3770,7 +3789,7 @@ int container_rename(LDAP *ldap_handle, char *dn_path, int beforec, char **befor
 
   memset(cName, '\0', sizeof(cName));
   container_get_name(after[CONTAINER_NAME], cName);
-  if (!check_string(cName))
+  if (!check_container_name(cName))
     {
       com_err(whoami, 0, "invalid LDAP container name %s", cName);
       return(AD_INVALID_NAME);
@@ -3876,7 +3895,7 @@ int container_create(LDAP *ldap_handle, char *dn_path, int count, char **av)
       return(AD_INVALID_NAME);
     }
 
-  if (!check_string(cName))
+  if (!check_container_name(cName))
     {
       com_err(whoami, 0, "invalid LDAP container name %s", cName);
       return(AD_INVALID_NAME);
@@ -3992,7 +4011,7 @@ int container_get_distinguishedName(LDAP *ldap_handle, char *dn_path, char *dist
       return(AD_INVALID_NAME);
     }
 
-  if (!check_string(cName))
+  if (!check_container_name(cName))
     {
       com_err(whoami, 0, "invalid LDAP container name %s", cName);
       return(AD_INVALID_NAME);
This page took 1.506901 seconds and 5 git commands to generate.