krb5samba: Add compat krb5_make_principal for MIT build
authorSimo Sorce <idra@samba.org>
Thu, 26 Apr 2012 21:21:22 +0000 (17:21 -0400)
committerSimo Sorce <idra@samba.org>
Fri, 4 May 2012 14:51:29 +0000 (16:51 +0200)
lib/krb5_wrap/krb5_samba.c
lib/krb5_wrap/krb5_samba.h
source3/configure.in
source4/heimdal_build/wscript_configure
wscript_configure_krb5

index 482684fc11b0aa52d47093944d767a7dc8346bfd..4bfc2531c66f16da43d46281a132a8fae3fc78ab 100644 (file)
@@ -2093,6 +2093,41 @@ krb5_error_code kerberos_kinit_s4u2_cc(krb5_context ctx,
 }
 #endif
 
 }
 #endif
 
+#if !defined(HAVE_KRB5_MAKE_PRINCIPAL) && defined(HAVE_KRB5_BUILD_PRINCIPAL_ALLOC_VA)
+krb5_error_code smb_krb5_make_principal(krb5_context context,
+                                       krb5_principal *principal,
+                                       const char *_realm, ...)
+{
+       krb5_error_code code;
+       bool free_realm;
+       char *realm;
+       va_list ap;
+
+       if (_realm) {
+               realm = _realm;
+               free_realm = false;
+       } else {
+               code = krb5_get_default_realm(context, &realm);
+               if (code) {
+                       return code;
+               }
+               free_realm = true;
+       }
+
+       va_start(ap, _realm);
+       code = krb5_build_principal_alloc_va(context, principal,
+                                            strlen(realm), realm,
+                                            ap);
+       va_end(ap);
+
+       if (free_realm) {
+               krb5_free_default_realm(context, &realm);
+       }
+
+       return code;
+}
+#endif
+
 /*
  * smb_krb5_principal_get_realm
  *
 /*
  * smb_krb5_principal_get_realm
  *
index a60be35a981a857fb44a642e6a67e192a79107df..d9f61e733817641fa78d305cfbee467f4e6ceace 100644 (file)
@@ -230,6 +230,16 @@ krb5_error_code kerberos_kinit_s4u2_cc(krb5_context ctx,
                                        time_t *expire_time,
                                        time_t *kdc_time);
 #endif
                                        time_t *expire_time,
                                        time_t *kdc_time);
 #endif
+
+#if defined(HAVE_KRB5_MAKE_PRINCIPAL)
+#define smb_krb5_make_principal krb5_make_principal
+#elif defined(HAVE_KRB5_BUILD_PRINCIPAL_ALLOC_VA)
+krb5_error_code smb_krb5_make_principal(krb5_context context,
+                                       krb5_principal *principal,
+                                       const char *realm, ...);
+#else
+#error krb5_make_principal not available
+#endif
 char *smb_krb5_principal_get_realm(krb5_context context,
                                   krb5_principal principal);
 
 char *smb_krb5_principal_get_realm(krb5_context context,
                                   krb5_principal principal);
 
index 8790ea713b980b8a257bddae6f030d1b0f038772..cec0ece3433ac3af6ba265ee3e9aa848d2157047 100644 (file)
@@ -3615,6 +3615,7 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_get_host_realm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_free_host_realm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_init_creds_keytab, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_host_realm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_free_host_realm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_init_creds_keytab, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_build_principal_alloc_va, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_krb5_import_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_get_name_attribute, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gsskrb5_extract_authz_data_from_sec_context, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_krb5_import_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_get_name_attribute, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gsskrb5_extract_authz_data_from_sec_context, $KRB5_LIBS)
index 80d772d56bfc5d82bdc7e588cb208e8bf9d096cf..d993eec4ed0e39ad48134959f8e71255ade99212 100755 (executable)
@@ -130,6 +130,7 @@ conf.define('HAVE_KRB5_MK_REQ_EXTENDED', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_COMPARE_ANY_REALM', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_COMP_STRING', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_REALM', 1)
+conf.define('HAVE_KRB5_MAKE_PRINCIPAL', 1)
 conf.define('HAVE_KRB5_REALM_TYPE', 1)
 conf.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1)
 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
 conf.define('HAVE_KRB5_REALM_TYPE', 1)
 conf.define('HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES', 1)
 conf.define('HAVE_KRB5_SET_REAL_TIME', 1)
index 1faa212e5fbd18767fa26cd8153819484e9c557b..4a483ef702dc9ef25480725f61e0d7f0a4086a50 100644 (file)
@@ -58,7 +58,8 @@ conf.CHECK_FUNCS('''
        krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
        krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
        krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm
        krb5_enctype_to_string krb5_fwd_tgt_creds krb5_auth_con_set_req_cksumtype
        krb5_get_creds_opt_alloc krb5_get_creds_opt_set_impersonate krb5_get_creds
        krb5_get_credentials_for_user krb5_get_host_realm krb5_free_host_realm
-       krb5_get_init_creds_keyblock krb5_get_init_creds_keytab''',
+       krb5_get_init_creds_keyblock krb5_get_init_creds_keytab
+       krb5_make_principal krb5_build_principal_alloc_va''',
      lib='krb5 k5crypto')
 conf.CHECK_DECLS('''krb5_get_credentials_for_user
                     krb5_auth_con_set_req_cksumtype''',
      lib='krb5 k5crypto')
 conf.CHECK_DECLS('''krb5_get_credentials_for_user
                     krb5_auth_con_set_req_cksumtype''',