From: Keith Vetter Date: Thu, 23 Mar 1995 00:31:21 +0000 (+0000) Subject: Added some error checking code to handle missing realms file X-Git-Tag: krb5-1.0-beta5~492 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c9075ac0ff51b881fe1d836948f8a648b3cc9708;p=krb5.git Added some error checking code to handle missing realms file git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5201 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/cns/ChangeLog b/src/windows/cns/ChangeLog new file mode 100644 index 000000000..75d8d73ef --- /dev/null +++ b/src/windows/cns/ChangeLog @@ -0,0 +1,3 @@ +Wed Mar 22 16:27:48 1995 Keith Vetter (keithv@fusion.com) + + * cns.c: added some error checking code to catch missing realms files diff --git a/src/windows/cns/cns.c b/src/windows/cns/cns.c index 3fc8913dc..ab685e4df 100644 --- a/src/windows/cns/cns.c +++ b/src/windows/cns/cns.c @@ -1936,32 +1936,40 @@ kwin_command ( #endif #ifdef KRB5 - code = krb5_parse_name(k5_context, name, &principal); - code = krb5_cc_initialize(k5_context, k5_ccache, principal); - memset(&creds, 0, sizeof(creds)); - creds.client = principal; - - code = krb5_build_principal_ext(k5_context, &server, - krb5_princ_realm(k5_context, principal)->length, - krb5_princ_realm(k5_context, principal)->data, - KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, - krb5_princ_realm(k5_context, principal)->length, - krb5_princ_realm(k5_context, principal)->data, 0); - - creds.server = server; - - //code = krb5_os_localaddr(&address); - code = krb5_timeofday(k5_context, &now); - - creds.times.starttime = 0; - creds.times.endtime = now + 60L * lifetime; - creds.times.renew_till = 0; - - code = krb5_get_in_tkt_with_password(k5_context, 0, NULL, NULL, - NULL, password, k5_ccache, &creds, 0); - - krb5_free_principal(k5_context, server); - //krb5_free_addresses(k5_context, address); + do { + principal = server = NULL; + memset(&creds, 0, sizeof(creds)); + + code = krb5_parse_name(k5_context, name, &principal); + if (code) break; + code = krb5_cc_initialize(k5_context, k5_ccache, principal); + if (code) break; + + code = krb5_build_principal_ext(k5_context, &server, + krb5_princ_realm(k5_context, principal)->length, + krb5_princ_realm(k5_context, principal)->data, + KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, + krb5_princ_realm(k5_context, principal)->length, + krb5_princ_realm(k5_context, principal)->data, 0); + if (code) break; + + creds.client = principal; + creds.server = server; + + code = krb5_timeofday(k5_context, &now); + if (code) break; + creds.times.starttime = 0; + creds.times.endtime = now + 60L * lifetime; + creds.times.renew_till = 0; + + code = krb5_get_in_tkt_with_password(k5_context, 0, NULL, + NULL, NULL, password, k5_ccache, &creds, 0); + } while (0); + + if (principal) + krb5_free_principal(k5_context, principal); + if (server) + krb5_free_principal(k5_context, server); #endif @@ -1983,8 +1991,6 @@ kwin_command ( com_err (NULL, code, "while logging in"); return TRUE; } - // ticket_init_list(GetDlgItem(hwnd, IDD_TICKET_LIST)); - #endif SetDlgItemText(hwnd, IDD_LOGIN_PASSWORD, ""); @@ -2016,7 +2022,6 @@ kwin_command ( #ifdef KRB5 code = k5_dest_tkt (); - // ticket_init_list(GetDlgItem(hwnd, IDD_TICKET_LIST)); #endif kwin_set_default_focus(hwnd); @@ -2053,7 +2058,12 @@ kwin_command ( if (isblocking) return TRUE; - strcpy(copyright, " Kerberos for Windows\n"); + #ifdef KRB4 + strcpy(copyright, " Kerberos 4 for Windows\n"); + #endif + #ifdef KRB5 + strcpy(copyright, " Kerberos 5 for Windows\n"); + #endif strcat(copyright, "\n Version 1.00\n\n"); strcat(copyright, " For support, contact:\n"); strcat(copyright, ORGANIZATION);