1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

libads: Add kerberos tracing

Replace kerberos context initialization from
raw krb5_init_context() to smb_krb5_init_context_basic()
which is adding common tracing as well.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
This commit is contained in:
Swen Schillig 2018-12-05 11:16:42 +01:00 committed by Christof Schmitt
parent 2cc561fbbf
commit 3df7789e4b
4 changed files with 31 additions and 30 deletions

View File

@ -128,9 +128,12 @@ int kerberos_kinit_password_ext(const char *principal,
ZERO_STRUCT(my_creds);
initialize_krb5_error_table();
if ((code = krb5_init_context(&ctx)))
goto out;
code = smb_krb5_init_context_common(&ctx);
if (code != 0) {
DBG_ERR("kerberos init context failed (%s)\n",
error_message(code));
return code;
}
if (time_offset != 0) {
krb5_set_real_time(ctx, time(NULL) + time_offset, 0);
@ -244,10 +247,10 @@ int ads_kdestroy(const char *cc_name)
krb5_context ctx = NULL;
krb5_ccache cc = NULL;
initialize_krb5_error_table();
if ((code = krb5_init_context (&ctx))) {
DEBUG(3, ("ads_kdestroy: kdb5_init_context failed: %s\n",
error_message(code)));
code = smb_krb5_init_context_common(&ctx);
if (code != 0) {
DBG_ERR("kerberos init context failed (%s)\n",
error_message(code));
return code;
}

View File

@ -259,11 +259,10 @@ int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc, bool update_ads)
TALLOC_CTX *tmpctx = NULL;
int i;
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1, (__location__ ": could not krb5_init_context: %s\n",
error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
return -1;
}
@ -436,11 +435,10 @@ int ads_keytab_flush(ADS_STRUCT *ads)
krb5_kvno kvno;
ADS_STATUS aderr;
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1, (__location__ ": could not krb5_init_context: %s\n",
error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
return ret;
}
@ -570,11 +568,10 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
memset(princ_s, '\0', sizeof(princ_s));
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1, (__location__ ": could not krb5_init_context: %s\n",
error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
goto done;
}
@ -774,11 +771,10 @@ int ads_keytab_list(const char *keytab_name)
ZERO_STRUCT(kt_entry);
ZERO_STRUCT(cursor);
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1, (__location__ ": could not krb5_init_context: %s\n",
error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
return ret;
}

View File

@ -69,10 +69,10 @@ ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *principal,
krb5_data result_code_string = { 0 };
krb5_data result_string = { 0 };
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1,("Failed to init krb5 context (%s)\n", error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
return ADS_ERROR_KRB5(ret);
}
@ -177,10 +177,10 @@ static ADS_STATUS ads_krb5_chg_password(const char *kdc_host,
krb5_data result_string = { 0 };
smb_krb5_addresses *addr = NULL;
initialize_krb5_error_table();
ret = krb5_init_context(&context);
ret = smb_krb5_init_context_common(&context);
if (ret) {
DEBUG(1,("Failed to init krb5 context (%s)\n", error_message(ret)));
DBG_ERR("kerberos init context failed (%s)\n",
error_message(ret));
return ADS_ERROR_KRB5(ret);
}

View File

@ -366,8 +366,10 @@ static ADS_STATUS ads_init_gssapi_cred(ADS_STRUCT *ads, gss_cred_id_t *cred)
return ADS_SUCCESS;
}
kerr = krb5_init_context(&kctx);
kerr = smb_krb5_init_context_common(&kctx);
if (kerr) {
DBG_ERR("kerberos init context failed (%s)\n",
error_message(kerr));
return ADS_ERROR_KRB5(kerr);
}