* kadmin.c (kadmin_addprinc): print warning/notice about no policy
authorBarry Jaspan <bjaspan@mit.edu>
Tue, 3 Dec 1996 20:40:42 +0000 (20:40 +0000)
committerBarry Jaspan <bjaspan@mit.edu>
Tue, 3 Dec 1996 20:40:42 +0000 (20:40 +0000)
  and default policy [krb5-admin/252]

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9597 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/cli/ChangeLog
src/kadmin/cli/kadmin.c

index d06ca6e98cee4de55adeae6d847be15e8b733d75..9c28f25e1d2c17b4904ef3277dcab4246c1e0824 100644 (file)
@@ -1,3 +1,8 @@
+Tue Dec  3 15:39:11 1996  Barry Jaspan  <bjaspan@mit.edu>
+
+       * kadmin.c (kadmin_addprinc): print warning/notice about no policy
+       and default policy [krb5-admin/252]
+
 Wed Nov 13 14:29:02 1996  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in (clean-unix): Remove getdate.c and kadmin_ct.c.
index d8011f86e4a3142bdf8f71bf4d67a23010243f9b..a684a2e58a4047965a2829d60f9ab8ebe694c27e 100644 (file)
@@ -377,27 +377,34 @@ char *kadmin_startup(argc, argv)
      * Initialize the kadm5 connection.  If we were given a ccache,
      * use it.  Otherwise, use/prompt for the password.
      */
-    if (ccache_name)
+    if (ccache_name) {
+        printf("Authenticating as principal %s with existing credentials.\n",
+               princstr);
         retval = kadm5_init_with_creds(princstr, cc,
                                        KADM5_ADMIN_SERVICE, 
                                        &params,
                                        KADM5_STRUCT_VERSION,
                                        KADM5_API_VERSION_2,
                                        &handle);
-    else if (use_keytab)
+    } else if (use_keytab) {
+        printf("Authenticating as principal %s with keytab %s.\n",
+               princstr, keytab_name);
         retval = kadm5_init_with_skey(princstr, keytab_name,
                                       KADM5_ADMIN_SERVICE, 
                                       &params,
                                       KADM5_STRUCT_VERSION,
                                       KADM5_API_VERSION_2,
                                       &handle);
-    else
+    } else {
+        printf("Authenticating as principal %s with password.\n",
+               princstr);
         retval = kadm5_init_with_password(princstr, password,
                                           KADM5_ADMIN_SERVICE, 
                                           &params,
                                           KADM5_STRUCT_VERSION,
                                           KADM5_API_VERSION_2,
                                           &handle);
+    }
     if (retval) {
        com_err(whoami, retval, "while initializing %s interface", whoami);
        if (retval == KADM5_BAD_CLIENT_PARAMS ||
@@ -814,11 +821,18 @@ void kadmin_addprinc(argc, argv)
      * unset, since it is never valid for kadm5_create_principal.
      */
     if ((! (mask & KADM5_POLICY)) &&
-       (! (mask & KADM5_POLICY_CLR)) &&
-       (! (retval = kadm5_get_policy(handle, "default", &defpol)))) {
-        princ.policy = "default";
-        mask |= KADM5_POLICY;
-        (void) kadm5_free_policy_ent(handle, &defpol);
+       (! (mask & KADM5_POLICY_CLR))) {
+        if (! kadm5_get_policy(handle, "default", &defpol)) {
+             fprintf(stderr,
+               "NOTICE: no policy specified for %s; assigning \"default\"\n",
+                     canon);
+             princ.policy = "default";
+             mask |= KADM5_POLICY;
+             (void) kadm5_free_policy_ent(handle, &defpol);
+        } else
+             fprintf(stderr,
+            "WARNING: no policy specified for %s; defaulting to no policy\n",
+                     canon);
     }
     mask &= ~KADM5_POLICY_CLR;