libfreerdp-sspi: fix compilation on Linux without UNICODE definition

This commit is contained in:
Marc-André Moreau
2012-03-24 16:02:58 -04:00
parent e6ca39750a
commit 842e85bcdc
8 changed files with 38 additions and 10 deletions

View File

@@ -20,6 +20,8 @@
#ifndef FREERDP_SSPI_H
#define FREERDP_SSPI_H
#include <wchar.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/utils/windows.h>
@@ -41,7 +43,7 @@
#define FREERDP_SSPI
typedef char CHAR;
typedef uint16 WCHAR;
typedef wchar_t WCHAR;
typedef CHAR* LPSTR;
typedef WCHAR* LPWSTR;

View File

@@ -22,6 +22,7 @@
#include <stddef.h>
#include <ctype.h>
#include <wchar.h>
#include <freerdp/api.h>
FREERDP_API void* xmalloc(size_t size);
@@ -30,6 +31,7 @@ FREERDP_API void* xrealloc(void* ptr, size_t size);
FREERDP_API void xfree(void* ptr);
FREERDP_API char* xstrdup(const char* str);
FREERDP_API char* xstrtoup(const char* str);
FREERDP_API wchar_t* xwcsdup(const wchar_t* wstr);
#define xnew(_type) (_type*)xzalloc(sizeof(_type))

View File

@@ -364,7 +364,7 @@ SECURITY_STATUS SEC_ENTRY kerberos_QueryCredentialsAttributesA(PCredHandle phCre
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
{
CREDENTIALS* credentials;
SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
//SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);

View File

@@ -202,7 +202,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesW(PCredHandle phCredent
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
{
CREDENTIALS* credentials;
SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
//SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
@@ -220,7 +220,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesA(PCredHandle phCredent
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
{
CREDENTIALS* credentials;
SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
//SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);

View File

@@ -229,7 +229,7 @@ SECURITY_STATUS SEC_ENTRY negotiate_QueryCredentialsAttributesA(PCredHandle phCr
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
{
CREDENTIALS* credentials;
SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
//SecPkgCredentials_Names* credential_names = (SecPkgCredentials_Names*) pBuffer;
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);

View File

@@ -1025,7 +1025,6 @@ void credssp_free(rdpCredssp* credssp)
xfree(credssp->identity.User);
xfree(credssp->identity.Domain);
xfree(credssp->identity.Password);
xfree(credssp->table);
xfree(credssp);
}
}

View File

@@ -366,8 +366,8 @@ SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(uint32* pcPackages, PSecPkg
pPackageInfo[index].wVersion = SecPkgInfoW_LIST[index]->wVersion;
pPackageInfo[index].wRPCID = SecPkgInfoW_LIST[index]->wRPCID;
pPackageInfo[index].cbMaxToken = SecPkgInfoW_LIST[index]->cbMaxToken;
pPackageInfo[index].Name = _wcsdup(SecPkgInfoW_LIST[index]->Name);
pPackageInfo[index].Comment = _wcsdup(SecPkgInfoW_LIST[index]->Comment);
pPackageInfo[index].Name = xwcsdup(SecPkgInfoW_LIST[index]->Name);
pPackageInfo[index].Comment = xwcsdup(SecPkgInfoW_LIST[index]->Comment);
}
*(pcPackages) = cPackages;
@@ -454,8 +454,8 @@ SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName, P
pPackageInfo->wVersion = SecPkgInfoW_LIST[index]->wVersion;
pPackageInfo->wRPCID = SecPkgInfoW_LIST[index]->wRPCID;
pPackageInfo->cbMaxToken = SecPkgInfoW_LIST[index]->cbMaxToken;
pPackageInfo->Name = _wcsdup(SecPkgInfoW_LIST[index]->Name);
pPackageInfo->Comment = _wcsdup(SecPkgInfoW_LIST[index]->Comment);
pPackageInfo->Name = xwcsdup(SecPkgInfoW_LIST[index]->Name);
pPackageInfo->Comment = xwcsdup(SecPkgInfoW_LIST[index]->Comment);
*(ppPackageInfo) = pPackageInfo;

View File

@@ -126,6 +126,31 @@ char* xstrdup(const char* str)
return mem;
}
/**
* Duplicate a string in memory.
* @param wstr
* @return
*/
wchar_t* xwcsdup(const wchar_t* wstr)
{
wchar_t* mem;
if (wstr == NULL)
return NULL;
#ifdef _WIN32
mem = _wcsdup(wstr);
#else
mem = wcsdup(wstr);
#endif
if (mem == NULL)
perror("wstrdup");
return mem;
}
char* xstrtoup(const char* str)
{
char* out;