- replace our patch for #563431 (kpasswd doesn't fall back to guessing your

principal name using your user name if you don't have a ccache) with
    the on upstream uses
This commit is contained in:
Nalin Dahyabhai 2010-03-19 21:15:10 +00:00
parent 39cf8a4b2d
commit 5d2ca1d225

View File

@ -1,34 +1,50 @@
If we encounter any errors reading the user's principal name from the default If we encounter any errors reading the user's principal name from the default
ccache, fall back to the default of using the current user's name. RT#6683 ccache, fall back to the default of using the current user's name. RT#6683
diff -up krb5-1.8/src/clients/kpasswd/kpasswd.c.kpasswd-ccache krb5-1.8/src/clients/kpasswd/kpasswd.c Index: src/clients/kpasswd/kpasswd.c
--- krb5-1.8/src/clients/kpasswd/kpasswd.c.kpasswd-ccache 2009-10-30 20:48:38.000000000 -0400 ===================================================================
+++ krb5-1.8/src/clients/kpasswd/kpasswd.c 2010-03-05 11:04:42.000000000 -0500 --- src/clients/kpasswd/kpasswd.c (revision 23818)
@@ -85,21 +85,23 @@ int main(int argc, char *argv[]) +++ src/clients/kpasswd/kpasswd.c (revision 23819)
@@ -47,7 +47,7 @@
{
krb5_error_code ret;
krb5_context context;
- krb5_principal princ;
+ krb5_principal princ = NULL;
char *pname;
krb5_ccache ccache;
krb5_get_init_creds_opt *opts = NULL;
@@ -84,23 +84,27 @@
com_err(argv[0], ret, "parsing client name");
exit(1); exit(1);
} }
} else if ((ret = krb5_cc_default(context, &ccache)) != KRB5_CC_NOTFOUND) { - } else if ((ret = krb5_cc_default(context, &ccache)) != KRB5_CC_NOTFOUND) {
+ princ = NULL; - if (ret) {
+ + } else {
if (ret) { + ret = krb5_cc_default(context, &ccache);
+ if (ret != 0) {
com_err(argv[0], ret, "opening default ccache"); com_err(argv[0], ret, "opening default ccache");
- exit(1); exit(1);
} }
+ else
if ((ret = krb5_cc_get_principal(context, ccache, &princ))) { - if ((ret = krb5_cc_get_principal(context, ccache, &princ))) {
+ ret = krb5_cc_get_principal(context, ccache, &princ);
+ if (ret != 0 && ret != KRB5_CC_NOTFOUND && ret != KRB5_FCC_NOFILE) {
com_err(argv[0], ret, "getting principal from ccache"); com_err(argv[0], ret, "getting principal from ccache");
- exit(1); exit(1);
} }
+ else
if ((ret = krb5_cc_close(context, ccache))) { - if ((ret = krb5_cc_close(context, ccache))) {
+ ret = krb5_cc_close(context, ccache);
+ if (ret != 0) {
com_err(argv[0], ret, "closing ccache"); com_err(argv[0], ret, "closing ccache");
- exit(1); exit(1);
} }
- } else { - } else {
+ } - get_name_from_passwd_file(argv[0], context, &princ);
+ if (princ == NULL) { +
get_name_from_passwd_file(argv[0], context, &princ); + if (princ == NULL)
+ get_name_from_passwd_file(argv[0], context, &princ);
} }
if ((ret = krb5_get_init_creds_opt_alloc(context, &opts))) {