another public api question

Jeffrey Altman jaltman at columbia.edu
Tue Apr 16 09:22:00 EDT 2002


I know that this one is going to start a long thread:

  krb5_get_profile()

This function has been exported for a while.  There has been much
argument over the years as to whether or not applications should be
using the profile_XXXX() functions or not.  However, removing this
function does not stop applications from linking to and using the
profile library directly.  All it does is prevent the application from
conveniently finding out which profile is being used by Kerberos 5.

Now I'm not using this for anything super important right now.  But I
did implement the following code to perform Realm name case
correction to avoid stupid errors just because the user typed the
realm name in lower case when it is required to be upper.  I would
like this to be able to work.

        profile_t profile;

        code = krb5_get_profile(kcontext, &profile);
        if ( !code ) {
            const char  *names[4];
            char ** realms;
            int found = 0;

            names[0] = "realms";
            names[1] = NULL;

            code = profile_get_subsection_names(profile,names,&realms);
            if ( code == 0 ) {
                int i=0;
                while ( realms[i] ) {
                    if (ckstrcmp(realm,realms[i],-1,0) == 0) {
                        strcpy(realm,realms[i]);
                        found = 1;
                        break;
                    }
                    i++;
                }
            }

        if (init->realm &&
             ckstrcmp(realm,init->realm,-1,0) == 0 &&
             ckstrcmp(realm,init->realm,-1,1) != 0)
            strcpy(init->realm,realm);
        if (ckstrcmp(realm,krb5_d_realm,-1,0) == 0 &&
             ckstrcmp(realm,krb5_d_realm,-1,1) != 0)
            strcpy(krb5_d_realm,realm);




 Jeffrey Altman * Sr.Software Designer      Kermit 95 1.1.21  available now!!!
 The Kermit Project @ Columbia University   SSH plus Telnet, FTP and HTTP
 http://www.kermit-project.org/             secured with Kerberos, SRP, and 
 kermit-support at columbia.edu                OpenSSL.



More information about the krbdev mailing list