Change admin instance name to kadmin and fix bug in kadmin_list
authorPaul Park <pjpark@mit.edu>
Thu, 1 Jun 1995 18:52:17 +0000 (18:52 +0000)
committerPaul Park <pjpark@mit.edu>
Thu, 1 Jun 1995 18:52:17 +0000 (18:52 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5929 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/v5client/ChangeLog
src/kadmin/v5client/kadmin5.M
src/kadmin/v5client/kadmin5.c

index 667a3ce9266f7eac23a813af1bbdb1dcaa72bbbc..4188e06b8aca55747deaa2701cd77c7f3e7d64a8 100644 (file)
@@ -1,4 +1,12 @@
 
+Thu Jun 1 14:31:49 EDT 1995    Paul Park       (pjpark@mit.edu)
+       * kadmin5.c: Change the default admin instance name to "kadmin"
+       * kadmin5.c(kadmin_list): Compare principals to each of the supplied
+               regular expressions instead of only to the last one.  This
+               is slightly inefficient, but correct.
+       * kadmin5.M: Document the change in default instance name.
+
+
 Mon May 15 10:57:17 EDT 1995   Paul Park       (pjpark@mit.edu)
        * kadmin5.M     - Change default principal name for kadmin5.
 
index 8443c67292927e58fb0a11ebb77325f662e5c5fd..63a5cf79c4689ff05865c94123d7a181e58758c0 100644 (file)
@@ -45,7 +45,7 @@ specifies the default realm.
 .B principal
 specifies a principal name to use instead of the default 
 .I user
-.B /kadmin5@realm.
+.B /kadmin@realm.
 .IP \-m
 specifies that multiple operations will be permitted for only one entry of the
 administrative principal's password.
@@ -73,7 +73,7 @@ Principals who may perform administrative operations are controlled by the
 .I kadmind5
 access control list.  The default administrative principal is
 .I user
-.B /kadmin5@realm.
+.B /kadmin@realm.
 .PP
 One command may be specified on the command line, or if no command is provided,
 an interactive command loop is entered for the administrator to enter commands.
index 92ed342f55c25ececdef1013611775841d50b5b6..5aa9fd039613ccb993c896c0e2b044cd602ee1d2 100644 (file)
@@ -64,7 +64,7 @@ static char           *re_string = (char *) NULL;
 static const char *help_option         = "-help";
 static const char *verbose_option      = "-verbose";
 static const char *force_option                = "-force";
-static const char *kadmin_instance     = "kadmin5";
+static const char *kadmin_instance     = "kadmin";
 
 static const char *wr_ktab_type                = "WRFILE";
 
@@ -1046,20 +1046,7 @@ kadmin_list(argc, argv)
     requestname = argv[0];
     error = 0;
     verbose = 0;
-#if    HAVE_REGCOMP
-    if (match_error = regcomp(&match_exp, lprinc_all_regexp, REG_EXTENDED)) {
-       errmsg_size = regerror(match_error,
-                              &match_exp,
-                              match_errmsg,
-                              sizeof(match_errmsg));
-       com_err(requestname, 0, lprinc_regexp_fmt, lprinc_all_regexp,
-               match_errmsg);
-       return;
-    }
-#else  /* HAVE_REGCOMP */
-    re_comp(".*");     /* Accept everything */
-#endif /* HAVE_REGCOMP */
-    
+
     for (i=1; i<argc; i++) {
        if (!strcmp(argv[i], help_option)) {
            com_err(argv[0], 0, lprinc_usage_fmt, argv[0], verbose_option);
@@ -1070,32 +1057,14 @@ kadmin_list(argc, argv)
            verbose = 1;
            continue;
        }
-#if    HAVE_REGCOMP
-       if (match_error = regcomp(&match_exp, argv[i], REG_EXTENDED)) {
-           errmsg_size = regerror(match_error,
-                                  &match_exp,
-                                  match_errmsg,
-                                  sizeof(match_errmsg));
-           com_err(requestname, 0, lprinc_regexp_fmt, argv[i], match_errmsg);
-           error = 1;
-       }
-       else
-           continue;
-#else  /* HAVE_REGCOMP */
-       if (!(re_result = re_comp(argv[i]))) {
-           continue;
-       }
-       else {
-           com_err(argv[0], 0, lprinc_regexp_fmt, re_result);
-           error = 1;
-       }
-#endif /* HAVE_REGCOMP */
     }
+    
     if (!error) {
        char            *next;
        char            *nnext;
        krb5_ui_4       valid;
        krb5_db_entry   *dbentry;
+       int             match;
 
        if (dbentry = (krb5_db_entry *) malloc(sizeof(krb5_db_entry))) {
            memset((char *) dbentry, 0, sizeof(*dbentry));
@@ -1116,50 +1085,71 @@ kadmin_list(argc, argv)
                        com_err(argv[0], 0, cant_get_fmt, lprinc_first_msg);
                        break;
                    }
+                   match = 0;
+                   for (i=1; i<argc; i++) {
+                       if (!strcmp(argv[i], verbose_option))
+                           continue;
 #if    HAVE_REGCOMP
-                   if (match_error = regexec(&match_exp,
-                                             next,
-                                             1,
-                                             &match_match,
-                                             0)) {
-                       if (match_error != REG_NOMATCH) {
+                       if (match_error = regcomp(&match_exp,
+                                                 argv[i],
+                                                 REG_EXTENDED)) {
                            errmsg_size = regerror(match_error,
                                                   &match_exp,
                                                   match_errmsg,
                                                   sizeof(match_errmsg));
                            com_err(requestname, 0,
-                                   lprinc_regsrch_fmt,
+                                   lprinc_regexp_fmt,
                                    argv[i],
-                                   next,
                                    match_errmsg);
                            error = 1;
+                           break;
                        }
-                   }
-                   else {
-                       /*
-                        * We have a match.  See if it matches the whole
-                        * name.
-                        */
-                       if ((match_match.rm_so == 0) &&
-                           (match_match.rm_eo == strlen(next))) {
-                           if (verbose) {
-                               kadmin_print_entry(next, valid, dbentry);
+                       if (match_error = regexec(&match_exp,
+                                                 next,
+                                                 1,
+                                                 &match_match,
+                                                 0)) {
+                           if (match_error != REG_NOMATCH) {
+                               errmsg_size = regerror(match_error,
+                                                      &match_exp,
+                                                      match_errmsg,
+                                                      sizeof(match_errmsg));
+                               com_err(requestname, 0,
+                                       lprinc_regsrch_fmt,
+                                       argv[i],
+                                       next,
+                                       match_errmsg);
+                               error = 1;
                            }
-                           else {
-                               printf("%s\n", next);
+                       }
+                       else {
+                           /*
+                            * We have a match.  See if it matches the whole
+                            * name.
+                            */
+                           if ((match_match.rm_so == 0) &&
+                               (match_match.rm_eo == strlen(next))) {
+                               match = 1;
                            }
                        }
-                   }
 #else  /* HAVE_REGCOMP */
-                   if (re_exec(next)) {
-                       if (verbose) {
-                           kadmin_print_entry(next, valid, dbentry);
+                       if (!(re_result = re_comp(argv[i]))) {
+                           com_err(argv[0], 0, lprinc_regexp_fmt, re_result);
+                           error = 1;
+                           break;
                        }
-                       else {
+                       if (re_exec(next))
+                           match = 1;
+#endif /* HAVE_REGCOMP */
+                   }
+                   if (error)
+                       break;
+                   if (match || (argc == 1)) {
+                       if (verbose)
+                           kadmin_print_entry(next, valid, dbentry);
+                       else
                            printf("%s\n", next);
-                       }
                    }
-#endif /* HAVE_REGCOMP */
                    free(next);
                    next = nnext;
                    krb5_db_free_principal(kcontext, dbentry, 1);