mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s4:netlogon RPC server - "LogonGetDomainInfo" - check for NULL attributes
This is needed to complete the transition from "samdb_msg_add_string" to "ldb_msg_add_string". And this patch yields better NTSTATUS error results than before (INVALID_PARAMETER rather than OUT_OF_MEMORY). Reviewed-by: Jelmer Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Tue Mar 1 14:42:15 CET 2011 on sn-devel-104
This commit is contained in:
parent
fecf925043
commit
0b5719f5fc
@ -1378,7 +1378,6 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
|||||||
struct ldb_dn *workstation_dn;
|
struct ldb_dn *workstation_dn;
|
||||||
struct netr_DomainInformation *domain_info;
|
struct netr_DomainInformation *domain_info;
|
||||||
struct netr_LsaPolicyInformation *lsa_policy_info;
|
struct netr_LsaPolicyInformation *lsa_policy_info;
|
||||||
struct netr_OsVersionInfoEx *os_version;
|
|
||||||
uint32_t default_supported_enc_types = 0xFFFFFFFF;
|
uint32_t default_supported_enc_types = 0xFFFFFFFF;
|
||||||
bool update_dns_hostname = true;
|
bool update_dns_hostname = true;
|
||||||
int ret, ret3, i;
|
int ret, ret3, i;
|
||||||
@ -1478,9 +1477,13 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
|||||||
new_msg->dn = workstation_dn;
|
new_msg->dn = workstation_dn;
|
||||||
|
|
||||||
/* Sets the OS name */
|
/* Sets the OS name */
|
||||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
|
||||||
"operatingSystem",
|
if (r->in.query->workstation_info->os_name.string == NULL) {
|
||||||
r->in.query->workstation_info->os_name.string);
|
return NT_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ldb_msg_add_string(new_msg, "operatingSystem",
|
||||||
|
r->in.query->workstation_info->os_name.string);
|
||||||
if (ret != LDB_SUCCESS) {
|
if (ret != LDB_SUCCESS) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
@ -1490,22 +1493,31 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
|||||||
* the values are cleared.
|
* the values are cleared.
|
||||||
*/
|
*/
|
||||||
if (r->in.query->workstation_info->os_version.os != NULL) {
|
if (r->in.query->workstation_info->os_version.os != NULL) {
|
||||||
|
struct netr_OsVersionInfoEx *os_version;
|
||||||
|
const char *os_version_str;
|
||||||
|
|
||||||
os_version = &r->in.query->workstation_info->os_version.os->os;
|
os_version = &r->in.query->workstation_info->os_version.os->os;
|
||||||
|
|
||||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
if (os_version->CSDVersion == NULL) {
|
||||||
"operatingSystemServicePack",
|
return NT_STATUS_INVALID_PARAMETER;
|
||||||
os_version->CSDVersion);
|
}
|
||||||
|
|
||||||
|
os_version_str = talloc_asprintf(new_msg, "%u.%u (%u)",
|
||||||
|
os_version->MajorVersion,
|
||||||
|
os_version->MinorVersion,
|
||||||
|
os_version->BuildNumber);
|
||||||
|
NT_STATUS_HAVE_NO_MEMORY(os_version_str);
|
||||||
|
|
||||||
|
ret = ldb_msg_add_string(new_msg,
|
||||||
|
"operatingSystemServicePack",
|
||||||
|
os_version->CSDVersion);
|
||||||
if (ret != LDB_SUCCESS) {
|
if (ret != LDB_SUCCESS) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
ret = ldb_msg_add_string(new_msg,
|
||||||
"operatingSystemVersion",
|
"operatingSystemVersion",
|
||||||
talloc_asprintf(mem_ctx,
|
os_version_str);
|
||||||
"%u.%u (%u)",
|
|
||||||
os_version->MajorVersion,
|
|
||||||
os_version->MinorVersion,
|
|
||||||
os_version->BuildNumber));
|
|
||||||
if (ret != LDB_SUCCESS) {
|
if (ret != LDB_SUCCESS) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
@ -1528,9 +1540,9 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
|||||||
* are fine to start the update.
|
* are fine to start the update.
|
||||||
*/
|
*/
|
||||||
if (update_dns_hostname) {
|
if (update_dns_hostname) {
|
||||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
ret = ldb_msg_add_string(new_msg,
|
||||||
"dNSHostname",
|
"dNSHostname",
|
||||||
r->in.query->workstation_info->dns_hostname);
|
r->in.query->workstation_info->dns_hostname);
|
||||||
if (ret != LDB_SUCCESS) {
|
if (ret != LDB_SUCCESS) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user