[SCM] Samba Shared Repository - branch v3-devel updated - release-3-2-0pre2-4037-g2e15036

Günther Deschner gd at samba.org
Fri Sep 5 11:24:15 GMT 2008


The branch, v3-devel has been updated
       via  2e15036bacf717d27d1806bcbdba1e68f2f76aae (commit)
       via  f3044d76530f63b16f26fedf8e00eaf4d3badb06 (commit)
       via  ebcd45ed3ff79ce3b90872aa87a737ba6ee3401f (commit)
       via  f21a934e1e100cb1496a6c854684ff110ba6d1cc (commit)
       via  a7050c999ff0a13724afbbbb2628cb47daec5b35 (commit)
       via  2066ebc5e3e782b9443aee3e5beb1a99d69096ec (commit)
       via  4d7947e54959c6a445e8b0f7a8313fe232c1fb8f (commit)
       via  7d863c4b00d70110819b847890ccb9b2a4aa71c9 (commit)
       via  22f37206338e54bbaf619a7b16e145f129bfe986 (commit)
       via  3fbfbaea004f792a577f21275e6e4218f581d698 (commit)
       via  029cf4a2a9d95b9c7de6eb75118a92474c0ae9c1 (commit)
       via  0166c8f04be1168fe83d7bf3730d3011ffd8c6f6 (commit)
       via  5c63b181ec698a6134ce31326dab9e6bd232acf0 (commit)
       via  237c6e0bca44e19ca89532e565b1345f9f329111 (commit)
       via  dab613e930a9193153cc744e4ad4ea0fa6476b40 (commit)
       via  5d669075295a3adb30c013d1a3b617bf4ced8e73 (commit)
      from  5851b4e40e5cc2b7ba973b274f9203aa6e6fb1d8 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-devel


- Log -----------------------------------------------------------------
commit 2e15036bacf717d27d1806bcbdba1e68f2f76aae
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 5 12:15:05 2008 +0200

    re-run make idl.
    
    Guenther

commit f3044d76530f63b16f26fedf8e00eaf4d3badb06
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 5 12:14:51 2008 +0200

    netapi: add SHARE_INFO_1005_FLAGS.
    
    Guenther

commit ebcd45ed3ff79ce3b90872aa87a737ba6ee3401f
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:24:23 2008 +0200

    netapi: implement NetShareSetInfo_r.
    
    Guenther

commit f21a934e1e100cb1496a6c854684ff110ba6d1cc
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:24:02 2008 +0200

    netapi: add support for level 1004 in
    map_SHARE_INFO_buffer_to_srvsvc_share_info.
    
    Guenther

commit a7050c999ff0a13724afbbbb2628cb47daec5b35
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:12:56 2008 +0200

    netapi: add NetShareSetInfo example code.
    
    Guenther

commit 2066ebc5e3e782b9443aee3e5beb1a99d69096ec
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:04:35 2008 +0200

    netapi: add NetShareSetInfo to public header.
    
    Guenther

commit 4d7947e54959c6a445e8b0f7a8313fe232c1fb8f
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:03:14 2008 +0200

    netapi: add skeleton for NetShareSetInfo.
    
    Guenther

commit 7d863c4b00d70110819b847890ccb9b2a4aa71c9
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:01:46 2008 +0200

    re-run make idl.
    
    Guenther

commit 22f37206338e54bbaf619a7b16e145f129bfe986
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 20:00:50 2008 +0200

    netapi: add NetShareSetInfo to IDL.
    
    Guenther

commit 3fbfbaea004f792a577f21275e6e4218f581d698
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 19:29:47 2008 +0200

    netapi: implement NetShareEnum_r.
    
    Guenther

commit 029cf4a2a9d95b9c7de6eb75118a92474c0ae9c1
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 16:31:18 2008 +0200

    netapi: implement NetShareGetInfo_r.
    
    Guenther

commit 0166c8f04be1168fe83d7bf3730d3011ffd8c6f6
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 16:18:32 2008 +0200

    netapi: add NetShareGetInfo example code.
    
    Guenther

