]> andersk Git - moira.git/commitdiff
change this behavior:
authordanw <danw>
Tue, 15 Jul 1997 15:39:47 +0000 (15:39 +0000)
committerdanw <danw>
Tue, 15 Jul 1997 15:39:47 +0000 (15:39 +0000)
  danw@technomage:~> blanche danw-test-1 -a danwn

  WARNING: "STRING:danwn" was just added to list "danw-test-1".
          If danw-test-1 is a mailing list, this may cause it to stop working.
          You should consider removing "STRING:danwn" from the list.

to give the `No records in database match ... while adding ...' error
since `danwn' was probably a typo. Because it only makes sense to add
a local string to a list if that string is the same as a list or a
user (otherwise, as the warning above states, you'll break the list).
Since blanche tries those cases first, if we reach the string case,
the string isn't the same as a user or list, so the user probably
doesn't want to add it to the list, so we assume it was a typo.

If the user had really wanted to add it as a string, he should have
said STRING:danwn, which will still work (although it will no longer
give the warning since it's not the sort of thing you're likely to do
accidentally).

clients/blanche/blanche.c

index 36a9805355ca93dbede9baef99e0fa9e88def4c5..c3651dde9a43013759e18a46ff9ca9e037003844 100644 (file)
@@ -320,6 +320,19 @@ char **argv;
                break;
            }
        case M_STRING:
+           if (memberstruct->type == M_ANY &&
+               !strchr(memberstruct->name, '@') &&
+               !strchr(memberstruct->name, '!') &&
+               !strchr(memberstruct->name, '%')) {
+               /* if user is trying to add something which isn't a
+                  remote string, or a list, or a user, and didn't
+                  explicitly specify `STRING:', it's probably a typo */
+               com_err(whoami, MR_NO_MATCH, "while adding member %s to %s",
+                       memberstruct->name, listname);
+               success = 0;
+               break;
+           }
+                           
            membervec[1] = "STRING";
            status = mr_query("add_member_to_list", 3, membervec,
                               scream, NULL);
@@ -328,14 +341,6 @@ char **argv;
                      memberstruct->name, listname);
              success = 0;
            }
-           else if (!strchr(memberstruct->name, '@') &&
-                    !strchr(memberstruct->name, '!') &&
-                    !strchr(memberstruct->name, '%')) {
-               fprintf(stderr, "\nWARNING: \"STRING:%s\" was just added to list \"%s\".\n",
-                       memberstruct->name, listname);
-               fprintf(stderr, "\tIf %s is a mailing list, this may cause it to stop working.\n", listname);
-               fprintf(stderr, "\tYou should consider removing \"STRING:%s\" from the list.\n", memberstruct->name);
-           }
            break;
        case M_KERBEROS:
            membervec[1] = "KERBEROS";
@@ -744,17 +749,14 @@ register char *s;
        else if (!strcasecmp("kerberos", s))
          m->type = M_KERBEROS;
        else {
-           m->type = M_STRING;
+           m->type = M_ANY;
            *(--p) = ':';
            m->name = s;
        }
        m->name = strsave(m->name);
     } else {
        m->name = strsave(s);
-       if (strchr(s, '@') || strchr(s, '!') || strchr(s, '%') || strchr(s, ' '))
-         m->type = M_STRING;
-       else
-         m->type = M_ANY;
+       m->type = M_ANY;
     }
     return(m);
 }
This page took 0.106731 seconds and 5 git commands to generate.