kinit in a Linux API SFBZH at
Thu Sep 1 11:18:07 EDT 2005

I think the minimum to do to get the TGT for a client in a C program is the following. I hope I release everything.

I start with 2 (char*): login & psw containing
user's login and password.

krb5_context context;
krb5_ccache id;
krb5_principal principal;
krb5_creds creds;

krb5_cc_default(context, &id);
krb5_parse_name(context, login, &principal);
krb5_cc_initialize(context, id, principal);
krb5_get_init_creds_password(context, &creds, principal,
    psw, 0, 0, 0, 0, 0);
krb5_free_principal(context, principal);

krb5_get_in_tkt_with_password(context, NULL, NULL, NULL,
    KRB5_PADATA_NONE, psw, id, &creds, NULL);

krb5_free_cred_contents(context, &creds);
krb5_cc_close(context, id);


More information about the krbdev mailing list