#include "includes.h"
#include "system/kerberos.h"
+#include "system/gssapi.h"
#include <tevent.h>
#include "auth/kerberos/kerberos.h"
#include "lib/socket/socket.h"
struct packet_context *packet;
size_t partial_read;
-
+#ifdef SAMBA4_USES_HEIMDAL
krb5_krbhst_info *hi;
+#endif
};
static krb5_error_code smb_krb5_context_destroy(struct smb_krb5_context *ctx)
krb5_closelog(ctx->krb5_context,
(krb5_log_facility *)ctx->pvt_log_data);
}
-#else
- krb5_set_trace_callback(ctx->krb5_context, NULL, NULL);
#endif
krb5_free_context(ctx->krb5_context);
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;
}
+#endif
#ifdef SAMBA4_USES_HEIMDAL
static void smb_krb5_debug_wrapper(const char *timestr, const char *msg, void *private_data)
{
DEBUG(3, ("Kerberos: %s\n", msg));
}
-#else
-static void smb_krb5_debug_wrapper(krb5_context context,
- const struct krb5_trace_info *info,
- void *cb_data)
-{
- DEBUG(3, ("Kerberos: %s\n", info->message));
-}
#endif
#ifdef SAMBA4_USES_HEIMDAL
if (!data) {
/* If no event context was available, then create one for this loop */
- ev = tevent_context_init(tmp_ctx);
+ ev = samba_tevent_context_init(tmp_ctx);
if (!ev) {
talloc_free(tmp_ctx);
return ENOMEM;
krb5_context *_krb5_context)
{
krb5_error_code ret;
+#ifdef SAMBA4_USES_HEIMDAL
char **config_files;
const char *config_file, *realm;
+#endif
krb5_context krb5_ctx;
initialize_krb5_error_table();
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);
}
/* Use our local krb5.conf file by default */
- ret = krb5_prepend_config_files_default(config_file == NULL?"":config_file, &config_files);
+ ret = krb5_prepend_config_files_default(config_file, &config_files);
if (ret) {
DEBUG(1,("krb5_prepend_config_files_default failed (%s)\n",
smb_get_krb5_error_message(krb5_ctx, ret, tmp_ctx)));
return ret;
}
}
-
+#endif
*_krb5_context = krb5_ctx;
return 0;
}
krb5_set_dns_canonicalize_hostname(kctx,
lpcfg_parm_bool(lp_ctx, NULL, "krb5",
"set_dns_canonicalize", false));
-#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"
- smb_get_krb5_error_message(kctx, ret, tmp_ctx)));
- talloc_free(tmp_ctx);
- return ret;
- }
#endif
talloc_steal(parent_ctx, *smb_krb5_context);
talloc_free(tmp_ctx);