#include "includes.h"
#include "../libcli/auth/spnego.h"
+#include "smb_krb5.h"
#include <keyutils.h>
#include <getopt.h>
krb5_principal principal;
time_t credtime = 0;
char *realm = NULL;
+ TALLOC_CTX *mem_ctx;
if (krb5_init_context(&context)) {
syslog(LOG_DEBUG, "%s: unable to init krb5 context", __func__);
goto err_ccstart;
}
+ mem_ctx = talloc_init("cifs.upcall");
while (!credtime && !krb5_cc_next_cred(context, ccache, &cur, &creds)) {
char *name;
- if (smb_krb5_unparse_name(NULL, context, creds.server, &name)) {
+ if (smb_krb5_unparse_name(mem_ctx, context, creds.server, &name)) {
syslog(LOG_DEBUG, "%s: unable to unparse name", __func__);
goto err_endseq;
}
TALLOC_FREE(name);
}
err_endseq:
+ TALLOC_FREE(mem_ctx);
krb5_cc_end_seq_get(context, ccache, &cur);
err_ccstart:
krb5_free_principal(context, principal);
err_princ:
+#if defined(KRB5_TC_OPENCLOSE)
krb5_cc_set_flags(context, ccache, KRB5_TC_OPENCLOSE);
+#endif
krb5_cc_close(context, ccache);
err_cache:
krb5_free_context(context);