1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

netapi: Add support for info level 502 in NetShareAdd.

Signed-off-by: Hans Leidekker <hans@meelstraat.net>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Nov 19 21:48:17 CET 2013 on sn-devel-104
This commit is contained in:
Hans Leidekker
2013-11-18 18:32:41 +01:00
committed by Günther Deschner
parent ec9f4d5c9b
commit 4503bdf560
4 changed files with 71 additions and 1 deletions

View File

@ -1233,6 +1233,19 @@ struct SHARE_INFO_501 {
uint32_t shi501_flags; uint32_t shi501_flags;
}; };
struct SHARE_INFO_502 {
const char * shi502_netname;
uint32_t shi502_type;
const char * shi502_remark;
uint32_t shi502_permissions;
uint32_t shi502_max_uses;
uint32_t shi502_current_uses;
const char * shi502_path;
const char * shi502_passwd;
uint32_t shi502_reserved;
struct security_descriptor * shi502_security_descriptor;
};
struct SHARE_INFO_1004 { struct SHARE_INFO_1004 {
const char * shi1004_remark; const char * shi1004_remark;
}; };

View File

@ -24,6 +24,7 @@
#include "lib/netapi/netapi_private.h" #include "lib/netapi/netapi_private.h"
#include "lib/netapi/libnetapi.h" #include "lib/netapi/libnetapi.h"
#include "../librpc/gen_ndr/ndr_srvsvc_c.h" #include "../librpc/gen_ndr/ndr_srvsvc_c.h"
#include "librpc/gen_ndr/ndr_security.h"
/**************************************************************** /****************************************************************
****************************************************************/ ****************************************************************/
@ -129,8 +130,10 @@ static NTSTATUS map_SHARE_INFO_buffer_to_srvsvc_share_info(TALLOC_CTX *mem_ctx,
union srvsvc_NetShareInfo *info) union srvsvc_NetShareInfo *info)
{ {
struct SHARE_INFO_2 *i2 = NULL; struct SHARE_INFO_2 *i2 = NULL;
struct SHARE_INFO_502 *i502 = NULL;
struct SHARE_INFO_1004 *i1004 = NULL; struct SHARE_INFO_1004 *i1004 = NULL;
struct srvsvc_NetShareInfo2 *s2 = NULL; struct srvsvc_NetShareInfo2 *s2 = NULL;
struct srvsvc_NetShareInfo502 *s502 = NULL;
struct srvsvc_NetShareInfo1004 *s1004 = NULL; struct srvsvc_NetShareInfo1004 *s1004 = NULL;
if (!buffer) { if (!buffer) {
@ -156,6 +159,29 @@ static NTSTATUS map_SHARE_INFO_buffer_to_srvsvc_share_info(TALLOC_CTX *mem_ctx,
info->info2 = s2; info->info2 = s2;
break; break;
case 502:
i502 = (struct SHARE_INFO_502 *)buffer;
s502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502);
NT_STATUS_HAVE_NO_MEMORY(s502);
s502->name = i502->shi502_netname;
s502->type = i502->shi502_type;
s502->comment = i502->shi502_remark;
s502->permissions = i502->shi502_permissions;
s502->max_users = i502->shi502_max_uses;
s502->current_users = i502->shi502_current_uses;
s502->path = i502->shi502_path;
s502->password = i502->shi502_passwd;
s502->sd_buf.sd_size =
ndr_size_security_descriptor(i502->shi502_security_descriptor, 0);
s502->sd_buf.sd = i502->shi502_security_descriptor;
info->info502 = s502;
break;
case 1004: case 1004:
i1004 = (struct SHARE_INFO_1004 *)buffer; i1004 = (struct SHARE_INFO_1004 *)buffer;
@ -191,8 +217,8 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx,
switch (r->in.level) { switch (r->in.level) {
case 2: case 2:
break;
case 502: case 502:
break;
case 503: case 503:
return WERR_NOT_SUPPORTED; return WERR_NOT_SUPPORTED;
default: default:

View File

@ -124,6 +124,7 @@ NET_API_STATUS netapitest_share(struct libnetapi_ctx *ctx,
const char *sharename, *comment; const char *sharename, *comment;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
struct SHARE_INFO_2 i2; struct SHARE_INFO_2 i2;
struct SHARE_INFO_502 i502;
struct SHARE_INFO_1004 i1004; struct SHARE_INFO_1004 i1004;
struct SHARE_INFO_501 *i501 = NULL; struct SHARE_INFO_501 *i501 = NULL;
uint32_t parm_err = 0; uint32_t parm_err = 0;
@ -142,6 +143,23 @@ NET_API_STATUS netapitest_share(struct libnetapi_ctx *ctx,
printf("testing NetShareAdd\n"); printf("testing NetShareAdd\n");
ZERO_STRUCT(i502);
i502.shi502_netname = sharename;
i502.shi502_path = "c:\\";
status = NetShareAdd(hostname, 502, (uint8_t *)&i502, &parm_err);
if (status) {
NETAPI_STATUS(ctx, status, "NetShareAdd");
goto out;
};
status = NetShareDel(hostname, sharename, 0);
if (status) {
NETAPI_STATUS(ctx, status, "NetShareDel");
goto out;
};
ZERO_STRUCT(i2); ZERO_STRUCT(i2);
i2.shi2_netname = sharename; i2.shi2_netname = sharename;

View File

@ -1778,6 +1778,19 @@ interface libnetapi
uint32 shi501_flags; uint32 shi501_flags;
} SHARE_INFO_501; } SHARE_INFO_501;
typedef struct {
string shi502_netname;
uint32 shi502_type;
string shi502_remark;
uint32 shi502_permissions;
uint32 shi502_max_uses;
uint32 shi502_current_uses;
string shi502_path;
string shi502_passwd;
uint32 shi502_reserved;
security_descriptor *shi502_security_descriptor;
} SHARE_INFO_502;
typedef struct { typedef struct {
string shi1004_remark; string shi1004_remark;
} SHARE_INFO_1004; } SHARE_INFO_1004;