From - Mon Jul 19 20:36:52 1999
Return-Path: <samba-technical@samba.org>
Message-Id: <002601bed1da$03ce9ae0$4b0210ac@tik.net>
Errors-To: listproc-errors@samba.anu.edu.au
Reply-To: rune@lyngbyes.dk
Originator: samba-technical@samba.org
Sender: samba-technical@samba.org
Precedence: bulk
From: "Rune Henssel" <rune@lyngbyes.dk>
To: Multiple recipients of list SAMBA-TECHNICAL 
        <samba-technical@samba.org>
Subject: new parameters "show to users" & "hide from users"
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_0024_01BED1EA.AFAAA060"
X-Listprocessor-Version: 6.0d -- ListProcessor by Anastasios Kotsikonas
X-URL:  http://samba.anu.edu.au/listproc
X-Comment: developer discussion of Samba implementation
X-Mailer: Microsoft Outlook Express 5.00.2615.200
Date:   Mon, 19 Jul 1999 21:34:29 +1000
X-UIDL: c15e9b155b5512844c49aac78fc6d8fb

This is a multi-part message in MIME format.

------=_NextPart_000_0024_01BED1EA.AFAAA060
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello!

In running a network in a dormitory ie. it is students using the network I had a need to be able to selectivly hide/disable shares based on the userID of the user requesting the share list. Hence the need for a "show to users" / "hide from users" parameter.

This is what I have made. The parameters accept the same type of arguments as the "read list" type parameter. The patch is made against samba-2.0.5-pre2, but it should pose no difficulties grafting it onto a 2.0.4b, or for that matter any other version.

A short description of the parameters:

"show to users" parameter:
    The share is only enabled for the users specified in the list.
    It will be disabled for all other users.

"hide from users" parameter:
    The share will be disabled for the specified user.
    All other users will have access to the share.

Any comments, easier ways of doing this, etc... Will greatly be appriciated.
Also it would be great to see this parameter be made "official", along with the "secure include" and the auditing parameters. when this is beeing done a cleanup of duplicate parameters would also be in order.

Thats my 10 cents... ;-)

    Rune!
    rune@lyngbyes.dk

If among many truth you choose one and follow it blindly, it will become a falsehood and you a fanatic. 

------=_NextPart_000_0024_01BED1EA.AFAAA060
Content-Type: application/octet-stream;
	name="loadparm.c.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="loadparm.c.diff"

diff -u -b samba-2.0.5-pre2/loadparm.c.orig samba-2.0.5-pre2/loadparm.c=0A=
--- loadparm.c.orig	Thu Jul 15 14:42:30 1999=0A=
+++ loadparm.c	Mon Jul 19 03:09:04 1999=0A=
@@ -289,6 +289,14 @@=0A=
   char *force_group;=0A=
   char *readlist;=0A=
   char *writelist;=0A=
+  =0A=
+/* show to users & hide from users parameters - begin - =
rune@lyngbyes.dk */=0A=
+  =0A=
+  char *showlist;=0A=
+  char *hidelist;=0A=
+  =0A=
+/* show to users & hide from users parameters - end - rune@lyngbyes.dk =
*/=0A=
+  =0A=
   char *volume;=0A=
   char *fstype;=0A=
   int  iMinPrintSpace;=0A=
@@ -389,6 +397,14 @@=0A=
   NULL,    /* force group */=0A=
   NULL,    /* readlist */=0A=
   NULL,    /* writelist */=0A=
+  =0A=
+/* show to users & hide from users parameters - begin - =
rune@lyngbyes.dk */=0A=
+=0A=
+  NULL,    /* showlist */=0A=
+  NULL,    /* hidelist */=0A=
+  =0A=
+/* show to users & hide from users parameters - end - rune@lyngbyes.dk =
*/=0A=
+  =0A=
   NULL,    /* volume */=0A=
   NULL,    /* fstype */=0A=
   0,       /* iMinPrintSpace */=0A=
@@ -466,6 +482,13 @@=0A=
 static BOOL handle_character_set(char *pszParmValue,char **ptr);=0A=
 static BOOL handle_coding_system(char *pszParmValue,char **ptr);=0A=
 =0A=
