s4-server: use GUID_to_ndr_blob() in cldap and smb servers
authorAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 03:31:52 +0000 (14:31 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 06:51:28 +0000 (17:51 +1100)
source4/cldap_server/netlogon.c
source4/smb_server/blob.c
source4/smb_server/smb2/negprot.c

index 049b0085b33c930cf42662cfee473476a2b7540b..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;
                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 */
 
 
                        /* 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 */
                        }
 
                        /* 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, 
                        }
                        ret = ldb_search(sam_ctx, mem_ctx, &dom_res,
                                                 NULL, LDB_SCOPE_SUBTREE, 
index bf8985ccdf639301dca460f3826030d294728bc5..182c803f965d590754eed907fb0cff31b4bbd7f8 100644 (file)
@@ -272,15 +272,13 @@ NTSTATUS smbsrv_push_passthru_fsinfo(TALLOC_CTX *mem_ctx,
                return NT_STATUS_OK;
 
        case RAW_QFS_OBJECTID_INFORMATION: {
                return NT_STATUS_OK;
 
        case RAW_QFS_OBJECTID_INFORMATION: {
-               enum ndr_err_code ndr_err;
+               NTSTATUS status;
 
                BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 64));
 
 
                BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 64));
 
-               ndr_err = ndr_push_struct_blob(&guid_blob, mem_ctx, NULL, 
-                                              &fsinfo->objectid_information.out.guid,
-                                              (ndr_push_flags_fn_t)ndr_push_GUID);
-               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-                       BLOB_CHECK(ndr_map_error2ntstatus(ndr_err));
+               status = GUID_to_ndr_blob(&fsinfo->objectid_information.out.guid, mem_ctx, &guid_blob);
+               if (!NT_STATUS_IS_OK(status)) {
+                       BLOB_CHECK(status);
                }
 
                memcpy(blob->data, guid_blob.data, guid_blob.length);
                }
 
                memcpy(blob->data, guid_blob.data, guid_blob.length);
index faf025a1f8283bc64615c2d713ffabc582dc154b..260822f2c5f5da2ac988e454cbe814c6cc9ccd4f 100644 (file)
@@ -153,7 +153,6 @@ static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2
 static void smb2srv_negprot_send(struct smb2srv_request *req, struct smb2_negprot *io)
 {
        NTSTATUS status;
 static void smb2srv_negprot_send(struct smb2srv_request *req, struct smb2_negprot *io)
 {
        NTSTATUS status;
-       enum ndr_err_code ndr_err;
 
        if (NT_STATUS_IS_ERR(req->status)) {
                smb2srv_send_error(req, req->status); /* TODO: is this correct? */
 
        if (NT_STATUS_IS_ERR(req->status)) {
                smb2srv_send_error(req, req->status); /* TODO: is this correct? */
@@ -170,8 +169,8 @@ static void smb2srv_negprot_send(struct smb2srv_request *req, struct smb2_negpro
        SSVAL(req->out.body, 0x02, io->out.security_mode);
        SIVAL(req->out.body, 0x04, io->out.dialect_revision);
        SIVAL(req->out.body, 0x06, io->out.reserved);
        SSVAL(req->out.body, 0x02, io->out.security_mode);
        SIVAL(req->out.body, 0x04, io->out.dialect_revision);
        SIVAL(req->out.body, 0x06, io->out.reserved);
-       ndr_err = smbcli_push_guid(req->out.body, 0x08, &io->out.server_guid);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+       status = smbcli_push_guid(req->out.body, 0x08, &io->out.server_guid);
+       if (!NT_STATUS_IS_OK(status)) {
                smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
                talloc_free(req);
                return;
                smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
                talloc_free(req);
                return;