From b92f61e5c47d5b4b2d8cd3e65f5dfdcc334624e6 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Wed, 22 Mar 1995 22:35:49 +0000 Subject: [PATCH] Added prototypes to ccache change notification git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5198 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/ChangeLog | 6 ++++++ src/lib/krb5/ccache/file/fcc-proto.h | 3 +++ src/lib/krb5/ccache/file/fcc.h | 4 ++++ src/lib/krb5/ccache/file/fcc_ops.c | 12 ++++++----- src/lib/krb5/os/ChangeLog | 4 ++++ src/lib/krb5/os/an_to_ln.c | 31 +++++++++++++++++++++------- src/lib/krb5/os/kuserok.c | 25 +++++++++++++++++++++- 7 files changed, 72 insertions(+), 13 deletions(-) diff --git a/src/lib/krb5/ccache/file/ChangeLog b/src/lib/krb5/ccache/file/ChangeLog index 990d3afb1..22fc4bf2b 100644 --- a/src/lib/krb5/ccache/file/ChangeLog +++ b/src/lib/krb5/ccache/file/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 22 11:24:07 1995 Keith Vetter (keithv@fusion.com) + + * fcc-proto.h: added prototype for cache changing hook, + * fcc.h: changed cache file location for the PC (out of /tmp). + * fcc_ops.h: made the cache changing hook return an error code. + Tue Mar 21 19:14:49 1995 Keith Vetter (keithv@fusion.com) * fcc_destroy.c: open file on the PC in binary mode, worked around diff --git a/src/lib/krb5/ccache/file/fcc-proto.h b/src/lib/krb5/ccache/file/fcc-proto.h index 26c605968..9d6687577 100644 --- a/src/lib/krb5/ccache/file/fcc-proto.h +++ b/src/lib/krb5/ccache/file/fcc-proto.h @@ -121,6 +121,9 @@ krb5_error_code INTERFACE krb5_fcc_set_flags /* fcc_ops.c */ extern krb5_cc_ops krb5_cc_file_ops; +krb5_error_code krb5_change_cache + PROTOTYPE(()); + /* fcc_write.c */ krb5_error_code INTERFACE krb5_fcc_write diff --git a/src/lib/krb5/ccache/file/fcc.h b/src/lib/krb5/ccache/file/fcc.h index 6b7c1b8b7..980a9c17e 100644 --- a/src/lib/krb5/ccache/file/fcc.h +++ b/src/lib/krb5/ccache/file/fcc.h @@ -63,8 +63,12 @@ #define FCC_OPEN_RDONLY 3 #ifndef TKT_ROOT +#ifdef MSDOS_FILESYSTEM +#define TKT_ROOT "\\tkt" +#else #define TKT_ROOT "/tmp/tkt" #endif +#endif /* macros to make checking flags easier */ #define OPENCLOSE(id) (((krb5_fcc_data *)id->data)->flags & KRB5_TC_OPENCLOSE) diff --git a/src/lib/krb5/ccache/file/fcc_ops.c b/src/lib/krb5/ccache/file/fcc_ops.c index 6c577b820..a38ffc03b 100644 --- a/src/lib/krb5/ccache/file/fcc_ops.c +++ b/src/lib/krb5/ccache/file/fcc_ops.c @@ -56,11 +56,12 @@ krb5_cc_ops krb5_fcc_ops = { * we'll communicate to all other processes. */ -void -krb5_change_cache (int send) { +krb5_error_code +krb5_change_cache (void) { SendMessage(HWND_BROADCAST, krb5_get_notification_message(), 0, 0); + return 0; } unsigned int INTERFACE @@ -74,13 +75,14 @@ krb5_get_notification_message (void) { } #else /* _WINDOWS */ -void INTERFACE +krb5_error_code krb5_change_cache () { - return; + return 0; } unsigned int INTERFACE -krb5_get_notification_message () { +krb5_get_notification_message () +{ return 0; } diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 3ac19f425..d6a791e5f 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 22 13:30:35 1995 Keith Vetter (keithv@fusion.com) + + * an_to_ln.c, kuserok.c: last two os routines ported to the PC. + Fri Mar 17 19:56:39 1995 John Gilmore (gnu at toad.com) * Makefile.in (LDFLAGS): Eliminate, duplicates config/pre.in. diff --git a/src/lib/krb5/os/an_to_ln.c b/src/lib/krb5/os/an_to_ln.c index da065b9dd..01e3d415c 100644 --- a/src/lib/krb5/os/an_to_ln.c +++ b/src/lib/krb5/os/an_to_ln.c @@ -25,11 +25,16 @@ */ #include "k5-int.h" -#ifndef _MSDOS /* Not yet for Windows */ + #ifndef min #define min(a,b) ((a) > (b) ? (b) : (a)) #endif /* min */ +int krb5_lname_username_fallback = 1; +extern char *krb5_lname_file; + +#ifndef _MSDOS + static krb5_error_code dbm_an_to_ln(); static krb5_error_code username_an_to_ln(); @@ -45,10 +50,6 @@ static krb5_error_code username_an_to_ln(); returns system errors, NOT_ENOUGH_SPACE */ -int krb5_lname_username_fallback = 1; - -extern char *krb5_lname_file; - krb5_error_code krb5_aname_to_localname(context, aname, lnsize, lname) krb5_context context; @@ -115,6 +116,7 @@ dbm_an_to_ln(context, aname, lnsize, lname) (void) dbm_close(db); return retval; } +#endif /* _MSDOS */ /* * Implementation: This version checks the realm to see if it is the local @@ -137,7 +139,7 @@ username_an_to_ln(context, aname, lnsize, lname) if (retval = krb5_get_default_realm(context, &def_realm)) { return(retval); } - if ((realm_length != strlen(def_realm)) || + if (((size_t) realm_length != strlen(def_realm)) || (memcmp(def_realm, krb5_princ_realm(context, aname)->data, realm_length))) { free(def_realm); return KRB5_LNAME_NOTRANS; @@ -168,4 +170,19 @@ username_an_to_ln(context, aname, lnsize, lname) } return retval; } -#endif + +#ifdef _MSDOS + +krb5_error_code INTERFACE +krb5_aname_to_localname(context, aname, lnsize, lname) + krb5_context context; + krb5_const_principal aname; + const int lnsize; + char *lname; +{ + if (krb5_lname_username_fallback) + return username_an_to_ln(context, aname, lnsize, lname); + return KRB5_LNAME_CANTOPEN; +} + +#endif /* _MSDOS */ diff --git a/src/lib/krb5/os/kuserok.c b/src/lib/krb5/os/kuserok.c index cefb3ce9a..5a25e53a0 100644 --- a/src/lib/krb5/os/kuserok.c +++ b/src/lib/krb5/os/kuserok.c @@ -136,4 +136,27 @@ krb5_kuserok(context, principal, luser) fclose(fp); return(isok); } -#endif + +#else /* _MSDOS */ + +/* + * If the given Kerberos name "server" translates to the same name as "luser" + * (using * krb5_aname_to_lname()), returns TRUE. + */ +krb5_boolean INTERFACE +krb5_kuserok(context, principal, luser) + krb5_context context; + krb5_principal principal; + const char *luser; +{ + char kuser[50]; + + if (! krb5_aname_to_localname(context, principal, sizeof(kuser), kuser)) + return FALSE; + + if (strcmp(kuser, luser) == 0) + return TRUE; + + return FALSE; +} +#endif /* _MSDOS */ -- 2.26.2