From ab7d176ca82df2b7a24a0dc90c3d368fd9ca1bbc Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Thu, 20 Oct 2005 22:43:29 +0000 Subject: [PATCH] pull up r17440 from trunk ticket: 3211 version_fixed: 1.4.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17443 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/ChangeLog | 7 +++++++ src/lib/krb5/ccache/cc_mslsa.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index e015116a5..ff19622c5 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,10 @@ +2005-10-20 Jeffrey Altman + + * cc_mslsa.c: + - provide defaults for client and server names in purge + ticket routines + - properly size the buffers used to store the names. + 2005-06-15 Ken Raeburn * cc_file.c (dereference): Fix test is list-walking loop. diff --git a/src/lib/krb5/ccache/cc_mslsa.c b/src/lib/krb5/ccache/cc_mslsa.c index fdd3f108b..41fc1c198 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -737,7 +737,7 @@ PurgeTicket2000( HANDLE LogonHandle, ULONG PackageId, NTSTATUS SubStatus = 0; KERB_PURGE_TKT_CACHE_REQUEST * pPurgeRequest; DWORD dwRequestLen = sizeof(KERB_PURGE_TKT_CACHE_REQUEST) + 1024; - char * sname, * srealm = NULL; + char * sname = NULL, * srealm = NULL; if (krb5_unparse_name(context, cred->server, &sname)) return FALSE; @@ -755,12 +755,12 @@ PurgeTicket2000( HANDLE LogonHandle, ULONG PackageId, pPurgeRequest->LogonId.LowPart = 0; pPurgeRequest->LogonId.HighPart = 0; pPurgeRequest->ServerName.Buffer = (PWSTR)(((CHAR *)pPurgeRequest)+sizeof(KERB_PURGE_TKT_CACHE_REQUEST)); - pPurgeRequest->ServerName.Length = strlen(sname); + pPurgeRequest->ServerName.Length = strlen(sname)*sizeof(WCHAR); pPurgeRequest->ServerName.MaximumLength = 256; ANSIToUnicode(sname, pPurgeRequest->ServerName.Buffer, pPurgeRequest->ServerName.MaximumLength); pPurgeRequest->RealmName.Buffer = (PWSTR)(((CHAR *)pPurgeRequest)+sizeof(KERB_PURGE_TKT_CACHE_REQUEST)+512); - pPurgeRequest->RealmName.Length = strlen(srealm); + pPurgeRequest->RealmName.Length = strlen(srealm)*sizeof(WCHAR); pPurgeRequest->RealmName.MaximumLength = 256; ANSIToUnicode(srealm, pPurgeRequest->RealmName.Buffer, pPurgeRequest->RealmName.MaximumLength); @@ -791,8 +791,8 @@ PurgeTicketXP( HANDLE LogonHandle, ULONG PackageId, NTSTATUS SubStatus = 0; KERB_PURGE_TKT_CACHE_EX_REQUEST * pPurgeRequest; DWORD dwRequestLen = sizeof(KERB_PURGE_TKT_CACHE_EX_REQUEST) + 2048; - char * cname, * crealm = NULL; - char * sname, * srealm = NULL; + char * cname = NULL, * crealm = NULL; + char * sname = NULL, * srealm = NULL; if (krb5_unparse_name(context, cred->client, &cname)) return FALSE; @@ -820,25 +820,25 @@ PurgeTicketXP( HANDLE LogonHandle, ULONG PackageId, pPurgeRequest->LogonId.HighPart = 0; pPurgeRequest->Flags = 0; pPurgeRequest->TicketTemplate.ClientName.Buffer = (PWSTR)((CHAR *)pPurgeRequest + sizeof(KERB_PURGE_TKT_CACHE_EX_REQUEST)); - pPurgeRequest->TicketTemplate.ClientName.Length = strlen(cname); + pPurgeRequest->TicketTemplate.ClientName.Length = strlen(cname)*sizeof(WCHAR); pPurgeRequest->TicketTemplate.ClientName.MaximumLength = 256; ANSIToUnicode(cname, pPurgeRequest->TicketTemplate.ClientName.Buffer, pPurgeRequest->TicketTemplate.ClientName.MaximumLength); pPurgeRequest->TicketTemplate.ClientRealm.Buffer = (PWSTR)(((CHAR *)pPurgeRequest)+sizeof(KERB_PURGE_TKT_CACHE_EX_REQUEST) + 512); - pPurgeRequest->TicketTemplate.ClientRealm.Length = strlen(crealm); + pPurgeRequest->TicketTemplate.ClientRealm.Length = strlen(crealm)*sizeof(WCHAR); pPurgeRequest->TicketTemplate.ClientRealm.MaximumLength = 256; ANSIToUnicode(crealm, pPurgeRequest->TicketTemplate.ClientRealm.Buffer, pPurgeRequest->TicketTemplate.ClientRealm.MaximumLength); pPurgeRequest->TicketTemplate.ServerName.Buffer = (PWSTR)(((CHAR *)pPurgeRequest)+sizeof(KERB_PURGE_TKT_CACHE_EX_REQUEST) + 1024); - pPurgeRequest->TicketTemplate.ServerName.Length = strlen(sname); + pPurgeRequest->TicketTemplate.ServerName.Length = strlen(sname)*sizeof(WCHAR); pPurgeRequest->TicketTemplate.ServerName.MaximumLength = 256; ANSIToUnicode(sname, pPurgeRequest->TicketTemplate.ServerName.Buffer, pPurgeRequest->TicketTemplate.ServerName.MaximumLength); pPurgeRequest->TicketTemplate.ServerRealm.Buffer = (PWSTR)(((CHAR *)pPurgeRequest)+sizeof(KERB_PURGE_TKT_CACHE_EX_REQUEST) + 1536); - pPurgeRequest->TicketTemplate.ServerRealm.Length = strlen(srealm); + pPurgeRequest->TicketTemplate.ServerRealm.Length = strlen(srealm)*sizeof(WCHAR); pPurgeRequest->TicketTemplate.ServerRealm.MaximumLength = 256; ANSIToUnicode(srealm, pPurgeRequest->TicketTemplate.ServerRealm.Buffer, pPurgeRequest->TicketTemplate.ServerRealm.MaximumLength); -- 2.26.2