krb5_wrap: add smb_krb5_principal_set_type().
authorGünther Deschner <gd@samba.org>
Tue, 10 Feb 2015 12:13:01 +0000 (13:13 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 27 Mar 2015 00:26:16 +0000 (01:26 +0100)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/krb5_wrap/krb5_samba.c
lib/krb5_wrap/krb5_samba.h
source4/heimdal_build/wscript_configure
wscript_configure_system_mitkrb5

index 6d71f2223dbe0fbd50423c900768b3aa082eaea4..b70c0d314d253ce418b242ae305150fe95ecaad3 100644 (file)
@@ -2602,6 +2602,27 @@ int smb_krb5_principal_get_type(krb5_context context,
 #endif
 }
 
+/**
+* @brief Set the type of a krb5_principal
+*
+* @param context       The krb5_context
+* @param principal     The const krb5_principal
+* @param type          The principal type
+*
+*/
+void smb_krb5_principal_set_type(krb5_context context,
+                                krb5_principal principal,
+                                int type)
+{
+#ifdef HAVE_KRB5_PRINCIPAL_SET_TYPE /* Heimdal */
+       krb5_principal_set_type(context, principal, type);
+#elif defined(krb5_princ_type) /* MIT */
+       krb5_princ_type(context, principal) = type;
+#else
+#error UNKNOWN_PRINC_SET_TYPE_FUNCTION
+#endif
+}
+
 /**
 * @brief Generate a krb5 warning, forwarding to com_err
 *
index 7ff3a86997321bf3a7ed003d25f5def145688028..12711e8cd325412cc5471d15865fa53a46fcf048 100644 (file)
@@ -263,6 +263,10 @@ krb5_error_code smb_krb5_make_pac_checksum(TALLOC_CTX *mem_ctx,
 char *smb_krb5_principal_get_realm(krb5_context context,
                                   krb5_const_principal principal);
 
+void smb_krb5_principal_set_type(krb5_context context,
+                                krb5_principal principal,
+                                int type);
+
 krb5_error_code smb_krb5_principal_set_realm(krb5_context context,
                                             krb5_principal principal,
                                             const char *realm);
index 9a6865661445c043c4c687a71e7c4e5c5558b44e..236adcd000e10e49af32607ec4c51697f7d2489c 100755 (executable)
@@ -164,6 +164,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_SET_TYPE', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_TYPE', 1)
 conf.define('HAVE_KRB5_WARNX', 1)
 
index 38397e32b7d58f2c3e8c350aad7911171f1a6ec1..351e9d83a6dab4b41091a8d6a739a5f3e8068e77 100644 (file)
@@ -113,6 +113,7 @@ conf.CHECK_FUNCS('''
        krb5_config_get_bool_default krb5_get_profile
        krb5_data_copy
        krb5_keyblock_init krb5_principal_set_realm krb5_principal_get_type
+       krb5_principal_set_type
        krb5_warnx
        ''',
      lib='krb5 k5crypto')