Skip to content

Commit d583c60

Browse files
committed
WAB-9186: Support multiple RDS (using CAL Per Device). (Remote target ip)
1 parent e74f187 commit d583c60

File tree

6 files changed

+14
-33
lines changed

6 files changed

+14
-33
lines changed

src/acl/file_system_license_store.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class FileSystemLicenseStore : public LicenseApi
3939
{}
4040

4141
// The functions shall return empty bytes_view to indicate the error.
42-
bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out, bool enable_log) override
42+
bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out, bool enable_log) override
4343
{
4444
char license_index[2048] = {};
45-
::snprintf(license_index, sizeof(license_index) - 1, "%s_0x%08X_%s_%s_%s", target_ip, version, scope, company_name, product_id);
45+
::snprintf(license_index, sizeof(license_index) - 1, "0.0.0.0_0x%08X_%s_%s_%s", version, scope, company_name, product_id);
4646
license_index[sizeof(license_index) - 1] = '\0';
4747
std::replace(std::begin(license_index), std::end(license_index), ' ', '-');
4848
LOG_IF(enable_log, LOG_INFO, "FileSystemLicenseStore::get_license_v1(): LicenseIndex=\"%s\"", license_index);
@@ -128,10 +128,10 @@ class FileSystemLicenseStore : public LicenseApi
128128
return bytes_view { out.data(), 0 };
129129
}
130130

131-
bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
131+
bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
132132
{
133133
char license_index[2048] = {};
134-
::snprintf(license_index, sizeof(license_index) - 1, "%s_0x%08X_%s_%s_%s", target_ip, version, scope, company_name, product_id);
134+
::snprintf(license_index, sizeof(license_index) - 1, "0.0.0.0_0x%08X_%s_%s_%s", version, scope, company_name, product_id);
135135
license_index[sizeof(license_index) - 1] = '\0';
136136
std::replace_if(std::begin(license_index), std::end(license_index),
137137
[](unsigned char c) { return (' ' == c); }, '-');

src/acl/license_api.hpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct LicenseApi : noncopyable
2929
virtual ~LicenseApi() = default;
3030

3131
// The functions shall return empty bytes_view to indicate the error.
32-
virtual bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope,
32+
virtual bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope,
3333
char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out,
3434
bool enable_log) = 0;
3535

@@ -38,18 +38,17 @@ struct LicenseApi : noncopyable
3838
char const* company_name, char const* product_id, writable_bytes_view out,
3939
bool enable_log) = 0;
4040

41-
virtual bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name,
41+
virtual bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name,
4242
char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) = 0;
4343
};
4444

4545
struct NullLicenseStore : LicenseApi
4646
{
47-
bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope,
47+
bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope,
4848
char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out,
4949
bool enable_log) override
5050
{
5151
(void)client_name;
52-
(void)target_ip;
5352
(void)version;
5453
(void)scope;
5554
(void)company_name;
@@ -74,11 +73,10 @@ struct NullLicenseStore : LicenseApi
7473
return bytes_view(out.data(), 0);
7574
}
7675

77-
bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name,
76+
bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name,
7877
char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
7978
{
8079
(void)client_name;
81-
(void)target_ip;
8280
(void)version;
8381
(void)scope;
8482
(void)company_name;

src/acl/module_manager/create_module_rdp.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ ModPack create_mod_rdp(
676676
mod_rdp_params.replace_null_pointer_by_default_pointer = ini.get<cfg::mod_rdp::replace_null_pointer_by_default_pointer>();
677677
mod_rdp_params.large_pointer_support = ini.get<cfg::globals::large_pointer_support>();
678678
mod_rdp_params.load_balance_info = ini.get<cfg::mod_rdp::load_balance_info>().c_str();
679-
mod_rdp_params.target_ip = ini.get<cfg::context::ip_target>().c_str();
680679

681680
// ======================= File System Params ===================
682681
{

src/mod/rdp/rdp_negociation.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ RdpNegociation::RdpNegociation(
270270
, real_client_name(info.hostname)
271271
, license_store(license_store)
272272
, use_license_store(mod_rdp_params.use_license_store)
273-
, target_ip(mod_rdp_params.target_ip)
274273
, build_number(info.build)
275274
, forward_build_number(mod_rdp_params.forward_client_build_number)
276275
{
@@ -1294,7 +1293,6 @@ bool RdpNegociation::get_license(InStream & stream, TpduBuffer& buf)
12941293
for (uint32_t i = 0; i < SvrLicReq.ScopeList.ScopeCount; ++i) {
12951294
bytes_view out = this->license_store.get_license_v1(
12961295
logon_info.client_name_is_hidden() ? "localhost" : logon_info.hostname().c_str(),
1297-
this->target_ip.c_str(),
12981296
SvrLicReq.ProductInfo.dwVersion,
12991297
::char_ptr_cast(SvrLicReq.ScopeList.ScopeArray[i].blobData.data()),
13001298
::char_ptr_cast(CompanyNameU8),
@@ -1474,7 +1472,6 @@ bool RdpNegociation::get_license(InStream & stream, TpduBuffer& buf)
14741472

14751473
license_saved = this->license_store.put_license(
14761474
logon_info.client_name_is_hidden() ? "localhost" : logon_info.hostname().c_str(),
1477-
this->target_ip.c_str(),
14781475
lic.licenseInfo.dwVersion,
14791476
::char_ptr_cast(lic.licenseInfo.pbScope),
14801477
::char_ptr_cast(CompanyNameU8),

src/mod/rdp/rdp_params.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ struct ModRDPParams
185185

186186
const char * load_balance_info = "";
187187

188-
const char * target_ip = "";
189-
190188
bool support_connection_redirection_during_recording = true;
191189

192190
bool split_domain = false;
@@ -427,8 +425,6 @@ struct ModRDPParams
427425

428426
RDP_PARAMS_LOG("%s", s_or_none, load_balance_info);
429427

430-
RDP_PARAMS_LOG("%s", s_or_none, target_ip);
431-
432428
RDP_PARAMS_LOG("%u", from_millisec, remote_app_params.rail_disconnect_message_delay);
433429

434430
RDP_PARAMS_LOG("%s", yes_or_no, file_system_params.bogus_ios_rdpdr_virtual_channel);

tests/acl/test_license_api.cpp

+6-15
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,11 @@ RED_AUTO_TEST_CASE(TestWithoutExistingLicense)
274274
class CaptureLicenseStore : public LicenseApi
275275
{
276276
public:
277-
bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope,
277+
bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope,
278278
char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out,
279279
bool enable_log) override
280280
{
281281
(void)client_name;
282-
(void)target_ip;
283282
(void)version;
284283
(void)scope;
285284
(void)company_name;
@@ -304,18 +303,14 @@ RED_AUTO_TEST_CASE(TestWithoutExistingLicense)
304303
return bytes_view { out.data(), 0 };
305304
}
306305

307-
bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
306+
bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
308307
{
309308
(void)enable_log;
310309

311310
LOG(LOG_INFO, "/*CaptureLicenseStore */ const char license_client_name[] =");
312311
hexdump_c(client_name, ::strlen(client_name));
313312
LOG(LOG_INFO, "/*CaptureLicenseStore */ ;");
314313

315-
LOG(LOG_INFO, "/*CaptureLicenseStore */ const char target_ip[] =");
316-
hexdump_c(target_ip, ::strlen(target_ip));
317-
LOG(LOG_INFO, "/*CaptureLicenseStore */ ;");
318-
319314
LOG(LOG_INFO, "/*CaptureLicenseStore */ uint32_t license_version = %u", version);
320315
LOG(LOG_INFO, "/*CaptureLicenseStore */ ;");
321316

@@ -355,12 +350,11 @@ RED_AUTO_TEST_CASE(TestWithoutExistingLicense)
355350
expected_hwid(hwid),
356351
expected_license_data(license_data) {}
357352

358-
bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope,
353+
bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope,
359354
char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out,
360355
bool enable_log) override
361356
{
362357
(void)client_name;
363-
(void)target_ip;
364358
(void)version;
365359
(void)scope;
366360
(void)company_name;
@@ -385,10 +379,9 @@ RED_AUTO_TEST_CASE(TestWithoutExistingLicense)
385379
return bytes_view { out.data(), 0 };
386380
}
387381

388-
bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
382+
bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
389383
{
390384
(void)enable_log;
391-
(void)target_ip;
392385

393386
RED_CHECK_EQ(client_name, this->expected_client_name);
394387
RED_CHECK_EQ(version, this->expected_version);
@@ -471,10 +464,9 @@ RED_AUTO_TEST_CASE(TestWithExistingLicense)
471464
expected_hwid(hwid),
472465
expected_license_data(license_data) {}
473466

474-
bytes_view get_license_v1(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out, bool enable_log) override
467+
bytes_view get_license_v1(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE>& hwid, writable_bytes_view out, bool enable_log) override
475468
{
476469
(void)enable_log;
477-
(void)target_ip;
478470

479471
RED_CHECK_EQ(client_name, this->expected_client_name);
480472
RED_CHECK_EQ(version, this->expected_version);
@@ -513,12 +505,11 @@ RED_AUTO_TEST_CASE(TestWithExistingLicense)
513505
return bytes_view { out.data(), effective_license_size };
514506
}
515507

516-
bool put_license(char const* client_name, char const* target_ip, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
508+
bool put_license(char const* client_name, uint32_t version, char const* scope, char const* company_name, char const* product_id, std::array<uint8_t, LIC::LICENSE_HWID_SIZE> const& hwid, bytes_view in, bool enable_log) override
517509
{
518510
(void)enable_log;
519511
(void)hwid;
520512
(void)in;
521-
(void)target_ip;
522513

523514
RED_CHECK_EQ(client_name, this->expected_client_name);
524515
RED_CHECK_EQ(version, this->expected_version);

0 commit comments

Comments
 (0)