summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>1999-07-22 04:55:13 +0000
committerTim Potter <tpot@samba.org>1999-07-22 04:55:13 +0000
commit1aef4d76c9ec5bd984ac1ba8123105d4c8e6cdfa (patch)
treecb7a2b6eeb2db3a74aa906b882a25863a307efa5 /source3/param
parent331ab45321dd37ba72b9569c1d62e887200595f3 (diff)
downloadsamba-1aef4d76c9ec5bd984ac1ba8123105d4c8e6cdfa.tar.gz
samba-1aef4d76c9ec5bd984ac1ba8123105d4c8e6cdfa.tar.bz2
samba-1aef4d76c9ec5bd984ac1ba8123105d4c8e6cdfa.zip
Support for arbitrary VFS options in smb.conf. Options are of the
format 'vfs option = name = value'. It would be nice to get rid of the first equals sign, but that would involve modifications to the smb.conf parser. There are a couple of naughties here - I've added a P_PTR enum as the VFS options are parsed in param/loadparm.c and stored as a linked list of structures. I couldn't for the life of me write a FN_LOCAL_PTR() macro to generate a lp_vfsoptions() function that actually worked so for the moment it is coded by hand. (This used to be commit 89ad85f0a3dfa233f6370ac6e3c97a1a645cfdfe)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c27a834914..7e736ad99d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -296,6 +296,7 @@ typedef struct
char *volume;
char *fstype;
char *vfsObjectFile;
+ struct vfs_options *vfsOptions;
int iMinPrintSpace;
int iCreate_mask;
int iCreate_force_mode;
@@ -390,6 +391,7 @@ static service sDefault =
NULL, /* volume */
NULL, /* fstype */
NULL, /* vfs object */
+ NULL, /* vfs options */
0, /* iMinPrintSpace */
0744, /* iCreate_mask */
0000, /* iCreate_force_mode */
@@ -459,6 +461,7 @@ static BOOL handle_copy(char *pszParmValue, char **ptr);
static BOOL handle_character_set(char *pszParmValue,char **ptr);
static BOOL handle_coding_system(char *pszParmValue,char **ptr);
static BOOL handle_vfs_object(char *pszParmValue, char **ptr);
+static BOOL handle_vfs_option(char *pszParmValue, char **ptr);
static void set_server_role(void);
static void set_default_server_announce_type(void);
@@ -810,7 +813,6 @@ static struct parm_struct parm_table[] =
{"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL, 0},
{"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, 0},
{"fstype", P_STRING, P_LOCAL, &sDefault.fstype, NULL, NULL, 0},
- {"vfs object", P_STRING, P_LOCAL, &sDefault.vfsObjectFile, handle_vfs_object, NULL, 0},
{"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL, 0},
{"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL, NULL, FLAG_GLOBAL},
{"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL, NULL, FLAG_GLOBAL},
@@ -824,6 +826,10 @@ static struct parm_struct parm_table[] =
{"fake directory create times", P_BOOL,P_LOCAL, &sDefault.bFakeDirCreateTimes, NULL, NULL, FLAG_GLOBAL},
{"panic action", P_STRING, P_GLOBAL, &Globals.szPanicAction, NULL, NULL, 0},
+ {"VFS options", P_SEP, P_SEPARATOR},
+
+ {"vfs object", P_STRING, P_LOCAL, &sDefault.vfsObjectFile, handle_vfs_object, NULL, 0},
+ {"vfs option", P_PTR, P_LOCAL, &sDefault.vfsOptions, handle_vfs_option, NULL, 0},
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
@@ -1170,6 +1176,9 @@ static char *lp_string(char *s)
#define FN_LOCAL_INTEGER(fn_name,val) \
int fn_name(int i) {return(LP_SNUM_OK(i)? pSERVICE(i)->val : sDefault.val);}
+struct vfs_options *lp_vfsoptions(int i)
+{ return(LP_SNUM_OK(i) ? pSERVICE(i)->vfsOptions : sDefault.vfsOptions); }
+
FN_GLOBAL_STRING(lp_logfile,&Globals.szLogFile)
FN_GLOBAL_STRING(lp_smbrun,&Globals.szSmbrun)
FN_GLOBAL_STRING(lp_configfile,&Globals.szConfigFile)
@@ -1893,6 +1902,65 @@ static BOOL handle_vfs_object(char *pszParmValue,char **ptr)
}
/***************************************************************************
+ handle the interpretation of the vfs option parameter
+ *************************************************************************/
+static BOOL handle_vfs_option(char *pszParmValue, char **ptr)
+{
+ struct vfs_options *new_option, **options = (struct vfs_options **)ptr;
+ int i;
+
+ /* Create new vfs option */
+
+ new_option = (struct vfs_options *)malloc(sizeof(*new_option));
+ if (new_option == NULL) {
+ return False;
+ }
+
+ ZERO_STRUCTP(new_option);
+
+ /* Get name and value */
+
+ new_option->name = strtok(pszParmValue, "=");
+
+ if (new_option->name == NULL) {
+ return False;
+ }
+
+ while(isspace(*new_option->name)) {
+ *new_option->name++;
+ }
+
+ for (i = strlen(new_option->name); i > 0; i--) {
+ if (!isspace(new_option->name[i - 1])) break;
+ }
+
+ new_option->name[i] = '\0';
+ new_option->name = strdup(new_option->name);
+
+ new_option->value = strtok(NULL, "=");
+
+ if (new_option->value != NULL) {
+
+ while(isspace(*new_option->value)) {
+ *new_option->value++;
+ }
+
+ for (i = strlen(new_option->value); i > 0; i--) {
+ if (!isspace(new_option->value[i - 1])) break;
+ }
+
+ new_option->value[i] = '\0';
+ new_option->value = strdup(new_option->value);
+ }
+
+ /* Add to list */
+
+ DLIST_ADD(*options, new_option);
+
+ return True;
+}
+
+/***************************************************************************
handle the interpretation of the coding system parameter
*************************************************************************/
static BOOL handle_coding_system(char *pszParmValue,char **ptr)