PATCH rpc server

Nigel Williams nigel at veritas.com
Mon Jan 21 17:13:03 GMT 2002


This patch contains the rpc server modifications required by the addition of
the share management client code

nigel
-------------- next part --------------
Index: include/rpc_srvsvc.h
===================================================================
RCS file: /cvsroot/samba/source/include/rpc_srvsvc.h,v
retrieving revision 1.20
diff -u -r1.20 rpc_srvsvc.h
--- include/rpc_srvsvc.h	27 Aug 2001 19:46:16 -0000	1.20
+++ include/rpc_srvsvc.h	22 Jan 2002 01:01:22 -0000
@@ -5,6 +5,7 @@
    Copyright (C) Andrew Tridgell 1992-1997
    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
    Copyright (C) Paul Ashton 1997
+   Copyright (C) Nigel Williams 2001
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,24 +25,24 @@
 #ifndef _RPC_SRVSVC_H /* _RPC_SRVSVC_H */
 #define _RPC_SRVSVC_H 
 
-
 /* srvsvc pipe */
-#define SRV_NETCONNENUM        0x08
-#define SRV_NETFILEENUM        0x09
-#define SRV_NETSESSENUM        0x0c
-#define SRV_NET_SHARE_ADD      0x0e
-#define SRV_NETSHAREENUM_ALL   0x0f
-#define SRV_NET_SHARE_GET_INFO 0x10
-#define SRV_NET_SHARE_SET_INFO 0x11
-#define SRV_NET_SHARE_DEL      0x12
-#define SRV_NET_SRV_GET_INFO   0x15
-#define SRV_NET_SRV_SET_INFO   0x16
-#define SRV_NET_DISK_ENUM      0x17
-#define SRV_NET_REMOTE_TOD     0x1c
-#define SRV_NET_NAME_VALIDATE  0x21
-#define SRV_NETSHAREENUM       0x24
-#define SRV_NETFILEQUERYSECDESC 0x27
-#define SRV_NETFILESETSECDESC	0x28
+#define SRV_NETCONNENUM          0x08
+#define SRV_NETFILEENUM          0x09
+#define SRV_NETSESSENUM          0x0c
+#define SRV_NET_SHARE_ADD        0x0e
+#define SRV_NETSHAREENUM         0x0f
+#define SRV_NET_SHARE_GET_INFO   0x10
+#define SRV_NET_SHARE_SET_INFO   0x11
+#define SRV_NET_SHARE_DEL        0x12
+#define SRV_NET_SHARE_DEL_STICKY 0x13
+#define SRV_NET_SRV_GET_INFO     0x15
+#define SRV_NET_SRV_SET_INFO     0x16
+#define SRV_NET_SRV_DISK_ENUM    0x17
+#define SRV_NET_REMOTE_TOD       0x1c
+#define SRV_NET_NAME_VALIDATE    0x21
+#define SRV_NETSHAREENUM_STICKY  0x24
+#define SRV_NETFILEQUERYSECDESC  0x27
+#define SRV_NETFILESETSECDESC	 0x28
 
 #define MAX_SERVER_DISK_ENTRIES 15
 
@@ -55,7 +56,7 @@
 	uint32 entries_read;
 	uint32 unknown;
 	uint32 disk_info_ptr;
-	DISK_INFO disk_info[MAX_SERVER_DISK_ENTRIES];
+	DISK_INFO *disk_info;
 } DISK_ENUM_CONTAINER;
 
 typedef struct net_srv_disk_enum {
@@ -67,13 +68,13 @@
 	uint32 preferred_len;        /* preferred maximum length (0xffff ffff) */
 	uint32 total_entries;        /* total number of entries */
 	ENUM_HND enum_hnd;
-	NTSTATUS status;               /* return status */
-} SRV_Q_NET_DISK_ENUM, SRV_R_NET_DISK_ENUM;
+	NTSTATUS status;             /* return status */
+} SRV_Q_NET_SRV_DISK_ENUM, SRV_R_NET_SRV_DISK_ENUM;
 
 typedef struct net_name_validate {
 	uint32 ptr_srv_name;
 	UNISTR2 uni_srv_name;
-	UNISTR2 uni_name; /*name to validate*/
+	UNISTR2 uni_name;      /*name to validate*/
 	uint32 type;
 	uint32 flags;
 	NTSTATUS status;
@@ -100,9 +101,9 @@
 /* SRV_SESS_INFO_0 */
 typedef struct srv_sess_info_0_info
 {
-	uint32 num_entries_read;                     /* EntriesRead */
-	uint32 ptr_sess_info;                       /* Buffer */
-	uint32 num_entries_read2;                    /* EntriesRead */
+	uint32 num_entries_read;                      /* EntriesRead */
+	uint32 ptr_sess_info;                         /* Buffer */
+	uint32 num_entries_read2;                     /* EntriesRead */
 
 	SESS_INFO_0     info_0    [MAX_SESS_ENTRIES]; /* session entry pointers */
 	SESS_INFO_0_STR info_0_str[MAX_SESS_ENTRIES]; /* session entry strings */
@@ -133,9 +134,9 @@
 /* SRV_SESS_INFO_1 */
 typedef struct srv_sess_info_1_info
 {
-	uint32 num_entries_read;                     /* EntriesRead */
-	uint32 ptr_sess_info;                       /* Buffer */
-	uint32 num_entries_read2;                    /* EntriesRead */
+	uint32 num_entries_read;                      /* EntriesRead */
+	uint32 ptr_sess_info;                         /* Buffer */
+	uint32 num_entries_read2;                     /* EntriesRead */
 
 	SESS_INFO_1     info_1    [MAX_SESS_ENTRIES]; /* session entry pointers */
 	SESS_INFO_1_STR info_1_str[MAX_SESS_ENTRIES]; /* session entry strings */
@@ -148,11 +149,11 @@
 	uint32 switch_value;         /* switch value */
 	uint32 ptr_sess_ctr;       /* pointer to sess info union */
 	union
-    {
+	{
 		SRV_SESS_INFO_0 info0; /* session info level 0 */
 		SRV_SESS_INFO_1 info1; /* session info level 1 */
-
-    } sess;
+    
+	} sess;
 
 } SRV_SESS_INFO_CTR;
 
@@ -251,11 +252,11 @@
 	uint32 switch_value;         /* switch value */
 	uint32 ptr_conn_ctr;       /* pointer to conn info union */
 	union
-    {
+	{
 		SRV_CONN_INFO_0 info0; /* connection info level 0 */
 		SRV_CONN_INFO_1 info1; /* connection info level 1 */
 
-    } conn;
+	} conn;
 
 } SRV_CONN_INFO_CTR;
 
@@ -292,20 +293,45 @@
 
 } SRV_R_NET_CONN_ENUM;
 
+/* SH_INFO_0 */
+typedef struct ptr_share_info0
+{
+	uint32 ptr_netname; /* pointer to net name. */
+} SH_INFO_0;
+
+/* SH_INFO_0_STR (level 0 share info strings) */
+typedef struct str_share_info0
+{
+        SH_INFO_0 *ptrs;
+
+	UNISTR2 uni_netname; /* unicode string of net name */
+
+} SH_INFO_0_STR;
+
+/* SRV_SHARE_INFO_0 */
+typedef struct share_info_0_info
+{
+	SH_INFO_0 info_0;
+	SH_INFO_0_STR info_0_str;
+
+} SRV_SHARE_INFO_0;
+
 /* SH_INFO_1 (pointers to level 1 share info strings) */
 typedef struct ptr_share_info1
 {
 	uint32 ptr_netname; /* pointer to net name. */
-	uint32 type; /* ipc, print, disk ... */
-	uint32 ptr_remark; /* pointer to comment. */
+	uint32 type;        /* ipc, print, disk ... */
+	uint32 ptr_remark;  /* pointer to comment. */
 
 } SH_INFO_1;
 
 /* SH_INFO_1_STR (level 1 share info strings) */
 typedef struct str_share_info1
 {
+        SH_INFO_1 *ptrs;
+
 	UNISTR2 uni_netname; /* unicode string of net name */
-	UNISTR2 uni_remark; /* unicode string of comment */
+	UNISTR2 uni_remark;  /* unicode string of comment */
 
 } SH_INFO_1_STR;
 
@@ -321,19 +347,21 @@
 typedef struct ptr_share_info2
 {
 	uint32 ptr_netname; /* pointer to net name. */
-	uint32 type; /* ipc, print, disk ... */
-	uint32 ptr_remark; /* pointer to comment. */
-	uint32 perms;      /* permissions */
-	uint32 max_uses;   /* maximum uses */
-	uint32 num_uses;   /* current uses */
-	uint32 ptr_path;   /* pointer to path name */
-	uint32 ptr_passwd; /* pointer to password */
+	uint32 type;        /* ipc, print, disk ... */
+	uint32 ptr_remark;  /* pointer to comment. */
+	uint32 perms;       /* permissions */
+	uint32 max_uses;    /* maximum uses */
+	uint32 num_uses;    /* current uses */
+	uint32 ptr_path;    /* pointer to path name */
+	uint32 ptr_passwd;  /* pointer to password */
 
 } SH_INFO_2;
 
 /* SH_INFO_2_STR (level 2 share info strings) */
 typedef struct str_share_info2
 {
+	SH_INFO_2 *ptrs;
+
 	UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */
 	UNISTR2 uni_remark;  /* unicode string of comment (e.g "Logon server share") */
 	UNISTR2 uni_path;    /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */
@@ -349,19 +377,49 @@
 
 } SRV_SHARE_INFO_2;
 
