Beispiel #1
0
BOOL rdp_client_reconnect(rdpRdp* rdp)
{
	UINT32 i;

	transport_disconnect(rdp->transport);

	mcs_free(rdp->mcs);
	nego_free(rdp->nego);
	license_free(rdp->license);
	transport_free(rdp->transport);

	/* Reset virtual channel status */
	for (i = 0; i < rdp->mcs->channelCount; i++)
	{
		rdp->mcs->channels[i].joined = FALSE;
	}

	rdp->transport = transport_new(rdp->settings);
	rdp->license = license_new(rdp);
	rdp->nego = nego_new(rdp->transport);
	rdp->mcs = mcs_new(rdp->transport);

	rdp->transport->layer = TRANSPORT_LAYER_TCP;

	return rdp_client_connect(rdp);
}
Beispiel #2
0
boolean rdp_client_redirect(rdpRdp* rdp)
{
	rdpSettings* settings = rdp->settings;
	rdpRedirection* redirection = rdp->redirection;

	rdp_client_disconnect(rdp);

	mcs_free(rdp->mcs);
	nego_free(rdp->nego);
	license_free(rdp->license);
	transport_free(rdp->transport);
	rdp->transport = transport_new(settings);
	rdp->license = license_new(rdp);
	rdp->nego = nego_new(rdp->transport);
	rdp->mcs = mcs_new(rdp->transport);

	rdp->transport->layer = TRANSPORT_LAYER_TCP;
	settings->redirected_session_id = redirection->sessionID;

	if (redirection->flags & LB_LOAD_BALANCE_INFO)
		nego_set_routing_token(rdp->nego, &redirection->loadBalanceInfo);

	if (redirection->flags & LB_TARGET_NET_ADDRESS)
		settings->hostname = redirection->targetNetAddress.ascii;
	else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
		settings->hostname = redirection->targetNetBiosName.ascii;

	if (redirection->flags & LB_USERNAME)
		settings->username = redirection->username.ascii;

	if (redirection->flags & LB_DOMAIN)
		settings->domain = redirection->domain.ascii;

	return rdp_client_connect(rdp);
}
Beispiel #3
0
void rdp_free(rdpRdp* rdp)
{
    if (rdp)
    {
        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);
        freerdp_settings_free(rdp->settings);
        freerdp_settings_free(rdp->settingsCopy);
        transport_free(rdp->transport);
        license_free(rdp->license);
        input_free(rdp->input);
        update_free(rdp->update);
        fastpath_free(rdp->fastpath);
        nego_free(rdp->nego);
        mcs_free(rdp->mcs);
        redirection_free(rdp->redirection);
        autodetect_free(rdp->autodetect);
        heartbeat_free(rdp->heartbeat);
        multitransport_free(rdp->multitransport);
        bulk_free(rdp->bulk);
        free(rdp);
    }
}
Beispiel #4
0
void
iso_free(rdpIso * iso)
{
	if (iso != NULL)
	{
		tcp_free(iso->tcp);
		if (iso->nego != NULL)
			nego_free(iso->nego);
		xfree(iso);
	}
}
Beispiel #5
0
void rdp_free(rdpRdp* rdp)
{
	if (rdp != NULL)
	{
		settings_free(rdp->settings);
		transport_free(rdp->transport);
		license_free(rdp->license);
		input_free(rdp->input);
		update_free(rdp->update);
		fastpath_free(rdp->fastpath);
		nego_free(rdp->nego);
		mcs_free(rdp->mcs);
		redirection_free(rdp->redirection);
		mppc_free(rdp);
		xfree(rdp);
	}
}
Beispiel #6
0
void rdp_free(rdpRdp* rdp)
{
	if (rdp != NULL)
	{
		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);
		settings_free(rdp->settings);
		transport_free(rdp->transport);
		license_free(rdp->license);
//		input_free(rdp->input);
//		update_free(rdp->update);
		fastpath_free(rdp->fastpath);
		nego_free(rdp->nego);
		mcs_free(rdp->mcs);
		redirection_free(rdp->redirection);
		mppc_free(rdp);
		xfree(rdp);
	}
}
Beispiel #7
0
void rdp_reset(rdpRdp* rdp)
{
    rdpSettings* settings;

    settings = rdp->settings;

    bulk_reset(rdp->bulk);

    crypto_rc4_free(rdp->rc4_decrypt_key);
    rdp->rc4_decrypt_key = NULL;
    crypto_rc4_free(rdp->rc4_encrypt_key);
    rdp->rc4_encrypt_key = NULL;
    crypto_des3_free(rdp->fips_encrypt);
    rdp->fips_encrypt = NULL;
    crypto_des3_free(rdp->fips_decrypt);
    rdp->fips_decrypt = NULL;
    crypto_hmac_free(rdp->fips_hmac);
    rdp->fips_hmac = NULL;

    mcs_free(rdp->mcs);
    nego_free(rdp->nego);
    license_free(rdp->license);
    transport_free(rdp->transport);

    free(settings->ServerRandom);
    settings->ServerRandom = NULL;
    free(settings->ServerCertificate);
    settings->ServerCertificate = NULL;
    free(settings->ClientAddress);
    settings->ClientAddress = NULL;

    rdp->transport = transport_new(rdp->settings);
    rdp->transport->rdp = rdp;
    rdp->license = license_new(rdp);
    rdp->nego = nego_new(rdp->transport);
    rdp->mcs = mcs_new(rdp->transport);
    rdp->transport->layer = TRANSPORT_LAYER_TCP;
}
Beispiel #8
0
boolean rdp_client_redirect(rdpRdp* rdp)
{
	rdpSettings* settings = rdp->settings;
	rdpRedirection* redirection = rdp->redirection;

	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);
	rdp->mcs = mcs_new(rdp->transport);

	rdp->transport->layer = TRANSPORT_LAYER_TCP;
	settings->redirected_session_id = redirection->sessionID;

	if (redirection->flags & LB_LOAD_BALANCE_INFO)
	{
		nego_set_routing_token(rdp->nego, &redirection->loadBalanceInfo);
	}
	else
	{
		if (redirection->flags & LB_TARGET_NET_ADDRESS)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetNetAddress.ascii);
		}
		else if (redirection->flags & LB_TARGET_FQDN)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetFQDN.ascii);
		}
		else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetNetBiosName.ascii);
		}
	}

	if (redirection->flags & LB_USERNAME)
	{
		xfree(settings->username);
		settings->username = xstrdup(redirection->username.ascii);
	}

	if (redirection->flags & LB_DOMAIN)
	{
		xfree(settings->domain);
		settings->domain = xstrdup(redirection->domain.ascii);
	}

	if (redirection->flags & LB_PASSWORD)
	{
		settings->password_cookie = &redirection->password_cookie;
	}

	return rdp_client_connect(rdp);
}
Beispiel #9
0
BOOL rdp_client_redirect(rdpRdp* rdp)
{
	rdpSettings* settings = rdp->settings;
	rdpRedirection* redirection = rdp->redirection;

	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);

	free(settings->ServerRandom);
	free(settings->ServerCertificate);
	free(settings->ClientAddress);

	rdp->transport = transport_new(settings);
	rdp->license = license_new(rdp);
	rdp->nego = nego_new(rdp->transport);
	rdp->mcs = mcs_new(rdp->transport);

	rdp->transport->layer = TRANSPORT_LAYER_TCP;
	settings->RedirectedSessionId = redirection->sessionID;

	if (redirection->flags & LB_LOAD_BALANCE_INFO)
	{
		nego_set_routing_token(rdp->nego, redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength);
	}
	else
	{
		if (redirection->flags & LB_TARGET_NET_ADDRESS)
		{
			free(settings->ServerHostname);
			settings->ServerHostname = _strdup(redirection->targetNetAddress.ascii);
		}
		else if (redirection->flags & LB_TARGET_FQDN)
		{
			free(settings->ServerHostname);
			settings->ServerHostname = _strdup(redirection->targetFQDN.ascii);
		}
		else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
		{
			free(settings->ServerHostname);
			settings->ServerHostname = _strdup(redirection->targetNetBiosName.ascii);
		}
	}

	if (redirection->flags & LB_USERNAME)
	{
		free(settings->Username);
		settings->Username = _strdup(redirection->username.ascii);
	}

	if (redirection->flags & LB_DOMAIN)
	{
		free(settings->Domain);
		settings->Domain = _strdup(redirection->domain.ascii);
	}

	if (redirection->flags & LB_PASSWORD)
	{
		settings->RedirectionPassword = redirection->PasswordCookie;
		settings->RedirectionPasswordLength = redirection->PasswordCookieLength;
	}

	return rdp_client_connect(rdp);
}
Beispiel #10
0
tbool rdp_client_redirect(rdpRdp* rdp)
{
	rdpSettings* settings = rdp->settings;
	rdpRedirection* redirection = rdp->redirection;

	rdp_client_disconnect(rdp);

	mcs_free(rdp->mcs);
	nego_free(rdp->nego);
	license_free(rdp->license);
	transport_free(rdp->transport);
	rdp->transport = transport_new(settings);
	rdp->license = license_new(rdp);
	rdp->nego = nego_new(rdp->transport);
	rdp->mcs = mcs_new(rdp->transport);

	rdp->transport->layer = TRANSPORT_LAYER_TCP;
	settings->redirected_session_id = redirection->sessionID;

	if (redirection->flags & LB_LOAD_BALANCE_INFO)
	{
		nego_set_routing_token(rdp->nego, &redirection->loadBalanceInfo);
	}
	else
	{
		if (redirection->flags & LB_TARGET_NET_ADDRESS)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetNetAddress.ascii);
		}
		else if (redirection->flags & LB_TARGET_FQDN)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetFQDN.ascii);
		}
		else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
		{
			xfree(settings->hostname);
			settings->hostname = xstrdup(redirection->targetNetBiosName.ascii);
		}
	}

	if (redirection->flags & LB_USERNAME)
	{
		xfree(settings->username);
		settings->username = xstrdup(redirection->username.ascii);
	}

	if (redirection->flags & LB_DOMAIN)
	{
		xfree(settings->domain);
		settings->domain = xstrdup(redirection->domain.ascii);
	}

	if (redirection->flags & LB_PASSWORD)
	{
		settings->password_cookie = &redirection->password_cookie;
	}

	return rdp_client_connect(rdp);
}
Beispiel #11
0
rdpRdp* rdp_new(rdpContext* context)
{
    rdpRdp* rdp;
    DWORD flags;
    BOOL newSettings = FALSE;

    rdp = (rdpRdp*) calloc(1, sizeof(rdpRdp));
    if (!rdp)
        return NULL;

    rdp->context = context;
    rdp->instance = context->instance;

    flags = 0;

    if (context->ServerMode)
        flags |= FREERDP_SETTINGS_SERVER_MODE;

    if (!context->settings)
    {
        context->settings = freerdp_settings_new(flags);
        if (!context->settings)
            goto out_free;
        newSettings = TRUE;
    }

    rdp->settings = context->settings;
    rdp->settings->instance = context->instance;

    if (context->instance)
        context->instance->settings = rdp->settings;

    rdp->transport = transport_new(rdp->settings);
    if (!rdp->transport)
        goto out_free_settings;

    rdp->transport->rdp = rdp;

    rdp->license = license_new(rdp);
    if (!rdp->license)
        goto out_free_transport;

    rdp->input = input_new(rdp);
    if (!rdp->input)
        goto out_free_license;

    rdp->update = update_new(rdp);
    if (!rdp->update)
        goto out_free_input;

    rdp->fastpath = fastpath_new(rdp);
    if (!rdp->fastpath)
        goto out_free_update;

    rdp->nego = nego_new(rdp->transport);
    if (!rdp->nego)
        goto out_free_fastpath;

    rdp->mcs = mcs_new(rdp->transport);
    if (!rdp->mcs)
        goto out_free_nego;

    rdp->redirection = redirection_new();
    if (!rdp->redirection)
        goto out_free_mcs;

    rdp->autodetect = autodetect_new();
    if (!rdp->autodetect)
        goto out_free_redirection;

    rdp->heartbeat = heartbeat_new();
    if (!rdp->heartbeat)
        goto out_free_autodetect;

    rdp->multitransport = multitransport_new();
    if (!rdp->multitransport)
        goto out_free_heartbeat;

    rdp->bulk = bulk_new(context);
    if (!rdp->bulk)
        goto out_free_multitransport;

    return rdp;

out_free_multitransport:
    multitransport_free(rdp->multitransport);
out_free_heartbeat:
    heartbeat_free(rdp->heartbeat);
out_free_autodetect:
    autodetect_free(rdp->autodetect);
out_free_redirection:
    redirection_free(rdp->redirection);
out_free_mcs:
    mcs_free(rdp->mcs);
out_free_nego:
    nego_free(rdp->nego);
out_free_fastpath:
    fastpath_free(rdp->fastpath);
out_free_update:
    update_free(rdp->update);
out_free_input:
    input_free(rdp->input);
out_free_license:
    license_free(rdp->license);
out_free_transport:
    transport_free(rdp->transport);
out_free_settings:
    if (newSettings)
        freerdp_settings_free(rdp->settings);
out_free:
    free(rdp);
    return NULL;
}