[PATCH] Move kadmin warnings/notices about principal to stderr
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Jul 17 18:42:09 EDT 2013
kadmin currently emits "Authenticating as principal ..."
warnings/notices to stdout. This means that these warnings/notices
get mixed up with the results of a supplied query, e.g.
kadmin -c /tmp/cc -q 'listprincs foo'
will contain both warnings and data on stdout.
These warnings were originally introduced back in 1996 by Barry
Jaspan, in what is now known as commit ID
073771e88ad5cd708d3ee18e206cb06d9f138c0a that only mentions
warnings/notices about policies (not principals) in
src/kadmin/cli/ChangeLog
This commit moves those warnings from stdout to stderr so that tools
that parse the output of kadmin can distinguish between the two.
---
src/kadmin/cli/kadmin.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/kadmin/cli/kadmin.c b/src/kadmin/cli/kadmin.c
index b2b464b..02de571 100644
--- a/src/kadmin/cli/kadmin.c
+++ b/src/kadmin/cli/kadmin.c
@@ -496,29 +496,31 @@ kadmin_startup(int argc, char *argv[])
* use it. Otherwise, use/prompt for the password.
*/
if (ccache_name) {
- printf(_("Authenticating as principal %s with existing "
+ fprintf(stderr, _("Authenticating as principal %s with existing "
"credentials.\n"), princstr);
retval = kadm5_init_with_creds(context, princstr, cc, svcname, ¶ms,
KADM5_STRUCT_VERSION,
KADM5_API_VERSION_4, db_args, &handle);
} else if (use_anonymous) {
- printf(_("Authenticating as principal %s with password; "
+ fprintf(stderr, _("Authenticating as principal %s with password; "
"anonymous requested.\n"), princstr);
retval = kadm5_init_anonymous(context, princstr, svcname, ¶ms,
KADM5_STRUCT_VERSION,
KADM5_API_VERSION_4, db_args, &handle);
} else if (use_keytab) {
if (keytab_name)
- printf(_("Authenticating as principal %s with keytab %s.\n"),
- princstr, keytab_name);
+ fprintf(stderr,
+ _("Authenticating as principal %s with keytab %s.\n"),
+ princstr, keytab_name);
else
- printf(_("Authenticating as principal %s with default keytab.\n"),
- princstr);
+ fprintf(stderr,
+ _("Authenticating as principal %s with default keytab.\n"),
+ princstr);
retval = kadm5_init_with_skey(context, princstr, keytab_name, svcname,
¶ms, KADM5_STRUCT_VERSION,
KADM5_API_VERSION_4, db_args, &handle);
} else {
- printf(_("Authenticating as principal %s with password.\n"),
+ fprintf(stderr, _("Authenticating as principal %s with password.\n"),
princstr);
retval = kadm5_init_with_password(context, princstr, password, svcname,
¶ms, KADM5_STRUCT_VERSION,
--
1.7.10.4
More information about the Kerberos
mailing list