From: Simon Wilkinson Date: Wed, 8 Sep 2010 07:12:41 +0000 (+0100) Subject: authcon: Use ktc_GetTokenEx in ClientAuthToken X-Git-Tag: upstream/1.8.0_pre1^2~4812 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=97c317c2ccb80b1d183275258999adecb66fe5d2;p=packages%2Fo%2Fopenafs.git authcon: Use ktc_GetTokenEx in ClientAuthToken Use ktc_GetTokenEx, and the related token utilities to check for a users tokens, rather than using the legacy ktc_GetToken Export the necessary symbols from libafsauthent on Windows to be able to do this. Change-Id: I475587d88d9a480c66b4e8484cc595ea984340a3 Reviewed-on: http://gerrit.openafs.org/2747 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/auth/authcon.c b/src/auth/authcon.c index 55f0d6a6f..574c4d0be 100644 --- a/src/auth/authcon.c +++ b/src/auth/authcon.c @@ -29,6 +29,7 @@ #include #include "cellconfig.h" #include "keys.h" +#include "ktc.h" #include "auth.h" /* return a null security object if nothing else can be done */ @@ -181,7 +182,7 @@ afsconf_ClientAuthToken(struct afsconf_cell *info, afs_int32 *scIndex, time_t *expires) { - struct ktc_principal sname; + struct ktc_setTokenData *tokenSet = NULL; struct ktc_token ttoken; int encryptLevel; afs_int32 code; @@ -189,11 +190,11 @@ afsconf_ClientAuthToken(struct afsconf_cell *info, *sc = NULL; *scIndex = RX_SECIDX_NULL; - strcpy(sname.cell, info->name); - sname.instance[0] = 0; - strcpy(sname.name, "afs"); - code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL); + code = ktc_GetTokenEx(info->name, &tokenSet); + if (code) + goto out; + code = token_extractRxkad(tokenSet, &ttoken, NULL, NULL); if (code == 0) { /* XXX - We should think about how to handle this */ if (ttoken.kvno < 0 || ttoken.kvno > 256) { @@ -214,6 +215,10 @@ afsconf_ClientAuthToken(struct afsconf_cell *info, if (expires) *expires = ttoken.endTime; } + +out: + token_FreeSet(&tokenSet); + if (*sc == NULL) return AFSCONF_NO_SECURITY_CLASS;