+/* SH_INFO_501 (pointers to level 501 share info strings) */
+typedef struct ptr_share_info501
+{
+	uint32 ptr_netname; /* pointer to net name. */
+	uint32 type;        /* ipc, print, disk ... */
+	uint32 ptr_remark;  /* pointer to comment. */
+        uint32 flags;
+
+} SH_INFO_501;
+
+/* SH_INFO_501_STR (level 501 share info strings) */
+typedef struct str_share_info501
+{
+	SH_INFO_501 *ptrs;
+
+	UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */
+	UNISTR2 uni_remark;  /* unicode string of comment (e.g "Logon server share") */
+
+} SH_INFO_501_STR;
+
+/* SRV_SHARE_INFO_501 */
+typedef struct share_info_501_info
+{
+	SH_INFO_501 info_501;
+	SH_INFO_501_STR info_501_str;
+
+} SRV_SHARE_INFO_501;
+
 /* SH_INFO_502 (pointers to level 502 share info strings) */
 typedef struct ptr_share_info502
 {
 	uint32 ptr_netname; /* pointer to net name. */
-	uint32 type; /* ipc, print, disk ... */
-	uint32 ptr_remark; /* pointer to comment. */
-	uint32 perms;      /* permissions */
-	uint32 max_uses;   /* maximum uses */
-	uint32 num_uses;   /* current uses */
-	uint32 ptr_path;   /* pointer to path name */
-	uint32 ptr_passwd; /* pointer to password */
-	uint32 sd_size;    /* size of security descriptor */
-	uint32 ptr_sd;     /* pointer to security descriptor */
+	uint32 type;        /* ipc, print, disk ... */
+	uint32 ptr_remark;  /* pointer to comment. */
+	uint32 perms;       /* permissions */
+	uint32 max_uses;    /* maximum uses */
+	uint32 num_uses;    /* current uses */
+	uint32 ptr_path;    /* pointer to path name */
+	uint32 ptr_passwd;  /* pointer to password */
+        uint32 reserved;    /* this holds the space taken by the sd in the rpc packet */
+        uint32 reserved_offset;   /* required for _post operation when marshalling */
+	uint32 sd_size;     /* size of security descriptor */
+	uint32 ptr_sd;      /* pointer to security descriptor */
 
 } SH_INFO_502;
 
@@ -375,6 +433,7 @@
 	UNISTR2 uni_path;    /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */
 	UNISTR2 uni_passwd;  /* unicode string of password - presumably for share level security (e.g NULL) */
 
+        uint32 reserved;
 	uint32 sd_size;
 	SEC_DESC *sd;
 
@@ -388,12 +447,57 @@
 
 } SRV_SHARE_INFO_502;
 
-/* SRV_SHARE_INFO_1005 */
+typedef struct ptr_share_info1004
+{
+	uint32 ptr_remark;
+
+} SH_INFO_1004;
+
+typedef struct str_share_info1004
+{
+	SH_INFO_1004 *ptrs;
+
+	UNISTR2 uni_remark;
+
+} SH_INFO_1004_STR;
+
+typedef struct ptr_info_1004_info
+{
+	SH_INFO_1004     info_1004; 
+	SH_INFO_1004_STR info_1004_str; 
+} SRV_SHARE_INFO_1004;
+
 typedef struct share_info_1005_info
 {
-  uint32 dfs_root_flag; 
+	uint32 dfs_root_flag; 
 } SRV_SHARE_INFO_1005;
 
+typedef struct share_info_1006_info
+{
+	uint32 max_uses; 
+} SRV_SHARE_INFO_1006;
+
+typedef struct ptr_share_info1007
+{
+	uint32 flags;
+	uint32 ptr_AlternateDirectoryName;
+
+} SH_INFO_1007;
+
+typedef struct str_share_info1007
+{
+	SH_INFO_1007 *ptrs;
+
+	UNISTR2 uni_AlternateDirectoryName;
+
+} SH_INFO_1007_STR;
+
+typedef struct ptr_info_1007_info
+{
+	SH_INFO_1007     info_1007; 
+	SH_INFO_1007_STR info_1007_str; 
+} SRV_SHARE_INFO_1007;
+
 /* SRV_SHARE_INFO_1501 */
 typedef struct share_info_1501_info
 {
@@ -412,9 +516,16 @@
 	uint32 num_entries2;
 
 	union {
-		SRV_SHARE_INFO_1 *info1; /* share info level 1 */
-		SRV_SHARE_INFO_2 *info2; /* share info level 2 */
-		SRV_SHARE_INFO_502 *info502; /* share info level 502 */
+		SRV_SHARE_INFO_0    *info0;
+		SRV_SHARE_INFO_1    *info1;
+		SRV_SHARE_INFO_2    *info2;
+		SRV_SHARE_INFO_501  *info501;
+		SRV_SHARE_INFO_502  *info502;
+		SRV_SHARE_INFO_1004 *info1004;
+		SRV_SHARE_INFO_1005 *info1005;
+		SRV_SHARE_INFO_1006 *info1006;
+		SRV_SHARE_INFO_1007 *info1007;
+		SRV_SHARE_INFO_1501 *info1501;
 		void *info;
 
 	} share;
@@ -427,7 +538,7 @@
 	uint32 ptr_srv_name;         /* pointer (to server name?) */
 	UNISTR2 uni_srv_name;        /* server name */
 
-	SRV_SHARE_INFO_CTR ctr;     /* share info container */
+	SRV_SHARE_INFO_CTR ctr;      /* share info container */
 
 	uint32 preferred_len;        /* preferred maximum length (0xffff ffff) */
 
@@ -435,20 +546,18 @@
 
 } SRV_Q_NET_SHARE_ENUM;
 
-
 /* SRV_R_NET_SHARE_ENUM */
 typedef struct r_net_share_enum_info
 {
 	SRV_SHARE_INFO_CTR ctr;     /* share info container */
 
-	uint32 total_entries;                    /* total number of entries */
+	uint32 total_entries;       /* total number of entries */
 	ENUM_HND enum_hnd;
 
-	NTSTATUS status;               /* return status */
+	NTSTATUS status;            /* return status */
 
 } SRV_R_NET_SHARE_ENUM;
 
-
 /* SRV_Q_NET_SHARE_GET_INFO */
 typedef struct q_net_share_get_info_info
 {
@@ -460,19 +569,22 @@
 
 } SRV_Q_NET_SHARE_GET_INFO;
 
-/* JRA. NB. We also need level 1004 and 1006 here. */
-
 /* SRV_SHARE_INFO */
 typedef struct srv_share_info {
 	uint32 switch_value;
 	uint32 ptr_share_ctr;
 
 	union {
-		SRV_SHARE_INFO_1 info1;
-		SRV_SHARE_INFO_2 info2;
-		SRV_SHARE_INFO_502 info502;
-        SRV_SHARE_INFO_1005 info1005;
-        SRV_SHARE_INFO_1501 info1501;
+		SRV_SHARE_INFO_0    info0;
+		SRV_SHARE_INFO_1    info1;
+		SRV_SHARE_INFO_2    info2;
+		SRV_SHARE_INFO_501  info501;
+		SRV_SHARE_INFO_502  info502;
+		SRV_SHARE_INFO_1004 info1004;
+		SRV_SHARE_INFO_1005 info1005;
+		SRV_SHARE_INFO_1006 info1006;
+		SRV_SHARE_INFO_1007 info1007;
+		SRV_SHARE_INFO_1501 info1501;
 	} share;
 } SRV_SHARE_INFO;
 
@@ -494,15 +606,19 @@
 	uint32 info_level;
 
 	SRV_SHARE_INFO info;
+        
+        uint32 ptr_parm_error;
+        uint32 parm_error;
 
 } SRV_Q_NET_SHARE_SET_INFO;
 
 /* SRV_R_NET_SHARE_SET_INFO */
 typedef struct r_net_share_set_info
 {
-	uint32 switch_value;         /* switch value */
+        uint32 ptr_parm_error;
+        uint32 parm_error;
 
-	NTSTATUS status;               /* return status */
+        NTSTATUS status;               /* return status */
 
 } SRV_R_NET_SHARE_SET_INFO;
 
@@ -516,12 +632,17 @@
 
 	SRV_SHARE_INFO info;
 
+        uint32 ptr_parm_error;
+        uint32 parm_error;
+
 } SRV_Q_NET_SHARE_ADD;
 
 /* SRV_R_NET_SHARE_ADD */
 typedef struct r_net_share_add
 {
-	uint32 switch_value;         /* switch value */
+
+        uint32 ptr_parm_error;
+        uint32 parm_error;
 
 	NTSTATUS status;               /* return status */
 
@@ -533,6 +654,7 @@
 	uint32 ptr_srv_name;
 	UNISTR2 uni_srv_name;
 	UNISTR2 uni_share_name;
+        uint32 reserved;
 
 } SRV_Q_NET_SHARE_DEL;
 
@@ -540,7 +662,6 @@
 typedef struct r_net_share_del
 {
 	NTSTATUS status;               /* return status */
-
 } SRV_R_NET_SHARE_DEL;
 
 /* FILE_INFO_3 (level 3 file info strings) */
@@ -583,12 +704,12 @@
 typedef struct srv_file_info_3_info
 {
 	uint32 switch_value;         /* switch value */
-	uint32 ptr_file_ctr;       /* pointer to file info union */
+	uint32 ptr_file_ctr;         /* pointer to file info union */
 	union
-    {
+	{
 		SRV_FILE_INFO_3 info3; /* file info with 0 entries */
 
-    } file;
+	} file;
 
 } SRV_FILE_INFO_CTR;
 