commit 5c63b181ec698a6134ce31326dab9e6bd232acf0
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 15:59:58 2008 +0200

    netapi: add NetShareGetInfo to public header.
    
    Guenther

commit 237c6e0bca44e19ca89532e565b1345f9f329111
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 15:53:54 2008 +0200

    netapi: add skeleton for NetShareGetInfo.
    
    Guenther

commit dab613e930a9193153cc744e4ad4ea0fa6476b40
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 15:52:19 2008 +0200

    re-run make idl.
    
    Guenther

commit 5d669075295a3adb30c013d1a3b617bf4ced8e73
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 4 15:50:49 2008 +0200

    netapi: add IDL for NetShareGetInfo.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/lib/netapi/examples/Makefile.in             |   14 +-
 .../group_getinfo.c => share/share_getinfo.c}      |   95 ++++--
 .../share/{share_del.c => share_setinfo.c}         |   36 ++-
 source/lib/netapi/libnetapi.c                      |   94 ++++++
 source/lib/netapi/libnetapi.h                      |   17 +
 source/lib/netapi/netapi.h                         |   42 +++
 source/lib/netapi/share.c                          |  351 +++++++++++++++++++-
 source/librpc/gen_ndr/libnetapi.h                  |   44 +++
 source/librpc/gen_ndr/ndr_libnetapi.c              |   96 ++++++
 source/librpc/gen_ndr/ndr_libnetapi.h              |   15 +-
 source/librpc/idl/libnetapi.idl                    |   40 +++-
 11 files changed, 797 insertions(+), 47 deletions(-)
 copy source/lib/netapi/examples/{group/group_getinfo.c => share/share_getinfo.c} (50%)
 copy source/lib/netapi/examples/share/{share_del.c => share_setinfo.c} (71%)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/examples/Makefile.in b/source/lib/netapi/examples/Makefile.in
index ee72a95..0fca4c7 100644
--- a/source/lib/netapi/examples/Makefile.in
+++ b/source/lib/netapi/examples/Makefile.in
@@ -54,7 +54,9 @@ PROGS = bin/getdc at EXEEXT@ \
 	bin/server_getinfo at EXEEXT@ \
 	bin/share_add at EXEEXT@ \
 	bin/share_del at EXEEXT@ \
-	bin/share_enum at EXEEXT@
+	bin/share_enum at EXEEXT@ \
+	bin/share_getinfo at EXEEXT@ \
+	bin/share_setinfo at EXEEXT@
 
 all: $(PROGS)
 
@@ -121,6 +123,8 @@ SERVERGETINFO_OBJ = server/server_getinfo.o $(CMDLINE_OBJ)
 SHAREADD_OBJ = share/share_add.o $(CMDLINE_OBJ)
 SHAREDEL_OBJ = share/share_del.o $(CMDLINE_OBJ)
 SHAREENUM_OBJ = share/share_enum.o $(CMDLINE_OBJ)
+SHAREGETINFO_OBJ = share/share_getinfo.o $(CMDLINE_OBJ)
+SHARESETINFO_OBJ = share/share_setinfo.o $(CMDLINE_OBJ)
 
 bin/getdc at EXEEXT@: $(BINARY_PREREQS) $(GETDC_OBJ)
 	@echo Linking $@
