aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_lib.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2005-12-30 22:53:59 +0000
committerAndy Polyakov <appro@openssl.org>2005-12-30 22:53:59 +0000
commit68b64fb6102737bf84de9e25168abbf7e969b54b (patch)
treefbd215080bb8f241fead7db2d4524f923d146b07 /crypto/dso/dso_lib.c
parent34b537ee66eb7d327ff04121ccb7b9cc6b07ab3e (diff)
downloadopenssl-68b64fb6102737bf84de9e25168abbf7e969b54b.tar.gz
Add DSO_global_lookup_func implementation. See commentary in dso_lib.c
for further details.
Diffstat (limited to 'crypto/dso/dso_lib.c')
-rw-r--r--crypto/dso/dso_lib.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 12ad097a28..8330c7d387 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -289,6 +289,7 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname)
DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_UNSUPPORTED);
return(NULL);
}
+fprintf(stderr,"boo\n");
if((ret = dso->meth->dso_bind_func(dso, symname)) == NULL)
{
DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_SYM_FAILURE);
@@ -476,3 +477,23 @@ int DSO_pathbyaddr(void *addr,char *path,int sz)
}
return (*meth->pathbyaddr)(addr,path,sz);
}
+
+/* This function should be used with caution! It looks up symbols in
+ * *all* loaded modules and if module gets unloaded by somebody else
+ * attempt to dereference the pointer is doomed to have fatal
+ * consequences. Primary usage for this function is to probe *core*
+ * system functionality, e.g. check if getnameinfo(3) is available
+ * at run-time without bothering about OS-specific details such as
+ * libc.so.versioning or where does it actually reside: in libc
+ * itself or libsocket. */
+DSO_FUNC_TYPE DSO_global_lookup_func(const char *name)
+ {
+ DSO_METHOD *meth = default_DSO_meth;
+ if (meth == NULL) meth = DSO_METHOD_openssl();
+ if (meth->globallookup == NULL)
+ {
+ DSOerr(DSO_F_GLOBAL_LOOKUP_FUNC,DSO_R_UNSUPPORTED);
+ return NULL;
+ }
+ return (*meth->globallookup)(name);
+ }