@@ -681,12 +802,12 @@
 	uint32 switch_value;         /* switch value */
 	uint32 ptr_srv_ctr;         /* pointer to server info */
 	union
-    {
+	{
 		SRV_INFO_102 sv102; /* server info level 102 */
 		SRV_INFO_101 sv101; /* server info level 101 */
 		SRV_INFO_100 sv100; /* server info level 100 */
 
-    } srv;
+	} srv;
 
 } SRV_INFO_CTR;
 
Index: rpc_parse/parse_srv.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_parse/parse_srv.c,v
retrieving revision 1.44
diff -u -r1.44 parse_srv.c
--- rpc_parse/parse_srv.c	2 Oct 2001 04:29:39 -0000	1.44
+++ rpc_parse/parse_srv.c	22 Jan 2002 01:01:22 -0000
@@ -6,6 +6,7 @@
  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
  *  Copyright (C) Paul Ashton                       1997.
  *  Copyright (C) Jeremy Allison		    1999.
+ *  Copyright (C) Nigel Williams		    2001.
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -25,6 +26,71 @@
 #include "includes.h"
 
 /*******************************************************************
+ Inits a SH_INFO_0_STR structure
+********************************************************************/
+
+void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name)
+{
+	DEBUG(5,("init_srv_share_info0_str\n"));
+
+	if(net_name)
+		init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1);
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth)
+{
+	if (sh0 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info0_str");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+	if(sh0->ptrs->ptr_netname)
+		if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth))
+			return False;
+
+	return True;
+}
+
+/*******************************************************************
+ makes a SH_INFO_0 structure
+********************************************************************/
+
+void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name)
+{
+	DEBUG(5,("init_srv_share_info0: %s\n", net_name));
+
+	sh0->ptr_netname = (net_name != NULL) ? 1 : 0;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth)
+{
+	if (sh0 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info0");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname))
+		return False;
+
+	return True;
+}
+
+/*******************************************************************
  Inits a SH_INFO_1_STR structure
 ********************************************************************/
 
@@ -32,8 +98,10 @@
 {
 	DEBUG(5,("init_srv_share_info1_str\n"));
 
-	init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
-	init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
+	if(net_name)
+		init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
+	if(remark)
+		init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
 }
 
 /*******************************************************************
@@ -50,13 +118,17 @@
 
 	if(!prs_align(ps))
 		return False;
-	if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
-		return False;
+
+	if(sh1->ptrs->ptr_netname)
+		if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
+			return False;
 
 	if(!prs_align(ps))
 		return False;
-	if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
-		return False;
+
+	if(sh1->ptrs->ptr_remark)
+		if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
+			return False;
 
 	return True;
 }
@@ -109,10 +181,14 @@
 {
 	DEBUG(5,("init_srv_share_info2_str\n"));
 
-	init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
-	init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
-	init_unistr2(&sh2->uni_path, path, strlen(path)+1);
-	init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
+	if(net_name)
+		init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
+	if(remark)
+		init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
+	if(path)
+		init_unistr2(&sh2->uni_path, path, strlen(path)+1);
+	if(passwd)
+		init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
 }
 
 /*******************************************************************
@@ -129,23 +205,32 @@
 
 	if(!prs_align(ps))
 		return False;
-	if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
-		return False;
+
+	if(sh2->ptrs->ptr_netname)
+	  if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
+	    return False;
 
 	if(!prs_align(ps))
-		return False;
-	if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
-		return False;
+	  return False;
+
+	if(sh2->ptrs->ptr_remark)
+	  if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
+	    return False;
 
 	if(!prs_align(ps))
-		return False;
-	if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
-		return False;
+	  return False;
+
+	
+	if(sh2->ptrs->ptr_path)
+	  if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
+	    return False;
 
 	if(!prs_align(ps))
-		return False;
-	if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
-		return False;
+	  return False;
+
+	if(sh2->ptrs->ptr_passwd)
+	  if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
+	    return False;
 
 	return True;
 }
@@ -155,9 +240,9 @@
 ********************************************************************/
 
 void init_srv_share_info2(SH_INFO_2 *sh2,
-				char *net_name, uint32 type, char *remark,
-				uint32 perms, uint32 max_uses, uint32 num_uses,
-				char *path, char *passwd)
+			  char *net_name, uint32 type, char *remark,
+			  uint32 perms, uint32 max_uses, uint32 num_uses,
+			  char *path, char *passwd)
 {
 	DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
 
@@ -167,7 +252,6 @@
 	sh2->perms       = perms;
 	sh2->max_uses    = max_uses;
 	sh2->num_uses    = num_uses;
-	sh2->type        = type;
 	sh2->ptr_path    = (path != NULL) ? 1 : 0;
 	sh2->ptr_passwd  = (passwd != NULL) ? 1 : 0;
 }
@@ -208,13 +292,99 @@
 }
 
 /*******************************************************************
+ Inits a SH_INFO_501_STR structure
+********************************************************************/
+
+void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
+				char *net_name, char *remark)
+{
+	DEBUG(5,("init_srv_share_info501_str\n"));
+
+	if(net_name)
+		init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1);
+	if(remark)
+		init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1);
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth)
+{
+	if (sh501 == NULL)
+	  return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info501_str");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(sh501->ptrs->ptr_netname)
+	  if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth))
+	    return False;
+
+	if(!prs_align(ps))
+	  return False;
+
+	if(sh501->ptrs->ptr_remark)
+	  if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth))
+	    return False;
+
+	return True;
+}
+
+/*******************************************************************
+ Inits a SH_INFO_501 structure
+********************************************************************/
+
+void init_srv_share_info501(SH_INFO_501 *sh501,
+			    char *net_name, uint32 type, char *remark, uint32 flags)
+{
+	DEBUG(5,("init_srv_share_info501: %s %8x %s\n", net_name, type, remark));
+
+	sh501->ptr_netname = (net_name != NULL) ? 1 : 0;
+	sh501->type        = type;
+	sh501->ptr_remark  = (remark != NULL) ? 1 : 0;
+	sh501->flags       = flags;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth)
+{
+	if (sh501 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info501");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname))
+		return False;
+	if(!prs_uint32("type       ", ps, depth, &sh501->type))
+		return False;
+	if(!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark))
+		return False;
+	if(!prs_uint32("flags      ", ps, depth, &sh501->flags))
+		return False;
+
+	return True;
+}
+
+/*******************************************************************
  Inits a SH_INFO_502 structure
 ********************************************************************/
 
 void init_srv_share_info502(SH_INFO_502 *sh502,
-				char *net_name, uint32 type, char *remark,
-				uint32 perms, uint32 max_uses, uint32 num_uses,
-				char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
+			    char *net_name, uint32 type, char *remark,
+			    uint32 perms, uint32 max_uses, uint32 num_uses,
+			    char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
 {
 	DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
 
@@ -226,9 +396,9 @@
 	sh502->perms       = perms;
 	sh502->max_uses    = max_uses;
 	sh502->num_uses    = num_uses;
-	sh502->type        = type;
 	sh502->ptr_path    = (path != NULL) ? 1 : 0;
 	sh502->ptr_passwd  = (passwd != NULL) ? 1 : 0;
+	sh502->reserved    = 0;  /* actual size within rpc */
 	sh502->sd_size     = (uint32)sd_size;
 	sh502->ptr_sd      = (psd != NULL) ? 1 : 0;
 }
@@ -264,7 +434,7 @@
 		return False;
 	if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
 		return False;
-	if(!prs_uint32("sd_size    ", ps, depth, &sh502->sd_size))
+	if(!prs_uint32_pre("reserved   ", ps, depth, &sh502->reserved, &sh502->reserved_offset))
 		return False;
 	if(!prs_uint32("ptr_sd     ", ps, depth, &sh502->ptr_sd))
 		return False;
@@ -277,26 +447,22 @@
 ********************************************************************/
 
 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
-				SH_INFO_502 *ptrs,
 				char *net_name, char *remark,
 				char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
 {
 	DEBUG(5,("init_srv_share_info502_str\n"));
 
-	sh502str->ptrs = ptrs;
-
-	if(sh502str->ptrs->ptr_netname)
+	if(net_name)
 		init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
-	if(sh502str->ptrs->ptr_remark)
+	if(remark)
 		init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
-	if(sh502str->ptrs->ptr_path)
+	if(path)
 		init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
-	if(sh502str->ptrs->ptr_passwd)
+	if(passwd)
 		init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
-	if(sh502str->ptrs->ptr_sd) {
-		sh502str->sd = psd;
-		sh502str->sd_size = sd_size;
-	}
+	sh502str->sd = psd;
+	sh502str->reserved = 0;
+	sh502str->sd_size  = sd_size;
 }
 
 /*******************************************************************
@@ -347,11 +513,103 @@
 		return False;
 
 	if(sh502->ptrs->ptr_sd) {
-		if(!prs_uint32("sd_size   ", ps, depth, &sh502->sd_size))
-			return False;
-		if (!sec_io_desc(desc, &sh502->sd, ps, depth))
-			return False;
+	  uint32 old_offset;
+	  uint32 reserved_offset;
+
+	  if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset))
+	    return False;
+	  
+	  old_offset = prs_offset(ps);
+	  
+	  if (!sec_io_desc(desc, &sh502->sd, ps, depth))
+	    return False;
+
+	  if(UNMARSHALLING(ps)) {
+
+	    sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
+
+	    prs_set_offset(ps, old_offset + sh502->reserved);
+	  }
+
+	  prs_align(ps);
+
+	  if(MARSHALLING(ps)) {
+
+	    sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
+	  }
+	    
+	  if(!prs_uint32_post("reserved ", ps, depth, 
+			      &sh502->reserved, reserved_offset, sh502->reserved))
+	    return False;
+	  if(!prs_uint32_post("reserved ", ps, depth, 
+			      &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
+	    return False;
 	}
+	
+	return True;
+}
+
+/*******************************************************************
+ Inits a SH_INFO_1004_STR structure
+********************************************************************/
+
+void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark)
+{
+	DEBUG(5,("init_srv_share_info1004_str\n"));
+
+	if(remark)
+		init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1);
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
+{
+	if (sh1004 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+	if(sh1004->ptrs->ptr_remark)
+		if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
+			return False;
+
+	return True;
+}
+
+/*******************************************************************
+ makes a SH_INFO_1004 structure
+********************************************************************/
+
+void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark)
+{
+	DEBUG(5,("init_srv_share_info1004: %s\n", remark));
+
+	sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
+{
+	if (sh1004 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info1004");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
+		return False;
 
 	return True;
 }
@@ -360,8 +618,7 @@
  Reads or writes a structure.
 ********************************************************************/
 
-static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005,
-				  prs_struct* ps, int depth)
+static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
 {
 	if(sh1005 == NULL)
 		return False;
@@ -382,6 +639,95 @@
  Reads or writes a structure.
 ********************************************************************/
 
+static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
+{
+	if(sh1006 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info1006");
+		depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("max uses     ", ps, depth, &sh1006->max_uses))
+		return False;
+
+	return True;
+}   
+
+/*******************************************************************
+ Inits a SH_INFO_1007_STR structure
+********************************************************************/
+
+void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
+{
+	DEBUG(5,("init_srv_share_info1007_str\n"));
+
+	if(alternate_directory_name)
+		init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1);
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
+{
+	if (sh1007 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+	if(sh1007->ptrs->ptr_AlternateDirectoryName)
+	  if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
+	    return False;
+
+	return True;
+}
+
+/*******************************************************************
+ makes a SH_INFO_1007 structure
+********************************************************************/
+
+void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
+{
+	DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
+
+	sh1007->flags                      = flags;
+	sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
+static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
+{
+	if (sh1007 == NULL)
+		return False;
+
+	prs_debug(ps, depth, desc, "srv_io_share_info1007");
+	depth++;
+
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("flags      ", ps, depth, &sh1007->flags))
+		return False;
+	if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
+		return False;
+
+	return True;
+}
+
+/*******************************************************************
+ Reads or writes a structure.
+********************************************************************/
+
 static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501,
 				  prs_struct* ps, int depth)
 {
@@ -422,8 +768,11 @@
 	if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
 		return False;
 
+#if 0
+	/* level 0 is infact valid */
 	if (ctr->info_level == 0)
 		return True;
+#endif
 
 	if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
 		return False;
@@ -452,6 +801,33 @@
 		return False;
 
 	switch (ctr->switch_value) {
+
+	case 0:
+	{
+		SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0))))
+				return False;
+			ctr->share.info0 = info0;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
+				return False;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			info0[i].info_0_str.ptrs = &info0[i].info_0;
+			if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
 	case 1:
 	{
 		SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
@@ -470,6 +846,7 @@
 		}
 
 		for (i = 0; i < num_entries; i++) {
+			info1[i].info_1_str.ptrs = &info1[i].info_1;
 			if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
 				return False;
 		}
@@ -495,6 +872,7 @@
 		}
 
 		for (i = 0; i < num_entries; i++) {
+			info2[i].info_2_str.ptrs = &info2[i].info_2;
 			if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth))
 				return False;
 		}
