commit
0f54e1c778
@ -206,6 +206,8 @@ void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show)
|
||||
hints.decorations = (show) ? MWM_DECOR_ALL : 0;
|
||||
hints.functions = MWM_FUNC_ALL ;
|
||||
hints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
||||
hints.inputMode = 0;
|
||||
hints.status = 0;
|
||||
|
||||
XChangeProperty(xfi->display, window->handle, xfi->_MOTIF_WM_HINTS, xfi->_MOTIF_WM_HINTS, 32,
|
||||
PropModeReplace, (uint8*) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
|
||||
|
@ -969,11 +969,17 @@ void xf_window_free(xfInfo* xfi)
|
||||
XFreeModifiermap(xfi->modifier_map);
|
||||
xfi->modifier_map = 0;
|
||||
|
||||
XFreeGC(xfi->display, xfi->gc);
|
||||
xfi->gc = 0;
|
||||
if (xfi->gc != NULL)
|
||||
{
|
||||
XFreeGC(xfi->display, xfi->gc);
|
||||
xfi->gc = 0;
|
||||
}
|
||||
|
||||
XFreeGC(xfi->display, xfi->gc_mono);
|
||||
xfi->gc_mono = 0;
|
||||
if (xfi->gc_mono != NULL)
|
||||
{
|
||||
XFreeGC(xfi->display, xfi->gc_mono);
|
||||
xfi->gc_mono = 0;
|
||||
}
|
||||
|
||||
if (xfi->window != NULL)
|
||||
{
|
||||
@ -987,6 +993,12 @@ void xf_window_free(xfInfo* xfi)
|
||||
xfi->primary = 0;
|
||||
}
|
||||
|
||||
if (xfi->bitmap_mono)
|
||||
{
|
||||
XFreePixmap(xfi->display, xfi->bitmap_mono);
|
||||
xfi->bitmap_mono = 0;
|
||||
}
|
||||
|
||||
if (xfi->image)
|
||||
{
|
||||
xfi->image->data = NULL;
|
||||
@ -1064,7 +1076,10 @@ int xfreerdp_run(freerdp* instance)
|
||||
memset(&timeout, 0, sizeof(struct timeval));
|
||||
|
||||
if (!freerdp_connect(instance))
|
||||
{
|
||||
xf_free(((xfContext*) instance->context)->xfi);
|
||||
return XF_EXIT_CONN_FAILED;
|
||||
}
|
||||
|
||||
xfi = ((xfContext*) instance->context)->xfi;
|
||||
channels = instance->context->channels;
|
||||
@ -1158,10 +1173,6 @@ int xfreerdp_run(freerdp* instance)
|
||||
gdi_free(instance);
|
||||
xf_free(xfi);
|
||||
|
||||
freerdp_context_free(instance);
|
||||
|
||||
freerdp_free(instance);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1178,12 +1189,10 @@ void* thread_func(void* param)
|
||||
|
||||
xfree(data);
|
||||
|
||||
pthread_detach(pthread_self());
|
||||
|
||||
g_thread_count--;
|
||||
|
||||
if (g_thread_count < 1)
|
||||
freerdp_sem_signal(g_sem);
|
||||
if (g_thread_count < 1)
|
||||
freerdp_sem_signal(g_sem);
|
||||
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
@ -1194,7 +1203,7 @@ static uint8 exit_code_from_disconnect_reason(uint32 reason)
|
||||
(reason >= XF_EXIT_PARSE_ARGUMENTS && reason <= XF_EXIT_CONN_FAILED))
|
||||
return reason;
|
||||
|
||||
/* Licence error set */
|
||||
/* License error set */
|
||||
else if (reason >= 0x100 && reason <= 0x10A)
|
||||
reason -= 0x100 + XF_EXIT_LICENSE_INTERNAL;
|
||||
|
||||
@ -1247,9 +1256,15 @@ int main(int argc, char* argv[])
|
||||
|
||||
while (g_thread_count > 0)
|
||||
{
|
||||
freerdp_sem_wait(g_sem);
|
||||
freerdp_sem_wait(g_sem);
|
||||
}
|
||||
|
||||
pthread_join(thread, NULL);
|
||||
pthread_detach(thread);
|
||||
|
||||
freerdp_context_free(instance);
|
||||
freerdp_free(instance);
|
||||
|
||||
freerdp_channels_global_uninit();
|
||||
|
||||
return exit_code_from_disconnect_reason(g_disconnect_reason);
|
||||
|
@ -128,10 +128,22 @@ boolean rdp_client_redirect(rdpRdp* rdp)
|
||||
|
||||
rdp_client_disconnect(rdp);
|
||||
|
||||
/* FIXME: this is a subset of rdp_free */
|
||||
crypto_rc4_free(rdp->rc4_decrypt_key);
|
||||
crypto_rc4_free(rdp->rc4_encrypt_key);
|
||||
crypto_des3_free(rdp->fips_encrypt);
|
||||
crypto_des3_free(rdp->fips_decrypt);
|
||||
crypto_hmac_free(rdp->fips_hmac);
|
||||
mcs_free(rdp->mcs);
|
||||
nego_free(rdp->nego);
|
||||
license_free(rdp->license);
|
||||
transport_free(rdp->transport);
|
||||
|
||||
/* FIXME: this is a subset of settings_free */
|
||||
freerdp_blob_free(settings->server_random);
|
||||
freerdp_blob_free(settings->server_certificate);
|
||||
xfree(settings->ip_address);
|
||||
|
||||
rdp->transport = transport_new(settings);
|
||||
rdp->license = license_new(rdp);
|
||||
rdp->nego = nego_new(rdp->transport);
|
||||
|
@ -892,7 +892,7 @@ void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking)
|
||||
|
||||
int rdp_check_fds(rdpRdp* rdp)
|
||||
{
|
||||
return transport_check_fds(rdp->transport);
|
||||
return transport_check_fds(&(rdp->transport));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -941,8 +941,8 @@ void rdp_free(rdpRdp* rdp)
|
||||
crypto_des3_free(rdp->fips_encrypt);
|
||||
crypto_des3_free(rdp->fips_decrypt);
|
||||
crypto_hmac_free(rdp->fips_hmac);
|
||||
extension_free(rdp->extension);
|
||||
settings_free(rdp->settings);
|
||||
extension_free(rdp->extension);
|
||||
transport_free(rdp->transport);
|
||||
license_free(rdp->license);
|
||||
input_free(rdp->input);
|
||||
|
@ -193,12 +193,6 @@ void redirection_free(rdpRedirection* redirection)
|
||||
{
|
||||
if (redirection != NULL)
|
||||
{
|
||||
//these four have already been freed in settings_free() and freerdp_string_free() checks for NULL
|
||||
redirection->username.ascii = NULL;
|
||||
redirection->domain.ascii = NULL;
|
||||
redirection->targetNetAddress.ascii = NULL;
|
||||
redirection->targetNetBiosName.ascii = NULL;
|
||||
|
||||
freerdp_string_free(&redirection->tsvUrl);
|
||||
freerdp_string_free(&redirection->username);
|
||||
freerdp_string_free(&redirection->domain);
|
||||
|
@ -301,12 +301,13 @@ void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount)
|
||||
wait_obj_get_fds(transport->recv_event, rfds, rcount);
|
||||
}
|
||||
|
||||
int transport_check_fds(rdpTransport* transport)
|
||||
int transport_check_fds(rdpTransport** ptransport)
|
||||
{
|
||||
int pos;
|
||||
int status;
|
||||
uint16 length;
|
||||
STREAM* received;
|
||||
rdpTransport* transport = *ptransport;
|
||||
|
||||
wait_obj_clear(transport->recv_event);
|
||||
|
||||
@ -384,6 +385,9 @@ int transport_check_fds(rdpTransport* transport)
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* transport might now have been freed by rdp_client_redirect and a new rdp->transport created */
|
||||
transport = *ptransport;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -72,7 +72,7 @@ boolean transport_accept_nla(rdpTransport* transport);
|
||||
int transport_read(rdpTransport* transport, STREAM* s);
|
||||
int transport_write(rdpTransport* transport, STREAM* s);
|
||||
void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount);
|
||||
int transport_check_fds(rdpTransport* transport);
|
||||
int transport_check_fds(rdpTransport** ptransport);
|
||||
boolean transport_set_blocking_mode(rdpTransport* transport, boolean blocking);
|
||||
rdpTransport* transport_new(rdpSettings* settings);
|
||||
void transport_free(rdpTransport* transport);
|
||||
|
@ -565,6 +565,8 @@ void update_free(rdpUpdate* update)
|
||||
|
||||
xfree(update->bitmap_update.rectangles);
|
||||
xfree(update->pointer);
|
||||
xfree(update->primary->polyline.points);
|
||||
xfree(update->primary->polygon_sc.points);
|
||||
xfree(update->primary);
|
||||
xfree(update->secondary);
|
||||
xfree(update->altsec);
|
||||
|
@ -109,6 +109,22 @@ void ntlm_ContextFree(NTLM_CONTEXT* context)
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
freerdp_uniconv_free(context->uniconv);
|
||||
crypto_rc4_free(context->send_rc4_seal);
|
||||
crypto_rc4_free(context->recv_rc4_seal);
|
||||
sspi_SecBufferFree(&context->NegotiateMessage);
|
||||
sspi_SecBufferFree(&context->ChallengeMessage);
|
||||
sspi_SecBufferFree(&context->AuthenticateMessage);
|
||||
sspi_SecBufferFree(&context->TargetInfo);
|
||||
sspi_SecBufferFree(&context->TargetName);
|
||||
sspi_SecBufferFree(&context->NtChallengeResponse);
|
||||
sspi_SecBufferFree(&context->LmChallengeResponse);
|
||||
xfree(context->identity.User);
|
||||
xfree(context->identity.Password);
|
||||
xfree(context->identity.Domain);
|
||||
xfree(context->Workstation);
|
||||
xfree(context->av_pairs->Timestamp.value);
|
||||
xfree(context->av_pairs);
|
||||
xfree(context);
|
||||
}
|
||||
|
||||
@ -376,6 +392,20 @@ SECURITY_STATUS ntlm_InitializeSecurityContext(CredHandle* phCredential, CtxtHan
|
||||
return SEC_E_OUT_OF_SEQUENCE;
|
||||
}
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375354 */
|
||||
|
||||
SECURITY_STATUS ntlm_DeleteSecurityContext(CtxtHandle* phContext)
|
||||
{
|
||||
NTLM_CONTEXT* context;
|
||||
|
||||
context = sspi_SecureHandleGetLowerPointer(phContext);
|
||||
if (!context)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
|
||||
ntlm_ContextFree(context);
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa379337/ */
|
||||
|
||||
SECURITY_STATUS ntlm_QueryContextAttributes(CtxtHandle* phContext, uint32 ulAttribute, void* pBuffer)
|
||||
@ -581,7 +611,7 @@ const SecurityFunctionTable NTLM_SecurityFunctionTable =
|
||||
ntlm_InitializeSecurityContext, /* InitializeSecurityContext */
|
||||
ntlm_AcceptSecurityContext, /* AcceptSecurityContext */
|
||||
NULL, /* CompleteAuthToken */
|
||||
NULL, /* DeleteSecurityContext */
|
||||
ntlm_DeleteSecurityContext, /* DeleteSecurityContext */
|
||||
NULL, /* ApplyControlToken */
|
||||
ntlm_QueryContextAttributes, /* QueryContextAttributes */
|
||||
ntlm_ImpersonateSecurityContext, /* ImpersonateSecurityContext */
|
||||
|
@ -167,11 +167,14 @@ int credssp_ntlm_client_init(rdpCredssp* credssp)
|
||||
sspi_SecBufferAlloc(&credssp->PublicKey, credssp->tls->public_key.length);
|
||||
memcpy(credssp->PublicKey.pvBuffer, credssp->tls->public_key.data, credssp->tls->public_key.length);
|
||||
|
||||
xfree(identity.User);
|
||||
xfree(identity.Domain);
|
||||
xfree(identity.Password);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize NTLMSSP authentication module (client).
|
||||
* Initialize NTLMSSP authentication module (server).
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
@ -325,6 +328,8 @@ int credssp_client_authenticate(rdpCredssp* credssp)
|
||||
p = (uint8*) credssp->pubKeyAuth.pvBuffer;
|
||||
memcpy(p, Buffers[1].pvBuffer, Buffers[1].cbBuffer); /* Message Signature */
|
||||
memcpy(&p[Buffers[1].cbBuffer], Buffers[0].pvBuffer, Buffers[0].cbBuffer); /* Encrypted Public Key */
|
||||
xfree(Buffers[0].pvBuffer);
|
||||
xfree(Buffers[1].pvBuffer);
|
||||
}
|
||||
|
||||
if (status == SEC_I_COMPLETE_NEEDED)
|
||||
@ -403,6 +408,9 @@ int credssp_client_authenticate(rdpCredssp* credssp)
|
||||
|
||||
FreeCredentialsHandle(&credentials);
|
||||
FreeContextBuffer(pPackageInfo);
|
||||
xfree(identity.User);
|
||||
xfree(identity.Domain);
|
||||
xfree(identity.Password);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -682,6 +690,9 @@ SECURITY_STATUS credssp_verify_public_key_echo(rdpCredssp* credssp)
|
||||
|
||||
public_key2[0]++;
|
||||
|
||||
xfree(Buffers[0].pvBuffer);
|
||||
xfree(Buffers[1].pvBuffer);
|
||||
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
@ -719,6 +730,9 @@ SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp* credssp)
|
||||
memcpy(p, Buffers[1].pvBuffer, Buffers[1].cbBuffer); /* Message Signature */
|
||||
memcpy(&p[Buffers[1].cbBuffer], Buffers[0].pvBuffer, Buffers[0].cbBuffer); /* Encrypted TSCredentials */
|
||||
|
||||
xfree(Buffers[0].pvBuffer);
|
||||
xfree(Buffers[1].pvBuffer);
|
||||
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
@ -990,14 +1004,9 @@ int credssp_recv(rdpCredssp* credssp)
|
||||
|
||||
void credssp_buffer_free(rdpCredssp* credssp)
|
||||
{
|
||||
if (credssp->negoToken.cbBuffer > 0)
|
||||
sspi_SecBufferFree(&credssp->negoToken);
|
||||
|
||||
if (credssp->pubKeyAuth.cbBuffer > 0)
|
||||
sspi_SecBufferFree(&credssp->pubKeyAuth);
|
||||
|
||||
if (credssp->authInfo.cbBuffer > 0)
|
||||
sspi_SecBufferFree(&credssp->authInfo);
|
||||
sspi_SecBufferFree(&credssp->negoToken);
|
||||
sspi_SecBufferFree(&credssp->pubKeyAuth);
|
||||
sspi_SecBufferFree(&credssp->authInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1037,8 +1046,14 @@ void credssp_free(rdpCredssp* credssp)
|
||||
{
|
||||
if (credssp != NULL)
|
||||
{
|
||||
credssp->table->DeleteSecurityContext(&credssp->context);
|
||||
sspi_SecBufferFree(&credssp->PublicKey);
|
||||
sspi_SecBufferFree(&credssp->ts_credentials);
|
||||
freerdp_uniconv_free(credssp->uniconv);
|
||||
xfree(credssp->identity.User);
|
||||
xfree(credssp->identity.Domain);
|
||||
xfree(credssp->identity.Password);
|
||||
xfree(credssp->table);
|
||||
xfree(credssp);
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +522,26 @@ SECURITY_STATUS CompleteAuthToken(CtxtHandle* phContext, SecBufferDesc* pToken)
|
||||
|
||||
SECURITY_STATUS DeleteSecurityContext(CtxtHandle* phContext)
|
||||
{
|
||||
return SEC_E_OK;
|
||||
char* Name;
|
||||
SECURITY_STATUS status;
|
||||
SecurityFunctionTable* table;
|
||||
|
||||
Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);
|
||||
|
||||
if (!Name)
|
||||
return SEC_E_SECPKG_NOT_FOUND;
|
||||
|
||||
table = sspi_GetSecurityFunctionTableByName(Name);
|
||||
|
||||
if (!table)
|
||||
return SEC_E_SECPKG_NOT_FOUND;
|
||||
|
||||
if (table->DeleteSecurityContext == NULL)
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
|
||||
status = table->DeleteSecurityContext(phContext);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SECURITY_STATUS FreeContextBuffer(void* pvContextBuffer)
|
||||
|
Loading…
Reference in New Issue
Block a user