#include "lib/netapi/netapi.h"
#include "lib/netapi/netapi_private.h"
#include "lib/netapi/libnetapi.h"
+#include "../librpc/gen_ndr/cli_srvsvc.h"
/****************************************************************
****************************************************************/
{
WERROR werr;
NTSTATUS status;
- struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
union srvsvc_NetShareInfo info;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
- &cli,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
done:
- if (!cli) {
- return werr;
- }
-
return werr;
}
{
WERROR werr;
NTSTATUS status;
- struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
if (!r->in.net_name) {
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
- &cli,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
r->in.net_name,
r->in.reserved,
&werr);
- if (!W_ERROR_IS_OK(werr)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
goto done;
}
done:
- if (!cli) {
- return werr;
- }
-
return werr;
}
{
WERROR werr;
NTSTATUS status;
- struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
struct srvsvc_NetShareInfoCtr info_ctr;
struct srvsvc_NetShareCtr0 ctr0;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
- &cli,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
info_ctr.level = r->in.level;
switch (r->in.level) {
case 0:
+ ZERO_STRUCT(ctr0);
info_ctr.ctr.ctr0 = &ctr0;
- break;
+ break;
case 1:
+ ZERO_STRUCT(ctr1);
info_ctr.ctr.ctr1 = &ctr1;
break;
case 2:
+ ZERO_STRUCT(ctr2);
info_ctr.ctr.ctr2 = &ctr2;
break;
}
- status = rpccli_srvsvc_NetShareEnum(pipe_cli, ctx,
- r->in.server_name,
- &info_ctr,
- r->in.prefmaxlen,
- r->out.total_entries,
- r->out.resume_handle,
- &werr);
+ status = rpccli_srvsvc_NetShareEnumAll(pipe_cli, ctx,
+ r->in.server_name,
+ &info_ctr,
+ r->in.prefmaxlen,
+ r->out.total_entries,
+ r->out.resume_handle,
+ &werr);
if (NT_STATUS_IS_ERR(status)) {
goto done;
}
}
done:
- if (!cli) {
- return werr;
- }
-
return werr;
}
{
WERROR werr;
NTSTATUS status;
- struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
union srvsvc_NetShareInfo info;
uint32_t num_entries = 0;
- if (!r->in.net_name) {
+ if (!r->in.net_name || !r->out.buffer) {
return WERR_INVALID_PARAM;
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
- &cli,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
done:
- if (!cli) {
- return werr;
- }
-
return werr;
}
WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
struct NetShareSetInfo *r)
{
- return WERR_NOT_SUPPORTED;
+ WERROR werr;
+ NTSTATUS status;
+ struct rpc_pipe_client *pipe_cli = NULL;
+ union srvsvc_NetShareInfo info;
+
+ if (!r->in.buffer) {
+ return WERR_INVALID_PARAM;
+ }
+
+ switch (r->in.level) {
+ case 2:
+ case 1004:
+ break;
+ case 1:
+ case 502:
+ case 503:
+ case 1005:
+ case 1006:
+ case 1501:
+ return WERR_NOT_SUPPORTED;
+ default:
+ return WERR_UNKNOWN_LEVEL;
+ }
+
+ werr = libnetapi_open_pipe(ctx, r->in.server_name,
+ &ndr_table_srvsvc.syntax_id,
+ &pipe_cli);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
+ status = map_SHARE_INFO_buffer_to_srvsvc_share_info(ctx,
+ r->in.buffer,
+ r->in.level,
+ &info);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ status = rpccli_srvsvc_NetShareSetInfo(pipe_cli, ctx,
+ r->in.server_name,
+ r->in.net_name,
+ r->in.level,
+ &info,
+ r->out.parm_err,
+ &werr);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
+ done:
+ return werr;
}
/****************************************************************