diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-15 06:41:31 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-15 06:41:31 +0000 |
commit | 44f9f1042c9c436ccda7fefafd4a68749ffb5fe8 (patch) | |
tree | 74122c215c7e5f6b714d34c2163b97691236708a /source3 | |
parent | c3221b8377e267133b7c04d78d98d806c54da599 (diff) | |
download | samba-44f9f1042c9c436ccda7fefafd4a68749ffb5fe8.tar.gz samba-44f9f1042c9c436ccda7fefafd4a68749ffb5fe8.tar.bz2 samba-44f9f1042c9c436ccda7fefafd4a68749ffb5fe8.zip |
Clean up the VFS module loading logic by making the parameter an P_LIST,
rather than a runtime-parsed string.
Andrew Bartlett
(This used to be commit 3465cd6cd92c39c018979b5a82acbddca0927623)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 21 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 74 |
2 files changed, 36 insertions, 59 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 3878dabb60..d558b09d24 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -548,7 +548,6 @@ static int default_server_announce; /* prototypes for the special type handlers */ static BOOL handle_include(const char *pszParmValue, char **ptr); static BOOL handle_copy(const char *pszParmValue, char **ptr); -static BOOL handle_vfs_object(const char *pszParmValue, char **ptr); static BOOL handle_source_env(const char *pszParmValue, char **ptr); static BOOL handle_netbios_name(const char *pszParmValue, char **ptr); static BOOL handle_winbind_uid(const char *pszParmValue, char **ptr); @@ -1104,7 +1103,7 @@ static struct parm_struct parm_table[] = { {"VFS module options", P_SEP, P_SEPARATOR}, - {"vfs object", P_STRING, P_LOCAL, &sDefault.szVfsObjectFile, handle_vfs_object, NULL, FLAG_SHARE}, + {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjectFile, NULL, NULL, FLAG_SHARE}, {"vfs options", P_STRING, P_LOCAL, &sDefault.szVfsOptions, NULL, NULL, FLAG_SHARE}, {"vfs path", P_STRING, P_LOCAL, &sDefault.szVfsPath, NULL, NULL, FLAG_SHARE}, @@ -1774,7 +1773,7 @@ FN_LOCAL_LIST(lp_readlist, readlist) FN_LOCAL_LIST(lp_writelist, writelist) FN_LOCAL_LIST(lp_printer_admin, printer_admin) FN_LOCAL_STRING(lp_fstype, fstype) -FN_LOCAL_STRING(lp_vfsobj, szVfsObjectFile) +FN_LOCAL_LIST(lp_vfsobj, szVfsObjectFile) FN_LOCAL_STRING(lp_vfs_options, szVfsOptions) FN_LOCAL_STRING(lp_vfs_path, szVfsPath) FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy) @@ -2739,22 +2738,6 @@ static BOOL handle_source_env(const char *pszParmValue, char **ptr) } /*************************************************************************** - Handle the interpretation of the vfs object parameter. -*************************************************************************/ - -static BOOL handle_vfs_object(const char *pszParmValue, char **ptr) -{ - /* Set string value */ - - string_set(ptr, pszParmValue); - - /* Do any other initialisation required for vfs. Note that - anything done here may have linking repercussions in nmbd. */ - - return True; -} - -/*************************************************************************** Handle the include operation. ***************************************************************************/ diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 533c64b229..3bbe8a737a 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -215,54 +215,48 @@ Proceeding in compatibility mode, new operations (since version #%d) will fallba BOOL smbd_vfs_init(connection_struct *conn) { - char **vfs_objects, *vfsobj, *vfs_module, *vfs_path; - int nobj, i; + const char **vfs_objects; + char *vfs_module, *vfs_path; + unsigned int i; + unsigned int j = 0; struct smb_vfs_handle_struct *handle; /* Normal share - initialise with disk access functions */ vfs_init_default(conn); + vfs_objects = lp_vfsobj(SNUM(conn)); /* Override VFS functions if 'vfs object' was specified*/ - if (*lp_vfsobj(SNUM(conn))) { - vfsobj = NULL; - for(i=0; i<SMB_VFS_OP_LAST; i++) { - vfs_opaque_ops[i].op = ((void**)&default_vfs_ops)[i]; - vfs_opaque_ops[i].type = i; - vfs_opaque_ops[i].layer = SMB_VFS_LAYER_OPAQUE; + if (!vfs_objects) + return True; + + for(i=0; i<SMB_VFS_OP_LAST; i++) { + vfs_opaque_ops[i].op = ((void**)&default_vfs_ops)[i]; + vfs_opaque_ops[i].type = i; + vfs_opaque_ops[i].layer = SMB_VFS_LAYER_OPAQUE; + } + + vfs_path = lp_vfs_path(SNUM(conn)); + + for (j=0; vfs_objects[j]; j++) { + conn->vfs_private = NULL; + handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct)); + /* Loadable object file */ + handle->handle = NULL; + DLIST_ADD(conn->vfs_private, handle); + vfs_module = NULL; + if (vfs_path) { + asprintf(&vfs_module, "%s/%s", vfs_path, vfs_objects[j]); + } else { + asprintf(&vfs_module, "%s", vfs_objects[j]); } - if (string_set(&vfsobj, lp_vfsobj(SNUM(conn)))) { - /* Parse passed modules specification to array of modules */ - set_first_token(vfsobj); - /* We are using default separators: ' \t\r\n' */ - vfs_objects = toktocliplist(&nobj, NULL); - if (vfs_objects) { - vfs_path = lp_vfs_path(SNUM(conn)); - conn->vfs_private = NULL; - for(i=nobj-1; i>=0; i--) { - handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct)); - /* Loadable object file */ - handle->handle = NULL; - DLIST_ADD(conn->vfs_private, handle) - vfs_module = NULL; - if (vfs_path) { - asprintf(&vfs_module, "%s/%s", vfs_path, vfs_objects[i]); - } else { - asprintf(&vfs_module, "%s", vfs_objects[i]); - } - if (!vfs_init_custom(conn, vfs_module)) { - DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for %s\n", vfs_module)); - string_free(&vfsobj); - SAFE_FREE(vfs_module); - DLIST_REMOVE(conn->vfs_private, handle); - SAFE_FREE(handle); - return False; - } - SAFE_FREE(vfs_module); - } - } - string_free(&vfsobj); - return True; + if (!vfs_init_custom(conn, vfs_module)) { + DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for %s\n", vfs_module)); + SAFE_FREE(vfs_module); + DLIST_REMOVE(conn->vfs_private, handle); + SAFE_FREE(handle); + return False; } + SAFE_FREE(vfs_module); } return True; } |