From 2107924b37762e974dc762987ac0ed63ad843018 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Fri, 28 Jun 2013 08:46:26 +0200 Subject: [PATCH] catch error from krb5_ functions Reported by http://www.forallsecure.com/bug-reports/2f227b78584144ab1f55549b36ea16ba2d1664e0/ via Brian May --- appl/xnlock/xnlock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/appl/xnlock/xnlock.c b/appl/xnlock/xnlock.c index a4fd682ba..b3692df26 100644 --- a/appl/xnlock/xnlock.c +++ b/appl/xnlock/xnlock.c @@ -959,8 +959,14 @@ main (int argc, char **argv) ret = krb5_init_context(&context); if (ret) errx (1, "krb5_init_context failed: %d", ret); - krb5_get_default_principal(context, &client); - krb5_unparse_name(context, client, &str); + + ret = krb5_get_default_principal(context, &client); + if (ret) + krb5_err(context, 1, ret, "getting default principal failed"); + + ret = krb5_unparse_name(context, client, &str); + if (ret) + krb5_err(context, 1, ret, "krb5_unparse_name"); snprintf(userprompt, sizeof(userprompt), "User: %s", str); free(str); }