summaryrefslogtreecommitdiffstats
path: root/src/windows/cns/cns.c
diff options
context:
space:
mode:
authorKeith Vetter <keithv@fusion.com>1995-03-23 00:31:21 +0000
committerKeith Vetter <keithv@fusion.com>1995-03-23 00:31:21 +0000
commitc9075ac0ff51b881fe1d836948f8a648b3cc9708 (patch)
tree7d90e18f2323be59036c9e73cd7830cc5b82a801 /src/windows/cns/cns.c
parent985f802817c083713b28fdb7fd2417abfbbfa3f9 (diff)
downloadkrb5-c9075ac0ff51b881fe1d836948f8a648b3cc9708.tar.gz
krb5-c9075ac0ff51b881fe1d836948f8a648b3cc9708.tar.xz
krb5-c9075ac0ff51b881fe1d836948f8a648b3cc9708.zip
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
Diffstat (limited to 'src/windows/cns/cns.c')
-rw-r--r--src/windows/cns/cns.c70
1 files changed, 40 insertions, 30 deletions
diff --git a/src/windows/cns/cns.c b/src/windows/cns/cns.c
index 3fc8913dc4..ab685e4df2 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);