diff options
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/ChangeLog | 11 | ||||
-rw-r--r-- | cipher/dynload.c | 56 | ||||
-rw-r--r-- | cipher/rndunix.c | 1 |
3 files changed, 57 insertions, 11 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 7692ef62d..133b3bc80 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,14 @@ +2001-04-17 Werner Koch <[email protected]> + + * rndunix.c: Add a signal.h header to avoid warnings on SOlaris 7 + and 8. + +2001-04-16 Werner Koch <[email protected]> + + * dynload.c [__MINGW32__]: Applied patch from Timo Schulz to make + it work under W32. This patches is based on the one from + 2001-04-06 Werner Koch <[email protected]> * rijndael.c, des.c, blowfish.c, twofish.c, cast5.c (burn_stack): diff --git a/cipher/dynload.c b/cipher/dynload.c index 879d2ec6d..01992942a 100644 --- a/cipher/dynload.c +++ b/cipher/dynload.c @@ -71,20 +71,52 @@ dlsym(void *handle, char *name) #endif /*HAVE_DL_SHL_LOAD*/ #ifdef __MINGW32__ -#warning Needs some more work. Based on [email protected] patch. +#define HAVE_DL_DLOPEN +#define USE_DYNAMIC_LINKING -#define dlopen(PATHNAME,MODE) ((void *)LoadLibrary(PATHNAME)) -#define dlclose(HANDLE) FreeLibrary(HANDLE) -char *dlerror(void) +static int last_error = 0; + +void* +dlopen(const char *pathname, int mode) { - static char dlerrstr[10]; - int err=GetLastError(); - if (!err) - return NULL; - sprintf(dlerrstr, "%u", err); - return dlerrstr; + void *h = LoadLibrary( pathname ); + if (!h) { + log_error( "LoadLibrary failed ec=%d\n", (int)GetLastError() ); + last_error = 1; + return NULL; + } + return h; +} + +int +dlclose( void *handle ) +{ + last_error = 0; + return FreeLibrary( handle ); +} + +char* +dlerror(void) +{ + static char dlerrstr[10]; + if (last_error) { + sprintf(dlerrstr, "%d", (int)GetLastError() ); + return dlerrstr; + } + return NULL; +} + +void* +dlsym( void *handle, const char *name ) +{ + void *h = GetProcAddress( handle, name ); + if (!h) { + log_error( "GetProcAddress failed ec=%d\n", (int)GetLastError() ); + last_error = 1; + return NULL; + } + return h; } -#define dlsym(HANDLE,NAME) GetProcAddress(HANDLE,NAME) #endif /*__MINGW32__*/ @@ -241,9 +273,11 @@ load_extension( EXTLIST el ) int rc; #endif + #ifndef __MINGW32__ /* make sure we are not setuid */ if( getuid() != geteuid() ) log_bug("trying to load an extension while still setuid\n"); + #endif /* now that we are not setuid anymore, we can safely load modules */ #ifdef HAVE_DL_DLOPEN diff --git a/cipher/rndunix.c b/cipher/rndunix.c index 7a3d76d87..87e832785 100644 --- a/cipher/rndunix.c +++ b/cipher/rndunix.c @@ -80,6 +80,7 @@ #endif /* _AIX || __QNX__ */ #ifndef __QNX__ #include <sys/shm.h> +#include <signal.h> #include <sys/signal.h> #endif /* __QNX__ */ #include <sys/stat.h> |