mirror of https://github.com/FreeRDP/FreeRDP
misc: integrate pull request feedback
This commit is contained in:
parent
421b74e85e
commit
06502e6a91
|
@ -36,6 +36,7 @@
|
|||
#include <freerdp/locale/keyboard.h>
|
||||
#include <freerdp/primitives.h>
|
||||
#include <freerdp/version.h>
|
||||
#include <freerdp/settings.h>
|
||||
|
||||
#include <android/bitmap.h>
|
||||
|
||||
|
@ -715,13 +716,20 @@ JNIEXPORT jboolean JNICALL jni_freerdp_disconnect(JNIEnv *env, jclass cls, jint
|
|||
freerdp* inst = (freerdp*)instance;
|
||||
androidContext* ctx = (androidContext*)inst->context;
|
||||
ANDROID_EVENT* event = (ANDROID_EVENT*)android_event_disconnect_new();
|
||||
if (!event)
|
||||
return JNI_FALSE;
|
||||
|
||||
DEBUG_ANDROID("DISCONNECT!");
|
||||
|
||||
assert(inst);
|
||||
assert(ctx);
|
||||
assert(event);
|
||||
|
||||
android_push_event(inst, event);
|
||||
if (!android_push_event(inst, event))
|
||||
{
|
||||
android_event_disconnect_free(event);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
WaitForSingleObject(ctx->thread, INFINITE);
|
||||
CloseHandle(ctx->thread);
|
||||
|
@ -748,6 +756,7 @@ JNIEXPORT jboolean JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cl
|
|||
|
||||
free(settings->HomePath);
|
||||
free(settings->ConfigPath);
|
||||
settings->HomePath = settings->ConfigPath = NULL;
|
||||
|
||||
int config_dir_len = strlen(directory) + 10; /* +9 chars for /.freerdp and +1 for \0 */
|
||||
char* config_dir_buf = (char*)malloc(config_dir_len);
|
||||
|
@ -1019,8 +1028,6 @@ out_fail:
|
|||
JNIEXPORT jboolean JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
|
||||
jclass cls, jint instance, jint redirect)
|
||||
{
|
||||
char** p;
|
||||
int count = 1;
|
||||
freerdp* inst = (freerdp*)instance;
|
||||
rdpSettings * settings = inst->settings;
|
||||
|
||||
|
@ -1031,16 +1038,10 @@ JNIEXPORT jboolean JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
|
|||
if (settings->AudioPlayback)
|
||||
{
|
||||
int ret;
|
||||
p = malloc(sizeof(char*));
|
||||
if (!p)
|
||||
{
|
||||
settings->AudioPlayback = FALSE;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
p[0] = "rdpsnd";
|
||||
char* p[1] = {"rdpsnd"};
|
||||
int count = 1;
|
||||
|
||||
ret = freerdp_client_add_static_channel(settings, count, p);
|
||||
free(p);
|
||||
|
||||
if(ret == -1)
|
||||
return JNI_FALSE;
|
||||
|
@ -1052,8 +1053,6 @@ JNIEXPORT jboolean JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
|
|||
JNIEXPORT jboolean JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
|
||||
jclass cls, jint instance, jboolean enable)
|
||||
{
|
||||
char** p;
|
||||
int count = 1;
|
||||
freerdp* inst = (freerdp*)instance;
|
||||
rdpSettings * settings = inst->settings;
|
||||
|
||||
|
@ -1063,16 +1062,10 @@ JNIEXPORT jboolean JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
|
|||
if (enable)
|
||||
{
|
||||
int ret;
|
||||
p = malloc(sizeof(char*));
|
||||
if (!p)
|
||||
{
|
||||
settings->AudioCapture = FALSE;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
p[0] = "audin";
|
||||
char* p[1] = {"audin"};
|
||||
int count = 1;
|
||||
|
||||
ret = freerdp_client_add_dynamic_channel(settings, count, p);
|
||||
free(p);
|
||||
|
||||
if (ret == -1)
|
||||
return JNI_FALSE;
|
||||
|
|
|
@ -79,6 +79,8 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
if (!context->argv[index])
|
||||
{
|
||||
ret = 1;
|
||||
for (--index; index > = 0; --index)
|
||||
free(context->argv[index]);
|
||||
free(context->argv);
|
||||
context->argv = NULL;
|
||||
goto out;
|
||||
|
|
|
@ -61,7 +61,7 @@ static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' };
|
|||
|
||||
static int freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name, int value, int index)
|
||||
{
|
||||
int bStandard = 1;
|
||||
int standard = 1;
|
||||
|
||||
#ifdef DEBUG_CLIENT_FILE
|
||||
WLog_DBG(TAG, "%s:i:%d", name, value);
|
||||
|
@ -196,7 +196,7 @@ static int freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name,
|
|||
else if (_stricmp(name, "rdgiskdcproxy") == 0)
|
||||
file->RdgIsKdcProxy = value;
|
||||
else
|
||||
bStandard = 1;
|
||||
standard = 1;
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
|
@ -208,13 +208,13 @@ static int freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name,
|
|||
file->lines[index].flags = RDP_FILE_LINE_FLAG_FORMATTED;
|
||||
file->lines[index].flags |= RDP_FILE_LINE_FLAG_TYPE_INTEGER;
|
||||
|
||||
if (bStandard)
|
||||
if (standard)
|
||||
file->lines[index].flags |= RDP_FILE_LINE_FLAG_STANDARD;
|
||||
|
||||
file->lines[index].valueLength = 0;
|
||||
}
|
||||
|
||||
return bStandard;
|
||||
return standard;
|
||||
}
|
||||
|
||||
static BOOL freerdp_client_parse_rdp_file_integer_unicode(rdpFile* file, WCHAR* name, WCHAR* value, int index)
|
||||
|
@ -270,7 +270,7 @@ static BOOL freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, const cha
|
|||
|
||||
static int freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, const char* value, int index)
|
||||
{
|
||||
int bStandard = 0;
|
||||
int standard = 0;
|
||||
LPSTR *tmp = NULL;
|
||||
|
||||
#ifdef DEBUG_CLIENT_FILE
|
||||
|
@ -316,7 +316,7 @@ static int freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, c
|
|||
else if (_stricmp(name, "winposstr") == 0)
|
||||
tmp = &file->WinPosStr;
|
||||
else
|
||||
bStandard = 1;
|
||||
standard = 1;
|
||||
|
||||
if (tmp && !(*tmp = strdup(value)))
|
||||
return -1;
|
||||
|
@ -335,13 +335,13 @@ static int freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, c
|
|||
file->lines[index].flags = RDP_FILE_LINE_FLAG_FORMATTED;
|
||||
file->lines[index].flags |= RDP_FILE_LINE_FLAG_TYPE_STRING;
|
||||
|
||||
if (bStandard == 0)
|
||||
if (standard == 0)
|
||||
file->lines[index].flags |= RDP_FILE_LINE_FLAG_STANDARD;
|
||||
|
||||
file->lines[index].valueLength = 0;
|
||||
}
|
||||
|
||||
return bStandard;
|
||||
return standard;
|
||||
}
|
||||
|
||||
static BOOL freerdp_client_add_option(rdpFile* file, char* option)
|
||||
|
|
|
@ -52,7 +52,7 @@ LPSTR freerdp_get_library_install_path()
|
|||
CopyMemory(pszPath, pszInstallPrefix, cchInstallPrefix);
|
||||
pszPath[cchInstallPrefix] = '\0';
|
||||
|
||||
if (NativePathCchAppendA(pszPath, cchPath + 1, pszLibraryPath) != S_OK)
|
||||
if (FAILED(NativePathCchAppendA(pszPath, cchPath + 1, pszLibraryPath)))
|
||||
{
|
||||
free(pszPath);
|
||||
return NULL;
|
||||
|
@ -81,7 +81,7 @@ LPSTR freerdp_get_dynamic_addin_install_path()
|
|||
CopyMemory(pszPath, pszInstallPrefix, cchInstallPrefix);
|
||||
pszPath[cchInstallPrefix] = '\0';
|
||||
|
||||
if (NativePathCchAppendA(pszPath, cchPath + 1, pszAddinPath) != S_OK)
|
||||
if (FAILED(NativePathCchAppendA(pszPath, cchPath + 1, pszAddinPath)))
|
||||
{
|
||||
free(pszPath);
|
||||
return NULL;
|
||||
|
@ -110,7 +110,7 @@ void* freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath, LPCSTR pszE
|
|||
bHasExt = TRUE;
|
||||
cchFileName = strlen(pszFileName);
|
||||
|
||||
if (PathCchFindExtensionA(pszFileName, cchFileName + 1, &pszExt) != S_OK)
|
||||
if (FAILED(PathCchFindExtensionA(pszFileName, cchFileName + 1, &pszExt)))
|
||||
{
|
||||
pszExt = PathGetSharedLibraryExtensionA(PATH_SHARED_LIB_EXT_WITH_DOT);
|
||||
cchExt = strlen(pszExt);
|
||||
|
|
|
@ -2445,232 +2445,191 @@ char* freerdp_get_param_string(rdpSettings* settings, int id)
|
|||
|
||||
int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
|
||||
{
|
||||
#define CHECKED_STRDUP(name) if (param && !(settings->name = _strdup(param))) return -1
|
||||
char **tmp = NULL;
|
||||
|
||||
if (!param)
|
||||
return -1;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case FreeRDP_ServerHostname:
|
||||
free(settings->ServerHostname);
|
||||
CHECKED_STRDUP(ServerHostname);
|
||||
tmp = &settings->ServerHostname;
|
||||
break;
|
||||
|
||||
case FreeRDP_Username:
|
||||
free(settings->Username);
|
||||
CHECKED_STRDUP(Username);
|
||||
tmp = &settings->Username;
|
||||
break;
|
||||
|
||||
case FreeRDP_Password:
|
||||
free(settings->Password);
|
||||
CHECKED_STRDUP(Password);
|
||||
tmp = &settings->Password;
|
||||
break;
|
||||
|
||||
case FreeRDP_Domain:
|
||||
free(settings->Domain);
|
||||
CHECKED_STRDUP(Domain);
|
||||
tmp = &settings->Domain;
|
||||
break;
|
||||
|
||||
case FreeRDP_PasswordHash:
|
||||
free(settings->PasswordHash);
|
||||
CHECKED_STRDUP(PasswordHash);
|
||||
tmp = &settings->PasswordHash;
|
||||
break;
|
||||
|
||||
case FreeRDP_ClientHostname:
|
||||
free(settings->ClientHostname);
|
||||
CHECKED_STRDUP(ClientHostname);
|
||||
tmp = &settings->ClientHostname;
|
||||
break;
|
||||
|
||||
case FreeRDP_ClientProductId:
|
||||
free(settings->ClientProductId);
|
||||
CHECKED_STRDUP(ClientProductId);
|
||||
tmp = &settings->ClientProductId;
|
||||
break;
|
||||
|
||||
case FreeRDP_AlternateShell:
|
||||
free(settings->AlternateShell);
|
||||
CHECKED_STRDUP(AlternateShell);
|
||||
tmp = &settings->AlternateShell;
|
||||
break;
|
||||
|
||||
case FreeRDP_ShellWorkingDirectory:
|
||||
free(settings->ShellWorkingDirectory);
|
||||
CHECKED_STRDUP(ShellWorkingDirectory);
|
||||
tmp = &settings->ShellWorkingDirectory;
|
||||
break;
|
||||
|
||||
case FreeRDP_ClientAddress:
|
||||
free(settings->ClientAddress);
|
||||
CHECKED_STRDUP(ClientAddress);
|
||||
tmp = &settings->ClientAddress;
|
||||
break;
|
||||
|
||||
case FreeRDP_ClientDir:
|
||||
free(settings->ClientDir);
|
||||
CHECKED_STRDUP(ClientDir);
|
||||
tmp = &settings->ClientDir;
|
||||
break;
|
||||
|
||||
case FreeRDP_DynamicDSTTimeZoneKeyName:
|
||||
free(settings->DynamicDSTTimeZoneKeyName);
|
||||
CHECKED_STRDUP(DynamicDSTTimeZoneKeyName);
|
||||
tmp = &settings->DynamicDSTTimeZoneKeyName;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteAssistanceSessionId:
|
||||
free(settings->RemoteAssistanceSessionId);
|
||||
CHECKED_STRDUP(RemoteAssistanceSessionId);
|
||||
tmp = &settings->RemoteAssistanceSessionId;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteAssistancePassStub:
|
||||
free(settings->RemoteAssistancePassStub);
|
||||
CHECKED_STRDUP(RemoteAssistancePassStub);
|
||||
tmp = &settings->RemoteAssistancePassStub;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteAssistancePassword:
|
||||
free(settings->RemoteAssistancePassword);
|
||||
CHECKED_STRDUP(RemoteAssistancePassword);
|
||||
tmp = &settings->RemoteAssistancePassword;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteAssistanceRCTicket:
|
||||
free(settings->RemoteAssistanceRCTicket);
|
||||
CHECKED_STRDUP(RemoteAssistanceRCTicket);
|
||||
tmp = &settings->RemoteAssistanceRCTicket;
|
||||
break;
|
||||
|
||||
case FreeRDP_AuthenticationServiceClass:
|
||||
free(settings->AuthenticationServiceClass);
|
||||
CHECKED_STRDUP(AuthenticationServiceClass);
|
||||
tmp = &settings->AuthenticationServiceClass;
|
||||
break;
|
||||
|
||||
case FreeRDP_PreconnectionBlob:
|
||||
free(settings->PreconnectionBlob);
|
||||
CHECKED_STRDUP(PreconnectionBlob);
|
||||
tmp = &settings->PreconnectionBlob;
|
||||
break;
|
||||
|
||||
case FreeRDP_KerberosKdc:
|
||||
free(settings->KerberosKdc);
|
||||
CHECKED_STRDUP(KerberosKdc);
|
||||
tmp = &settings->KerberosKdc;
|
||||
break;
|
||||
|
||||
case FreeRDP_KerberosRealm:
|
||||
free(settings->KerberosRealm);
|
||||
CHECKED_STRDUP(KerberosRealm);
|
||||
tmp = &settings->KerberosRealm;
|
||||
break;
|
||||
|
||||
case FreeRDP_CertificateName:
|
||||
free(settings->CertificateName);
|
||||
CHECKED_STRDUP(CertificateName);
|
||||
tmp = &settings->CertificateName;
|
||||
break;
|
||||
|
||||
case FreeRDP_CertificateFile:
|
||||
free(settings->CertificateFile);
|
||||
CHECKED_STRDUP(CertificateFile);
|
||||
tmp = &settings->CertificateFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_PrivateKeyFile:
|
||||
free(settings->PrivateKeyFile);
|
||||
CHECKED_STRDUP(PrivateKeyFile);
|
||||
tmp = &settings->PrivateKeyFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_RdpKeyFile:
|
||||
free(settings->RdpKeyFile);
|
||||
CHECKED_STRDUP(RdpKeyFile);
|
||||
tmp = &settings->RdpKeyFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_WindowTitle:
|
||||
free(settings->WindowTitle);
|
||||
CHECKED_STRDUP(WindowTitle);
|
||||
tmp = &settings->WindowTitle;
|
||||
break;
|
||||
|
||||
case FreeRDP_ComputerName:
|
||||
free(settings->ComputerName);
|
||||
CHECKED_STRDUP(ComputerName);
|
||||
tmp = &settings->ComputerName;
|
||||
break;
|
||||
|
||||
case FreeRDP_ConnectionFile:
|
||||
free(settings->ConnectionFile);
|
||||
CHECKED_STRDUP(ConnectionFile);
|
||||
tmp = &settings->ConnectionFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_AssistanceFile:
|
||||
free(settings->AssistanceFile);
|
||||
CHECKED_STRDUP(AssistanceFile);
|
||||
tmp = &settings->AssistanceFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_HomePath:
|
||||
free(settings->HomePath);
|
||||
CHECKED_STRDUP(HomePath);
|
||||
tmp = &settings->HomePath;
|
||||
break;
|
||||
|
||||
case FreeRDP_ConfigPath:
|
||||
free(settings->ConfigPath);
|
||||
CHECKED_STRDUP(ConfigPath);
|
||||
tmp = &settings->ConfigPath;
|
||||
break;
|
||||
|
||||
case FreeRDP_CurrentPath:
|
||||
free(settings->CurrentPath);
|
||||
CHECKED_STRDUP(CurrentPath);
|
||||
tmp = &settings->CurrentPath;
|
||||
break;
|
||||
|
||||
case FreeRDP_DumpRemoteFxFile:
|
||||
free(settings->DumpRemoteFxFile);
|
||||
CHECKED_STRDUP(DumpRemoteFxFile);
|
||||
tmp = &settings->DumpRemoteFxFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_PlayRemoteFxFile:
|
||||
free(settings->PlayRemoteFxFile);
|
||||
CHECKED_STRDUP(PlayRemoteFxFile);
|
||||
tmp = &settings->PlayRemoteFxFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayHostname:
|
||||
free(settings->GatewayHostname);
|
||||
CHECKED_STRDUP(GatewayHostname);
|
||||
tmp = &settings->GatewayHostname;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayUsername:
|
||||
free(settings->GatewayUsername);
|
||||
CHECKED_STRDUP(GatewayUsername);
|
||||
tmp = &settings->GatewayUsername;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayPassword:
|
||||
free(settings->GatewayPassword);
|
||||
CHECKED_STRDUP(GatewayPassword);
|
||||
tmp = &settings->GatewayPassword;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayDomain:
|
||||
free(settings->GatewayDomain);
|
||||
CHECKED_STRDUP(GatewayDomain);
|
||||
tmp = &settings->GatewayDomain;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationName:
|
||||
free(settings->RemoteApplicationName);
|
||||
CHECKED_STRDUP(RemoteApplicationName);
|
||||
tmp = &settings->RemoteApplicationName;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationIcon:
|
||||
free(settings->RemoteApplicationIcon);
|
||||
CHECKED_STRDUP(RemoteApplicationIcon);
|
||||
tmp = &settings->RemoteApplicationIcon;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationProgram:
|
||||
free(settings->RemoteApplicationProgram);
|
||||
CHECKED_STRDUP(RemoteApplicationProgram);
|
||||
tmp = &settings->RemoteApplicationProgram;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationFile:
|
||||
free(settings->RemoteApplicationFile);
|
||||
CHECKED_STRDUP(RemoteApplicationFile);
|
||||
tmp = &settings->RemoteApplicationFile;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationGuid:
|
||||
free(settings->RemoteApplicationGuid);
|
||||
CHECKED_STRDUP(RemoteApplicationGuid);
|
||||
tmp = &settings->RemoteApplicationGuid;
|
||||
break;
|
||||
|
||||
case FreeRDP_RemoteApplicationCmdLine:
|
||||
free(settings->RemoteApplicationCmdLine);
|
||||
CHECKED_STRDUP(RemoteApplicationCmdLine);
|
||||
tmp = &settings->RemoteApplicationCmdLine;
|
||||
break;
|
||||
|
||||
case FreeRDP_ImeFileName:
|
||||
free(settings->ImeFileName);
|
||||
CHECKED_STRDUP(ImeFileName);
|
||||
tmp = &settings->ImeFileName;
|
||||
break;
|
||||
|
||||
case FreeRDP_DrivesToRedirect:
|
||||
free(settings->DrivesToRedirect);
|
||||
CHECKED_STRDUP(DrivesToRedirect);
|
||||
tmp = &settings->DrivesToRedirect;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2678,6 +2637,10 @@ int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
|
|||
return -1;
|
||||
}
|
||||
|
||||
free(*tmp);
|
||||
if (!(*tmp = _strdup(param)))
|
||||
return -1;
|
||||
|
||||
/* Mark field as modified */
|
||||
settings->SettingsModified[id] = 1;
|
||||
|
||||
|
|
|
@ -836,11 +836,11 @@ rdpCertificate* certificate_clone(rdpCertificate* certificate)
|
|||
return _certificate;
|
||||
|
||||
out_fail:
|
||||
if (certificate->x509_cert_chain->count)
|
||||
if (_certificate->x509_cert_chain)
|
||||
{
|
||||
free(_certificate->x509_cert_chain->array);
|
||||
free(_certificate->x509_cert_chain);
|
||||
}
|
||||
free(_certificate->x509_cert_chain);
|
||||
free(_certificate->cert_info.Modulus);
|
||||
free(_certificate);
|
||||
return NULL;
|
||||
|
|
|
@ -983,15 +983,12 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, PSecBuffer ts_credentials)
|
|||
|
||||
/* TSCredentials (SEQUENCE) */
|
||||
ret = ber_read_sequence_tag(s, &length) &&
|
||||
|
||||
/* [0] credType (INTEGER) */
|
||||
ber_read_contextual_tag(s, 0, &length, TRUE) &&
|
||||
ber_read_integer(s, NULL) &&
|
||||
|
||||
/* [1] credentials (OCTET STRING) */
|
||||
ber_read_contextual_tag(s, 1, &length, TRUE) &&
|
||||
ber_read_octet_string_tag(s, &ts_password_creds_length) &&
|
||||
|
||||
nla_read_ts_password_creds(nla, s);
|
||||
|
||||
Stream_Free(s, FALSE);
|
||||
|
@ -1467,10 +1464,6 @@ LPTSTR nla_make_spn(const char* ServiceClass, const char* hostname)
|
|||
|
||||
rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* settings)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG status;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
|
||||
rdpNla* nla = (rdpNla*) calloc(1, sizeof(rdpNla));
|
||||
|
||||
|
@ -1498,6 +1491,11 @@ rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* setting
|
|||
|
||||
if (nla->server)
|
||||
{
|
||||
LONG status;
|
||||
HKEY hKey;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"),
|
||||
0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
|
||||
|
@ -1506,11 +1504,15 @@ rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* setting
|
|||
|
||||
status = RegQueryValueEx(hKey, _T("SspiModule"), NULL, &dwType, NULL, &dwSize);
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return nla;
|
||||
}
|
||||
|
||||
nla->SspiModule = (LPTSTR) malloc(dwSize + sizeof(TCHAR));
|
||||
if (!nla->SspiModule)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
free(nla);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1519,10 +1521,9 @@ rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* setting
|
|||
(BYTE*) nla->SspiModule, &dwSize);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
WLog_INFO(TAG, "Using SSPI Module: %s", nla->SspiModule);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return nla;
|
||||
|
|
|
@ -196,7 +196,7 @@ void settings_load_hkey_local_machine(rdpSettings* settings)
|
|||
BOOL settings_get_computer_name(rdpSettings* settings)
|
||||
{
|
||||
DWORD nSize = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
|
||||
if (!GetComputerNameExA(ComputerNameNetBIOS, computerName, &nSize))
|
||||
return FALSE;
|
||||
|
|
|
@ -64,7 +64,7 @@ BOOL pcap_write_header(rdpPcap* pcap, pcap_header* header)
|
|||
|
||||
BOOL pcap_read_record_header(rdpPcap* pcap, pcap_record_header* record)
|
||||
{
|
||||
return fread((void*) record, sizeof(pcap_record_header), 1, pcap->fp) > 0;
|
||||
return fread((void*) record, sizeof(pcap_record_header), 1, pcap->fp) == 1;
|
||||
}
|
||||
|
||||
void pcap_write_record_header(rdpPcap* pcap, pcap_record_header* record)
|
||||
|
@ -82,7 +82,7 @@ BOOL pcap_read_record(rdpPcap* pcap, pcap_record* record)
|
|||
if (!record->data)
|
||||
return FALSE;
|
||||
|
||||
if (!fread(record->data, record->length, 1, pcap->fp))
|
||||
if (fread(record->data, record->length, 1, pcap->fp) != 1)
|
||||
{
|
||||
free(record->data);
|
||||
record->data = NULL;
|
||||
|
|
|
@ -258,7 +258,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
|
|||
settings->NSCodec = FALSE;
|
||||
settings->JpegCodec = FALSE;
|
||||
if (!wf_peer_read_settings(client))
|
||||
goto fail_peer_init;
|
||||
goto fail_peer_init;
|
||||
|
||||
client->PostConnect = wf_peer_post_connect;
|
||||
client->Activate = wf_peer_activate;
|
||||
|
|
|
@ -152,8 +152,8 @@ static char* GetPath_XDG_CONFIG_HOME(void)
|
|||
if (!path)
|
||||
return NULL;
|
||||
|
||||
if (SHGetFolderPathA(0, CSIDL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path) != S_OK)
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path)))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
@ -250,8 +250,8 @@ char* GetPath_XDG_RUNTIME_DIR(void)
|
|||
if (!path)
|
||||
return NULL;
|
||||
|
||||
if (SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path) != S_OK)
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path)))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
@ -407,7 +407,7 @@ char* GetCombinedPath(const char* basePath, const char* subPath)
|
|||
CopyMemory(path, basePath, basePathLength);
|
||||
path[basePathLength] = '\0';
|
||||
|
||||
if (PathCchConvertStyleA(path, basePathLength, PATH_STYLE_NATIVE) != S_OK)
|
||||
if (FAILED(PathCchConvertStyleA(path, basePathLength, PATH_STYLE_NATIVE)))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
@ -422,7 +422,7 @@ char* GetCombinedPath(const char* basePath, const char* subPath)
|
|||
free(path);
|
||||
return NULL;
|
||||
}
|
||||
if (PathCchConvertStyleA(subPathCpy, subPathLength, PATH_STYLE_NATIVE) != S_OK)
|
||||
if (FAILED(PathCchConvertStyleA(subPathCpy, subPathLength, PATH_STYLE_NATIVE)))
|
||||
{
|
||||
free(path);
|
||||
free(subPathCpy);
|
||||
|
@ -433,7 +433,7 @@ char* GetCombinedPath(const char* basePath, const char* subPath)
|
|||
|
||||
free(subPathCpy);
|
||||
|
||||
if (status != S_OK)
|
||||
if (FAILED(status))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
|
|
@ -50,7 +50,7 @@ int ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
|
|||
int status;
|
||||
DWORD nSize = MAX_COMPUTERNAME_LENGTH;
|
||||
char* ws = Workstation;
|
||||
TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
|
||||
if (!Workstation)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ int ntlm_SetContextServicePrincipalNameA(NTLM_CONTEXT* context, char* ServicePri
|
|||
int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
|
||||
{
|
||||
int status;
|
||||
TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD nSize = MAX_COMPUTERNAME_LENGTH;
|
||||
char* name = TargetName;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ int ntlm_get_target_computer_name(PUNICODE_STRING pName, COMPUTER_NAME_FORMAT ty
|
|||
{
|
||||
char* name;
|
||||
int status;
|
||||
TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD nSize = MAX_COMPUTERNAME_LENGTH;
|
||||
|
||||
if (!GetComputerNameExA(type, computerName, &nSize))
|
||||
|
|
|
@ -32,9 +32,9 @@ int TestAcquireCredentialsHandle(int argc, char* argv[])
|
|||
fprintf(stderr, "Memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
identity.UserLength = sizeof(test_User);
|
||||
identity.DomainLength = sizeof(test_Domain);
|
||||
identity.PasswordLength = sizeof(test_Password);
|
||||
identity.UserLength = strlen(test_User);
|
||||
identity.DomainLength = strlen(test_Domain);
|
||||
identity.PasswordLength = strlen(test_Password);
|
||||
identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
|
||||
|
||||
status = table->AcquireCredentialsHandle(NULL, NTLMSP_NAME,
|
||||
|
|
|
@ -51,9 +51,9 @@ int TestInitializeSecurityContext(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
identity.UserLength = sizeof(test_User);
|
||||
identity.DomainLength = sizeof(test_Domain);
|
||||
identity.PasswordLength = sizeof(test_Password);
|
||||
identity.UserLength = strlen(test_User);
|
||||
identity.DomainLength = strlen(test_Domain);
|
||||
identity.PasswordLength = strlen(test_Password);
|
||||
identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
|
||||
|
||||
status = table->AcquireCredentialsHandle(NULL, NTLMSP_NAME,
|
||||
|
|
|
@ -297,7 +297,7 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
|||
ZeroMemory(&StreamSizes, sizeof(SecPkgContext_StreamSizes));
|
||||
status = table->QueryContextAttributes(phContext, SECPKG_ATTR_STREAM_SIZES, &StreamSizes);
|
||||
ioBufferLength = StreamSizes.cbHeader + StreamSizes.cbMaximumMessage + StreamSizes.cbTrailer;
|
||||
ioBuffer = (BYTE*) malloc(1, ioBufferLength);
|
||||
ioBuffer = (BYTE*) calloc(1, ioBufferLength);
|
||||
if (!ioBuffer)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -89,7 +89,13 @@ BOOL Pcap_Read_Record(wPcap* pcap, wPcapRecord* record)
|
|||
record->data = malloc(record->length);
|
||||
if (!record->data)
|
||||
return FALSE;
|
||||
fread(record->data, record->length, 1, pcap->fp);
|
||||
if (fread(record->data, record->length, 1, pcap->fp) != 1)
|
||||
{
|
||||
free(record->data);
|
||||
record->length = 0;
|
||||
record->data = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ char* x509_name_parse(char* name, char* txt, int* length)
|
|||
|
||||
char* x509_get_default_name()
|
||||
{
|
||||
TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD nSize = MAX_COMPUTERNAME_LENGTH;
|
||||
|
||||
char* ret;
|
||||
|
|
Loading…
Reference in New Issue