diff options
Diffstat (limited to 'src/lib/libssl/src/crypto/dso/dso_vms.c')
-rw-r--r-- | src/lib/libssl/src/crypto/dso/dso_vms.c | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/src/lib/libssl/src/crypto/dso/dso_vms.c b/src/lib/libssl/src/crypto/dso/dso_vms.c index 8ff7090129..1674619d17 100644 --- a/src/lib/libssl/src/crypto/dso/dso_vms.c +++ b/src/lib/libssl/src/crypto/dso/dso_vms.c | |||
@@ -59,18 +59,17 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <errno.h> | 61 | #include <errno.h> |
62 | #ifdef VMS | 62 | #include "cryptlib.h" |
63 | #include <openssl/dso.h> | ||
64 | #ifdef OPENSSL_SYS_VMS | ||
63 | #pragma message disable DOLLARID | 65 | #pragma message disable DOLLARID |
64 | #include <lib$routines.h> | 66 | #include <lib$routines.h> |
65 | #include <libfisdef.h> | ||
66 | #include <stsdef.h> | 67 | #include <stsdef.h> |
67 | #include <descrip.h> | 68 | #include <descrip.h> |
68 | #include <starlet.h> | 69 | #include <starlet.h> |
69 | #endif | 70 | #endif |
70 | #include "cryptlib.h" | ||
71 | #include <openssl/dso.h> | ||
72 | 71 | ||
73 | #ifndef VMS | 72 | #ifndef OPENSSL_SYS_VMS |
74 | DSO_METHOD *DSO_METHOD_vms(void) | 73 | DSO_METHOD *DSO_METHOD_vms(void) |
75 | { | 74 | { |
76 | return NULL; | 75 | return NULL; |
@@ -78,7 +77,7 @@ DSO_METHOD *DSO_METHOD_vms(void) | |||
78 | #else | 77 | #else |
79 | #pragma message disable DOLLARID | 78 | #pragma message disable DOLLARID |
80 | 79 | ||
81 | static int vms_load(DSO *dso, const char *filename); | 80 | static int vms_load(DSO *dso); |
82 | static int vms_unload(DSO *dso); | 81 | static int vms_unload(DSO *dso); |
83 | static void *vms_bind_var(DSO *dso, const char *symname); | 82 | static void *vms_bind_var(DSO *dso, const char *symname); |
84 | static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname); | 83 | static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname); |
@@ -87,8 +86,9 @@ static int vms_unbind_var(DSO *dso, char *symname, void *symptr); | |||
87 | static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | 86 | static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); |
88 | static int vms_init(DSO *dso); | 87 | static int vms_init(DSO *dso); |
89 | static int vms_finish(DSO *dso); | 88 | static int vms_finish(DSO *dso); |
90 | #endif | ||
91 | static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg); | 89 | static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg); |
90 | #endif | ||
91 | static char *vms_name_converter(DSO *dso, const char *filename); | ||
92 | 92 | ||
93 | static DSO_METHOD dso_meth_vms = { | 93 | static DSO_METHOD dso_meth_vms = { |
94 | "OpenSSL 'VMS' shared library method", | 94 | "OpenSSL 'VMS' shared library method", |
@@ -101,7 +101,8 @@ static DSO_METHOD dso_meth_vms = { | |||
101 | NULL, /* unbind_var */ | 101 | NULL, /* unbind_var */ |
102 | NULL, /* unbind_func */ | 102 | NULL, /* unbind_func */ |
103 | #endif | 103 | #endif |
104 | vms_ctrl, | 104 | NULL, /* ctrl */ |
105 | vms_name_converter, | ||
105 | NULL, /* init */ | 106 | NULL, /* init */ |
106 | NULL /* finish */ | 107 | NULL /* finish */ |
107 | }; | 108 | }; |
@@ -129,11 +130,20 @@ DSO_METHOD *DSO_METHOD_vms(void) | |||
129 | return(&dso_meth_vms); | 130 | return(&dso_meth_vms); |
130 | } | 131 | } |
131 | 132 | ||
132 | static int vms_load(DSO *dso, const char *filename) | 133 | static int vms_load(DSO *dso) |
133 | { | 134 | { |
135 | void *ptr = NULL; | ||
136 | /* See applicable comments in dso_dl.c */ | ||
137 | char *filename = DSO_convert_filename(dso, NULL); | ||
134 | DSO_VMS_INTERNAL *p; | 138 | DSO_VMS_INTERNAL *p; |
135 | const char *sp1, *sp2; /* Search result */ | 139 | const char *sp1, *sp2; /* Search result */ |
136 | 140 | ||
141 | if(filename == NULL) | ||
142 | { | ||
143 | DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME); | ||
144 | goto err; | ||
145 | } | ||
146 | |||
137 | /* A file specification may look like this: | 147 | /* A file specification may look like this: |
138 | * | 148 | * |
139 | * node::dev:[dir-spec]name.type;ver | 149 | * node::dev:[dir-spec]name.type;ver |
@@ -175,14 +185,14 @@ static int vms_load(DSO *dso, const char *filename) | |||
175 | || (sp1 - filename) + strlen(sp2) > FILENAME_MAX) | 185 | || (sp1 - filename) + strlen(sp2) > FILENAME_MAX) |
176 | { | 186 | { |
177 | DSOerr(DSO_F_VMS_LOAD,DSO_R_FILENAME_TOO_BIG); | 187 | DSOerr(DSO_F_VMS_LOAD,DSO_R_FILENAME_TOO_BIG); |
178 | return(0); | 188 | goto err; |
179 | } | 189 | } |
180 | 190 | ||
181 | p = (DSO_VMS_INTERNAL *)OPENSSL_malloc(sizeof(DSO_VMS_INTERNAL)); | 191 | p = (DSO_VMS_INTERNAL *)OPENSSL_malloc(sizeof(DSO_VMS_INTERNAL)); |
182 | if(p == NULL) | 192 | if(p == NULL) |
183 | { | 193 | { |
184 | DSOerr(DSO_F_VMS_LOAD,ERR_R_MALLOC_FAILURE); | 194 | DSOerr(DSO_F_VMS_LOAD,ERR_R_MALLOC_FAILURE); |
185 | return(0); | 195 | goto err; |
186 | } | 196 | } |
187 | 197 | ||
188 | strncpy(p->filename, sp1, sp2-sp1); | 198 | strncpy(p->filename, sp1, sp2-sp1); |
@@ -204,10 +214,19 @@ static int vms_load(DSO *dso, const char *filename) | |||
204 | if(!sk_push(dso->meth_data, (char *)p)) | 214 | if(!sk_push(dso->meth_data, (char *)p)) |
205 | { | 215 | { |
206 | DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR); | 216 | DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR); |
207 | OPENSSL_free(p); | 217 | goto err; |
208 | return(0); | ||
209 | } | 218 | } |
219 | |||
220 | /* Success (for now, we lie. We actually do not know...) */ | ||
221 | dso->loaded_filename = filename; | ||
210 | return(1); | 222 | return(1); |
223 | err: | ||
224 | /* Cleanup! */ | ||
225 | if(p != NULL) | ||
226 | OPENSSL_free(p); | ||
227 | if(filename != NULL) | ||
228 | OPENSSL_free(filename); | ||
229 | return(0); | ||
211 | } | 230 | } |
212 | 231 | ||
213 | /* Note that this doesn't actually unload the shared image, as there is no | 232 | /* Note that this doesn't actually unload the shared image, as there is no |
@@ -260,7 +279,12 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) | |||
260 | { | 279 | { |
261 | DSO_VMS_INTERNAL *ptr; | 280 | DSO_VMS_INTERNAL *ptr; |
262 | int status; | 281 | int status; |
263 | int flags = LIB$M_FIS_MIXEDCASE; | 282 | #if 0 |
283 | int flags = (1<<4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't | ||
284 | defined in VMS older than 7.0 or so */ | ||
285 | #else | ||
286 | int flags = 0; | ||
287 | #endif | ||
264 | struct dsc$descriptor_s symname_dsc; | 288 | struct dsc$descriptor_s symname_dsc; |
265 | *sym = NULL; | 289 | *sym = NULL; |
266 | 290 | ||
@@ -344,28 +368,12 @@ static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname) | |||
344 | return sym; | 368 | return sym; |
345 | } | 369 | } |
346 | 370 | ||
347 | static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg) | 371 | static char *vms_name_converter(DSO *dso, const char *filename) |
348 | { | 372 | { |
349 | if(dso == NULL) | 373 | int len = strlen(filename); |
350 | { | 374 | char *not_translated = OPENSSL_malloc(len+1); |
351 | DSOerr(DSO_F_VMS_CTRL,ERR_R_PASSED_NULL_PARAMETER); | 375 | strcpy(not_translated,filename); |
352 | return(-1); | 376 | return(not_translated); |
353 | } | 377 | } |
354 | switch(cmd) | 378 | |
355 | { | 379 | #endif /* OPENSSL_SYS_VMS */ |
356 | case DSO_CTRL_GET_FLAGS: | ||
357 | return dso->flags; | ||
358 | case DSO_CTRL_SET_FLAGS: | ||
359 | dso->flags = (int)larg; | ||
360 | return(0); | ||
361 | case DSO_CTRL_OR_FLAGS: | ||
362 | dso->flags |= (int)larg; | ||
363 | return(0); | ||
364 | default: | ||
365 | break; | ||
366 | } | ||
367 | DSOerr(DSO_F_VMS_CTRL,DSO_R_UNKNOWN_COMMAND); | ||
368 | return(-1); | ||
369 | } | ||
370 | |||
371 | #endif /* VMS */ | ||