krb-init: define out heimdal specific stuff in mitkrb build
authorSimo Sorce <idra@samba.org>
Wed, 25 Apr 2012 14:31:12 +0000 (10:31 -0400)
committerSimo Sorce <idra@samba.org>
Thu, 26 Apr 2012 23:07:55 +0000 (19:07 -0400)
source4/auth/kerberos/krb5_init_context.c

index 948f6870a41ab6c264b2464c7436fcecdea78a74..9b36ee94f4afefdf8fbc7cc307a0e4aafc78513b 100644 (file)
@@ -47,8 +47,9 @@ struct smb_krb5_socket {
        struct packet_context *packet;
 
        size_t partial_read;
        struct packet_context *packet;
 
        size_t partial_read;
-
+#ifdef SAMBA4_USES_HEIMDAL
        krb5_krbhst_info *hi;
        krb5_krbhst_info *hi;
+#endif
 };
 
 static krb5_error_code smb_krb5_context_destroy(struct smb_krb5_context *ctx)
 };
 
 static krb5_error_code smb_krb5_context_destroy(struct smb_krb5_context *ctx)
@@ -68,10 +69,12 @@ static krb5_error_code smb_krb5_context_destroy(struct smb_krb5_context *ctx)
        return 0;
 }
 
        return 0;
 }
 
+#ifdef SAMBA4_USES_HEIMDAL
 /* We never close down the DEBUG system, and no need to unreference the use */
 static void smb_krb5_debug_close(void *private_data) {
        return;
 }
 /* We never close down the DEBUG system, and no need to unreference the use */
 static void smb_krb5_debug_close(void *private_data) {
        return;
 }
+#endif
 
 #ifdef SAMBA4_USES_HEIMDAL
 static void smb_krb5_debug_wrapper(const char *timestr, const char *msg, void *private_data)
 
 #ifdef SAMBA4_USES_HEIMDAL
 static void smb_krb5_debug_wrapper(const char *timestr, const char *msg, void *private_data)
@@ -421,8 +424,10 @@ smb_krb5_init_context_basic(TALLOC_CTX *tmp_ctx,
                            krb5_context *_krb5_context)
 {
        krb5_error_code ret;
                            krb5_context *_krb5_context)
 {
        krb5_error_code ret;
+#ifdef SAMBA4_USES_HEIMDAL
        char **config_files;
        const char *config_file, *realm;
        char **config_files;
        const char *config_file, *realm;
+#endif
        krb5_context krb5_ctx;
 
        initialize_krb5_error_table();
        krb5_context krb5_ctx;
 
        initialize_krb5_error_table();
@@ -434,6 +439,10 @@ smb_krb5_init_context_basic(TALLOC_CTX *tmp_ctx,
                return ret;
        }
 
                return ret;
        }
 
+       /* The MIT Kerberos build relies on using the system krb5.conf file.
+        * If you really want to use another file please set KRB5_CONFIG
+        * accordingly. */
+#ifdef SAMBA4_USES_HEIMDAL
        config_file = lpcfg_config_path(tmp_ctx, lp_ctx, "krb5.conf");
        if (!config_file) {
                krb5_free_context(krb5_ctx);
        config_file = lpcfg_config_path(tmp_ctx, lp_ctx, "krb5.conf");
        if (!config_file) {
                krb5_free_context(krb5_ctx);
@@ -468,7 +477,7 @@ smb_krb5_init_context_basic(TALLOC_CTX *tmp_ctx,
                        return ret;
                }
        }
                        return ret;
                }
        }
-
+#endif
        *_krb5_context = krb5_ctx;
        return 0;
 }
        *_krb5_context = krb5_ctx;
        return 0;
 }
@@ -548,7 +557,7 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
 #else
        ret = krb5_set_trace_callback(kctx, smb_krb5_debug_wrapper, NULL);
        if (ret && ret != KRB5_TRACE_NOSUPP) {
 #else
        ret = krb5_set_trace_callback(kctx, smb_krb5_debug_wrapper, NULL);
        if (ret && ret != KRB5_TRACE_NOSUPP) {
-               DEBUG(1, ("krb5_set_trace_callback failed (%s)\n"
+               DEBUG(1, ("krb5_set_trace_callback failed (%s)\n",
                          smb_get_krb5_error_message(kctx, ret, tmp_ctx)));
                talloc_free(tmp_ctx);
                return ret;
                          smb_get_krb5_error_message(kctx, ret, tmp_ctx)));
                talloc_free(tmp_ctx);
                return ret;