From 3434497cf5a775962e08378e3a25c33417d905e6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Dec 2021 13:58:07 +0100 Subject: [PATCH 1/2] s4:torture/rpc: test how CSDVersion="" wipes operatingSystemServicePack BUG: https://bugzilla.samba.org/show_bug.cgi?id=14936 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison (cherry picked from commit 4a0a0d2fc9555dc8ff7692607b1d51189785bd47) --- selftest/knownfail.d/samba4.rpc.netlogon | 9 +++++++++ source4/torture/rpc/netlogon.c | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 selftest/knownfail.d/samba4.rpc.netlogon diff --git a/selftest/knownfail.d/samba4.rpc.netlogon b/selftest/knownfail.d/samba4.rpc.netlogon new file mode 100644 index 00000000000..12d871e7014 --- /dev/null +++ b/selftest/knownfail.d/samba4.rpc.netlogon @@ -0,0 +1,9 @@ +^samba4.rpc.netlogon.on.ncacn_np.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.on.ncacn_np.with.validate.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.validate.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.on.ncacn_np.with.bigendian.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.bigendian.netlogon.GetDomainInfo\(ad_dc_ntvfs\) +^samba4.rpc.netlogon.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc\) +^samba4.rpc.netlogon.with.validate.netlogon.GetDomainInfo\(ad_dc\) +^samba4.rpc.netlogon.with.bigendian.netlogon.GetDomainInfo\(ad_dc\) diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 0d8926b6d81..11f950d3aab 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -5143,8 +5143,8 @@ static bool test_GetDomainInfo(struct torture_context *tctx, torture_comment(tctx, "Testing netr_LogonGetDomainInfo 2nd call (variation of DNS hostname doesn't work)\n"); netlogon_creds_client_authenticator(creds, &a); - /* Wipe out the osVersion, and prove which values still 'stick' */ - q1.os_version.os = NULL; + /* Wipe out the CSDVersion, and prove which values still 'stick' */ + os.os.CSDVersion = ""; /* Change also the DNS hostname to test differences in behaviour */ talloc_free(discard_const_p(char, q1.dns_hostname)); @@ -5175,9 +5175,9 @@ static bool test_GetDomainInfo(struct torture_context *tctx, torture_assert(tctx, ldb_msg_find_attr_as_string(res[0], "operatingSystemServicePack", NULL) == NULL, "'operatingSystemServicePack' shouldn't stick!"); - torture_assert(tctx, - ldb_msg_find_attr_as_string(res[0], "operatingSystemVersion", NULL) == NULL, - "'operatingSystemVersion' shouldn't stick!"); + torture_assert_str_equal(tctx, + ldb_msg_find_attr_as_string(res[0], "operatingSystemVersion", NULL), + version_str, "'operatingSystemVersion' wrong!"); /* The DNS host name shouldn't have been updated by the server */ -- 2.30.2 From 149a71ef52e4a4060a53789d280efcd0bed3e594 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Dec 2021 14:00:34 +0100 Subject: [PATCH 2/2] s4:rpc_server/netlogon: let CSDVersion="" wipe operatingSystemServicePack BUG: https://bugzilla.samba.org/show_bug.cgi?id=14936 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Jan 11 22:03:03 UTC 2022 on sn-devel-184 (cherry picked from commit 1243f52f7ae58de1005c431e20563f2f1902dfce) --- selftest/knownfail.d/samba4.rpc.netlogon | 9 --------- source4/rpc_server/netlogon/dcerpc_netlogon.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 selftest/knownfail.d/samba4.rpc.netlogon diff --git a/selftest/knownfail.d/samba4.rpc.netlogon b/selftest/knownfail.d/samba4.rpc.netlogon deleted file mode 100644 index 12d871e7014..00000000000 --- a/selftest/knownfail.d/samba4.rpc.netlogon +++ /dev/null @@ -1,9 +0,0 @@ -^samba4.rpc.netlogon.on.ncacn_np.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.on.ncacn_np.with.validate.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.validate.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.on.ncacn_np.with.bigendian.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.on.ncacn_ip_tcp.with.bigendian.netlogon.GetDomainInfo\(ad_dc_ntvfs\) -^samba4.rpc.netlogon.with.seal,padcheck.netlogon.GetDomainInfo\(ad_dc\) -^samba4.rpc.netlogon.with.validate.netlogon.GetDomainInfo\(ad_dc\) -^samba4.rpc.netlogon.with.bigendian.netlogon.GetDomainInfo\(ad_dc\) diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index aa277e63a8c..6f5a6e500db 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -2599,9 +2599,14 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal os_version->BuildNumber); NT_STATUS_HAVE_NO_MEMORY(os_version_str); - ret = ldb_msg_add_string(new_msg, - "operatingSystemServicePack", - os_version->CSDVersion); + if (strlen(os_version->CSDVersion) != 0) { + ret = ldb_msg_add_string(new_msg, + "operatingSystemServicePack", + os_version->CSDVersion); + } else { + ret = samdb_msg_add_delete(sam_ctx, mem_ctx, new_msg, + "operatingSystemServicePack"); + } if (ret != LDB_SUCCESS) { return NT_STATUS_NO_MEMORY; } -- 2.30.2