@@ -274,6 +278,14 @@ bin/share_enum at EXEEXT@: $(BINARY_PREREQS) $(SHAREENUM_OBJ)
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(SHAREENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
 
+bin/share_getinfo at EXEEXT@: $(BINARY_PREREQS) $(SHAREGETINFO_OBJ)
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(SHAREGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
+bin/share_setinfo at EXEEXT@: $(BINARY_PREREQS) $(SHARESETINFO_OBJ)
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(SHARESETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
 clean:
 	-rm -f $(PROGS)
 	-rm -f core */*~ *~ \
diff --git a/source/lib/netapi/examples/group/group_getinfo.c b/source/lib/netapi/examples/share/share_getinfo.c
similarity index 50%
copy from source/lib/netapi/examples/group/group_getinfo.c
copy to source/lib/netapi/examples/share/share_getinfo.c
index 2e5b793..5b3bbc3 100644
--- a/source/lib/netapi/examples/group/group_getinfo.c
+++ b/source/lib/netapi/examples/share/share_getinfo.c
@@ -1,6 +1,6 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  NetGroupGetInfo query
+ *  NetShareGetInfo query
  *  Copyright (C) Guenther Deschner 2008
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -32,14 +32,15 @@ int main(int argc, const char **argv)
 	NET_API_STATUS status;
 	struct libnetapi_ctx *ctx = NULL;
 	const char *hostname = NULL;
-	const char *groupname = NULL;
+	const char *sharename = NULL;
+	uint32_t level = 2;
 	uint8_t *buffer = NULL;
-	uint32_t level = 0;
-	struct GROUP_INFO_0 *g0;
-	struct GROUP_INFO_1 *g1;
-	struct GROUP_INFO_2 *g2;
-	struct GROUP_INFO_3 *g3;
-	char *sid_str = NULL;
+
+	struct SHARE_INFO_0 *i0 = NULL;
+	struct SHARE_INFO_1 *i1 = NULL;
+	struct SHARE_INFO_2 *i2 = NULL;
+	struct SHARE_INFO_501 *i501 = NULL;
+	struct SHARE_INFO_1005 *i1005 = NULL;
 
 	poptContext pc;
 	int opt;
@@ -55,9 +56,9 @@ int main(int argc, const char **argv)
 		return status;
 	}
 
-	pc = poptGetContext("group_getinfo", argc, argv, long_options, 0);
+	pc = poptGetContext("share_getinfo", argc, argv, long_options, 0);
 
-	poptSetOtherOptionHelp(pc, "hostname groupname level");
+	poptSetOtherOptionHelp(pc, "hostname sharename level");
 	while((opt = poptGetNextOpt(pc)) != -1) {
 	}
 
@@ -71,53 +72,77 @@ int main(int argc, const char **argv)
 		poptPrintHelp(pc, stderr, 0);
 		goto out;
 	}
-	groupname = poptGetArg(pc);
+	sharename = poptGetArg(pc);
 
 	if (poptPeekArg(pc)) {
 		level = atoi(poptGetArg(pc));
 	}
 
-	/* NetGroupGetInfo */
+	/* NetShareGetInfo */
 
-	status = NetGroupGetInfo(hostname,
-				 groupname,
+	status = NetShareGetInfo(hostname,
+				 sharename,
 				 level,
 				 &buffer);
 	if (status != 0) {
-		printf("NetGroupGetInfo failed with: %s\n",
+		printf("NetShareGetInfo failed with: %s\n",
 			libnetapi_get_error_string(ctx, status));
 		goto out;
 	}
 
 	switch (level) {
 		case 0:
-			g0 = (struct GROUP_INFO_0 *)buffer;
-			printf("name: %s\n", g0->grpi0_name);
+			i0 = (struct SHARE_INFO_0 *)buffer;
+			break;
+		case 1:
+			i1 = (struct SHARE_INFO_1 *)buffer;
+			break;
+		case 2:
+			i2 = (struct SHARE_INFO_2 *)buffer;
+			break;
+		case 501:
+			i501 = (struct SHARE_INFO_501 *)buffer;
+			break;
+		case 1005:
+			i1005 = (struct SHARE_INFO_1005 *)buffer;
+			break;
+
+		default:
+			break;
+	}
+
+	switch (level) {
+		case 0:
+			printf("netname: %s\n", i0->shi0_netname);
 			break;
 		case 1:
-			g1 = (struct GROUP_INFO_1 *)buffer;
-			printf("name: %s\n", g1->grpi1_name);
-			printf("comment: %s\n", g1->grpi1_comment);
+			printf("netname: %s\n", i1->shi1_netname);
+			printf("type: %d\n", i1->shi1_type);
+			printf("remark: %s\n", i1->shi1_remark);
 			break;
 		case 2:
-			g2 = (struct GROUP_INFO_2 *)buffer;
-			printf("name: %s\n", g2->grpi2_name);
-			printf("comment: %s\n", g2->grpi2_comment);
-			printf("group_id: %d\n", g2->grpi2_group_id);
-			printf("attributes: %d\n", g2->grpi2_attributes);
+			printf("netname: %s\n", i2->shi2_netname);
+			printf("type: %d\n", i2->shi2_type);
+			printf("remark: %s\n", i2->shi2_remark);
+			printf("permissions: %d\n", i2->shi2_permissions);
+			printf("max users: %d\n", i2->shi2_max_uses);
+			printf("current users: %d\n", i2->shi2_current_uses);
+			printf("path: %s\n", i2->shi2_path);
+			printf("password: %s\n", i2->shi2_passwd);
+			break;
+		case 501:
+			printf("netname: %s\n", i501->shi501_netname);
+			printf("type: %d\n", i501->shi501_type);
+			printf("remark: %s\n", i501->shi501_remark);
+			printf("flags: %d\n", i501->shi501_flags);
+			break;
+		case 1005:
+			printf("flags: %s\n", i1005->shi1005_flags);
 			break;
-		case 3:
-			g3 = (struct GROUP_INFO_3 *)buffer;
-			printf("name: %s\n", g3->grpi3_name);
-			printf("comment: %s\n", g3->grpi3_comment);
-			if (ConvertSidToStringSid(g3->grpi3_group_sid,
-						  &sid_str)) {
-				printf("group_sid: %s\n", sid_str);
-				free(sid_str);
-			}
-			printf("attributes: %d\n", g3->grpi3_attributes);
+		default:
 			break;
 	}
+	NetApiBufferFree(buffer);
 
  out:
 	libnetapi_free(ctx);
diff --git a/source/lib/netapi/examples/share/share_del.c b/source/lib/netapi/examples/share/share_setinfo.c
similarity index 71%
copy from source/lib/netapi/examples/share/share_del.c
copy to source/lib/netapi/examples/share/share_setinfo.c
index 20e3ce5..f4748f4 100644
--- a/source/lib/netapi/examples/share/share_del.c
+++ b/source/lib/netapi/examples/share/share_setinfo.c
@@ -1,6 +1,6 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  NetShareDel query
+ *  NetShareSetInfo query
  *  Copyright (C) Guenther Deschner 2008
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,12 @@ int main(int argc, const char **argv)
 	struct libnetapi_ctx *ctx = NULL;
 	const char *hostname = NULL;
 	const char *sharename = NULL;
+	const char *comment = "NetApi generated Share comment";
+	uint32_t level = 1004;
+	uint8_t *buffer = NULL;
+	uint32_t parm_err = 0;
+
+	struct SHARE_INFO_1004 i1004;
 
 	poptContext pc;
 	int opt;
@@ -48,9 +54,9 @@ int main(int argc, const char **argv)
 		return status;
 	}
 
-	pc = poptGetContext("share_del", argc, argv, long_options, 0);
+	pc = poptGetContext("share_setinfo", argc, argv, long_options, 0);
 
-	poptSetOtherOptionHelp(pc, "hostname sharename");
+	poptSetOtherOptionHelp(pc, "hostname sharename comment");
 	while((opt = poptGetNextOpt(pc)) != -1) {
 	}
 
@@ -66,13 +72,27 @@ int main(int argc, const char **argv)
 	}
 	sharename = poptGetArg(pc);
 
-	/* NetShareDel */
+	if (poptPeekArg(pc)) {
+		comment = poptGetArg(pc);
+	}
+
+	/* NetShareSetInfo */
+	switch (level) {
+		case 1004:
+			i1004.shi1004_remark = comment;
+			buffer = (uint8_t *)&i1004;
+			break;
+		default:
+			break;
+	}
 
-	status = NetShareDel(hostname,
-			     sharename,
-			     0);
+	status = NetShareSetInfo(hostname,
+				 sharename,
+				 level,
+				 buffer,
+				 &parm_err);
 	if (status != 0) {
-		printf("NetShareDel failed with: %s\n",
+		printf("NetShareSetInfo failed with: %s\n",
 			libnetapi_get_error_string(ctx, status));
 		goto out;
 	}
diff --git a/source/lib/netapi/libnetapi.c b/source/lib/netapi/libnetapi.c
index 3e42254..1f3f2d9 100644
--- a/source/lib/netapi/libnetapi.c
+++ b/source/lib/netapi/libnetapi.c
@@ -1964,3 +1964,97 @@ NET_API_STATUS NetShareEnum(const char * server_name /* [in] */,
 	return r.out.result;
 }
 
+/****************************************************************
+ NetShareGetInfo
+****************************************************************/
+
+NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t **buffer /* [out] [ref] */)
+{
+	struct NetShareGetInfo r;
+	struct libnetapi_ctx *ctx = NULL;
+	NET_API_STATUS status;
+	WERROR werr;
+
+	status = libnetapi_getctx(&ctx);
+	if (status != 0) {
+		return status;
+	}
+
+	/* In parameters */
+	r.in.server_name = server_name;
+	r.in.net_name = net_name;
+	r.in.level = level;
+
+	/* Out parameters */
+	r.out.buffer = buffer;
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(NetShareGetInfo, &r);
+	}
+
+	if (LIBNETAPI_LOCAL_SERVER(server_name)) {
+		werr = NetShareGetInfo_l(ctx, &r);
+	} else {
+		werr = NetShareGetInfo_r(ctx, &r);
+	}
+
+	r.out.result = W_ERROR_V(werr);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(NetShareGetInfo, &r);
+	}
+
+	return r.out.result;
+}
+
+/****************************************************************
+ NetShareSetInfo
+****************************************************************/
+
+NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t *buffer /* [in] [ref] */,
+			       uint32_t *parm_err /* [out] [ref] */)
+{
+	struct NetShareSetInfo r;
+	struct libnetapi_ctx *ctx = NULL;
+	NET_API_STATUS status;
+	WERROR werr;
+
+	status = libnetapi_getctx(&ctx);
+	if (status != 0) {
+		return status;
+	}
+
+	/* In parameters */
+	r.in.server_name = server_name;
+	r.in.net_name = net_name;
+	r.in.level = level;
+	r.in.buffer = buffer;
+
+	/* Out parameters */
+	r.out.parm_err = parm_err;
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(NetShareSetInfo, &r);
+	}
+
+	if (LIBNETAPI_LOCAL_SERVER(server_name)) {
+		werr = NetShareSetInfo_l(ctx, &r);
+	} else {
+		werr = NetShareSetInfo_r(ctx, &r);
+	}
+
+	r.out.result = W_ERROR_V(werr);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(NetShareSetInfo, &r);
+	}
+
+	return r.out.result;
+}
+
diff --git a/source/lib/netapi/libnetapi.h b/source/lib/netapi/libnetapi.h
index d2531a2..00ad4de 100644
--- a/source/lib/netapi/libnetapi.h
+++ b/source/lib/netapi/libnetapi.h
@@ -352,4 +352,21 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx,
 		      struct NetShareEnum *r);
 WERROR NetShareEnum_l(struct libnetapi_ctx *ctx,
 		      struct NetShareEnum *r);
+NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t **buffer /* [out] [ref] */);
+WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx,
+			 struct NetShareGetInfo *r);
+WERROR NetShareGetInfo_l(struct libnetapi_ctx *ctx,
+			 struct NetShareGetInfo *r);
+NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t *buffer /* [in] [ref] */,
+			       uint32_t *parm_err /* [out] [ref] */);
+WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
+			 struct NetShareSetInfo *r);
+WERROR NetShareSetInfo_l(struct libnetapi_ctx *ctx,
+			 struct NetShareSetInfo *r);
 #endif /* __LIBNETAPI_LIBNETAPI__ */
diff --git a/source/lib/netapi/netapi.h b/source/lib/netapi/netapi.h
index 8f1ec84..e9670bb 100644
--- a/source/lib/netapi/netapi.h
+++ b/source/lib/netapi/netapi.h
@@ -1636,6 +1636,48 @@ NET_API_STATUS NetShareEnum(const char * server_name /* [in] */,
 			    uint32_t *total_entries /* [out] [ref] */,
 			    uint32_t *resume_handle /* [in,out] [ref] */);
 
+/************************************************************//**
+ *
+ * NetShareGetInfo
+ *
+ * @brief Get Share Info
+ *
+ * @param[in] server_name The server name to connect to
+ * @param[in] net_name The name of the share to query
+ * @param[in] level The level defining the SHARE_INFO_X structure
+ * @param[out] buffer The buffer containing a SHARE_INFO_X structure
+ * @return NET_API_STATUS
+ *
+ * example share/share_getinfo.c
+ ***************************************************************/
+
+NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t **buffer /* [out] [ref] */);
+
+/************************************************************//**
+ *
+ * NetShareSetInfo
+ *
+ * @brief Set Share Info
+ *
+ * @param[in] server_name The server name to connect to
+ * @param[in] net_name The name of the share to query
+ * @param[in] level The level defining the SHARE_INFO_X structure
+ * @param[in] buffer The buffer containing a SHARE_INFO_X structure
+ * @param[out] parm_err The returned parameter error number if any
+ * @return NET_API_STATUS
+ *
+ * example share/share_setinfo.c
+ ***************************************************************/
+
+NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */,
+			       const char * net_name /* [in] */,
+			       uint32_t level /* [in] */,
+			       uint8_t *buffer /* [in] [ref] */,
+			       uint32_t *parm_err /* [out] [ref] */);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/source/lib/netapi/share.c b/source/lib/netapi/share.c
index d317432..c6af548 100644
--- a/source/lib/netapi/share.c
+++ b/source/lib/netapi/share.c
@@ -27,13 +27,110 @@
 /****************************************************************
 ****************************************************************/
 
