Added some error checking code to handle missing realms file
authorKeith Vetter <keithv@fusion.com>
Thu, 23 Mar 1995 00:31:21 +0000 (00:31 +0000)
committerKeith Vetter <keithv@fusion.com>
Thu, 23 Mar 1995 00:31:21 +0000 (00:31 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5201 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/cns/ChangeLog [new file with mode: 0644]
src/windows/cns/cns.c

diff --git a/src/windows/cns/ChangeLog b/src/windows/cns/ChangeLog
new file mode 100644 (file)
index 0000000..75d8d73
--- /dev/null
@@ -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
index 3fc8913dc47e5e4443b22889627c3b68fc2e96d7..ab685e4df269e5b08cfd2f035b87547dfd76a64e 100644 (file)
@@ -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);