From 2d8fdf1f37f063807699a297e4d37218af7d0c27 Mon Sep 17 00:00:00 2001 From: Cyrus Daboo Date: Mon, 21 May 2007 18:01:59 +0000 Subject: [PATCH] Raise an exception if we cannot find a matching principal. git-svn-id: https://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@1541 e27351fd-9f3e-4f54-a53b-843176b1656c --- src/kerberosgss.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kerberosgss.c b/src/kerberosgss.c index c445caa..464c066 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -90,6 +90,12 @@ char* server_principal_details(const char* service, const char* hostname) krb5_free_keytab_entry_contents(kcontext, &entry); } + if (result == NULL) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Principal not found in keytab", -1)); + } + end: if (cursor) krb5_kt_end_seq_get(kcontext, kt, &cursor);