From: Keith Vetter Date: Thu, 6 Apr 1995 03:49:47 +0000 (+0000) Subject: Bug fixes or better error handling for the following 4 Windows bugs X-Git-Tag: krb5-1.0-beta5~387 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8ae426aca4d7f95de05ec34a9e0dfe5cc70395a3;p=krb5.git Bug fixes or better error handling for the following 4 Windows bugs (note, these changes haven't yet been tested on the PC which were failing so no guarantee that they fully work): a) GUI to cns improved so that you don't need a resize for the widgets to align properly, and so the interaction of typing: "username cr password cr" is all you need to do to get you a ticket. b) cns uses krb5_us_gettimeofday instead of krb5_timeofday because the former is more accurate and handles timezones. Probably should make the latter just call the former. c) Added SOCKET_INIT and SOCKET_DESTROY around krb5_sendto_kdc to prevent some tcp/ip stacks from locking up after 8 uses. d) Added a new error message and better error handling to give more precision as to why one PC was getting the error 'Cannot find KDC for requested realm.' git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5342 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog index fd6533dea..bdafb01f6 100644 --- a/src/include/krb5/ChangeLog +++ b/src/include/krb5/ChangeLog @@ -1,3 +1,11 @@ +Wed Apr 5 16:41:41 1995 Keith Vetter (keithv@fusion.com) + + * los-proto.h, func-proto.h: moved krb5_us_timeofday and + krb5_sname_to_principal from the former to the latter. + * base-def.h: added FAR to pointer types for the PC. + * func-proto.h: added FAR to pointer types in prototypes but + only for functions which are exported. + Fri Mar 31 19:34:47 1995 Keith Vetter (keithv@fusion.com) * k5-config.h: defined dup to _dup for STDC stuff on Windows diff --git a/src/include/krb5/base-defs.h b/src/include/krb5/base-defs.h index 77fc54179..2929c7cab 100644 --- a/src/include/krb5/base-defs.h +++ b/src/include/krb5/base-defs.h @@ -57,7 +57,7 @@ typedef krb5_error_code krb5_magic; typedef struct _krb5_data { krb5_magic magic; int length; - char *data; + char FAR *data; } krb5_data; /* make const & volatile available without effect */ @@ -70,11 +70,11 @@ typedef struct _krb5_data { #endif #if defined(__STDC__) || defined(HAS_VOID_TYPE) -typedef void * krb5_pointer; -typedef void const * krb5_const_pointer; +typedef void FAR * krb5_pointer; +typedef void const FAR * krb5_const_pointer; #else -typedef char * krb5_pointer; -typedef char const * krb5_const_pointer; +typedef char FAR * krb5_pointer; +typedef char const FAR * krb5_const_pointer; #endif #if defined(__STDC__) || defined(KRB5_PROVIDE_PROTOTYPES) @@ -98,12 +98,12 @@ typedef char const * krb5_const_pointer; typedef struct krb5_principal_data { krb5_magic magic; krb5_data realm; - krb5_data *data; /* An array of strings */ + krb5_data FAR *data; /* An array of strings */ krb5_int32 length; krb5_int32 type; } krb5_principal_data; -typedef krb5_principal_data *krb5_principal; +typedef krb5_principal_data FAR * krb5_principal; /* * Per V5 spec on definition of principal types @@ -123,7 +123,7 @@ typedef krb5_principal_data *krb5_principal; #define KRB5_NT_UID 5 /* constant version thereof: */ -typedef const krb5_principal_data *krb5_const_principal; +typedef const krb5_principal_data FAR *krb5_const_principal; #define krb5_princ_realm(context, princ) (&(princ)->realm) #define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value)) diff --git a/src/include/krb5/func-proto.h b/src/include/krb5/func-proto.h index a28e9d126..ce1c9280b 100644 --- a/src/include/krb5/func-proto.h +++ b/src/include/krb5/func-proto.h @@ -28,7 +28,7 @@ #define KRB5_FUNC_PROTO__ krb5_error_code INTERFACE krb5_init_context - PROTOTYPE((krb5_context *)); + PROTOTYPE((krb5_context FAR *)); void INTERFACE krb5_free_context PROTOTYPE((krb5_context)); @@ -80,8 +80,8 @@ krb5_error_code INTERFACE krb5_get_credentials PROTOTYPE((krb5_context, const krb5_flags, krb5_ccache, - krb5_creds *, - krb5_creds **)); + krb5_creds FAR *, + krb5_creds FAR * FAR *)); krb5_error_code INTERFACE krb5_get_for_creds PROTOTYPE((krb5_context, const krb5_cksumtype, @@ -101,20 +101,20 @@ krb5_error_code INTERFACE krb5_mk_req krb5_data * )); krb5_error_code INTERFACE krb5_mk_req_extended PROTOTYPE((krb5_context, - krb5_auth_context **, + krb5_auth_context FAR * FAR *, const krb5_flags, - krb5_data *, - krb5_creds *, - krb5_data * )); + krb5_data FAR *, + krb5_creds FAR *, + krb5_data FAR * )); krb5_error_code INTERFACE krb5_mk_rep PROTOTYPE((krb5_context, krb5_auth_context *, krb5_data *)); krb5_error_code INTERFACE krb5_rd_rep PROTOTYPE((krb5_context, - krb5_auth_context *, - const krb5_data *, - krb5_ap_rep_enc_part **)); + krb5_auth_context FAR *, + const krb5_data FAR *, + krb5_ap_rep_enc_part FAR * FAR *)); krb5_error_code INTERFACE krb5_mk_error PROTOTYPE((krb5_context, const krb5_error *, @@ -137,12 +137,12 @@ krb5_error_code INTERFACE krb5_rd_priv krb5_replay_data *)); krb5_error_code INTERFACE krb5_parse_name PROTOTYPE((krb5_context, - const char *, - krb5_principal * )); + const char FAR *, + krb5_principal FAR * )); krb5_error_code INTERFACE krb5_unparse_name PROTOTYPE((krb5_context, krb5_const_principal, - char ** )); + char FAR * FAR * )); krb5_error_code INTERFACE krb5_unparse_name_ext PROTOTYPE((krb5_context, krb5_const_principal, @@ -222,7 +222,7 @@ krb5_error_code INTERFACE krb5_get_server_rcache PROTOTYPE((krb5_context, const krb5_data *, krb5_rcache *)); krb5_error_code INTERFACE_C krb5_build_principal_ext - STDARG_P((krb5_context, krb5_principal *, int, const char *, ...)); + STDARG_P((krb5_context, krb5_principal FAR *, int, const char FAR *, ...)); krb5_error_code INTERFACE_C krb5_build_principal STDARG_P((krb5_context, krb5_principal *, int, const char *, ...)); #ifdef va_start @@ -298,7 +298,7 @@ char * INTERFACE krb5_cc_default_name PROTOTYPE((krb5_context)); krb5_error_code INTERFACE krb5_cc_default PROTOTYPE((krb5_context, - krb5_ccache *)); + krb5_ccache FAR *)); unsigned int INTERFACE krb5_get_notification_message PROTOTYPE((void)); @@ -324,7 +324,7 @@ void INTERFACE krb5_free_authenticator_contents krb5_authenticator * )); void INTERFACE krb5_free_addresses PROTOTYPE((krb5_context, - krb5_address ** )); + krb5_address FAR * FAR * )); void INTERFACE krb5_free_address PROTOTYPE((krb5_context, krb5_address * )); @@ -378,10 +378,10 @@ void INTERFACE krb5_free_cred krb5_cred *)); void INTERFACE krb5_free_creds PROTOTYPE((krb5_context, - krb5_creds *)); + krb5_creds FAR *)); void INTERFACE krb5_free_cred_contents PROTOTYPE((krb5_context, - krb5_creds *)); + krb5_creds FAR *)); void INTERFACE krb5_free_cred_enc_part PROTOTYPE((krb5_context, krb5_cred_enc_part *)); @@ -396,7 +396,7 @@ void INTERFACE krb5_free_pa_data krb5_pa_data **)); void INTERFACE krb5_free_ap_rep_enc_part PROTOTYPE((krb5_context, - krb5_ap_rep_enc_part *)); + krb5_ap_rep_enc_part FAR *)); void INTERFACE krb5_free_tkt_authent PROTOTYPE((krb5_context, krb5_tkt_authent *)); @@ -408,15 +408,25 @@ void INTERFACE krb5_free_pwd_sequences passwd_phrase_element **)); /* From krb5/os but needed but by the outside world */ +krb5_error_code INTERFACE krb5_us_timeofday + PROTOTYPE((krb5_context, + krb5_int32 FAR *, + krb5_int32 FAR * )); krb5_error_code INTERFACE krb5_timeofday PROTOTYPE((krb5_context, - krb5_int32 * )); + krb5_int32 FAR * )); /* get all the addresses of this host */ krb5_error_code INTERFACE krb5_os_localaddr - PROTOTYPE((krb5_address ***)); + PROTOTYPE((krb5_address FAR * FAR * FAR *)); krb5_error_code INTERFACE krb5_get_default_realm PROTOTYPE((krb5_context, - char ** )); + char FAR * FAR * )); +krb5_error_code INTERFACE krb5_sname_to_principal + PROTOTYPE((krb5_context, + const char FAR *, + const char FAR *, + krb5_int32, + krb5_principal FAR *)); /* Only put things which don't have pointers to the narrow types in this section */ @@ -468,13 +478,13 @@ krb5_error_code INTERFACE krb5_get_in_tkt krb5_error_code INTERFACE krb5_get_in_tkt_with_password PROTOTYPE((krb5_context, const krb5_flags, - krb5_address * const *, - krb5_enctype *, - krb5_preauthtype *, - const char *, + krb5_address FAR * const FAR *, + krb5_enctype FAR *, + krb5_preauthtype FAR *, + const char FAR *, krb5_ccache, - krb5_creds *, - krb5_kdc_rep ** )); + krb5_creds FAR *, + krb5_kdc_rep FAR * FAR * )); krb5_error_code INTERFACE krb5_get_in_tkt_with_skey PROTOTYPE((krb5_context, @@ -679,8 +689,6 @@ krb5_error_code INTERFACE krb5_auth_con_getremotesubkey krb5_auth_context *, krb5_keyblock **)); - - #define KRB5_REALM_BRANCH_CHAR '.' #endif /* KRB5_FUNC_PROTO__ */ diff --git a/src/include/krb5/los-proto.h b/src/include/krb5/los-proto.h index f66170e8f..202f6a140 100644 --- a/src/include/krb5/los-proto.h +++ b/src/include/krb5/los-proto.h @@ -50,10 +50,6 @@ krb5_error_code INTERFACE krb5_unlock_file PROTOTYPE((krb5_context, FILE *, char * )); -krb5_error_code INTERFACE krb5_us_timeofday - PROTOTYPE((krb5_context, - krb5_int32 *, - krb5_int32 * )); int INTERFACE krb5_net_read PROTOTYPE((krb5_context, int , @@ -125,13 +121,6 @@ krb5_error_code INTERFACE krb5_write_message krb5_pointer, krb5_data *)); -krb5_error_code INTERFACE krb5_sname_to_principal - PROTOTYPE((krb5_context, - const char *, - const char *, - krb5_int32, - krb5_principal *)); - krb5_error_code INTERFACE krb5_os_init_context PROTOTYPE((krb5_context)); diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index 6dd26c2a6..5bb0712bb 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 5 16:27:53 1995 Keith Vetter (keithv@fusion.com) + + * libkrb5.def: added krb5_us_timeofday to export list + Fri Mar 31 16:15:59 1995 Theodore Y. Ts'o (tytso@dcl) * Makefile.in, configure.in: Move the dependency which causes diff --git a/src/lib/krb5/error_tables/ChangeLog b/src/lib/krb5/error_tables/ChangeLog index 49562dc95..8938b0daa 100644 --- a/src/lib/krb5/error_tables/ChangeLog +++ b/src/lib/krb5/error_tables/ChangeLog @@ -1,3 +1,8 @@ +Wed Apr 5 16:29:25 1995 Keith Vetter (keithv@fusion.com) + + * krb5_err.et: added KRB5_REALM_CANT_RESOLVE for more precise + handling of not finding KDC. + Fri Mar 31 16:06:21 1995 Theodore Y. Ts'o (tytso@dcl) * Makefile.in (BUILDTOP2, etc): Back out previous change so that diff --git a/src/lib/krb5/error_tables/krb5_err.et b/src/lib/krb5/error_tables/krb5_err.et index 9e7b3a15c..1be16712f 100644 --- a/src/lib/krb5/error_tables/krb5_err.et +++ b/src/lib/krb5/error_tables/krb5_err.et @@ -290,4 +290,5 @@ error_code KRB5_ERR_HOST_REALM_UNKNOWN, "Cannot determine realm for host" error_code KRB5_SNAME_UNSUPP_NAMETYPE, "Conversion to service principal undefined for name type" error_code KRB5KRB_AP_ERR_V4_REPLY, "Initial Ticket response appears to be Version 4 error" +error_code KRB5_REALM_CANT_RESOLVE, "Cannot resolve KDC for requested realm" end diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 0571ee818..58e9fe645 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,13 @@ +Wed Apr 5 16:32:07 1995 Keith Vetter (keithv@fusion.com) + + * get_krbh.c: better error handling--old return values were + being overwritten. + * locate_kdc.c: added new error code KRB5_REALM_CANT_RESOLVE for + when we have realm names but can't find their addresses. + Also, fixed up indenting of an if clause. + * sendto_kdc.c: added winsock init/destroy calls because some + PC tcp/ip stacks seem to need it. + Fri Mar 31 16:30:03 1995 Theodore Y. Ts'o (tytso@dcl) * realm_dom.c (krb5_get_realm_domain): Don't indent #ifdef's! diff --git a/src/lib/krb5/os/get_krbhst.c b/src/lib/krb5/os/get_krbhst.c index 0a02a3805..d41b80a37 100644 --- a/src/lib/krb5/os/get_krbhst.c +++ b/src/lib/krb5/os/get_krbhst.c @@ -85,7 +85,10 @@ krb5_get_krbhst(context, realm, hostlist) else { retval = 0; rethlist = (char **)calloc(hlsize, sizeof (*rethlist)); - for (;;) { + if (rethlist == NULL) + retval = ENOMEM; + + while (retval == 0) { if (fgets(filebuf, sizeof(filebuf), config_file) == NULL) break; if (strncmp(filebuf, realm->data, realm->length)) @@ -144,7 +147,8 @@ krb5_get_krbhst(context, realm, hostlist) if (hlindex == 0) { krb5_xfree(rethlist); rethlist = 0; - retval = KRB5_REALM_UNKNOWN; + if (retval == 0) + retval = KRB5_REALM_UNKNOWN; } *hostlist = rethlist; diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index e9ef69b09..61abc2cef 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -97,33 +97,34 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs) switch (hp->h_addrtype) { #ifdef KRB5_USE_INET case AF_INET: - if (udpport) /* must have gotten a port # */ - for (j=0; hp->h_addr_list[j]; j++) { - sin_p = (struct sockaddr_in *) &addr_p[out++]; - memset ((char *)sin_p, 0, sizeof(struct sockaddr)); - sin_p->sin_family = hp->h_addrtype; - sin_p->sin_port = udpport; - memcpy((char *)&sin_p->sin_addr, - (char *)hp->h_addr_list[j], - sizeof(struct in_addr)); - if (out >= count) { - count *= 2; - addr_p = (struct sockaddr *) - realloc ((char *)addr_p, - sizeof(struct sockaddr) * count); - } - if (sec_udpport) { - addr_p[out] = addr_p[out-1]; - sin_p = (struct sockaddr_in *) &addr_p[out++]; - sin_p->sin_port = sec_udpport; - if (out >= count) { + if (udpport) { /* must have gotten a port # */ + for (j=0; hp->h_addr_list[j]; j++) { + sin_p = (struct sockaddr_in *) &addr_p[out++]; + memset ((char *)sin_p, 0, sizeof(struct sockaddr)); + sin_p->sin_family = hp->h_addrtype; + sin_p->sin_port = udpport; + memcpy((char *)&sin_p->sin_addr, + (char *)hp->h_addr_list[j], + sizeof(struct in_addr)); + if (out >= count) { count *= 2; addr_p = (struct sockaddr *) - realloc ((char *)addr_p, - sizeof(struct sockaddr) * count); - } + realloc ((char *)addr_p, + sizeof(struct sockaddr) * count); + } + if (sec_udpport) { + addr_p[out] = addr_p[out-1]; + sin_p = (struct sockaddr_in *) &addr_p[out++]; + sin_p->sin_port = sec_udpport; + if (out >= count) { + count *= 2; + addr_p = (struct sockaddr *) + realloc ((char *)addr_p, + sizeof(struct sockaddr) * count); + } + } } - } + } break; #endif default: @@ -134,11 +135,12 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs) hostlist[i] = 0; } free ((char *)hostlist); - /* - * XXX need to distinguish between - * "can't resolve KDC name" and - * "can't find any KDC names" - */ + + if (out == 0) { /* Couldn't resolve any KDC names */ + free (addr_p); + return KRB5_REALM_CANT_RESOLVE; + } + *addr_pp = addr_p; *naddrs = out; return 0; diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 0a534b356..f4fffee9b 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -85,7 +85,6 @@ krb5_sendto_kdc (context, message, realm, reply) socklist = (SOCKET *)malloc(naddr * sizeof(SOCKET)); if (socklist == NULL) { krb5_xfree(addr); - krb5_xfree(socklist); return ENOMEM; } for (i = 0; i < naddr; i++) @@ -98,6 +97,13 @@ krb5_sendto_kdc (context, message, realm, reply) } reply->length = krb5_max_dgram_size; + if (SOCKET_INITIALIZE()) { /* PC needs this for some tcp/ip stacks */ + krb5_xfree(addr); + krb5_xfree(socklist); + free(reply->data); + return SOCKET_ERRNO; + } + /* * do exponential backoff. */ @@ -197,6 +203,7 @@ krb5_sendto_kdc (context, message, realm, reply) } retval = KRB5_KDC_UNREACH; out: + SOCKET_CLEANUP(); /* Done with sockets for now */ for (i = 0; i < naddr; i++) if (socklist[i] != INVALID_SOCKET) (void) closesocket (socklist[i]); diff --git a/src/lib/libkrb5.def b/src/lib/libkrb5.def index 3afbd0c4a..7f668c618 100644 --- a/src/lib/libkrb5.def +++ b/src/lib/libkrb5.def @@ -31,6 +31,7 @@ EXPORTS KRB5_RD_REP KRB5_SNAME_TO_PRINCIPAL KRB5_TIMEOFDAY + KRB5_US_TIMEOFDAY KRB5_UNPARSE_NAME ;Com_err routines _com_err diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index dc7212715..ea43dcd24 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 5 16:25:35 1995 Keith Vetter (keithv@fusion.com) + + * com_err.h: added FAR to pointers in prototypes. + Wed Mar 29 08:56:47 1995 John Gilmore (gnu at toad.com) * Makefile.in: Fix up Mac makefile. diff --git a/src/util/et/com_err.h b/src/util/et/com_err.h index e85965573..749ee05d9 100644 --- a/src/util/et/com_err.h +++ b/src/util/et/com_err.h @@ -41,8 +41,8 @@ #if defined(__STDC__) || defined(_WINDOWS) /* ANSI C -- use prototypes etc */ -extern void INTERFACE_C com_err (const char *, long, const char *, ...); -extern char const * INTERFACE error_message (long); +extern void INTERFACE_C com_err (const char FAR *, long, const char FAR *, ...); +extern char const FAR * INTERFACE error_message (long); extern void (*com_err_hook) (const char *, long, const char *, va_list); extern void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) (const char *, long, const char *, va_list); diff --git a/src/windows/changelo b/src/windows/changelo index cbd9f7b20..73fb984fa 100644 --- a/src/windows/changelo +++ b/src/windows/changelo @@ -1,3 +1,7 @@ +Wed Apr 5 16:14:49 1995 Keith Vetter (keithv@fusion.com) + + * readme: updated about realms, conf files and telnet port. + Tue Mar 28 12:00:00 1995 Keith Vetter (keithv@fusion.com) * ChangeLog renamed to changelo to avoid having to always rename it. diff --git a/src/windows/cns/changelo b/src/windows/cns/changelo index a2d9b87e6..eb98d9a90 100644 --- a/src/windows/cns/changelo +++ b/src/windows/cns/changelo @@ -1,3 +1,12 @@ +Wed Apr 5 16:01:16 1995 Keith Vetter (keithv@fusion.com) + + * cns.h, cns.rc, cns.c: GUI changes: re-order and resize + edit boxes, add hidden button for better CR handling. + * cns.c: used krb5_us_timeofday instead of krb5_timeofday + for timezone/clock skew fix (not tested by tytso yet). + * cns.c: added password changing stub with correct interface. + * cns.def: changed kwin to cns as the name of the program. + Fri Mar 31 16:47:18 1995 Keith Vetter (keithv@fusion.com) * cns.c: realms file was not getting saved properly. diff --git a/src/windows/cns/cns.c b/src/windows/cns/cns.c index fbf5cd10e..97b4b6bdb 100644 --- a/src/windows/cns/cns.c +++ b/src/windows/cns/cns.c @@ -235,7 +235,7 @@ position_dialog ( x + cx < 0 || y + cy < 0) center_dialog(hwnd); - else + else MoveWindow(hwnd, x, y, cx, cy, TRUE); } /* position_dialog */ @@ -492,12 +492,45 @@ change_password ( #endif #ifdef KRB5 /* FIXME */ - MessageBox (NULL, "Changing passwords is not yet implemented", "", MB_ICONEXCLAMATION); - return TRUE; + char *msg; // Message string + krb5_error_code code; // Return value + + krb5_error_code //FIXME INTERFACE + krb5_change_password( + krb5_context context, + char *user, + char *realm, + char *old_password, + char *new_password, + char **text); + + code = krb5_change_password (k5_context, name, realm, oldpw, newpw, &msg); + + if (msg != NULL) { + MessageBox (NULL, msg, NULL, MB_ICONEXCLAMATION); + //WHO FREES THIS SPACE??? free (msg); + } else if (code) + com_err (NULL, code, "while changing password."); + + return (code == 0); #endif } /* change_password */ - +/*+*/ +#ifdef KRB5 +krb5_error_code //FIXME INTERFACE +krb5_change_password( + krb5_context context, + char *user, + char *realm, + char *old_password, + char *new_password, + char **text) +{ + *text = "Changing passwords is not yet implemented"; + return -1; +} +#endif /* KRB5 */ /*+ * Function: Process WM_COMMAND messages for the password dialog. * @@ -1847,6 +1880,7 @@ kwin_command ( HMENU hmenu; char menuitem[MAX_K_NAME_SZ + 3]; char copyright[128]; + int id; #ifdef KRB4 char instance[INST_SZ]; int lifetime; @@ -1859,6 +1893,7 @@ kwin_command ( krb5_creds creds; krb5_principal server; krb5_timestamp now; + krb5_int32 sec, usec; #endif #ifdef KRB4 @@ -1885,6 +1920,8 @@ kwin_command ( } EnableWindow(GetDlgItem(hwnd, IDD_LOGIN), blogin); + id = (blogin) ? IDD_LOGIN : IDD_PASSWORD_CR2; + SendMessage(hwnd, DM_SETDEFID, id, 0); if (HIWORD(lparam) != BN_CLICKED && HIWORD(lparam) != 0 && HIWORD(lparam) != 1) return FALSE; @@ -1914,6 +1951,18 @@ kwin_command ( return TRUE; + case IDD_PASSWORD_CR2: // Make CR == TAB + id = GetDlgCtrlID(GetFocus()); + assert(id != 0); + + if (id == IDD_MAX_EDIT) + PostMessage(hwnd, WM_NEXTDLGCTL, + GetDlgItem(hwnd, IDD_MIN_EDIT), MAKELONG(1, 0)); + else + PostMessage(hwnd, WM_NEXTDLGCTL, 0, 0); + + return TRUE; + case IDD_LOGIN: if (isblocking) return TRUE; @@ -1964,8 +2013,14 @@ kwin_command ( creds.client = principal; creds.server = server; - code = krb5_timeofday(k5_context, &now); + //code = krb5_timeofday(k5_context, &now); + //if (code) break; + code = krb5_us_timeofday(k5_context, &sec, &usec); if (code) break; +//if (labs(now-sec) > 60*60) { // Off by more than an hour +// MessageBox (NULL, "DEBUG: timeofday != us_timeofday", NULL, 0); +// now = sec; +//} creds.times.starttime = 0; creds.times.endtime = now + 60L * lifetime; creds.times.renew_till = 0; diff --git a/src/windows/cns/cns.def b/src/windows/cns/cns.def index d0f2032c7..01fd7f5ea 100644 --- a/src/windows/cns/cns.def +++ b/src/windows/cns/cns.def @@ -1,9 +1,9 @@ -NAME KWIN -DESCRIPTION 'KWIN' -EXETYPE WINDOWS -STUB 'WINSTUB.EXE' +NAME CNS +DESCRIPTION 'CNS - Cygnus Network Security' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' SEGMENTS _TEXT CLASS 'CODE' PRELOAD -CODE DISCARDABLE +CODE DISCARDABLE DATA PRELOAD MULTIPLE MOVEABLE HEAPSIZE 20480 STACKSIZE 20480 diff --git a/src/windows/cns/cns.h b/src/windows/cns/cns.h index 7579400b8..1508c09e1 100644 --- a/src/windows/cns/cns.h +++ b/src/windows/cns/cns.h @@ -59,14 +59,14 @@ #define IDD_MIN_TITLE 103 #define IDD_LOGIN_NAME_TITLE 103 - #define IDD_LOGIN_REALM_TITLE 104 - #define IDD_LOGIN_PASSWORD_TITLE 105 + #define IDD_LOGIN_PASSWORD_TITLE 104 + #define IDD_LOGIN_REALM_TITLE 105 #define IDD_MAX_TITLE 105 #define IDD_MIN_EDIT 107 #define IDD_LOGIN_NAME 107 - #define IDD_LOGIN_REALM 108 - #define IDD_LOGIN_PASSWORD 109 + #define IDD_LOGIN_PASSWORD 108 + #define IDD_LOGIN_REALM 109 #define IDD_MAX_EDIT 109 #endif @@ -76,8 +76,9 @@ #define IDD_TICKET_DELETE 112 #define IDD_LOGIN 113 #define IDD_MAX_BUTTON 113 + #define IDD_PASSWORD_CR2 114 // For better cr handling - #define IDD_KWIN_LAST 113 + #define IDD_KWIN_LAST 114 #define ID_PASSWORD 200 diff --git a/src/windows/cns/cns.rc b/src/windows/cns/cns.rc index 55137252d..1a49e2a48 100644 --- a/src/windows/cns/cns.rc +++ b/src/windows/cns/cns.rc @@ -61,15 +61,16 @@ BEGIN #endif #ifdef KRB5 CONTROL "&Name", IDD_LOGIN_NAME_TITLE, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 69, 27, 8 - CONTROL "&Realm", IDD_LOGIN_REALM_TITLE, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 140, 69, 26, 8 - CONTROL "&Password", IDD_LOGIN_PASSWORD_TITLE, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 207, 69, 36, 8 - CONTROL "", IDD_LOGIN_NAME, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 6, 79, 62, 12 - CONTROL "", IDD_LOGIN_REALM, "EDIT", ES_LEFT | ES_AUTOHSCROLL | ES_UPPERCASE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 73, 79, 62, 12 - CONTROL "", IDD_LOGIN_PASSWORD, "EDIT", ES_LEFT | ES_AUTOHSCROLL | ES_PASSWORD | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 207, 79, 62, 12 + CONTROL "&Password", IDD_LOGIN_PASSWORD_TITLE, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 95, 69, 36, 8 + CONTROL "&Realm", IDD_LOGIN_REALM_TITLE, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 184, 69, 26, 8 + CONTROL "", IDD_LOGIN_NAME, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 6, 79, 84, 12 + CONTROL "", IDD_LOGIN_PASSWORD, "EDIT", ES_LEFT | ES_AUTOHSCROLL | ES_PASSWORD | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 95, 79, 84, 12 + CONTROL "", IDD_LOGIN_REALM, "EDIT", ES_LEFT | ES_AUTOHSCROLL | ES_UPPERCASE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 184, 79, 84, 12 #endif CONTROL "&Change Password...", IDD_CHANGE_PASSWORD, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 6, 96, 74, 14 CONTROL "&Delete", IDD_TICKET_DELETE, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 122, 96, 52, 14 CONTROL "&Login", IDD_LOGIN, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 216, 96, 52, 14 + CONTROL "", IDD_PASSWORD_CR2, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 5000, 5000, 0, 0 END #ifdef KRB4 diff --git a/src/windows/readme b/src/windows/readme index 6a3462094..7c1e5846a 100644 --- a/src/windows/readme +++ b/src/windows/readme @@ -19,15 +19,10 @@ On the PC side 4) nmake -c -f makefile.in # Configures the makefiles and runs # ...make in all the subdirectories. 5) + are in the windows directory.> The resulting interesting files will be: lib/libkrb5.dll # The actual DLL lib/libkrb5.lib # The library for linking in the DLL windows/cns/cns.exe # Cygnus Network Security program windows/wintel/telnet # K5 authenticated telnet program - -Note on telnet: since the only k5 telnet daemon at this time is -tsx-11.mit.edu port 13131, the port the program connects to is -hardwired for now to 13131. - diff --git a/src/windows/wintel/changelo b/src/windows/wintel/changelo index 34b6ed30d..f903d1045 100644 --- a/src/windows/wintel/changelo +++ b/src/windows/wintel/changelo @@ -1,3 +1,8 @@ +Wed Apr 5 16:18:30 1995 Keith Vetter (keithv@fusion.com) + + * screen.c, screen.h, dialog.h, telnet.rc: added an about + box with version number. + Fri Mar 31 16:24:52 1995 Keith Vetter (keithv@fusion.com) * telnet.c, wt-proto.h: added command line option to set port number diff --git a/src/windows/wintel/dialog.h b/src/windows/wintel/dialog.h index da4790f74..cfec5928a 100644 --- a/src/windows/wintel/dialog.h +++ b/src/windows/wintel/dialog.h @@ -1,4 +1,3 @@ -#define IDM_ABOUT 100 #define IDM_SHOWCONSOLE 700 #define IDM_OPENTELNETDLG 200 diff --git a/src/windows/wintel/screen.c b/src/windows/wintel/screen.c index 2f12ad00c..6842b75c9 100644 --- a/src/windows/wintel/screen.c +++ b/src/windows/wintel/screen.c @@ -2,7 +2,7 @@ #include #include #include -#include "screen.h" +#include "telnet.h" #include "ini.h" extern char *cInvertedArray; @@ -759,6 +759,19 @@ LPARAM lParam; /* additional information */ case IDM_PASTE: Edit_Paste(hWnd); break; + case IDM_ABOUT: + #ifdef KRB4 + strcpy(strTmp, " Kerberos 4 for Windows\n"); + #endif + #ifdef KRB5 + strcpy(strTmp, " Kerberos 5 for Windows\n"); + #endif + strcat(strTmp, "\n Version 1.00\n\n"); + strcat(strTmp, " For support, contact:\n"); + strcat(strTmp, "Cygnus Support"); + strcat(strTmp, " - (415) 903-1400"); + MessageBox(NULL, strTmp, "Kerberos", MB_OK); + break; #ifdef _DEBUG case IDM_DEBUG: CheckScreen(fpScr); diff --git a/src/windows/wintel/screen.h b/src/windows/wintel/screen.h index edc4d1368..7a472436f 100644 --- a/src/windows/wintel/screen.h +++ b/src/windows/wintel/screen.h @@ -127,6 +127,7 @@ typedef struct CONFIG { #define IDM_FONT 100 #define IDM_BACKSPACE 101 #define IDM_DELETE 102 +#define IDM_ABOUT 103 #define IDM_COPY 200 #define IDM_PASTE 201 diff --git a/src/windows/wintel/telnet.rc b/src/windows/wintel/telnet.rc index bcdcdb569..cbe082578 100644 --- a/src/windows/wintel/telnet.rc +++ b/src/windows/wintel/telnet.rc @@ -14,6 +14,7 @@ BEGIN MENUITEM "&Delete", IDM_DELETE MENUITEM SEPARATOR MENUITEM "&Font...", IDM_FONT + MENUITEM "&About...", IDM_ABOUT END POPUP "&Edit" BEGIN