summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/configure.in27
-rw-r--r--source3/lib/iconv.c9
-rw-r--r--source3/lib/module.c2
-rw-r--r--source3/smbd/conn.c4
-rw-r--r--source3/smbd/vfs.c29
6 files changed, 48 insertions, 25 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 75a8db30c2..b05e7692cd 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1028,7 +1028,7 @@ bin/audit.@SHLIBEXT@: $(VFS_AUDIT_OBJ)
bin/extd_audit.@SHLIBEXT@: $(VFS_EXTD_AUDIT_OBJ)
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_AUDIT_OBJ) \
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_EXTD_AUDIT_OBJ) \
@SONAMEFLAG@`basename $@`
bin/recycle.@SHLIBEXT@: $(VFS_RECYCLE_OBJ)
diff --git a/source3/configure.in b/source3/configure.in
index 20c3b2ef04..98e01f5bd5 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -239,7 +239,11 @@ AC_VALIDATE_CACHE_SYSTEM_TYPE
DYNEXP=
dnl Add modules that have to be built by default here
-default_modules="pdb_smbpasswd pdb_tdbsam pdb_unix rpc_lsa rpc_samr rpc_reg rpc_wks rpc_net rpc_dfs rpc_srv rpc_spoolss auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_recycle vfs_audit vfs_extd_audit vfs_fake_perms vfs_netatalk"
+dnl These have to be built static:
+default_static_modules="pdb_smbpasswd pdb_tdbsam pdb_unix rpc_lsa rpc_samr rpc_reg rpc_wks rpc_net rpc_dfs rpc_srv rpc_spoolss auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin"
+
+dnl These are preferably build shared, and static if dlopen() is not available
+default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_fake_perms vfs_netatalk"
#
# Config CPPFLAG settings for strange OS's that must be set
@@ -2255,7 +2259,7 @@ if test x"$with_ldap_support" = x"yes"; then
if test x$have_ldap != xyes; then
AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])])
- AC_CHECK_HEADERS([ldap.h lber.h], [default_modules="$default_modules pdb_ldap"])
+ AC_CHECK_HEADERS([ldap.h lber.h], [default_static_modules="$default_static_modules pdb_ldap"])
########################################################
# If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
@@ -2272,11 +2276,11 @@ fi
########################################################
# Compile with MySQL support?
-AM_PATH_MYSQL([0.11.0],[default_modules="$default_modules pdb_mysql"],[])
+AM_PATH_MYSQL([0.11.0],[default_shared_modules="$default_shared_modules pdb_mysql"],[])
########################################################
# Compile with XML support?
-AM_PATH_XML2([2.0.0],[default_modules="$default_modules pdb_xml"],[])
+AM_PATH_XML2([2.0.0],[default_shared_modules="$default_shared_modules pdb_xml"],[])
#################################################
# check for automount support
@@ -3333,13 +3337,22 @@ AC_ARG_WITH(python,
esac ])
AC_SUBST(PYTHON)
-for i in `echo $default_modules | sed -e's/,/ /g'`
+for i in `echo $default_static_modules | sed -e's/,/ /g'`
do
- dnl Set to shared instead of static when dlopen() is available?
eval MODULE_DEFAULT_$i=STATIC
done
-# Always built these modules static
+for i in `echo $default_shared_modules | sed -e's/,/ /g'`
+do
+ dnl Fall back to static if dlopen() is not available
+ eval MODULE_DEFAULT_$i=STATIC
+
+ if test x"$ac_cv_func_dlopen" = xyes; then
+ eval MODULE_DEFAULT_$i=SHARED
+ fi
+done
+
+dnl Always built these modules static
MODULE_pdb_guest=STATIC
MODULE_rpc_spoolss=STATIC
MODULE_rpc_srv=STATIC
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index 6a397f2d9e..a37441b9fa 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -66,8 +66,12 @@ static struct charset_functions *charsets = NULL;
static struct charset_functions *find_charset_functions(const char *name)
{
struct charset_functions *c = charsets;
+ pstring stripped;
+
+ module_path_get_name(name, stripped);
+
while(c) {
- if (strcasecmp(name, c->name) == 0)return c;
+ if (strequal(stripped, c->name) == 0)return c;
c = c->next;
}
@@ -103,9 +107,8 @@ void lazy_initialize_iconv(void)
initialized = True;
for(i = 0; builtin_functions[i].name; i++)
smb_register_charset(&builtin_functions[i]);
+ static_init_charset;
}
-
- static_init_charset;
}
/* if there was an error then reset the internal state,
diff --git a/source3/lib/module.c b/source3/lib/module.c
index e400945a8b..700de56953 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -132,7 +132,7 @@ void module_path_get_name(char *path, pstring name)
char *s;
/* First, make the path relative */
- s = strrchr_m(path, '/');
+ s = strrchr(path, '/');
if(s) pstrcpy(name, s+1);
else pstrcpy(name, path);
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 2a77e23e73..b6c7aa1076 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -201,10 +201,11 @@ void conn_free(connection_struct *conn)
/* Free vfs_connection_struct */
handle = conn->vfs_private;
while(handle) {
+ /* Only call dlclose for the old modules */
if (handle->handle) {
/* Close dlopen() handle */
done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
-
+
if (done_fptr == NULL) {
DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
} else {
@@ -212,7 +213,6 @@ void conn_free(connection_struct *conn)
}
sys_dlclose(handle->handle);
}
-
DLIST_REMOVE(conn->vfs_private, handle);
thandle = handle->next;
SAFE_FREE(handle);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 119e2e2f9a..465d14abba 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -141,9 +141,12 @@ static struct vfs_ops default_vfs_ops = {
struct vfs_init_function_entry *vfs_find_backend_entry(const char *name)
{
struct vfs_init_function_entry *entry = backends;
+ pstring stripped;
+
+ module_path_get_name(name, stripped);
while(entry) {
- if (strequal(entry->name, name)) return entry;
+ if (strequal(entry->name, stripped)) return entry;
entry = entry->next;
}
@@ -200,7 +203,7 @@ static void vfs_init_default(connection_struct *conn)
Function to load old VFS modules. Should go away after a while.
**************************************************************************/
-static BOOL vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
+static vfs_op_tuple *vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
{
int vfs_version = -1;
vfs_op_tuple *ops, *(*init_fptr)(int *, const struct vfs_ops *, struct smb_vfs_handle_struct *);
@@ -208,7 +211,7 @@ static BOOL vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
if ((conn->vfs_private->handle = sys_dlopen(vfs_object, RTLD_NOW)) == NULL) {
DEBUG(0, ("Error opening %s: %s\n", vfs_object, sys_dlerror()));
- return False;
+ return NULL;
}
/* Get handle on vfs_init() symbol */
@@ -218,21 +221,21 @@ static BOOL vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
if (init_fptr == NULL) {
DEBUG(0, ("No vfs_init() symbol found in %s\n", vfs_object));
sys_dlclose(conn->vfs_private->handle);
- return False;
+ return NULL;
}
/* Initialise vfs_ops structure */
if ((ops = init_fptr(&vfs_version, &conn->vfs_ops, conn->vfs_private)) == NULL) {
DEBUG(0, ("vfs_init() function from %s failed\n", vfs_object));
sys_dlclose(conn->vfs_private->handle);
- return False;
+ return NULL;
}
if ((vfs_version < SMB_VFS_INTERFACE_CASCADED)) {
DEBUG(0, ("vfs_init() returned wrong interface version info (was %d, should be no less than %d)\n",
vfs_version, SMB_VFS_INTERFACE_VERSION ));
sys_dlclose(conn->vfs_private->handle);
- return False;
+ return NULL;
}
if ((vfs_version < SMB_VFS_INTERFACE_VERSION)) {
@@ -240,10 +243,10 @@ static BOOL vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
Proceeding in compatibility mode, new operations (since version #%d) will fallback to default ones.\n",
vfs_version, SMB_VFS_INTERFACE_VERSION, vfs_version ));
sys_dlclose(conn->vfs_private->handle);
- return False;
+ return NULL;
}
- return True;
+ return ops;
}
@@ -277,10 +280,14 @@ BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object)
/* If that doesn't work, fall back to the old system
* (This part should go away after a while, it's only here
* for backwards compatibility) */
- DEBUG(2, ("Can't load module with new modules system, falling back to old\n"));
- if (!vfs_load_old_plugin(conn, vfs_object)) return False;
+ DEBUG(2, ("Can't load module %s with new modules system, falling back to compatibility\n",
+ vfs_object));
+ if ((ops = vfs_load_old_plugin(conn, vfs_object)) == NULL) {
+ DEBUG(0, ("vfs init function from %s failed\n", vfs_object));
+ return False;
+ }
}
-
+
for(i=0; ops[i].op != NULL; i++) {
DEBUG(3, ("Checking operation #%d (type %d, layer %d)\n", i, ops[i].type, ops[i].layer));
if(ops[i].layer == SMB_VFS_LAYER_OPAQUE) {