diff -Naur libmcrypt-2.5.7/lib/Makefile.am libmcrypt-2.5.7.new/lib/Makefile.am --- libmcrypt-2.5.7/lib/Makefile.am 2003-03-08 20:21:44 +0300 +++ libmcrypt-2.5.7.new/lib/Makefile.am 2003-03-28 13:10:24 +0300 @@ -11,7 +11,7 @@ libmcrypt_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -export-symbols libmcrypt.sym @LIBLTDL@ + -export-symbols libmcrypt.sym -ldl libmcrypt_la_LIBADD = @EXTRA_OBJECTS@ m4datadir = $(datadir)/aclocal diff -Naur libmcrypt-2.5.7/lib/mcrypt_modules.c libmcrypt-2.5.7.new/lib/mcrypt_modules.c --- libmcrypt-2.5.7/lib/mcrypt_modules.c 2003-01-07 10:17:18 +0300 +++ libmcrypt-2.5.7.new/lib/mcrypt_modules.c 2003-03-28 13:13:30 +0300 @@ -17,6 +17,7 @@ * Boston, MA 02111-1307, USA. */ + #ifndef LIBDEFS_H #define LIBDEFS_H #include @@ -29,6 +30,31 @@ # define fputs(x, y) #endif +#ifndef USE_LTDL +WIN32DLL_DEFINE +void *mcrypt_dlopen_ext ( const char *filename) { + void *ret; + char full_path[1054]; + + if (strlen(filename)>sizeof(full_path)) return NULL; + + strcpy(full_path, filename); + ret = dlopen(full_path, RTLD_LAZY); + + if (ret==NULL) { +#ifndef WIN32 + strcat(full_path, ".so"); +#else + strcat(full_path, ".dll"); +#endif + ret = dlopen(full_path, RTLD_LAZY); + } + return ret; + +} +#endif + + extern const mcrypt_preloaded mps[]; #define MAX_MOD_SIZE 1024 @@ -126,7 +152,7 @@ WIN32DLL_DEFINE void* mcrypt_dlopen ( mcrypt_dlhandle* handle, const char* a_directory, const char *m_directory, const char *filename) { - +#ifdef USE_LTDL char paths[1539]; if (!filename || !(*filename)) { @@ -159,7 +185,39 @@ handle->handle = lt_dlopenext(filename); return handle->handle; +#else + char full_path[1050]; + + if (strlen(filename) > sizeof( handle->name)) + return MCRYPT_FAILED; + else + strcpy( handle->name, filename); + + if (a_directory!=NULL) { + strncpy(full_path, a_directory, 512); + strcat(full_path, "/"); + strncat( full_path, filename, 512); + handle->handle = mcrypt_dlopen_ext(full_path); + } + if (handle->handle==NULL) { + if (m_directory!=NULL) { + strncpy(full_path, m_directory, 512); + strcat(full_path, "/"); + strncat( full_path, filename, 510); + handle->handle = mcrypt_dlopen_ext(full_path); + } + } + if (handle->handle==NULL) { + if (LIBDIR!=NULL) { + strncpy(full_path, LIBDIR, 512); + strcat(full_path, "/"); + strncat( full_path, filename, 510); + handle->handle = mcrypt_dlopen_ext(full_path); + } + } + return handle->handle; +#endif } WIN32DLL_DEFINE