2006-07-23 22:43:07 +04:00
/*
Unix SMB / CIFS implementation .
Modular services configuration
Copyright ( C ) Simo Sorce 2006
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2006-07-23 22:43:07 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-07-23 22:43:07 +04:00
*/
# ifndef _SHARE_H
# define _SHARE_H
struct share_ops ;
struct share_context {
const struct share_ops * ops ;
void * priv_data ;
} ;
struct share_config {
const char * name ;
struct share_context * ctx ;
void * opaque ;
} ;
2006-09-17 04:15:13 +04:00
enum share_info_type {
SHARE_INFO_STRING ,
SHARE_INFO_INT ,
SHARE_INFO_BLOB
} ;
2006-09-15 09:18:53 +04:00
struct share_info {
2006-09-17 04:15:13 +04:00
enum share_info_type type ;
2006-09-15 09:18:53 +04:00
const char * name ;
2006-09-17 04:15:13 +04:00
void * value ;
2006-09-15 09:18:53 +04:00
} ;
2006-07-23 22:43:07 +04:00
struct share_ops {
const char * name ;
NTSTATUS ( * init ) ( TALLOC_CTX * , const struct share_ops * , struct share_context * * ) ;
const char * ( * string_option ) ( struct share_config * , const char * , const char * ) ;
int ( * int_option ) ( struct share_config * , const char * , int ) ;
2007-08-27 22:10:19 +04:00
bool ( * bool_option ) ( struct share_config * , const char * , bool ) ;
2006-07-23 22:43:07 +04:00
const char * * ( * string_list_option ) ( TALLOC_CTX * , struct share_config * , const char * ) ;
NTSTATUS ( * list_all ) ( TALLOC_CTX * , struct share_context * , int * , const char * * * ) ;
NTSTATUS ( * get_config ) ( TALLOC_CTX * , struct share_context * , const char * , struct share_config * * ) ;
2006-09-17 04:15:13 +04:00
NTSTATUS ( * create ) ( struct share_context * , const char * , struct share_info * , int ) ;
NTSTATUS ( * set ) ( struct share_context * , const char * , struct share_info * , int ) ;
2006-09-15 09:18:53 +04:00
NTSTATUS ( * remove ) ( struct share_context * , const char * ) ;
2006-07-23 22:43:07 +04:00
} ;
2007-12-03 00:32:11 +03:00
struct loadparm_context ;
2006-07-23 22:43:07 +04:00
# include "param/share_proto.h"
/* list of shares options */
# define SHARE_NAME "name"
# define SHARE_PATH "path"
# define SHARE_COMMENT "comment"
2006-09-15 09:18:53 +04:00
# define SHARE_PASSWORD "password"
2006-07-23 22:43:07 +04:00
# define SHARE_HOSTS_ALLOW "hosts-allow"
# define SHARE_HOSTS_DENY "hosts-deny"
# define SHARE_NTVFS_HANDLER "ntvfs-handler"
# define SHARE_TYPE "type"
# define SHARE_VOLUME "volume"
# define SHARE_CSC_POLICY "csc-policy"
2006-09-15 09:18:53 +04:00
# define SHARE_AVAILABLE "available"
2006-07-23 22:43:07 +04:00
# define SHARE_BROWSEABLE "browseable"
# define SHARE_MAX_CONNECTIONS "max-connections"
/* I'd like to see the following options go away
* and always use EAs and SECDESCs */
# define SHARE_READONLY "readonly"
# define SHARE_MAP_SYSTEM "map-system"
# define SHARE_MAP_HIDDEN "map-hidden"
# define SHARE_MAP_ARCHIVE "map-archive"
# define SHARE_STRICT_LOCKING "strict-locking"
# define SHARE_STRICT_SYNC "strict-sync"
# define SHARE_MSDFS_ROOT "msdfs-root"
# define SHARE_CI_FILESYSTEM "ci-filesystem"
r23696: added the create mask and related share permissions options to Samba4,
using the new share_int_option() code from Simo
speaking of which, this is the first time I've looked closely at the
share_classic.c code. It is absolutely and completely braindead and
broken. Whatever drugs Simo was on at the time, he better not try to
cross a border with them on him!
Problems with it:
- if you actually set a value, it gets ignored, and the defvalue gets
used instead ('ret' is never returned). If you don't set a value,
then defvalue gets returned too. Sound useful?
- it means we now have to list parameters in source/param/ in lots
and lots of places, all of which have to match exactly. code like
this is supposed to reduce the likelyhood of errors, not increase
it!
- code which has a long line of if() statements with strcmp() should
cause your fingers to burn on the keyboard when you type it
in. That's what structure lists are for. Strangely enough, we have
all the info in loadparm.c in a structure list, but instead it gets
replicated in share_classic.c in this strange if() strcmp() form
expect some changes to this code shortly. I'll need a calming cup of
tea first though :-)
(This used to be commit 19a9fc2f444efc0894b06a249daf73ed555b61e2)
2007-07-04 08:15:07 +04:00
# define SHARE_DIR_MASK "directory mask"
# define SHARE_CREATE_MASK "create mask"
# define SHARE_FORCE_CREATE_MODE "force create mode"
# define SHARE_FORCE_DIR_MODE "force directory mode"
2006-07-23 22:43:07 +04:00
/* defaults */
# define SHARE_HOST_ALLOW_DEFAULT NULL
# define SHARE_HOST_DENY_DEFAULT NULL
# define SHARE_VOLUME_DEFAULT NULL
# define SHARE_TYPE_DEFAULT "DISK"
# define SHARE_CSC_POLICY_DEFAULT 0
2007-10-07 01:39:52 +04:00
# define SHARE_AVAILABLE_DEFAULT true
# define SHARE_BROWSEABLE_DEFAULT true
2006-07-23 22:43:07 +04:00
# define SHARE_MAX_CONNECTIONS_DEFAULT 0
r23696: added the create mask and related share permissions options to Samba4,
using the new share_int_option() code from Simo
speaking of which, this is the first time I've looked closely at the
share_classic.c code. It is absolutely and completely braindead and
broken. Whatever drugs Simo was on at the time, he better not try to
cross a border with them on him!
Problems with it:
- if you actually set a value, it gets ignored, and the defvalue gets
used instead ('ret' is never returned). If you don't set a value,
then defvalue gets returned too. Sound useful?
- it means we now have to list parameters in source/param/ in lots
and lots of places, all of which have to match exactly. code like
this is supposed to reduce the likelyhood of errors, not increase
it!
- code which has a long line of if() statements with strcmp() should
cause your fingers to burn on the keyboard when you type it
in. That's what structure lists are for. Strangely enough, we have
all the info in loadparm.c in a structure list, but instead it gets
replicated in share_classic.c in this strange if() strcmp() form
expect some changes to this code shortly. I'll need a calming cup of
tea first though :-)
(This used to be commit 19a9fc2f444efc0894b06a249daf73ed555b61e2)
2007-07-04 08:15:07 +04:00
# define SHARE_DIR_MASK_DEFAULT 0755
# define SHARE_CREATE_MASK_DEFAULT 0744
# define SHARE_FORCE_CREATE_MODE_DEFAULT 0000
# define SHARE_FORCE_DIR_MODE_DEFAULT 0000
2006-07-23 22:43:07 +04:00
/* I'd like to see the following options go away
* and always use EAs and SECDESCs */
2007-10-07 01:39:52 +04:00
# define SHARE_READONLY_DEFAULT true
# define SHARE_MAP_SYSTEM_DEFAULT false
# define SHARE_MAP_HIDDEN_DEFAULT false
# define SHARE_MAP_ARCHIVE_DEFAULT true
# define SHARE_STRICT_LOCKING_DEFAULT true
# define SHARE_STRICT_SYNC_DEFAULT false
# define SHARE_MSDFS_ROOT_DEFAULT false
# define SHARE_CI_FILESYSTEM_DEFAULT false
2006-07-23 22:43:07 +04:00
# endif /* _SHARE_H */