summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/krb5_wrap/krb5_samba.c20
-rw-r--r--lib/krb5_wrap/krb5_samba.h3
-rwxr-xr-xsource4/heimdal_build/wscript_configure1
-rw-r--r--wscript_configure_system_mitkrb52
4 files changed, 25 insertions, 1 deletions
diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index 8d91e1c074f..3288f7563fb 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -2572,6 +2572,26 @@ krb5_boolean smb_krb5_get_allowed_weak_crypto(krb5_context context)
#error UNKNOWN_KRB5_CONFIG_ROUTINES
#endif
+/**
+* @brief Return the type of a krb5_principal
+*
+* @param context The krb5_context
+* @param principal The const krb5_principal
+*
+* @return integer type of the principal
+*/
+int smb_krb5_principal_get_type(krb5_context context,
+ krb5_const_principal principal)
+{
+#ifdef HAVE_KRB5_PRINCIPAL_GET_TYPE /* Heimdal */
+ return krb5_principal_get_type(context, principal);
+#elif defined(krb5_princ_type) /* MIT */
+ return krb5_princ_type(context, principal);
+#else
+#error UNKNOWN_PRINC_GET_TYPE_FUNCTION
+#endif
+}
+
#else /* HAVE_KRB5 */
/* this saves a few linking headaches */
int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,
diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h
index 03246fd0288..13b8c32e7cb 100644
--- a/lib/krb5_wrap/krb5_samba.h
+++ b/lib/krb5_wrap/krb5_samba.h
@@ -329,6 +329,9 @@ krb5_error_code krb5_copy_data_contents(krb5_data *p,
const void *data,
size_t len);
+int smb_krb5_principal_get_type(krb5_context context,
+ krb5_const_principal principal);
+
#endif /* HAVE_KRB5 */
int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,
diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure
index 297422f6116..cac72adea96 100755
--- a/source4/heimdal_build/wscript_configure
+++ b/source4/heimdal_build/wscript_configure
@@ -165,6 +165,7 @@ conf.define('HAVE_FLAGS_IN_KRB5_CREDS', 1)
conf.define('HAVE_KRB5_CONFIG_GET_BOOL_DEFAULT', 1)
conf.define('HAVE_KRB5_DATA_COPY', 1)
conf.define('HAVE_KRB5_PRINCIPAL_SET_REALM', 1)
+conf.define('HAVE_KRB5_PRINCIPAL_GET_TYPE', 1)
heimdal_includedirs = []
heimdal_libdirs = []
diff --git a/wscript_configure_system_mitkrb5 b/wscript_configure_system_mitkrb5
index 3293b3c7b4c..c3e9e275d58 100644
--- a/wscript_configure_system_mitkrb5
+++ b/wscript_configure_system_mitkrb5
@@ -108,7 +108,7 @@ conf.CHECK_FUNCS('''
krb5_free_checksum_contents krb5_c_make_checksum krb5_create_checksum
krb5_config_get_bool_default krb5_get_profile
krb5_data_copy
- krb5_keyblock_init krb5_principal_set_realm
+ krb5_keyblock_init krb5_principal_set_realm krb5_principal_get_type
''',
lib='krb5 k5crypto')
conf.CHECK_DECLS('''krb5_get_credentials_for_user