#include "includes.h"
#include "rpcclient.h"
#include "../librpc/gen_ndr/ndr_srvsvc.h"
-#include "../librpc/gen_ndr/cli_srvsvc.h"
+#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
/* Display server query info */
WERROR result;
NTSTATUS status;
const char *server_unc = cli->srv_name_slash;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3) {
printf("Usage: %s [infolevel] [server_unc]\n", argv[0]);
server_unc = argv[2];
}
- status = rpccli_srvsvc_NetSrvGetInfo(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
server_unc,
info_level,
&info,
uint32_t resume_handle = 0;
uint32_t *resume_handle_p = NULL;
uint32 preferred_len = 0xffffffff, i;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3) {
printf("Usage: %s [infolevel] [resume_handle]\n", argv[0]);
switch (opcode) {
case NDR_SRVSVC_NETSHAREENUM:
- status = rpccli_srvsvc_NetShareEnum(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareEnum(b, mem_ctx,
cli->desthost,
&info_ctr,
preferred_len,
&result);
break;
case NDR_SRVSVC_NETSHAREENUMALL:
- status = rpccli_srvsvc_NetShareEnumAll(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareEnumAll(b, mem_ctx,
cli->desthost,
&info_ctr,
preferred_len,
return WERR_INVALID_PARAM;
}
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
union srvsvc_NetShareInfo info;
WERROR result;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2 || argc > 3) {
printf("Usage: %s [sharename] [infolevel]\n", argv[0]);
if (argc == 3)
info_level = atoi(argv[2]);
- status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
cli->desthost,
argv[1],
info_level,
&info,
&result);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
WERROR result;
NTSTATUS status;
uint32_t parm_err = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 3) {
printf("Usage: %s [sharename] [comment]\n", argv[0]);
}
/* retrieve share info */
- status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
cli->desthost,
argv[1],
info_level,
&info_get,
&result);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
info_get.info502->comment = argv[2];
/* set share info */
- status = rpccli_srvsvc_NetShareSetInfo(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx,
cli->desthost,
argv[1],
info_level,
&parm_err,
&result);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
/* re-retrieve share info and display */
- status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
cli->desthost,
argv[1],
info_level,
&info_get,
&result);
-
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
struct srvsvc_NetRemoteTODInfo *tod = NULL;
WERROR result;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 1) {
printf("Usage: %s\n", argv[0]);
return WERR_OK;
}
- status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetRemoteTOD(b, mem_ctx,
cli->srv_name_slash,
&tod,
&result);
uint32 preferred_len = 0xffff;
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
info_ctr.level = info_level;
info_ctr.ctr.ctr3 = &ctr3;
- status = rpccli_srvsvc_NetFileEnum(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetFileEnum(b, mem_ctx,
cli->desthost,
NULL,
NULL,
&total_entries,
&resume_handle,
&result);
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result))
+ if (!W_ERROR_IS_OK(result)) {
goto done;
+ }
done:
return result;
NTSTATUS status;
uint32_t name_type = 9;
uint32_t flags = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2 || argc > 3) {
printf("Usage: %s [sharename] [type]\n", argv[0]);
name_type = atoi(argv[2]);
}
- status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetNameValidate(b, mem_ctx,
cli->desthost,
argv[1],
name_type,
flags,
&result);
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
if (!W_ERROR_IS_OK(result))
goto done;
WERROR result;
NTSTATUS status;
struct sec_desc_buf *sd_buf = NULL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2 || argc > 4) {
printf("Usage: %s [sharename] [file]\n", argv[0]);
return WERR_OK;
}
- status = rpccli_srvsvc_NetGetFileSecurity(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetGetFileSecurity(b, mem_ctx,
cli->desthost,
argv[1],
argv[2],
SECINFO_DACL,
&sd_buf,
&result);
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
{
WERROR result;
NTSTATUS status;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc < 2 || argc > 4) {
printf("Usage: %s [client] [user]\n", argv[0]);
return WERR_OK;
}
- status = rpccli_srvsvc_NetSessDel(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetSessDel(b, mem_ctx,
cli->desthost,
argv[1],
argv[2],
&result);
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
uint32_t level = 1;
const char *client = NULL;
const char *user = NULL;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 6) {
printf("Usage: %s [client] [user] [level] [resume_handle]\n", argv[0]);
break;
}
- status = rpccli_srvsvc_NetSessEnum(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetSessEnum(b, mem_ctx,
cli->desthost,
client,
user,
resume_handle_p,
&result);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
uint32_t level = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 4) {
printf("Usage: %s [level] [resume_handle]\n", argv[0]);
ZERO_STRUCT(info);
- status = rpccli_srvsvc_NetDiskEnum(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetDiskEnum(b, mem_ctx,
cli->desthost,
level,
&info,
&total_entries,
&resume_handle,
&result);
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
uint32_t *resume_handle_p = NULL;
uint32_t level = 1;
const char *path = "IPC$";
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 4) {
printf("Usage: %s [level] [path] [resume_handle]\n", argv[0]);
return WERR_INVALID_PARAM;
}
- status = rpccli_srvsvc_NetConnEnum(cli, mem_ctx,
+ status = dcerpc_srvsvc_NetConnEnum(b, mem_ctx,
cli->desthost,
path,
&info_ctr,
resume_handle_p,
&result);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ result = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}