aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_lib.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2000-04-19 21:45:17 +0000
committerGeoff Thorpe <geoff@openssl.org>2000-04-19 21:45:17 +0000
commitb9e6391582c1a2c8ff6ebc96d7a2abb7483def2a (patch)
tree9255d75e5070366a465d52bed9c3a473446b10cd /crypto/dso/dso_lib.c
parent2c8c4ce2e0e4c3ccc7f43993e0fed1542e20e11f (diff)
downloadopenssl-b9e6391582c1a2c8ff6ebc96d7a2abb7483def2a.tar.gz
This change facilitates name translation for shared libraries. The
technique used is far from perfect and alternatives are welcome. Basically if the translation flag is set, the string is not too long, and there appears to be no path information in the string, then it is converted to whatever the standard should be for the DSO_METHOD in question, eg; blah --> libblah.so on *nix, and blah --> blah.dll on win32. This change also introduces the DSO_ctrl() function that is used by the name translation stuff.
Diffstat (limited to 'crypto/dso/dso_lib.c')
-rw-r--r--crypto/dso/dso_lib.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 9430d0d76f..f41ebf1aa4 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -187,7 +187,7 @@ int DSO_up(DSO *dso)
return(1);
}
-DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth)
+DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
{
DSO *ret;
int allocated = 0;
@@ -209,6 +209,15 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth)
}
else
ret = dso;
+ /* Bleurgh ... have to check for negative return values for
+ * errors. <grimace> */
+ if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
+ {
+ DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
+ if(allocated)
+ DSO_free(ret);
+ return(NULL);
+ }
if(ret->meth->dso_load == NULL)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED);
@@ -249,3 +258,26 @@ void *DSO_bind(DSO *dso, const char *symname)
/* Success */
return(ret);
}
+
+/* I don't really like these *_ctrl functions very much to be perfectly
+ * honest. For one thing, I think I have to return a negative value for
+ * any error because possible DSO_ctrl() commands may return values
+ * such as "size"s that can legitimately be zero (making the standard
+ * "if(DSO_cmd(...))" form that works almost everywhere else fail at
+ * odd times. I'd prefer "output" values to be passed by reference and
+ * the return value as success/failure like usual ... but we conform
+ * when we must... :-) */
+long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
+ {
+ if(dso == NULL)
+ {
+ DSOerr(DSO_F_DSO_CTRL,ERR_R_PASSED_NULL_PARAMETER);
+ return(-1);
+ }
+ if((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL))
+ {
+ DSOerr(DSO_F_DSO_CTRL,DSO_R_UNSUPPORTED);
+ return(-1);
+ }
+ return(dso->meth->dso_ctrl(dso,cmd,larg,parg));
+ }