@@ -502,6 +880,32 @@
 		break;
 	}
 
+	case 501:
+	{
+		SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info501 = (SRV_SHARE_INFO_501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_501))))
+				return False;
+			ctr->share.info501 = info501;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info501("", &info501[i].info_501, ps, depth))
+				return False;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			info501[i].info_501_str.ptrs = &info501[i].info_501;
+			if(!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
 	case 502:
 	{
 		SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
@@ -528,6 +932,118 @@
 		break;
 	}
 
+	case 1004:
+	{
+		SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004))))
+				return False;
+			ctr->share.info1004 = info1004;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
+				return False;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
+			if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
+	case 1005:
+	{
+		SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005))))
+				return False;
+			ctr->share.info1005 = info1005;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info1005("", &info1005[i], ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
+	case 1006:
+	{
+		SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006))))
+				return False;
+			ctr->share.info1006 = info1006;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info1006("", &info1006[i], ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
+	case 1007:
+	{
+		SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007))))
+				return False;
+			ctr->share.info1007 = info1007;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
+				return False;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
+			if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
+	case 1501:
+	{
+		SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
+		int num_entries = ctr->num_entries;
+		int i;
+
+		if (UNMARSHALLING(ps)) {
+			if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501))))
+				return False;
+			ctr->share.info1501 = info1501;
+		}
+
+		for (i = 0; i < num_entries; i++) {
+			if(!srv_io_share_info1501("", &info1501[i], ps, depth))
+				return False;
+		}
+
+		break;
+	}
+
 	default:
 		DEBUG(5,("%s no share info at switch_value %d\n",
 			 tab_depth(depth), ctr->switch_value));
@@ -551,7 +1067,10 @@
 	init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
 
 	q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
-	q_n->ctr.ptr_share_info = 0;
+	q_n->ctr.ptr_share_info = 1;
+	q_n->ctr.num_entries  = 0;
+	q_n->ctr.ptr_entries  = 0;
+	q_n->ctr.num_entries2 = 0;
 	q_n->preferred_len = preferred_len;
 
 	memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
@@ -612,8 +1131,12 @@
 
 	if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
 		return False;
-	if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
-		return False;
+
+	if(r_n->total_entries != 0) {
+	  if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
+	    return False;
+	}
+
 	if(!prs_ntstatus("status     ", ps, depth, &r_n->status))
 		return False;
 
@@ -621,6 +1144,25 @@
 }
 
 /*******************************************************************
+ initialises a structure.
+********************************************************************/
+
+BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level)
+{
+
+	uint32 ptr_share_name;
+
+	DEBUG(5,("init_srv_q_net_share_get_info\n"));
+
+	init_buf_unistr2(&q_n->uni_srv_name,   &q_n->ptr_srv_name, srv_name);
+	init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name,    share_name);
+
+	q_n->info_level = info_level;
+
+	return True;
+}
+
+/*******************************************************************
  Reads or writes a structure.
 ********************************************************************/
 
@@ -675,10 +1217,24 @@
 
 	if (r_n->ptr_share_ctr != 0) {
 		switch (r_n->switch_value) {
+		case 0:
+			if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
+				return False;
+
+			/* allow access to pointers in the str part. */
+			r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
+
+			if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
+				return False;
+
+			break;
 		case 1:
 			if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
 				return False;
 
+			/* allow access to pointers in the str part. */
+			r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
+
 			if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
 				return False;
 
@@ -687,24 +1243,61 @@
 			if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
 				return False;
 
+			/* allow access to pointers in the str part. */
+			r_n->share.info2.info_2_str.ptrs = &r_n->share.info2.info_2;
+
 			if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth))
 				return False;
 
 			break;
+		case 501:
+			if(!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
+				return False;
+
+			/* allow access to pointers in the str part. */
+			r_n->share.info501.info_501_str.ptrs = &r_n->share.info501.info_501;
+
+			if(!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
+				return False;
+			break;
 		case 502:
 			if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
 				return False;
 
-			/*allow access to pointers in the str part. */
+			/* allow access to pointers in the str part. */
 			r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
 
 			if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
 				return False;
 			break;
+		case 1004:
+			if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
+				return False;
+
+			/* allow access to pointers in the str part. */
+			r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
+
+			if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
+				return False;
+			break;
 		case 1005:
 			if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
 				return False;  		
 			break;
+		case 1006:
+			if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
+				return False;  		
+			break;
+		case 1007:
+			if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
+				return False;
+
+			/* allow access to pointers in the str part. */
+			r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
+
+			if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
+				return False;
+			break;
 		case 1501:
 			if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
 				return False;
@@ -746,6 +1339,34 @@
 }
 
 /*******************************************************************
+ intialises a structure.
+********************************************************************/
+
+BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, 
+				   const char *srv_name, 
+				   const char *share_name, 
+				   uint32 info_level, 
+				   const SRV_SHARE_INFO *info) 
+{
+
+	uint32 ptr_share_name;
+
+	DEBUG(5,("init_srv_q_net_share_set_info\n"));
+
+	init_buf_unistr2(&q_n->uni_srv_name,   &q_n->ptr_srv_name, srv_name);
+	init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name,    share_name);
+
+	q_n->info_level = info_level;
+  
+	q_n->info = *info;
+
+	q_n->ptr_parm_error = 1;
+	q_n->parm_error     = 0;
+
+	return True;
+}
+
+/*******************************************************************
  Reads or writes a structure.
 ********************************************************************/
 
@@ -780,6 +1401,15 @@
 	if(!srv_io_srv_share_info("info  ", ps, depth, &q_n->info))
 		return False;
 