+/* show to users & hide from users parameters - begin - =
rune@lyngbyes.dk */=0A=
+=0A=
+static BOOL handle_show(char *pszParmValue, char **ptr);=0A=
+static BOOL handle_hide(char *pszParmValue, char **ptr);=0A=
+=0A=
+/* show to users & hide from users parameters - end - rune@lyngbyes.dk =
*/=0A=
+=0A=
 static void set_default_server_announce_type(void);=0A=
 =0A=
 static struct enum_list enum_protocol[] =3D {{PROTOCOL_NT1, "NT1"}, =
{PROTOCOL_LANMAN2, "LANMAN2"}, =0A=
@@ -572,6 +595,14 @@=0A=
   {"admin users",      P_STRING,  P_LOCAL,  &sDefault.szAdminUsers,     =
NULL,   NULL,  FLAG_GLOBAL|FLAG_SHARE},=0A=
   {"read list",        P_STRING,  P_LOCAL,  &sDefault.readlist,         =
NULL,   NULL,  FLAG_GLOBAL|FLAG_SHARE},=0A=
   {"write list",       P_STRING,  P_LOCAL,  &sDefault.writelist,        =
NULL,   NULL,  FLAG_GLOBAL|FLAG_SHARE},=0A=
+=0A=
+/* show to users & hide from users parameters - begin - =
rune@lyngbyes.dk */=0A=
+  =0A=
+  {"show to users",    P_STRING,  P_LOCAL,  &sDefault.showlist,         =
handle_show,   NULL,  FLAG_GLOBAL|FLAG_SHARE},=0A=
+  {"hide from users",  P_STRING,  P_LOCAL,  &sDefault.hidelist,         =
handle_hide,   NULL,  FLAG_GLOBAL|FLAG_SHARE},=0A=
+=0A=
+/* show to users & hide from users parameters - end - rune@lyngbyes.dk =
*/=0A=
+  =0A=
   {"force user",       P_STRING,  P_LOCAL,  &sDefault.force_user,       =
NULL,   NULL,  FLAG_SHARE},=0A=
   {"force group",      P_STRING,  P_LOCAL,  &sDefault.force_group,      =
NULL,   NULL,  FLAG_SHARE},=0A=
   {"group",            P_STRING,  P_LOCAL,  &sDefault.force_group,      =
NULL,   NULL,  0},=0A=
@@ -1307,6 +1338,14 @@=0A=
 FN_LOCAL_STRING(lp_force_group,force_group)=0A=
 FN_LOCAL_STRING(lp_readlist,readlist)=0A=
 FN_LOCAL_STRING(lp_writelist,writelist)=0A=
+=0A=
+/* show to users & hide from users parameters - begin - =
rune@lyngbyes.dk */=0A=
+=0A=
+FN_LOCAL_STRING(lp_showlist,showlist)=0A=
+FN_LOCAL_STRING(lp_hidelist,hidelist)=0A=
+=0A=
+/* show to users & hide from users parameters - end - rune@lyngbyes.dk =
*/=0A=
+=0A=
 FN_LOCAL_STRING(lp_fstype,fstype)=0A=
 static FN_LOCAL_STRING(lp_volume,volume)=0A=
 FN_LOCAL_STRING(lp_mangled_map,szMangledMap)=0A=
@@ -1955,6 +1994,46 @@=0A=
 =0A=
 =0A=
 =
/************************************************************************=
***=0A=
+handle the show to users parameter  - rune@lyngbyes.dk=0A=
+************************************************************************=
***/=0A=
+static BOOL handle_show(char *pszParmValue,char **ptr)=0A=
+{ =0A=
+  pstring uname;=0A=
+  pstring showlist;=0A=
+  pstrcpy(uname,"%U");=0A=
+  standard_sub_basic(uname);=0A=
+  pstrcpy(showlist,pszParmValue);=0A=
+  string_set(ptr,showlist);=0A=
+  =0A=
+  if (strlen(showlist)) {=0A=
+    if (!user_in_list(uname,showlist))=0A=
+      iSERVICE(iServiceIndex).bAvailable =3D False;=0A=
+  }=0A=
+  return(True);=0A=
+}=0A=
+=0A=
+=0A=
+/***********************************************************************=
****=0A=
+handle the hide from users parameter  - rune@lyngbyes.dk=0A=
+************************************************************************=
***/=0A=
+static BOOL handle_hide(char *pszParmValue,char **ptr)=0A=
+{ =0A=
+  pstring uname;=0A=
+  pstring hidelist;=0A=
+  pstrcpy(uname,"%U");=0A=
+  standard_sub_basic(uname);=0A=
+  pstrcpy(hidelist,pszParmValue);=0A=
+  string_set(ptr,hidelist);=0A=
+=0A=
+  if (strlen(hidelist)) {=0A=
+    if (user_in_list(uname,hidelist))=0A=
+      iSERVICE(iServiceIndex).bAvailable =3D False;=0A=
+  }=0A=
+  return(True);=0A=
+}=0A=
+=0A=
+=0A=
+/***********************************************************************=
****=0A=
 initialise a copymap=0A=
 =
*************************************************************************=
**/=0A=
 static void init_copymap(service *pservice)=0A=
@@ -2094,6 +2173,7 @@=0A=
 =
*************************************************************************=
**/=0A=
 static BOOL do_parameter( char *pszParmName, char *pszParmValue )=0A=
 {=0A=
+=0A=
   if( !bInGlobalSection && bGlobalOnly )=0A=
     return(True);=0A=
 =0A=

------=_NextPart_000_0024_01BED1EA.AFAAA060--

