#include "auth.h"
#include <afs/afsutil.h>
+/* TBUFFERSIZE must be at least 512 larger than KTCMAXTICKETSIZE */
+#define TBUFFERSIZE 8192
/* Forward declarations for local token cache. */
static int SetLocalToken(struct ktc_principal *aserver,
struct ktc_principal *client, int flags)
{
struct ViceIoctl iob;
- char tbuffer[1024];
+ char tbuffer[TBUFFERSIZE];
char *tp;
struct ClearToken ct;
int temp;
int tokenLen, struct ktc_principal *client)
{
struct ViceIoctl iob;
- char tbuffer[1024];
+ char tbuffer[TBUFFERSIZE];
char *tp, *cp;
char *ticketP;
int ticketLen, temp;
/* user name is here */
- /* check that ticket will fit */
- maxLen = tokenLen - sizeof(struct ktc_token) + MAXKTCTICKETLEN;
- if (maxLen < ticketLen)
- return KTC_TOOBIG;
+ /* check that ticket will fit
+ * this compares the size of the ktc_token allocated by the app
+ * which might be smaller than the current definition of MAXKTCTICKETLEN
+ */
+ maxLen = tokenLen - sizeof(struct ktc_token) + MAXKTCTICKETLEN;
+ if (maxLen < ticketLen)
+ return KTC_TOOBIG;
/* set return values */
memcpy(token->ticket, ticketP, ticketLen);
ktc_ListTokens(int cellNum, int *cellNumP, struct ktc_principal *server)
{
struct ViceIoctl iob;
- char tbuffer[1024];
+ char tbuffer[TBUFFERSIZE];
char *tp, *cp;
int newIter, ticketLen, temp;
int code;
ktc_ForgetToken(struct ktc_principal *server)
{
struct ViceIoctl iob;
- char tbuffer[1024];
+ char tbuffer[TBUFFERSIZE];
char *tp;
int code;
HANDLE ktcMutex = NULL;
ktc_ForgetAllTokens()
{
struct ViceIoctl iob;
- char tbuffer[1024];
+ char tbuffer[TBUFFERSIZE];
int code;
HANDLE ktcMutex = NULL;