+	if(!prs_align(ps))
+		return False;
+	if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
+		return False;
+	if(q_n->ptr_parm_error!=0) {
+	  if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
+	    return False;
+	}
+
 	return True;
 }
 
@@ -787,9 +1417,9 @@
  Reads or writes a structure.
 ********************************************************************/
 
-BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
+BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
 {
-	if (q_n == NULL)
+	if (r_n == NULL)
 		return False;
 
 	prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
@@ -798,15 +1428,39 @@
 	if(!prs_align(ps))
 		return False;
 
-	if(!prs_uint32("switch_value  ", ps, depth, &q_n->switch_value))
+	if(!prs_uint32("ptr_parm_error  ", ps, depth, &r_n->ptr_parm_error))
 		return False;
-	if(!prs_ntstatus("status        ", ps, depth, &q_n->status))
+
+	if(r_n->ptr_parm_error) {
+
+	  if(!prs_uint32("parm_error  ", ps, depth, &r_n->parm_error))
+	    return False;
+	}
+
+	if(!prs_ntstatus("status        ", ps, depth, &r_n->status))
 		return False;
 
 	return True;
 }	
 
 /*******************************************************************
+ initialises a structure.
+********************************************************************/
+
+BOOL init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q_n, const char *srv_name, uint32 info_level, SRV_SHARE_INFO *info) 
+{
+
+	init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
+	q_n->info_level = info_level;
+	q_n->info       = *info;
+
+	q_n->ptr_parm_error = 1;
+	q_n->parm_error     = 0;
+  
+	return True;
+}
+
+/*******************************************************************
  Reads or writes a structure.
 ********************************************************************/
 
@@ -838,6 +1492,15 @@
 	if(!srv_io_srv_share_info("info  ", ps, depth, &q_n->info))
 		return False;
 
+	if(!prs_align(ps))
+		return False;
+	if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
+		return False;
+	if(q_n->ptr_parm_error) {
+	  if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
+	    return False;
+	}
+
 	return True;
 }
 
@@ -845,9 +1508,9 @@
  Reads or writes a structure.
 ********************************************************************/
 
-BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
+BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
 {
-	if (q_n == NULL)
+	if (r_n == NULL)
 		return False;
 
 	prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
@@ -856,15 +1519,38 @@
 	if(!prs_align(ps))
 		return False;
 
-	if(!prs_uint32("switch_value  ", ps, depth, &q_n->switch_value))
+	if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
 		return False;
-	if(!prs_ntstatus("status        ", ps, depth, &q_n->status))
+
+	if(r_n->ptr_parm_error) {
+	  
+	  if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
+	    return False;
+	}
+
+	if(!prs_ntstatus("status        ", ps, depth, &r_n->status))
 		return False;
 
 	return True;
 }	
 
 /*******************************************************************
+ initialises a structure.
+********************************************************************/
+
+BOOL init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *q_n, const char *srv_name, const char *share_name) 
+{
+
+	uint32 ptr_share_name;
+
+	init_buf_unistr2(&q_n->uni_srv_name,   &q_n->ptr_srv_name, srv_name);
+	init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name,    share_name);
+	q_n->reserved = 0;
+
+	return True;
+}
+
+/*******************************************************************
  Reads or writes a structure.
 ********************************************************************/
 
@@ -887,6 +1573,12 @@
 	if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
 		return False;
 
+	if(!prs_align(ps))
+		return False;
+
+	if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
+	        return False;
+
 	return True;
 }
 
@@ -2078,7 +2770,7 @@
 	sv102->disc         = disc;
 	sv102->hidden       = hidden;
 	sv102->announce     = announce;
-	sv102->ann_delta    =ann_delta;
+	sv102->ann_delta    = ann_delta;
 	sv102->licenses     = licenses;
 	init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
 }
@@ -2342,11 +3034,11 @@
 	if(!prs_align(ps))
 		return False;
 
-	if(!prs_uint32("switch_value  ", ps, depth, &r_n->switch_value))
-		return False;
+	if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
+	  return False;
 
 	if(!prs_ntstatus("status ", ps, depth, &r_n->status))
-		return False;
+	  return False;
 
 	return True;
 }
@@ -2471,10 +3163,35 @@
 }
 
 /*******************************************************************
+ initialises a structure.
+ ********************************************************************/
+
+BOOL init_srv_q_net_srv_disk_enum(SRV_Q_NET_SRV_DISK_ENUM *q_n,
+				  const char *srv_name,
+				  uint32 preferred_len,
+				  ENUM_HND *enum_hnd
+				  ) 
+{
+  
+
+  DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
+
+  init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
+
+  q_n->disk_enum_ctr.level = 0;
+  q_n->disk_enum_ctr.disk_info_ptr   = 0;
+  
+  q_n->preferred_len = preferred_len;
+  memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
+
+  return True;
+}
+
+/*******************************************************************
  Reads or writes a structure.
  ********************************************************************/
 
-BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
+BOOL srv_io_q_net_srv_disk_enum(char *desc, SRV_Q_NET_SRV_DISK_ENUM *q_n, prs_struct *ps, int depth)
 {
 	if (q_n == NULL)
 		return False;
@@ -2518,9 +3235,11 @@
  Reads or writes a structure.
  ********************************************************************/
 
-BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
+BOOL srv_io_r_net_srv_disk_enum(char *desc, SRV_R_NET_SRV_DISK_ENUM *r_n, prs_struct *ps, int depth)
 {
+
 	int i;
+	uint32 entries_read, entries_read2, entries_read3;
 
 	if (r_n == NULL)
 		return False;
@@ -2528,23 +3247,36 @@
 	prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
 	depth++;
 
+	entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
+
 	if(!prs_align(ps))
 		return False;
 
-	if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read))
+	if(!prs_uint32("entries_read", ps, depth, &entries_read))
 		return False;
 	if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
 		return False;
 
 	/*this may be max, unknown, actual?*/
 
-	if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
+	if(!prs_uint32("max_elements", ps, depth, &entries_read2))
 		return False;
 	if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
 		return False;
-	if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
+	if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
 		return False;
 
+	r_n->disk_enum_ctr.entries_read = entries_read3;
+
+	if(UNMARSHALLING(ps)) {
+
+	  DISK_INFO *dinfo;
+
+	  if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3)))
+	    return False;
+	  r_n->disk_enum_ctr.disk_info = dinfo;
+	}
+
 	for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
 
 		if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
@@ -2565,6 +3297,25 @@
 
 	if(!prs_ntstatus("status", ps, depth, &r_n->status))
 		return False;
+
+	return True;
+}
+
+/*******************************************************************
+ initialises a structure.
+ ********************************************************************/
+
+BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type) 
+{
+	uint32 ptr_share_name;
+
+	DEBUG(5,("init_srv_q_net_name_validate\n"));
+  
+	init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
+	init_buf_unistr2(&q_n->uni_name,     &ptr_share_name,    share_name);
+
+	q_n->type  = type;
+	q_n->flags = 0;
 
 	return True;
 }
Index: rpc_server/srv_srvsvc.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_srvsvc.c,v
retrieving revision 1.35
diff -u -r1.35 srv_srvsvc.c
--- rpc_server/srv_srvsvc.c	2 Oct 2001 04:29:43 -0000	1.35
+++ rpc_server/srv_srvsvc.c	22 Jan 2002 01:01:22 -0000
@@ -166,7 +166,7 @@
  RPC to enumerate shares.
 ********************************************************************/
 
-static BOOL api_srv_net_share_enum_all(pipes_struct *p)
+static BOOL api_srv_net_share_enum(pipes_struct *p)
 {
 	SRV_Q_NET_SHARE_ENUM q_u;
 	SRV_R_NET_SHARE_ENUM r_u;
@@ -178,14 +178,14 @@
 
 	/* Unmarshall the net server get enum. */
 	if(!srv_io_q_net_share_enum("", &q_u, data, 0)) {
-		DEBUG(0,("api_srv_net_share_enum_all: Failed to unmarshall SRV_Q_NET_SHARE_ENUM.\n"));
+		DEBUG(0,("api_srv_net_share_enum: Failed to unmarshall SRV_Q_NET_SHARE_ENUM.\n"));
 		return False;
 	}
 
-	r_u.status = _srv_net_share_enum_all(p, &q_u, &r_u);
+	r_u.status = _srv_net_share_enum(p, &q_u, &r_u);
 
 	if (!srv_io_r_net_share_enum("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_srv_net_share_enum_all: Failed to marshall SRV_R_NET_SHARE_ENUM.\n"));
+		DEBUG(0,("api_srv_net_share_enum: Failed to marshall SRV_R_NET_SHARE_ENUM.\n"));
 		return False;
 	}
 
@@ -196,7 +196,7 @@
  RPC to enumerate shares.
 ********************************************************************/
 
-static BOOL api_srv_net_share_enum(pipes_struct *p)
+static BOOL api_srv_net_share_enum_sticky(pipes_struct *p)
 {
 	SRV_Q_NET_SHARE_ENUM q_u;
 	SRV_R_NET_SHARE_ENUM r_u;
@@ -208,14 +208,14 @@
 
 	/* Unmarshall the net server get enum. */
 	if(!srv_io_q_net_share_enum("", &q_u, data, 0)) {
-		DEBUG(0,("api_srv_net_share_enum: Failed to unmarshall SRV_Q_NET_SHARE_ENUM.\n"));
+		DEBUG(0,("api_srv_net_share_enum_sticky: Failed to unmarshall SRV_Q_NET_SHARE_ENUM.\n"));
 		return False;
 	}
 
-	r_u.status = _srv_net_share_enum(p, &q_u, &r_u);
+	r_u.status = _srv_net_share_enum_sticky(p, &q_u, &r_u);
 
 	if (!srv_io_r_net_share_enum("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_srv_net_share_enum: Failed to marshall SRV_R_NET_SHARE_ENUM.\n"));
+		DEBUG(0,("api_srv_net_share_enum_sticky: Failed to marshall SRV_R_NET_SHARE_ENUM.\n"));
 		return False;
 	}
 
