[krbdev.mit.edu #6684] Simple kinit verbosity patch

Jeff Blaine via RT rt-comment at krbdev.mit.edu
Fri Mar 12 17:09:53 EST 2010


--- kinit.c	2010-03-12 16:28:36.000000000 -0500
+++ ../../../../PRISTINE-DONT-MOD-krb5-1.8/src/clients/kinit/kinit.c	2009-12-28 13:03:31.000000000 -0500
@@ -455,9 +455,6 @@
             com_err(progname, code, "resolving ccache %s",
                     opts->k5_cache_name);
             return 0;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "Using specified cache: %s\n", opts->k5_cache_name);
         }
     }
     else
@@ -465,9 +462,6 @@
         if ((code = krb5_cc_default(k5->ctx, &k5->cc))) {
             com_err(progname, code, "while getting default ccache");
             return 0;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "Using default cache: %s\n", krb5_cc_default_name(k5->ctx));
         }
     }
 
@@ -525,7 +519,6 @@
                     return 0;
                 }
             } else {
-                /* not anonymous, not keytab */
                 /* Get default principal from cache if one exists */
                 code = krb5_cc_get_principal(k5->ctx, k5->cc,
                                              &k5->me);
@@ -551,9 +544,6 @@
         com_err(progname, code, "when unparsing name");
         return 0;
     }
-    if (opts->verbose)
-        fprintf(stderr, "Using principal: %s\n", k5->name);
-
     opts->principal_name = k5->name;
 
     return 1;
@@ -606,14 +596,14 @@
     memset(&my_creds, 0, sizeof(my_creds));
 
     code = krb5_get_init_creds_opt_alloc(k5->ctx, &options);
+    if (code)
+        goto cleanup;
+
     /*
       From this point on, we can goto cleanup because my_creds is
       initialized.
     */
 
-    if (code)
-        goto cleanup;
-
     if (opts->lifetime)
         krb5_get_init_creds_opt_set_tkt_life(options, opts->lifetime);
     if (opts->rlife)
@@ -653,9 +643,6 @@
             com_err(progname, code, "resolving keytab %s",
                     opts->keytab_name);
             goto cleanup;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "Using keytab: %s\n", opts->keytab_name);
         }
     }
 
@@ -667,9 +654,6 @@
             com_err(progname, code, "while setting '%s'='%s'",
                     opts->pa_opts[i].attr, opts->pa_opts[i].value);
             goto cleanup;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "PA Option %s = %s\n", opts->pa_opts[i].attr, opts->pa_opts[i].value);
         }
     }
     code = krb5_get_init_creds_opt_set_out_ccache(k5->ctx, options, k5->cc);
@@ -731,18 +715,12 @@
             com_err(progname, code, "when initializing cache %s",
                     opts->k5_cache_name?opts->k5_cache_name:"");
             goto cleanup;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "Initialized cache\n");
         }
 
         code = krb5_cc_store_cred(k5->ctx, k5->cc, &my_creds);
         if (code) {
             com_err(progname, code, "while storing credentials");
             goto cleanup;
-        } else {
-            if (opts->verbose)
-                fprintf(stderr, "Stored credentials\n");
         }
     }
     notix = 0;





More information about the krb5-bugs mailing list