+static NTSTATUS map_srvsvc_share_info_to_SHARE_INFO_buffer(TALLOC_CTX *mem_ctx,
+							   uint32_t level,
+							   union srvsvc_NetShareInfo *info,
+							   uint8_t **buffer,
+							   uint32_t *num_shares)
+{
+	struct SHARE_INFO_0 i0;
+	struct SHARE_INFO_1 i1;
+	struct SHARE_INFO_2 i2;
+	struct SHARE_INFO_501 i501;
+	struct SHARE_INFO_1005 i1005;
+
+	struct srvsvc_NetShareInfo0 *s0;
+	struct srvsvc_NetShareInfo1 *s1;
+	struct srvsvc_NetShareInfo2 *s2;
+	struct srvsvc_NetShareInfo501 *s501;
+	struct srvsvc_NetShareInfo1005 *s1005;
+
+	if (!buffer) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	switch (level) {
+		case 0:
+			s0 = info->info0;
+
+			i0.shi0_netname		= talloc_strdup(mem_ctx, s0->name);
+
+			ADD_TO_ARRAY(mem_ctx, struct SHARE_INFO_0, i0,
+				     (struct SHARE_INFO_0 **)buffer,
+				     num_shares);
+			break;
+
+		case 1:
+			s1 = info->info1;
+
+			i1.shi1_netname		= talloc_strdup(mem_ctx, s1->name);
+			i1.shi1_type		= s1->type;
+			i1.shi1_remark		= talloc_strdup(mem_ctx, s1->comment);
+
+			ADD_TO_ARRAY(mem_ctx, struct SHARE_INFO_1, i1,
+				     (struct SHARE_INFO_1 **)buffer,
+				     num_shares);
+			break;
+
+		case 2:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list