@@ -343,6 +343,36 @@
 }
 
 /*******************************************************************
+ RPC to delete share information.
+********************************************************************/
+
+static BOOL api_srv_net_share_del_sticky(pipes_struct *p)
+{
+	SRV_Q_NET_SHARE_DEL q_u;
+	SRV_R_NET_SHARE_DEL r_u;
+	prs_struct *data = &p->in_data.data;
+	prs_struct *rdata = &p->out_data.rdata;
+
+	ZERO_STRUCT(q_u);
+	ZERO_STRUCT(r_u);
+
+	/* Unmarshall the net server del info. */
+	if(!srv_io_q_net_share_del("", &q_u, data, 0)) {
+		DEBUG(0,("api_srv_net_share_del_sticky: Failed to unmarshall SRV_Q_NET_SHARE_DEL.\n"));
+		return False;
+	}
+
+	r_u.status = _srv_net_share_del_sticky(p, &q_u, &r_u);
+
+	if(!srv_io_r_net_share_del("", &r_u, rdata, 0)) {
+		DEBUG(0,("api_srv_net_share_del_sticky: Failed to marshall SRV_R_NET_SHARE_DEL.\n"));
+		return False;
+	}
+
+	return True;
+}
+
+/*******************************************************************
  api_srv_net_remote_tod
 ********************************************************************/
 
@@ -373,10 +403,10 @@
  RPC to enumerate disks available on a server e.g. C:, D: ...
 *******************************************************************/
 
-static BOOL api_srv_net_disk_enum(pipes_struct *p) 
+static BOOL api_srv_net_srv_disk_enum(pipes_struct *p) 
 {
-	SRV_Q_NET_DISK_ENUM q_u;
-	SRV_R_NET_DISK_ENUM r_u;
+	SRV_Q_NET_SRV_DISK_ENUM q_u;
+	SRV_R_NET_SRV_DISK_ENUM r_u;
 	prs_struct *data = &p->in_data.data;
 	prs_struct *rdata = &p->out_data.rdata;
 
@@ -384,15 +414,15 @@
 	ZERO_STRUCT(r_u);
 
 	/* Unmarshall the net server disk enum. */
-	if(!srv_io_q_net_disk_enum("", &q_u, data, 0)) {
-		DEBUG(0,("api_srv_net_disk_enum: Failed to unmarshall SRV_Q_NET_DISK_ENUM.\n"));
+	if(!srv_io_q_net_srv_disk_enum("", &q_u, data, 0)) {
+		DEBUG(0,("api_srv_net_srv_disk_enum: Failed to unmarshall SRV_Q_NET_SRV_DISK_ENUM.\n"));
 		return False;
 	}
 
-	r_u.status = _srv_net_disk_enum(p, &q_u, &r_u);
+	r_u.status = _srv_net_srv_disk_enum(p, &q_u, &r_u);
 
-	if(!srv_io_r_net_disk_enum("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_srv_net_disk_enum: Failed to marshall SRV_R_NET_DISK_ENUM.\n"));
+	if(!srv_io_r_net_srv_disk_enum("", &r_u, rdata, 0)) {
+		DEBUG(0,("api_srv_net_srv_disk_enum: Failed to marshall SRV_R_NET_SRV_DISK_ENUM.\n"));
 		return False;
 	}
 
@@ -495,23 +525,25 @@
 
 struct api_struct api_srv_cmds[] =
 {
-	{ "SRV_NETCONNENUM"       , SRV_NETCONNENUM       , api_srv_net_conn_enum    },
-	{ "SRV_NETSESSENUM"       , SRV_NETSESSENUM       , api_srv_net_sess_enum    },
-	{ "SRV_NETSHAREENUM_ALL"  , SRV_NETSHAREENUM_ALL  , api_srv_net_share_enum_all   },
-	{ "SRV_NETSHAREENUM"      , SRV_NETSHAREENUM      , api_srv_net_share_enum   },
-	{ "SRV_NET_SHARE_ADD"     , SRV_NET_SHARE_ADD     , api_srv_net_share_add },
-	{ "SRV_NET_SHARE_DEL"     , SRV_NET_SHARE_DEL     , api_srv_net_share_del },
-	{ "SRV_NET_SHARE_GET_INFO", SRV_NET_SHARE_GET_INFO, api_srv_net_share_get_info },
-	{ "SRV_NET_SHARE_SET_INFO", SRV_NET_SHARE_SET_INFO, api_srv_net_share_set_info },
-	{ "SRV_NETFILEENUM"       , SRV_NETFILEENUM       , api_srv_net_file_enum    },
-	{ "SRV_NET_SRV_GET_INFO"  , SRV_NET_SRV_GET_INFO  , api_srv_net_srv_get_info },
-	{ "SRV_NET_SRV_SET_INFO"  , SRV_NET_SRV_SET_INFO  , api_srv_net_srv_set_info },
-	{ "SRV_NET_REMOTE_TOD"    , SRV_NET_REMOTE_TOD    , api_srv_net_remote_tod   },
-	{ "SRV_NET_DISK_ENUM"     , SRV_NET_DISK_ENUM     , api_srv_net_disk_enum    },
-	{ "SRV_NET_NAME_VALIDATE" , SRV_NET_NAME_VALIDATE , api_srv_net_name_validate},
-	{ "SRV_NETFILEQUERYSECDESC",SRV_NETFILEQUERYSECDESC,api_srv_net_file_query_secdesc},
-	{ "SRV_NETFILESETSECDESC" , SRV_NETFILESETSECDESC , api_srv_net_file_set_secdesc},
-	{ NULL                    , 0                     , NULL                     }
+        { "SRV_NETCONNENUM"         , SRV_NETCONNENUM         , api_srv_net_conn_enum         },
+	{ "SRV_NETSESSENUM"         , SRV_NETSESSENUM         , api_srv_net_sess_enum         },
+	{ "SRV_NETSHAREENUM"        , SRV_NETSHAREENUM        , api_srv_net_share_enum        },
+	{ "SRV_NETSHAREENUM_STICKY" , SRV_NETSHAREENUM_STICKY , api_srv_net_share_enum_sticky },
+	{ "SRV_NET_SHARE_ADD"       , SRV_NET_SHARE_ADD       , api_srv_net_share_add         },
+	{ "SRV_NET_SHARE_DEL"       , SRV_NET_SHARE_DEL       , api_srv_net_share_del         },
+	{ "SRV_NET_SHARE_DEL_STICKY", SRV_NET_SHARE_DEL_STICKY, api_srv_net_share_del_sticky  },
+	{ "SRV_NET_SHARE_DEL"       , SRV_NET_SHARE_DEL       , api_srv_net_share_del         },
+	{ "SRV_NET_SHARE_GET_INFO"  , SRV_NET_SHARE_GET_INFO  , api_srv_net_share_get_info    },
+	{ "SRV_NET_SHARE_SET_INFO"  , SRV_NET_SHARE_SET_INFO  , api_srv_net_share_set_info    },
+	{ "SRV_NETFILEENUM"         , SRV_NETFILEENUM         , api_srv_net_file_enum         },
+	{ "SRV_NET_SRV_GET_INFO"    , SRV_NET_SRV_GET_INFO    , api_srv_net_srv_get_info      },
+	{ "SRV_NET_SRV_SET_INFO"    , SRV_NET_SRV_SET_INFO    , api_srv_net_srv_set_info      },
+	{ "SRV_NET_REMOTE_TOD"      , SRV_NET_REMOTE_TOD      , api_srv_net_remote_tod        },
+	{ "SRV_NET_SRV_DISK_ENUM"   , SRV_NET_SRV_DISK_ENUM   , api_srv_net_srv_disk_enum     },
+	{ "SRV_NET_NAME_VALIDATE"   , SRV_NET_NAME_VALIDATE   , api_srv_net_name_validate     },
+	{ "SRV_NETFILEQUERYSECDESC" , SRV_NETFILEQUERYSECDESC , api_srv_net_file_query_secdesc},
+	{ "SRV_NETFILESETSECDESC"   , SRV_NETFILESETSECDESC   , api_srv_net_file_set_secdesc  },
+	{ NULL                      , 0                       , NULL                          }
 };
 
 /*******************************************************************
Index: rpc_server/srv_srvsvc_nt.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_srvsvc_nt.c,v
retrieving revision 1.63
diff -u -r1.63 srv_srvsvc_nt.c
--- rpc_server/srv_srvsvc_nt.c	9 Jan 2002 05:24:07 -0000	1.63
+++ rpc_server/srv_srvsvc_nt.c	22 Jan 2002 01:01:27 -0000
@@ -6,6 +6,7 @@
  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
  *  Copyright (C) Paul Ashton                       1997.
  *  Copyright (C) Jeremy Allison					2001.
+ *  Copyright (C) Nigel Williams					2001.
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -29,6 +30,20 @@
 extern pstring global_myname;
 
 /*******************************************************************
+ Fill in a share info level 0 structure.
+ ********************************************************************/
+
+static void init_srv_share_info_0(pipes_struct *p, SRV_SHARE_INFO_0 *sh0, int snum)
+{
+	pstring net_name;
+
+	pstrcpy(net_name, lp_servicename(snum));
+
+	init_srv_share_info0(&sh0->info_0, net_name);
+	init_srv_share_info0_str(&sh0->info_0_str, net_name);
+}
+
+/*******************************************************************
  Fill in a share info level 1 structure.
  ********************************************************************/
 
@@ -102,6 +117,39 @@
 }
 
 /*******************************************************************
+ Fill in a share info level 501 structure.
+ ********************************************************************/
+
+static void init_srv_share_info_501(pipes_struct *p, SRV_SHARE_INFO_501 *sh501, int snum)
+{
+	int len_net_name;
+	pstring net_name;
+	pstring remark;
+	uint32 type;
+	uint32 flags = 0;  /* dfs related etc */
+	TALLOC_CTX *ctx = p->mem_ctx;
+
+	ZERO_STRUCTP(sh501);
+
+	pstrcpy(net_name, lp_servicename(snum));
+	pstrcpy(remark, lp_comment(snum));
+	standard_sub_conn(p->conn, remark);
+
+	/* work out the share type */
+	type = STYPE_DISKTREE;
+		
+	if (lp_print_ok(snum))
+		type = STYPE_PRINTQ;
+	if (strequal("IPC$", net_name))
+		type = STYPE_IPC;
+	if (net_name[len_net_name] == '$')
+		type |= STYPE_HIDDEN;
+
+	init_srv_share_info501(&sh501->info_501, net_name, type, remark, flags);
+	init_srv_share_info501_str(&sh501->info_501_str, net_name, remark);
+}
+
+/*******************************************************************
  What to do when smb.conf is updated.
  ********************************************************************/
 
@@ -174,8 +222,8 @@
 
 	se_map_generic(&def_access, &file_generic_mapping);
 
-    init_sec_access(&sa, GENERIC_ALL_ACCESS | def_access );
-    init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
+	init_sec_access(&sa, GENERIC_ALL_ACCESS | def_access );
+	init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
 
 	if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 1, &ace)) != NULL) {
 		psd = make_sec_desc(ctx, SEC_DESC_REVISION, NULL, NULL, NULL, psa, psize);
@@ -205,13 +253,12 @@
  
 	slprintf(key, sizeof(key)-1, "SECDESC/%s", lp_servicename(snum));
  
-    if (tdb_prs_fetch(share_tdb, key, &ps, ctx)!=0 ||
-        !sec_io_desc("get_share_security", &psd, &ps, 1)) {
+	if (tdb_prs_fetch(share_tdb, key, &ps, ctx)!=0 || !sec_io_desc("get_share_security", &psd, &ps, 1)) {
  
-        DEBUG(4,("get_share_security: using default secdesc for %s\n", lp_servicename(snum) ));
+	  DEBUG(4,("get_share_security: using default secdesc for %s\n", lp_servicename(snum) ));
  
-        return get_share_security_default(ctx, snum, psize);
-    }
+	  return get_share_security_default(ctx, snum, psize);
+	}
 
 	if (psd)
 		*psize = sec_desc_size(psd);
@@ -237,27 +284,27 @@
 
 	prs_init(&ps, (uint32)sec_desc_size(psd), mem_ctx, MARSHALL);
  
-    if (!sec_io_desc("share_security", &psd, &ps, 1)) {
-        goto out;
-    }
+	if (!sec_io_desc("share_security", &psd, &ps, 1)) {
+	  goto out;
+	}
  
 	slprintf(key, sizeof(key)-1, "SECDESC/%s", share_name);
  
-    if (tdb_prs_store(share_tdb, key, &ps)==0) {
-        ret = True;
-        DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
-    } else {
-        DEBUG(1,("set_share_security: Failed to store secdesc for %s\n", share_name ));
-    }
+	if (tdb_prs_store(share_tdb, key, &ps)==0) {
+	  ret = True;
+	  DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
+	} else {
+	  DEBUG(1,("set_share_security: Failed to store secdesc for %s\n", share_name ));
+	}
 
     /* Free malloc'ed memory */
  
  out:
  
-    prs_mem_free(&ps);
-    if (mem_ctx)
-        talloc_destroy(mem_ctx);
-    return ret;
+	prs_mem_free(&ps);
+	if (mem_ctx)
+	  talloc_destroy(mem_ctx);
+	return ret;
 }
 
 /*******************************************************************
@@ -394,20 +441,77 @@
 	sd = get_share_security(ctx, snum, &sd_size);
 
 	init_srv_share_info502(&sh502->info_502, net_name, type, remark, 0, 0xffffffff, 1, path, passwd, sd, sd_size);
-	init_srv_share_info502_str(&sh502->info_502_str, &sh502->info_502, net_name, remark, path, passwd, sd, sd_size);
+	init_srv_share_info502_str(&sh502->info_502_str, net_name, remark, path, passwd, sd, sd_size);
+}
+
+/***************************************************************************
+ Fill in a share info level 1004 structure.
+ ***************************************************************************/
+
+static void init_srv_share_info_1004(pipes_struct *p, SRV_SHARE_INFO_1004* sh1004, int snum)
+{
+        pstring remark;
+
+	pstrcpy(remark, lp_comment(snum));
+	standard_sub_conn(p->conn, remark);
+
+	ZERO_STRUCTP(sh1004);
+  
+	init_srv_share_info1004(&sh1004->info_1004, remark);
+	init_srv_share_info1004_str(&sh1004->info_1004_str, remark);
 }
 
 /***************************************************************************
  Fill in a share info level 1005 structure.
  ***************************************************************************/
 
