summaryrefslogtreecommitdiff
path: root/lib/krb5_wrap
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2012-04-26 18:22:43 -0400
committerSimo Sorce <idra@samba.org>2012-05-04 16:51:29 +0200
commit38c7d8e4fdf6facd37310aa848eb5b2459d4fbe7 (patch)
tree6da1b97254b6b9e02619b352130025af947be8a0 /lib/krb5_wrap
parent548046ff4df23f08e1f652136e7322623885d7ab (diff)
downloadsamba-38c7d8e4fdf6facd37310aa848eb5b2459d4fbe7.tar.gz
samba-38c7d8e4fdf6facd37310aa848eb5b2459d4fbe7.tar.bz2
samba-38c7d8e4fdf6facd37310aa848eb5b2459d4fbe7.zip
krb5samba: Add compat function for krb5_kt_compare
Diffstat (limited to 'lib/krb5_wrap')
-rw-r--r--lib/krb5_wrap/keytab_util.c29
-rw-r--r--lib/krb5_wrap/krb5_samba.h10
2 files changed, 39 insertions, 0 deletions
diff --git a/lib/krb5_wrap/keytab_util.c b/lib/krb5_wrap/keytab_util.c
index 12aca7f5a0..91e4990022 100644
--- a/lib/krb5_wrap/keytab_util.c
+++ b/lib/krb5_wrap/keytab_util.c
@@ -227,3 +227,32 @@ krb5_error_code kt_copy_one_principal(krb5_context context,
krb5_kt_close (context, dst_keytab);
return ret;
}
+
+#if !defined(HAVE_KRB5_KT_COMPARE)
+krb5_boolean smb_krb5_kt_compare(krb5_context context,
+ krb5_keytab_entry *entry,
+ krb5_const_principal principal,
+ krb5_kvno kvno,
+ krb5_enctype enctype)
+{
+ if (principal) {
+ if (!krb5_principal_compare(context,
+ entry->principal, principal)) {
+ return false;
+ }
+ }
+ if (kvno) {
+ if (entry->vno != kvno) {
+ return false;
+ }
+ }
+ if (enctype) {
+ if (KRB5_KEY_TYPE(KRB5_KT_KEY(entry)) != enctype) {
+ return false;
+ }
+ }
+
+ return true;
+}
+#endif
+
diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h
index d9f61e7338..2c492642a6 100644
--- a/lib/krb5_wrap/krb5_samba.h
+++ b/lib/krb5_wrap/krb5_samba.h
@@ -267,6 +267,16 @@ krb5_error_code kt_copy_one_principal(krb5_context context,
krb5_kvno kvno,
krb5_enctype *enctypes);
+#if defined(HAVE_KRB5_KT_COMPARE)
+#define smb_krb5_kt_compare krb5_kt_compare
+#else
+krb5_boolean smb_krb5_kt_compare(krb5_context context,
+ krb5_keytab_entry *entry,
+ krb5_const_principal principal,
+ krb5_kvno vno,
+ krb5_enctype enctype);
+#endif
+
#endif /* HAVE_KRB5 */
int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,