mirror of
https://github.com/samba-team/samba.git
synced 2025-07-23 20:59:10 +03:00
s3-libnetapi: prefer dcerpc_srvsvc_X functions.
Guenther Signed-off-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
committed by
Andreas Schneider
parent
aa4efa154f
commit
1ef94dffe6
@ -23,7 +23,7 @@
|
||||
#include "lib/netapi/netapi.h"
|
||||
#include "lib/netapi/netapi_private.h"
|
||||
#include "lib/netapi/libnetapi.h"
|
||||
#include "../librpc/gen_ndr/cli_srvsvc.h"
|
||||
#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
|
||||
|
||||
/****************************************************************
|
||||
****************************************************************/
|
||||
@ -34,6 +34,7 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
|
||||
WERROR werr;
|
||||
NTSTATUS status;
|
||||
struct rpc_pipe_client *pipe_cli = NULL;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
werr = libnetapi_open_pipe(ctx, r->in.server_name,
|
||||
&ndr_table_srvsvc.syntax_id,
|
||||
@ -42,7 +43,9 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = rpccli_srvsvc_NetFileClose(pipe_cli, talloc_tos(),
|
||||
b = pipe_cli->binding_handle;
|
||||
|
||||
status = dcerpc_srvsvc_NetFileClose(b, talloc_tos(),
|
||||
r->in.server_name,
|
||||
r->in.fileid,
|
||||
&werr);
|
||||
@ -116,6 +119,7 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
|
||||
struct rpc_pipe_client *pipe_cli = NULL;
|
||||
union srvsvc_NetFileInfo info;
|
||||
uint32_t num_entries = 0;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
if (!r->out.buffer) {
|
||||
return WERR_INVALID_PARAM;
|
||||
@ -136,12 +140,19 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = rpccli_srvsvc_NetFileGetInfo(pipe_cli, talloc_tos(),
|
||||
b = pipe_cli->binding_handle;
|
||||
|
||||
status = dcerpc_srvsvc_NetFileGetInfo(b, talloc_tos(),
|
||||
r->in.server_name,
|
||||
r->in.fileid,
|
||||
r->in.level,
|
||||
&info,
|
||||
&werr);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
werr = ntstatus_to_werror(status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
goto done;
|
||||
}
|
||||
@ -182,6 +193,7 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
|
||||
struct srvsvc_NetFileCtr3 ctr3;
|
||||
uint32_t num_entries = 0;
|
||||
uint32_t i;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
if (!r->out.buffer) {
|
||||
return WERR_INVALID_PARAM;
|
||||
@ -202,6 +214,8 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
b = pipe_cli->binding_handle;
|
||||
|
||||
ZERO_STRUCT(info_ctr);
|
||||
|
||||
info_ctr.level = r->in.level;
|
||||
@ -216,7 +230,7 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
|
||||
break;
|
||||
}
|
||||
|
||||
status = rpccli_srvsvc_NetFileEnum(pipe_cli, talloc_tos(),
|
||||
status = dcerpc_srvsvc_NetFileEnum(b, talloc_tos(),
|
||||
r->in.server_name,
|
||||
r->in.base_path,
|
||||
r->in.user_name,
|
||||
@ -225,7 +239,12 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
|
||||
r->out.total_entries,
|
||||
r->out.resume_handle,
|
||||
&werr);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
werr = ntstatus_to_werror(status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!W_ERROR_IS_OK(werr) && !W_ERROR_EQUAL(werr, WERR_MORE_DATA)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user