s4-server: use GUID_to_ndr_blob() in cldap and smb servers
[samba.git] / source4 / cldap_server / netlogon.c
index c565f2fb1ad2ac962464a6a7aa550bffff3e28e5..70729531216607d380cfbdef7f4440d343a0cdf4 100644 (file)
@@ -104,7 +104,6 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
                if (domain_guid) {
                        struct GUID binary_guid;
                        struct ldb_val guid_val;
-                       enum ndr_err_code ndr_err;
 
                        /* By this means, we ensure we don't have funny stuff in the GUID */
 
@@ -114,10 +113,9 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
                        }
 
                        /* And this gets the result into the binary format we want anyway */
-                       ndr_err = ndr_push_struct_blob(&guid_val, mem_ctx, NULL, &binary_guid,
-                                                      (ndr_push_flags_fn_t)ndr_push_GUID);
-                       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-                               return NT_STATUS_INVALID_PARAMETER;
+                       status = GUID_to_ndr_blob(&binary_guid, mem_ctx, &guid_val);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               return status;
                        }
                        ret = ldb_search(sam_ctx, mem_ctx, &dom_res,
                                                 NULL, LDB_SCOPE_SUBTREE, 
@@ -215,10 +213,8 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
 #endif
 
        if (samdb_is_pdc(sam_ctx)) {
-               int *domainFunctionality;
                server_type |= DS_SERVER_PDC;
-               domainFunctionality = talloc_get_type(ldb_get_opaque(sam_ctx, "domainFunctionality"), int);
-               if (domainFunctionality && *domainFunctionality >= DS_DOMAIN_FUNCTION_2008) {
+               if (dsdb_functional_level(sam_ctx) >= DS_DOMAIN_FUNCTION_2008) {
                        server_type |= DS_SERVER_FULL_SECRET_DOMAIN_6;
                }
        }