mirror of https://github.com/FreeRDP/FreeRDP
libwinpr-sspi: fix data type warnings
This commit is contained in:
parent
733fc24a48
commit
90dcef3178
|
@ -654,7 +654,7 @@ typedef CtxtHandle* PCtxtHandle;
|
|||
struct _SecBuffer
|
||||
{
|
||||
ULONG cbBuffer;
|
||||
uint32 BufferType;
|
||||
ULONG BufferType;
|
||||
void* pvBuffer;
|
||||
};
|
||||
typedef struct _SecBuffer SecBuffer;
|
||||
|
@ -662,8 +662,8 @@ typedef SecBuffer* PSecBuffer;
|
|||
|
||||
struct _SecBufferDesc
|
||||
{
|
||||
uint32 ulVersion;
|
||||
uint32 cBuffers;
|
||||
ULONG ulVersion;
|
||||
ULONG cBuffers;
|
||||
PSecBuffer pBuffers;
|
||||
};
|
||||
typedef struct _SecBufferDesc SecBufferDesc;
|
||||
|
|
|
@ -37,7 +37,6 @@ set(FREERDP_UTILS_SRCS
|
|||
profiler.c
|
||||
rail.c
|
||||
rect.c
|
||||
registry.c
|
||||
semaphore.c
|
||||
signal.c
|
||||
sleep.c
|
||||
|
|
|
@ -1,187 +0,0 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Registry Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <freerdp/utils/file.h>
|
||||
|
||||
#include <freerdp/utils/registry.h>
|
||||
|
||||
static const char registry_dir[] = "freerdp";
|
||||
static const char registry_file[] = "config.txt";
|
||||
|
||||
static REG_SECTION global[] =
|
||||
{
|
||||
{ REG_TYPE_SECTION, "global", 0, NULL },
|
||||
{ REG_TYPE_BOOLEAN, "fast_path", 1, "1" },
|
||||
{ REG_TYPE_STRING, "resolution", 8, "1024x768" },
|
||||
{ REG_TYPE_INTEGER, "performance_flags", 4, "0xFFFF" },
|
||||
{ REG_TYPE_NONE, "", 0, NULL }
|
||||
};
|
||||
|
||||
static REG_SECTION licensing[] =
|
||||
{
|
||||
{ REG_TYPE_SECTION, "licensing", 0, NULL },
|
||||
{ REG_TYPE_STRING, "platform_id", 1, "0x000201" },
|
||||
{ REG_TYPE_STRING, "hardware_id", 16, "0xe107d9d372bb6826bd81d3542a419d6" },
|
||||
{ REG_TYPE_NONE, "", 0, NULL }
|
||||
};
|
||||
|
||||
static REG_SECTION* sections[] =
|
||||
{
|
||||
(REG_SECTION*) &global,
|
||||
(REG_SECTION*) &licensing,
|
||||
(REG_SECTION*) NULL
|
||||
};
|
||||
|
||||
void registry_print_entry(REG_ENTRY* entry, FILE* fp)
|
||||
{
|
||||
uint8* value;
|
||||
value = (uint8*) entry->value;
|
||||
fprintf(fp, "%s = %s\n", entry->name, value);
|
||||
}
|
||||
|
||||
void registry_print_section(REG_SECTION* section, FILE* fp)
|
||||
{
|
||||
int i = 0;
|
||||
REG_ENTRY* entries = (REG_ENTRY*) §ion[1];
|
||||
|
||||
fprintf(fp, "\n");
|
||||
fprintf(fp, "[%s]\n", section->name);
|
||||
|
||||
while (entries[i].type != REG_TYPE_NONE)
|
||||
{
|
||||
registry_print_entry(&entries[i], fp);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void registry_print(rdpRegistry* registry, FILE* fp)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
fprintf(fp, "# FreeRDP Configuration Registry\n");
|
||||
|
||||
while (sections[i] != NULL)
|
||||
{
|
||||
registry_print_section(sections[i], fp);
|
||||
i++;
|
||||
}
|
||||
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
void registry_create(rdpRegistry* registry)
|
||||
{
|
||||
registry->fp = fopen((char*)registry->file, "w+");
|
||||
|
||||
if (registry->fp == NULL)
|
||||
{
|
||||
printf("registry_create: error opening [%s] for writing\n", registry->file);
|
||||
return;
|
||||
}
|
||||
|
||||
registry_print(registry, registry->fp);
|
||||
fflush(registry->fp);
|
||||
}
|
||||
|
||||
void registry_load(rdpRegistry* registry)
|
||||
{
|
||||
registry->fp = fopen((char*) registry->file, "r+");
|
||||
}
|
||||
|
||||
void registry_open(rdpRegistry* registry)
|
||||
{
|
||||
struct stat stat_info;
|
||||
|
||||
if (stat((char*)registry->file, &stat_info) != 0)
|
||||
registry_create(registry);
|
||||
else
|
||||
registry_load(registry);
|
||||
}
|
||||
|
||||
void registry_close(rdpRegistry* registry)
|
||||
{
|
||||
if (registry->fp != NULL)
|
||||
fclose(registry->fp);
|
||||
}
|
||||
|
||||
void registry_init(rdpRegistry* registry)
|
||||
{
|
||||
int length;
|
||||
char* home_path;
|
||||
struct stat stat_info;
|
||||
|
||||
if (registry->settings->home_path == NULL)
|
||||
home_path = getenv("HOME");
|
||||
else
|
||||
home_path = registry->settings->home_path;
|
||||
|
||||
if (home_path == NULL)
|
||||
{
|
||||
printf("could not get home path\n");
|
||||
registry->available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
registry->available = true;
|
||||
|
||||
registry->home = (char*) xstrdup(home_path);
|
||||
printf("home path: %s\n", registry->home);
|
||||
|
||||
registry->path = (char*) xmalloc(strlen(registry->home) + strlen("/.") + strlen(registry_dir) + 1);
|
||||
sprintf(registry->path, "%s/.%s", registry->home, registry_dir);
|
||||
printf("registry path: %s\n", registry->path);
|
||||
|
||||
if (stat(registry->path, &stat_info) != 0)
|
||||
{
|
||||
freerdp_mkdir(registry->path);
|
||||
printf("creating directory %s\n", registry->path);
|
||||
}
|
||||
|
||||
length = strlen(registry->path);
|
||||
registry->file = (char*) xmalloc(strlen(registry->path) + strlen("/") + strlen(registry_file) + 1);
|
||||
sprintf(registry->file, "%s/%s", registry->path, registry_file);
|
||||
printf("registry file: %s\n", registry->file);
|
||||
|
||||
registry_open(registry);
|
||||
}
|
||||
|
||||
rdpRegistry* registry_new(rdpSettings* settings)
|
||||
{
|
||||
rdpRegistry* registry = (rdpRegistry*) xzalloc(sizeof(rdpRegistry));
|
||||
|
||||
if (registry != NULL)
|
||||
{
|
||||
registry->settings = settings;
|
||||
registry_init(registry);
|
||||
}
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
void registry_free(rdpRegistry* registry)
|
||||
{
|
||||
if (registry != NULL)
|
||||
{
|
||||
registry_close(registry);
|
||||
xfree(registry->path);
|
||||
xfree(registry->file);
|
||||
xfree(registry->home);
|
||||
xfree(registry);
|
||||
}
|
||||
}
|
|
@ -491,7 +491,7 @@ PCtxtHandle krbctx_client_init(rdpSettings* settings, SEC_WINNT_AUTH_IDENTITY* i
|
|||
KDCENTRY* entry;
|
||||
KRB_CONTEXT* krb_ctx;
|
||||
ULONG fContextReq;
|
||||
uint32 pfContextAttr;
|
||||
ULONG pfContextAttr;
|
||||
TimeStamp expiration;
|
||||
|
||||
if (tcp_is_ipaddr(settings->hostname))
|
||||
|
|
|
@ -580,7 +580,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
|||
freerdp_hexdump(data, length);
|
||||
printf("\n");
|
||||
|
||||
printf("Encrypted Data Buffer (length = %d)\n", data_buffer->cbBuffer);
|
||||
printf("Encrypted Data Buffer (length = %d)\n", (int) data_buffer->cbBuffer);
|
||||
freerdp_hexdump(data_buffer->pvBuffer, data_buffer->cbBuffer);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
@ -599,7 +599,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
|||
context->SendSeqNum++;
|
||||
|
||||
#ifdef WITH_DEBUG_NTLM
|
||||
printf("Signature (length = %d)\n", signature_buffer->cbBuffer);
|
||||
printf("Signature (length = %d)\n", (int) signature_buffer->cbBuffer);
|
||||
freerdp_hexdump(signature_buffer->pvBuffer, signature_buffer->cbBuffer);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
@ -658,7 +658,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
|||
freerdp_hexdump(data, length);
|
||||
printf("\n");
|
||||
|
||||
printf("Data Buffer (length = %d)\n", data_buffer->cbBuffer);
|
||||
printf("Data Buffer (length = %d)\n", (int) data_buffer->cbBuffer);
|
||||
freerdp_hexdump(data_buffer->pvBuffer, data_buffer->cbBuffer);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
|
|
@ -1127,7 +1127,7 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer
|
|||
{
|
||||
ntlm_print_av_pairs(context);
|
||||
|
||||
printf("targetInfo (length = %d)\n", context->TargetInfo.cbBuffer);
|
||||
printf("targetInfo (length = %d)\n", (int) context->TargetInfo.cbBuffer);
|
||||
freerdp_hexdump(context->TargetInfo.pvBuffer, context->TargetInfo.cbBuffer);
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -151,9 +151,9 @@ int credssp_ntlm_server_init(rdpCredssp* credssp)
|
|||
|
||||
int credssp_client_authenticate(rdpCredssp* credssp)
|
||||
{
|
||||
uint32 cbMaxToken;
|
||||
ULONG cbMaxToken;
|
||||
ULONG fContextReq;
|
||||
uint32 pfContextAttr;
|
||||
ULONG pfContextAttr;
|
||||
SECURITY_STATUS status;
|
||||
CredHandle credentials;
|
||||
TimeStamp expiration;
|
||||
|
@ -631,10 +631,10 @@ int credssp_authenticate(rdpCredssp* credssp)
|
|||
SECURITY_STATUS credssp_verify_public_key_echo(rdpCredssp* credssp)
|
||||
{
|
||||
int length;
|
||||
uint32 pfQOP;
|
||||
uint8* public_key1;
|
||||
uint8* public_key2;
|
||||
uint8* pub_key_auth;
|
||||
ULONG pfQOP;
|
||||
BYTE* public_key1;
|
||||
BYTE* public_key2;
|
||||
BYTE* pub_key_auth;
|
||||
int public_key_length;
|
||||
SecBuffer Buffers[2];
|
||||
SecBufferDesc Message;
|
||||
|
@ -1006,19 +1006,19 @@ void credssp_buffer_print(rdpCredssp* credssp)
|
|||
{
|
||||
if (credssp->negoToken.cbBuffer > 0)
|
||||
{
|
||||
printf("CredSSP.negoToken (length = %d):\n", credssp->negoToken.cbBuffer);
|
||||
printf("CredSSP.negoToken (length = %d):\n", (int) credssp->negoToken.cbBuffer);
|
||||
freerdp_hexdump(credssp->negoToken.pvBuffer, credssp->negoToken.cbBuffer);
|
||||
}
|
||||
|
||||
if (credssp->pubKeyAuth.cbBuffer > 0)
|
||||
{
|
||||
printf("CredSSP.pubKeyAuth (length = %d):\n", credssp->pubKeyAuth.cbBuffer);
|
||||
printf("CredSSP.pubKeyAuth (length = %d):\n", (int) credssp->pubKeyAuth.cbBuffer);
|
||||
freerdp_hexdump(credssp->pubKeyAuth.pvBuffer, credssp->pubKeyAuth.cbBuffer);
|
||||
}
|
||||
|
||||
if (credssp->authInfo.cbBuffer > 0)
|
||||
{
|
||||
printf("CredSSP.authInfo (length = %d):\n", credssp->authInfo.cbBuffer);
|
||||
printf("CredSSP.authInfo (length = %d):\n", (int) credssp->authInfo.cbBuffer);
|
||||
freerdp_hexdump(credssp->authInfo.pvBuffer, credssp->authInfo.cbBuffer);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue