Query, Need help for building principal and retrieving service cred from cache.

Santosh Kumar santoshjeergi at gmail.com
Mon Nov 26 06:30:50 EST 2018

Could you please help with information i'm replacing the heimdal calls into

char * serverRealm =  "CSQALAB.NET"
char * HTTPSVC = "HTTP"
char * server = "Parent-2K16.csqalab.net"

krb5_creds inCred, outCred;
memset(&inCred, 0, sizeof(inCred));
memset(&outCred, 0, sizeof(outCred));
#if heimdal
        m_error = krb5_make_principal(m_context, &inCred.server,
serverRealm, HTTPSVC, server, NULL);
        if (m_error == 0) {
             m_error = krb5_cc_retrieve_cred(m_context, m_cache, flags,
&inCred, &outCred);

#if MIT
        m_error =krb5_build_principal_ext(m_context,&inCred.server,
                                          strlen(serverRealm), serverRealm,
       if (m_error == 0) {
             m_error = krb5_cc_retrieve_cred(m_context, m_cache, flags,
&inCred, &outCred);

 i'm getting crash:

(gdb) bt
#0  0xf7673f60 in krb5_principal_compare_flags (context=0xa449930,
princ1=0x0, princ2=0xa444ab0, flags=0) at princ_comp.c:108
#1  0xf7674183 in krb5_principal_compare (context=0xa449930, princ1=0x0,
princ2=0xa444ab0) at princ_comp.c:169
#2  0xf764f1ec in standard_fields_match (context=0xa449930, whichfields=0,
mcreds=0xfff48dc8, creds=0xfff48ba0) at cc_retr.c:67
#3  krb5int_cc_creds_match_request (context=0xa449930, whichfields=0,
mcreds=0xfff48dc8, creds=0xfff48ba0) at cc_retr.c:172
#4  0xf764f842 in krb5_cc_retrieve_cred_seq (context=0xa449930,
id=0xa44ae70, whichfields=0, mcreds=0xfff48dc8, creds=0xfff48d74,
nktypes=0, ktypes=0x0) at cc_retr.c:233
#5  0xf764faa0 in krb5_cc_retrieve_cred_default (context=0xa449930,
id=0xa44ae70, flags=0, mcreds=0xfff48dc8, creds=0xfff48d74) at cc_retr.c:290
#6  0xf76533c9 in krb5_mcc_retrieve (context=0xa449930, id=0xa44ae70,
whichfields=0, mcreds=0xfff48dc8, creds=0xfff48d74) at cc_memory.c:591
#7  0xf76540c2 in krb5_cc_retrieve_cred (context=0xa449930,
cache=0xa44ae70, flags=0, mcreds=0xfff48dc8, creds=0xfff48d74) at

 should i use  code = krb5int_construct_matching_creds(context, options,
in_creds,  &mcreds, &fields); before calling retrive from cache.

More information about the Kerberos mailing list