Jeremy.
#define F_SETLKW 14
#endif
+/* Needed for sys_dlopen/sys_dlsym/sys_dlclose */
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#ifndef RTLD_LAZY
+#define RTLD_LAZY 0
+#endif
+
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+
#endif /* _INCLUDES_H */
pid_t sys_getpid(void);
int sys_popen(const char *command);
int sys_pclose(int fd);
+void *sys_dlopen(const char *name, int flags);
+void *sys_dlsym(void *handle, char *symbol);
+int sys_dlclose (void *handle);
/*The following definitions come from lib/talloc.c */
return -1;
return wstatus;
}
+
+/**************************************************************************
+ Wrappers for dlopen, dlsym, dlclose.
+****************************************************************************/
+
+void *sys_dlopen(const char *name, int flags)
+{
+#ifdef HAVE_LIBDL
+ return dlopen(name, flags);
+#else
+ return NULL;
+#endif
+}
+
+void *sys_dlsym(void *handle, char *symbol)
+{
+#ifdef HAVE_LIBDL
+ return dlsym(handle, symbol);
+#else
+ return NULL;
+#endif
+}
+
+int sys_dlclose (void *handle)
+{
+#ifdef HAVE_LIBDL
+ return dlclose(handle);
+#else
+ return 0;
+#endif
+}
/* load another module? */
if (reload && pdb_handle)
{
- dlclose (pdb_handle);
+ sys_dlclose (pdb_handle);
pdb_handle = NULL;
}
/* do we have a module defined or use the default? */
if (strlen (modulename) != 0)
{
- if ((pdb_handle=dlopen (modulename, RTLD_LAZY)) == NULL)
+ if ((pdb_handle=sys_dlopen (modulename, RTLD_LAZY)) == NULL)
{
DEBUG(0,("initialize_password_db: ERROR - Unable to open passdb module \"%s\"!\n%s\n",
modulename, dlerror()));
to open. Let's try the default */
if (pdb_handle == NULL)
{
- if ((pdb_handle=dlopen ("libpdbfile.so", RTLD_LAZY)) == NULL)
+ if ((pdb_handle=sys_dlopen ("libpdbfile.so", RTLD_LAZY)) == NULL)
{
DEBUG(0,("initialize_password_db: ERROR - Unable to open \"libpdbfile.so\" passdb module! No user authentication possible!\n%s\n",
dlerror()));
/* Open object file */
- if ((conn->dl_handle = dlopen(lp_vfsobj(SNUM(conn)), RTLD_NOW | RTLD_GLOBAL)) == NULL) {
+ if ((conn->dl_handle = sys_dlopen(lp_vfsobj(SNUM(conn)), RTLD_NOW | RTLD_GLOBAL)) == NULL) {
DEBUG(0, ("Error opening %s: %s\n", lp_vfsobj(SNUM(conn)), dlerror()));
return False;
}
/* Get handle on vfs_init() symbol */
- init_fptr = (struct vfs_ops *(*)(int *))dlsym(conn->dl_handle, "vfs_init");
+ init_fptr = (struct vfs_ops *(*)(int *))sys_dlsym(conn->dl_handle, "vfs_init");
if (init_fptr == NULL) {
DEBUG(0, ("No vfs_init() symbol found in %s\n",