diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2000-05-19 22:21:41 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2000-05-19 22:21:41 +0000 |
| commit | 592d3079f51a02415b412fd2f3e288e1dc1989c7 (patch) | |
| tree | 1cf7841803083e1d9a4fda6b865ace2858f9b006 /src/lib | |
| parent | b9c85dcc0529cd2219ae3010383f0e155f65e4d6 (diff) | |
| download | krb5-592d3079f51a02415b412fd2f3e288e1dc1989c7.tar.gz krb5-592d3079f51a02415b412fd2f3e288e1dc1989c7.tar.xz krb5-592d3079f51a02415b412fd2f3e288e1dc1989c7.zip | |
2000-5-19 Alexandra Ellwood <lxs@mit.edu>
* ccdefault.c: Added krb5int_cc_default. This function
supports the Kerberos Login Library and pops up a dialog if the cache does
not contain valid tickets. This is used to automatically get a tgt before
obtaining service tickets. Note that this should be an internal function
because callers don't expect krb5_cc_default to pop up a dialog!
(We found this out the hard way :-)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12292 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb5/ccache/ChangeLog | 9 | ||||
| -rw-r--r-- | src/lib/krb5/ccache/ccdefault.c | 52 |
2 files changed, 45 insertions, 16 deletions
diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index 8b4fe4d59..1711ba759 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,12 @@ +2000-5-19 Alexandra Ellwood <lxs@mit.edu> + + * ccdefault.c: Added krb5int_cc_default. This function + supports the Kerberos Login Library and pops up a dialog if the cache does + not contain valid tickets. This is used to automatically get a tgt before + obtaining service tickets. Note that this should be an internal function + because callers don't expect krb5_cc_default to pop up a dialog! + (We found this out the hard way :-) + 2000-4-26 Alexandra Ellwood <lxs@mit.edu> * ccdefault.c: Added version number to internal Kerberos Login Library diff --git a/src/lib/krb5/ccache/ccdefault.c b/src/lib/krb5/ccache/ccdefault.c index f34a33518..f863f4a31 100644 --- a/src/lib/krb5/ccache/ccdefault.c +++ b/src/lib/krb5/ccache/ccdefault.c @@ -38,22 +38,49 @@ krb5_cc_default(context, ccache) krb5_context context; krb5_ccache FAR *ccache; { - krb5_error_code retval, err; + krb5_error_code retval; krb5_os_context os_ctx; if (!context || context->magic != KV5M_CONTEXT) return KV5M_CONTEXT; os_ctx = context->os_context; + + retval = krb5_cc_resolve(context, krb5_cc_default_name(context), ccache); + if (!retval && ccache && !os_ctx->default_ccprincipal) { + /* We got a ccache... remember what principal is associated with it */ + if (krb5_cc_get_principal (context, *ccache, &os_ctx->default_ccprincipal) != 0) + os_ctx->default_ccprincipal = 0; + } + return retval; +} + +/* This is the internal function which opens the default ccache. On platforms supporting + the login library's automatic popup dialog to get tickets, this function also updated the + library's internal view of the current principal associated with this cache. + + All krb5 and GSS functions which need to open a cache to get a tgt to obtain service tickets + should call this function, not krb5_cc_default() */ +KRB5_DLLIMP krb5_error_code KRB5_CALLCONV +krb5int_cc_default(context, ccache) + krb5_context context; + krb5_ccache FAR *ccache; +{ #ifdef USE_LOGIN_LIBRARY { - /* this is the best place to do this: - * make sure the default cache has tix before you open it */ - char *outCacheName; - KLPrincipal desiredPrincipal = nil; - krb5_principal desiredKrb5Principal; - + /* make sure the default cache has tix before you open it */ + char *outCacheName; + KLPrincipal desiredPrincipal = nil; + krb5_principal desiredKrb5Principal; + krb5_error_code err; + krb5_os_context os_ctx; + + if (!context || context->magic != KV5M_CONTEXT) + return KV5M_CONTEXT; + + os_ctx = context->os_context; + desiredKrb5Principal = os_ctx->default_ccprincipal; /* do we want a specific client principal? */ @@ -88,12 +115,5 @@ krb5_cc_default(context, ccache) } #endif - retval = krb5_cc_resolve(context, krb5_cc_default_name(context), ccache); - if (!retval && ccache && !os_ctx->default_ccprincipal) { - /* We got a ccache... remember what principal is associated with it */ - err = krb5_cc_get_principal (context, *ccache, &os_ctx->default_ccprincipal); - if (err) - os_ctx->default_ccprincipal = 0; - } - return retval; -} + return krb5_cc_default (context, ccache); +}
\ No newline at end of file |
