mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +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 netr_DomainInformation *domain_info;
|
||||
struct netr_LsaPolicyInformation *lsa_policy_info;
|
||||
struct netr_OsVersionInfoEx *os_version;
|
||||
uint32_t default_supported_enc_types = 0xFFFFFFFF;
|
||||
bool update_dns_hostname = true;
|
||||
int ret, ret3, i;
|
||||
@ -1478,9 +1477,13 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
||||
new_msg->dn = workstation_dn;
|
||||
|
||||
/* Sets the OS name */
|
||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
||||
"operatingSystem",
|
||||
r->in.query->workstation_info->os_name.string);
|
||||
|
||||
if (r->in.query->workstation_info->os_name.string == NULL) {
|
||||
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) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
@ -1490,22 +1493,31 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
|
||||
* the values are cleared.
|
||||
*/
|
||||
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;
|
||||
|
||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
||||
"operatingSystemServicePack",
|
||||
os_version->CSDVersion);
|
||||
if (os_version->CSDVersion == NULL) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
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) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
||||
"operatingSystemVersion",
|
||||
talloc_asprintf(mem_ctx,
|
||||
"%u.%u (%u)",
|
||||
os_version->MajorVersion,
|
||||
os_version->MinorVersion,
|
||||
os_version->BuildNumber));
|
||||
ret = ldb_msg_add_string(new_msg,
|
||||
"operatingSystemVersion",
|
||||
os_version_str);
|
||||
if (ret != LDB_SUCCESS) {
|
||||
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.
|
||||
*/
|
||||
if (update_dns_hostname) {
|
||||
ret = samdb_msg_set_string(sam_ctx, mem_ctx, new_msg,
|
||||
"dNSHostname",
|
||||
r->in.query->workstation_info->dns_hostname);
|
||||
ret = ldb_msg_add_string(new_msg,
|
||||
"dNSHostname",
|
||||
r->in.query->workstation_info->dns_hostname);
|
||||
if (ret != LDB_SUCCESS) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user