From: Jeffrey Altman Date: Thu, 20 Oct 2005 20:24:21 +0000 (+0000) Subject: cc_mslsa.c: X-Git-Tag: ms-bug-test-20060525~100 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d791e13a1fe30dee88e73f679bad496bda094e2;p=krb5.git cc_mslsa.c: - provide defaults for client and server names in purge ticket routines - properly size the buffers used to store the names. ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17440 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index dede9ceb3..66627280b 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 02ecf9da1..e7e59766e 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -840,7 +840,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; @@ -858,12 +858,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); @@ -894,8 +894,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; @@ -923,25 +923,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);