-static void init_srv_share_info_1005(SRV_SHARE_INFO_1005* sh1005, int snum)
+static void init_srv_share_info_1005(pipes_struct *p, SRV_SHARE_INFO_1005* sh1005, int snum)
 {
-	sh1005->dfs_root_flag = 0;
+	sh1005->dfs_root_flag;
 
 	if(lp_host_msdfs() && lp_msdfs_root(snum))
 		sh1005->dfs_root_flag = 3;
 }
+/***************************************************************************
+ Fill in a share info level 1006 structure.
+ ***************************************************************************/
+
+static void init_srv_share_info_1006(pipes_struct *p, SRV_SHARE_INFO_1006* sh1006, int snum)
+{
+	sh1006->max_uses = -1;
+}
+
+/***************************************************************************
+ Fill in a share info level 1007 structure.
+ ***************************************************************************/
+
+static void init_srv_share_info_1007(pipes_struct *p, SRV_SHARE_INFO_1007* sh1007, int snum)
+{
+        pstring alternate_directory_name = "";
+	uint32 flags = 0;
+
+	ZERO_STRUCTP(sh1007);
+  
+	init_srv_share_info1007(&sh1007->info_1007, flags, alternate_directory_name);
+	init_srv_share_info1007_str(&sh1007->info_1007_str, alternate_directory_name);
+}
+
+/*******************************************************************
+ Fill in a share info level 1501 structure.
+ ********************************************************************/
+
+static void init_srv_share_info_1501(pipes_struct *p, SRV_SHARE_INFO_1501 *sh1501, int snum)
+{
+	SEC_DESC *sd;
+	size_t sd_size;
+	TALLOC_CTX *ctx = p->mem_ctx;
+
+	ZERO_STRUCTP(sh1501);
+
+	sd = get_share_security(ctx, snum, &sd_size);
+
+	sh1501->sdb = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
+}
 
 /*******************************************************************
  True if it ends in '$'.
@@ -454,6 +558,24 @@
 		return True;
 
 	switch (info_level) {
+	case 0:
+	{
+		SRV_SHARE_INFO_0 *info0;
+		int i = 0;
+
+		info0 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_0));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_0(p, &info0[i++], snum);
+			}
+		}
+
+		ctr->share.info0 = info0;
+		break;
+
+	}
+
 	case 1:
 	{
 		SRV_SHARE_INFO_1 *info1;
@@ -488,6 +610,23 @@
 		break;
 	}
 
+	case 501:
+	{
+		SRV_SHARE_INFO_501 *info501;
+		int i = 0;
+
+		info501 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_501));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_501(p, &info501[i++], snum);
+			}
+		}
+
+		ctr->share.info501 = info501;
+		break;
+	}
+
 	case 502:
 	{
 		SRV_SHARE_INFO_502 *info502;
@@ -505,6 +644,94 @@
 		break;
 	}
 
+#if 0
+	/* here for completeness but not currently used with enum */
+	
+	case 1004:
+	{
+		SRV_SHARE_INFO_1004 *info1004;
+		int i = 0;
+
+		info1004 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_1004));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_1004(p, &info1004[i++], snum);
+			}
+		}
+
+		ctr->share.info1004 = info1004;
+		break;
+	}
+
+	case 1005:
+	{
+		SRV_SHARE_INFO_1005 *info1005;
+		int i = 0;
+
+		info1005 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_1005));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_1005(p, &info1005[i++], snum);
+			}
+		}
+
+		ctr->share.info1005 = info1005;
+		break;
+	}
+
+	case 1006:
+	{
+		SRV_SHARE_INFO_1006 *info1006;
+		int i = 0;
+
+		info1006 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_1006));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_1006(p, &info1006[i++], snum);
+			}
+		}
+
+		ctr->share.info1006 = info1006;
+		break;
+	}
+
+	case 1007:
+	{
+		SRV_SHARE_INFO_1007 *info1007;
+		int i = 0;
+
+		info1007 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_1007));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_1007(p, &info1007[i++], snum);
+			}
+		}
+
+		ctr->share.info1007 = info1007;
+		break;
+	}
+
+	case 1501:
+	{
+		SRV_SHARE_INFO_1501 *info1501;
+		int i = 0;
+
+		info1501 = talloc(ctx, num_entries * sizeof(SRV_SHARE_INFO_1501));
+
+		for (snum = *resume_hnd; snum < num_services; snum++) {
+			if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_admin_share(snum)) ) {
+				init_srv_share_info_1501(p, &info1501[i++], snum);
+			}
+		}
+
+		ctr->share.info1501 = info1501;
+		break;
+	}
+#endif
 	default:
 		DEBUG(5,("init_srv_share_info_ctr: unsupported switch value %d\n", info_level));
 		return False;
