krb5 commit: Use retval, not errno, when stashing master keys

Benjamin Kaduk kaduk at MIT.EDU
Mon Nov 4 14:22:21 EST 2013


https://github.com/krb5/krb5/commit/51b5cef8387da33c2a61e5ebbf69a8702eece1d5
commit 51b5cef8387da33c2a61e5ebbf69a8702eece1d5
Author: Ben Kaduk <kaduk at mit.edu>
Date:   Mon Nov 4 13:09:13 2013 -0500

    Use retval, not errno, when stashing master keys
    
    The krb5_db_store_master_key{,_list} functions return a
    krb5_error_code, and do not necessarily set errno on failure.
    Use the correct variable while reporting errors with com_err().

 src/kadmin/dbutil/kdb5_create.c |    2 +-
 src/kadmin/dbutil/kdb5_mkey.c   |    2 +-
 src/kadmin/dbutil/kdb5_stash.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kadmin/dbutil/kdb5_create.c b/src/kadmin/dbutil/kdb5_create.c
index 96275ca..31b3c6e 100644
--- a/src/kadmin/dbutil/kdb5_create.c
+++ b/src/kadmin/dbutil/kdb5_create.c
@@ -341,7 +341,7 @@ void kdb5_create(argc, argv)
                                       &master_keyblock,
                                       mkey_password);
     if (retval) {
-        com_err(progname, errno, _("while storing key"));
+        com_err(progname, retval, _("while storing key"));
         printf(_("Warning: couldn't stash master key.\n"));
     }
     /* clean up */
diff --git a/src/kadmin/dbutil/kdb5_mkey.c b/src/kadmin/dbutil/kdb5_mkey.c
index 59bce3c..ba8716b 100644
--- a/src/kadmin/dbutil/kdb5_mkey.c
+++ b/src/kadmin/dbutil/kdb5_mkey.c
@@ -337,7 +337,7 @@ kdb5_add_mkey(int argc, char *argv[])
                                           &new_mkeyblock,
                                           mkey_password);
         if (retval) {
-            com_err(progname, errno, _("while storing key"));
+            com_err(progname, retval, _("while storing key"));
             printf(_("Warning: couldn't stash master key.\n"));
         }
     }
diff --git a/src/kadmin/dbutil/kdb5_stash.c b/src/kadmin/dbutil/kdb5_stash.c
index 30ca82c..e05944f 100644
--- a/src/kadmin/dbutil/kdb5_stash.c
+++ b/src/kadmin/dbutil/kdb5_stash.c
@@ -130,7 +130,7 @@ kdb5_stash(argc, argv)
     retval = krb5_db_store_master_key_list(util_context, keyfile, master_princ,
                                            NULL);
     if (retval) {
-        com_err(progname, errno, _("while storing key"));
+        com_err(progname, retval, _("while storing key"));
         exit_status++; return;
     }
 


More information about the cvs-krb5 mailing list