@@ -550,18 +777,44 @@
 
 	if (snum >= 0) {
 		switch (info_level) {
+		case 0:
+			init_srv_share_info_0(p, &r_n->info.share.info0, snum);
+			break;
 		case 1:
 			init_srv_share_info_1(p, &r_n->info.share.info1, snum);
 			break;
 		case 2:
 			init_srv_share_info_2(p, &r_n->info.share.info2, snum);
 			break;
+		case 501:
+			init_srv_share_info_501(p, &r_n->info.share.info501, snum);
+			break;
 		case 502:
 			init_srv_share_info_502(p, &r_n->info.share.info502, snum);
 			break;
+#if 0
+			/* here for completeness */
+			
+		case 1004:
+			init_srv_share_info_1004(p, &r_n->info.share.info1004, snum);
+			break;
+#endif
 		case 1005:
-			init_srv_share_info_1005(&r_n->info.share.info1005, snum);
+			init_srv_share_info_1005(p, &r_n->info.share.info1005, snum);
+			break;
+#if 0
+			/* here for completeness */
+
+		case 1006:
+			init_srv_share_info_1006(p, &r_n->info.share.info1006, snum);
 			break;
+		case 1007:
+			init_srv_share_info_1007(p, &r_n->info.share.info1007, snum);
+			break;
+		case 1501:
+			init_srv_share_info_1501(p, &r_n->info.share.info1501, snum);
+			break;
+#endif
 		default:
 			DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level));
 			status = NT_STATUS_INVALID_INFO_CLASS;
@@ -1145,7 +1398,7 @@
  Net share enum all.
 ********************************************************************/
 
-NTSTATUS _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
+NTSTATUS _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
 {
 	DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
 
@@ -1163,16 +1416,16 @@
  Net share enum.
 ********************************************************************/
 
-NTSTATUS _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
+NTSTATUS _srv_net_share_enum_sticky(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
 {
-	DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
+	DEBUG(5,("_srv_net_share_enum_sticky: %d\n", __LINE__));
 
 	/* Create the list of shares for the response. */
 	init_srv_r_net_share_enum(p, r_u,
 				q_u->ctr.info_level,
 				get_enum_hnd(&q_u->enum_hnd), False);
 
-	DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
+	DEBUG(5,("_srv_net_share_enum_sticky: %d\n", __LINE__));
 
 	return r_u->status;
 }
@@ -1258,7 +1511,7 @@
 
 	unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name));
 
-	r_u->switch_value = 0;
+	r_u->parm_error = 0;
 
 	if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
 		return NT_STATUS_ACCESS_DENIED;
@@ -1280,23 +1533,42 @@
 
 	switch (q_u->info_level) {
 	case 1:
-		/* Not enough info in a level 1 to do anything. */
-		return NT_STATUS_ACCESS_DENIED;
+		fstrcpy(pathname, lp_pathname(snum));
+		unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment));
+		type = q_u->info.share.info2.info_2.type;
+		psd = NULL;
+		break;
 	case 2:
-		unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name));
-		unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(share_name));
+		unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(comment));
+		unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(pathname));
 		type = q_u->info.share.info2.info_2.type;
 		psd = NULL;
 		break;
+#if 0
+		/* not supported on set but here for completeness */
+	case 501:
+		unistr2_to_ascii(comment, &q_u->info.share.info501.info_501_str.uni_remark, sizeof(comment));
+		type = q_u->info.share.info501.info_501.type;
+		psd = NULL;
+		break;
+#endif
 	case 502:
-		unistr2_to_ascii(comment, &q_u->info.share.info502.info_502_str.uni_remark, sizeof(share_name));
-		unistr2_to_ascii(pathname, &q_u->info.share.info502.info_502_str.uni_path, sizeof(share_name));
+		unistr2_to_ascii(comment, &q_u->info.share.info502.info_502_str.uni_remark, sizeof(comment));
+		unistr2_to_ascii(pathname, &q_u->info.share.info502.info_502_str.uni_path, sizeof(pathname));
 		type = q_u->info.share.info502.info_502.type;
 		psd = q_u->info.share.info502.info_502_str.sd;
 		map_generic_share_sd_bits(psd);
 		break;
+	case 1004:
+		fstrcpy(pathname, lp_pathname(snum));
+		unistr2_to_ascii(comment, &q_u->info.share.info1004.info_1004_str.uni_remark, sizeof(comment));
+		break;
 	case 1005:
 		return NT_STATUS_ACCESS_DENIED;
+	case 1006:
+		return NT_STATUS_ACCESS_DENIED;
+	case 1007:
+		return NT_STATUS_ACCESS_DENIED;
 	case 1501:
 		fstrcpy(pathname, lp_pathname(snum));
 		fstrcpy(comment, lp_comment(snum));
@@ -1386,7 +1658,7 @@
 
 	DEBUG(5,("_srv_net_share_add: %d\n", __LINE__));
 
-	r_u->switch_value = 0;
+	r_u->parm_error = 0;
 
 	get_current_user(&user,p);
 
@@ -1401,8 +1673,11 @@
 	}
 
 	switch (q_u->info_level) {
+	case 0:
+		/* No path. Not enough info in a level 0 to do anything. */
+		return NT_STATUS_ACCESS_DENIED;
 	case 1:
-		/* Not enough info in a level 1 to do anything. */
+		/* No path. Not enough info in a level 1 to do anything. */
 		return NT_STATUS_ACCESS_DENIED;
 	case 2:
 		unistr2_to_ascii(share_name, &q_u->info.share.info2.info_2_str.uni_netname, sizeof(share_name));
@@ -1410,6 +1685,9 @@
 		unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(share_name));
 		type = q_u->info.share.info2.info_2.type;
 		break;
+	case 501:
+		/* No path. Not enough info in a level 501 to do anything. */
+		return NT_STATUS_ACCESS_DENIED;
 	case 502:
 		unistr2_to_ascii(share_name, &q_u->info.share.info502.info_502_str.uni_netname, sizeof(share_name));
 		unistr2_to_ascii(comment, &q_u->info.share.info502.info_502_str.uni_remark, sizeof(share_name));
@@ -1418,8 +1696,18 @@
 		psd = q_u->info.share.info502.info_502_str.sd;
 		map_generic_share_sd_bits(psd);
 		break;
+
+		/* none of the following contain share names.  NetShareAdd does not have a separate parameter for the share name */ 
+
+	case 1004:
+		return NT_STATUS_ACCESS_DENIED;
 	case 1005:
-		/* DFS only level. */
+		return NT_STATUS_ACCESS_DENIED;
+	case 1006:
+		return NT_STATUS_ACCESS_DENIED;
+	case 1007:
+		return NT_STATUS_ACCESS_DENIED;
+	case 1501:
 		return NT_STATUS_ACCESS_DENIED;
 	default:
 		DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level));
@@ -1536,6 +1824,13 @@
 	return NT_STATUS_OK;
 }
 
+NTSTATUS _srv_net_share_del_sticky(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u)
+{
+  DEBUG(5,("_srv_net_share_del_stick: %d\n", __LINE__));
+
+  return _srv_net_share_del(p, q_u, r_u);
+}
+
 /*******************************************************************
 time of day
 ********************************************************************/
@@ -1827,10 +2122,11 @@
 	return disk;
 }
 
-NTSTATUS _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_DISK_ENUM *r_u)
+NTSTATUS _srv_net_srv_disk_enum(pipes_struct *p, SRV_Q_NET_SRV_DISK_ENUM *q_u, SRV_R_NET_SRV_DISK_ENUM *r_u)
 {
 	uint32 i;
 	const char *disk_name;
+	TALLOC_CTX *ctx = p->mem_ctx;
 	uint32 resume=get_enum_hnd(&q_u->enum_hnd);
 
 	r_u->status=NT_STATUS_OK;
@@ -1839,6 +2135,18 @@
 
 	r_u->disk_enum_ctr.unknown = 0; 
 
+	{
+	  DISK_INFO *dinfo;
+
+	  int dinfo_size = MAX_SERVER_DISK_ENTRIES * sizeof(*dinfo);
+	  
+	  if(!(dinfo =  talloc(ctx, dinfo_size))) {
+
+	  }
+
+	  r_u->disk_enum_ctr.disk_info = dinfo;
+	}
+
 	r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info? 1 : 0;
 
 	/*allow one DISK_INFO for null terminator*/
@@ -1852,7 +2160,7 @@
 		init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, disk_name);    
 	}
 
-	/*add a terminating null string.  Is this there if there is more data to come?*/
+	/* add a terminating null string.  Is this there if there is more data to come? */
 
 	r_u->disk_enum_ctr.entries_read++;
 


More information about the samba-technical mailing list