setup-vms.h
Go to the documentation of this file.
00001 #ifndef HEADER_CURL_SETUP_VMS_H
00002 #define HEADER_CURL_SETUP_VMS_H
00003 /***************************************************************************
00004  *                                  _   _ ____  _
00005  *  Project                     ___| | | |  _ \| |
00006  *                             / __| | | | |_) | |
00007  *                            | (__| |_| |  _ <| |___
00008  *                             \___|\___/|_| \_\_____|
00009  *
00010  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00011  *
00012  * This software is licensed as described in the file COPYING, which
00013  * you should have received as part of this distribution. The terms
00014  * are also available at https://curl.haxx.se/docs/copyright.html.
00015  *
00016  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00017  * copies of the Software, and permit persons to whom the Software is
00018  * furnished to do so, under the terms of the COPYING file.
00019  *
00020  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00021  * KIND, either express or implied.
00022  *
00023  ***************************************************************************/
00024 
00025 /*                                                                         */
00026 /* JEM, 12/30/12, VMS now generates config.h, so only define wrappers for  */
00027 /*                getenv(), getpwuid() and provide is_vms_shell()          */
00028 /*                Also need upper case symbols for system services, and    */
00029 /*                OpenSSL, and some Kerberos image                         */
00030 
00031 #ifdef __DECC
00032 #pragma message save
00033 #pragma message disable dollarid
00034 #endif
00035 
00036 /* Hide the stuff we are overriding */
00037 #define getenv decc_getenv
00038 #ifdef __DECC
00039 #   if __INITIAL_POINTER_SIZE != 64
00040 #       define getpwuid decc_getpwuid
00041 #   endif
00042 #endif
00043 #include <stdlib.h>
00044 char *decc$getenv(const char *__name);
00045 #include <pwd.h>
00046 
00047 #include <string.h>
00048 #include <unixlib.h>
00049 
00050 #undef getenv
00051 #undef getpwuid
00052 #define getenv vms_getenv
00053 #define getpwuid vms_getpwuid
00054 
00055 /* VAX needs these in upper case when compiling exact case */
00056 #define sys$assign SYS$ASSIGN
00057 #define sys$dassgn SYS$DASSGN
00058 #define sys$qiow SYS$QIOW
00059 
00060 #ifdef __DECC
00061 #   if __INITIAL_POINTER_SIZE
00062 #       pragma __pointer_size __save
00063 #   endif
00064 #endif
00065 
00066 #if __USE_LONG_GID_T
00067 #   define decc_getpwuid DECC$__LONG_GID_GETPWUID
00068 #else
00069 #   if __INITIAL_POINTER_SIZE
00070 #       define decc_getpwuid decc$__32_getpwuid
00071 #   else
00072 #       define decc_getpwuid decc$getpwuid
00073 #   endif
00074 #endif
00075 
00076     struct passwd * decc_getpwuid(uid_t uid);
00077 
00078 #ifdef __DECC
00079 #   if __INITIAL_POINTER_SIZE == 32
00080 /* Translate the path, but only if the path is a VMS file specification */
00081 /* The translation is usually only needed for older versions of VMS */
00082 static char *vms_translate_path(const char *path)
00083 {
00084   char *unix_path;
00085   char *test_str;
00086 
00087   /* See if the result is in VMS format, if not, we are done */
00088   /* Assume that this is a PATH, not just some data */
00089   test_str = strpbrk(path, ":[<^");
00090   if(test_str == NULL) {
00091     return (char *)path;
00092   }
00093 
00094   unix_path = decc$translate_vms(path);
00095 
00096   if((int)unix_path <= 0) {
00097     /* We can not translate it, so return the original string */
00098     return (char *)path;
00099   }
00100 }
00101 #   else
00102     /* VMS translate path is actually not needed on the current 64 bit */
00103     /* VMS platforms, so instead of figuring out the pointer settings */
00104     /* Change it to a noop */
00105 #   define vms_translate_path(__path) __path
00106 #   endif
00107 #endif
00108 
00109 #ifdef __DECC
00110 #   if __INITIAL_POINTER_SIZE
00111 #       pragma __pointer_size __restore
00112 #   endif
00113 #endif
00114 
00115 static char *vms_getenv(const char *envvar)
00116 {
00117   char *result;
00118   char *vms_path;
00119 
00120   /* first use the DECC getenv() function */
00121   result = decc$getenv(envvar);
00122   if(result == NULL) {
00123     return result;
00124   }
00125 
00126   vms_path = result;
00127   result = vms_translate_path(vms_path);
00128 
00129   /* note that if you backport this to use VAX C RTL, that the VAX C RTL */
00130   /* may do a malloc(2048) for each call to getenv(), so you will need   */
00131   /* to add a free(vms_path) */
00132   /* Do not do a free() for DEC C RTL builds, which should be used for */
00133   /* VMS 5.5-2 and later, even if using GCC */
00134 
00135   return result;
00136 }
00137 
00138 
00139 static struct passwd vms_passwd_cache;
00140 
00141 static struct passwd * vms_getpwuid(uid_t uid)
00142 {
00143   struct passwd * my_passwd;
00144 
00145 /* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */
00146 #ifdef __DECC
00147 #   if __INITIAL_POINTER_SIZE
00148   __char_ptr32 unix_path;
00149 #   else
00150   char *unix_path;
00151 #   endif
00152 #else
00153   char *unix_path;
00154 #endif
00155 
00156   my_passwd = decc_getpwuid(uid);
00157   if(my_passwd == NULL) {
00158     return my_passwd;
00159   }
00160 
00161   unix_path = vms_translate_path(my_passwd->pw_dir);
00162 
00163   if((long)unix_path <= 0) {
00164     /* We can not translate it, so return the original string */
00165     return my_passwd;
00166   }
00167 
00168   /* If no changes needed just return it */
00169   if(unix_path == my_passwd->pw_dir) {
00170     return my_passwd;
00171   }
00172 
00173   /* Need to copy the structure returned */
00174   /* Since curl is only using pw_dir, no need to fix up */
00175   /* the pw_shell when running under Bash */
00176   vms_passwd_cache.pw_name = my_passwd->pw_name;
00177   vms_passwd_cache.pw_uid = my_passwd->pw_uid;
00178   vms_passwd_cache.pw_gid = my_passwd->pw_uid;
00179   vms_passwd_cache.pw_dir = unix_path;
00180   vms_passwd_cache.pw_shell = my_passwd->pw_shell;
00181 
00182   return &vms_passwd_cache;
00183 }
00184 
00185 #ifdef __DECC
00186 #pragma message restore
00187 #endif
00188 
00189 /* Bug - VMS OpenSSL and Kerberos universal symbols are in uppercase only */
00190 /* VMS libraries should have universal symbols in exact and uppercase */
00191 
00192 #define ASN1_INTEGER_get ASN1_INTEGER_GET
00193 #define ASN1_STRING_data ASN1_STRING_DATA
00194 #define ASN1_STRING_length ASN1_STRING_LENGTH
00195 #define ASN1_STRING_print ASN1_STRING_PRINT
00196 #define ASN1_STRING_to_UTF8 ASN1_STRING_TO_UTF8
00197 #define ASN1_STRING_type ASN1_STRING_TYPE
00198 #define BIO_ctrl BIO_CTRL
00199 #define BIO_free BIO_FREE
00200 #define BIO_new BIO_NEW
00201 #define BIO_s_mem BIO_S_MEM
00202 #define BN_bn2bin BN_BN2BIN
00203 #define BN_num_bits BN_NUM_BITS
00204 #define CRYPTO_cleanup_all_ex_data CRYPTO_CLEANUP_ALL_EX_DATA
00205 #define CRYPTO_free CRYPTO_FREE
00206 #define CRYPTO_malloc CRYPTO_MALLOC
00207 #define CONF_modules_load_file CONF_MODULES_LOAD_FILE
00208 #ifdef __VAX
00209 #  ifdef VMS_OLD_SSL
00210   /* Ancient OpenSSL on VAX/VMS missing this constant */
00211 #    define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
00212 #    undef CONF_modules_load_file
00213      static int CONF_modules_load_file(const char *filename,
00214                                        const char *appname,
00215                                        unsigned long flags) {
00216              return 1;
00217      }
00218 #  endif
00219 #endif
00220 #define DES_ecb_encrypt DES_ECB_ENCRYPT
00221 #define DES_set_key DES_SET_KEY
00222 #define DES_set_odd_parity DES_SET_ODD_PARITY
00223 #define ENGINE_ctrl ENGINE_CTRL
00224 #define ENGINE_ctrl_cmd ENGINE_CTRL_CMD
00225 #define ENGINE_finish ENGINE_FINISH
00226 #define ENGINE_free ENGINE_FREE
00227 #define ENGINE_get_first ENGINE_GET_FIRST
00228 #define ENGINE_get_id ENGINE_GET_ID
00229 #define ENGINE_get_next ENGINE_GET_NEXT
00230 #define ENGINE_init ENGINE_INIT
00231 #define ENGINE_load_builtin_engines ENGINE_LOAD_BUILTIN_ENGINES
00232 #define ENGINE_load_private_key ENGINE_LOAD_PRIVATE_KEY
00233 #define ENGINE_set_default ENGINE_SET_DEFAULT
00234 #define ERR_clear_error ERR_CLEAR_ERROR
00235 #define ERR_error_string ERR_ERROR_STRING
00236 #define ERR_error_string_n ERR_ERROR_STRING_N
00237 #define ERR_free_strings ERR_FREE_STRINGS
00238 #define ERR_get_error ERR_GET_ERROR
00239 #define ERR_peek_error ERR_PEEK_ERROR
00240 #define ERR_remove_state ERR_REMOVE_STATE
00241 #define EVP_PKEY_copy_parameters EVP_PKEY_COPY_PARAMETERS
00242 #define EVP_PKEY_free EVP_PKEY_FREE
00243 #define EVP_cleanup EVP_CLEANUP
00244 #define GENERAL_NAMES_free GENERAL_NAMES_FREE
00245 #define i2d_X509_PUBKEY I2D_X509_PUBKEY
00246 #define MD4_Final MD4_FINAL
00247 #define MD4_Init MD4_INIT
00248 #define MD4_Update MD4_UPDATE
00249 #define MD5_Final MD5_FINAL
00250 #define MD5_Init MD5_INIT
00251 #define MD5_Update MD5_UPDATE
00252 #define OPENSSL_add_all_algo_noconf OPENSSL_ADD_ALL_ALGO_NOCONF
00253 #ifndef __VAX
00254 #define OPENSSL_load_builtin_modules OPENSSL_LOAD_BUILTIN_MODULES
00255 #endif
00256 #define PEM_read_X509 PEM_READ_X509
00257 #define PEM_write_bio_X509 PEM_WRITE_BIO_X509
00258 #define PKCS12_PBE_add PKCS12_PBE_ADD
00259 #define PKCS12_free PKCS12_FREE
00260 #define PKCS12_parse PKCS12_PARSE
00261 #define RAND_add RAND_ADD
00262 #define RAND_bytes RAND_BYTES
00263 #define RAND_egd RAND_EGD
00264 #define RAND_file_name RAND_FILE_NAME
00265 #define RAND_load_file RAND_LOAD_FILE
00266 #define RAND_status RAND_STATUS
00267 #define SSL_CIPHER_get_name SSL_CIPHER_GET_NAME
00268 #define SSL_CTX_add_client_CA SSL_CTX_ADD_CLIENT_CA
00269 #define SSL_CTX_callback_ctrl SSL_CTX_CALLBACK_CTRL
00270 #define SSL_CTX_check_private_key SSL_CTX_CHECK_PRIVATE_KEY
00271 #define SSL_CTX_ctrl SSL_CTX_CTRL
00272 #define SSL_CTX_free SSL_CTX_FREE
00273 #define SSL_CTX_get_cert_store SSL_CTX_GET_CERT_STORE
00274 #define SSL_CTX_load_verify_locations SSL_CTX_LOAD_VERIFY_LOCATIONS
00275 #define SSL_CTX_new SSL_CTX_NEW
00276 #define SSL_CTX_set_cipher_list SSL_CTX_SET_CIPHER_LIST
00277 #define SSL_CTX_set_def_passwd_cb_ud SSL_CTX_SET_DEF_PASSWD_CB_UD
00278 #define SSL_CTX_set_default_passwd_cb SSL_CTX_SET_DEFAULT_PASSWD_CB
00279 #define SSL_CTX_set_msg_callback SSL_CTX_SET_MSG_CALLBACK
00280 #define SSL_CTX_set_verify SSL_CTX_SET_VERIFY
00281 #define SSL_CTX_use_PrivateKey SSL_CTX_USE_PRIVATEKEY
00282 #define SSL_CTX_use_PrivateKey_file SSL_CTX_USE_PRIVATEKEY_FILE
00283 #define SSL_CTX_use_cert_chain_file SSL_CTX_USE_CERT_CHAIN_FILE
00284 #define SSL_CTX_use_certificate SSL_CTX_USE_CERTIFICATE
00285 #define SSL_CTX_use_certificate_file SSL_CTX_USE_CERTIFICATE_FILE
00286 #define SSL_SESSION_free SSL_SESSION_FREE
00287 #define SSL_connect SSL_CONNECT
00288 #define SSL_free SSL_FREE
00289 #define SSL_get1_session SSL_GET1_SESSION
00290 #define SSL_get_certificate SSL_GET_CERTIFICATE
00291 #define SSL_get_current_cipher SSL_GET_CURRENT_CIPHER
00292 #define SSL_get_error SSL_GET_ERROR
00293 #define SSL_get_peer_cert_chain SSL_GET_PEER_CERT_CHAIN
00294 #define SSL_get_peer_certificate SSL_GET_PEER_CERTIFICATE
00295 #define SSL_get_privatekey SSL_GET_PRIVATEKEY
00296 #define SSL_get_session SSL_GET_SESSION
00297 #define SSL_get_shutdown SSL_GET_SHUTDOWN
00298 #define SSL_get_verify_result SSL_GET_VERIFY_RESULT
00299 #define SSL_library_init SSL_LIBRARY_INIT
00300 #define SSL_load_error_strings SSL_LOAD_ERROR_STRINGS
00301 #define SSL_new SSL_NEW
00302 #define SSL_peek SSL_PEEK
00303 #define SSL_pending SSL_PENDING
00304 #define SSL_read SSL_READ
00305 #define SSL_set_connect_state SSL_SET_CONNECT_STATE
00306 #define SSL_set_fd SSL_SET_FD
00307 #define SSL_set_session SSL_SET_SESSION
00308 #define SSL_shutdown SSL_SHUTDOWN
00309 #define SSL_version SSL_VERSION
00310 #define SSL_write SSL_WRITE
00311 #define SSLeay SSLEAY
00312 #define SSLv23_client_method SSLV23_CLIENT_METHOD
00313 #define SSLv3_client_method SSLV3_CLIENT_METHOD
00314 #define TLSv1_client_method TLSV1_CLIENT_METHOD
00315 #define UI_create_method UI_CREATE_METHOD
00316 #define UI_destroy_method UI_DESTROY_METHOD
00317 #define UI_get0_user_data UI_GET0_USER_DATA
00318 #define UI_get_input_flags UI_GET_INPUT_FLAGS
00319 #define UI_get_string_type UI_GET_STRING_TYPE
00320 #define UI_create_method UI_CREATE_METHOD
00321 #define UI_destroy_method UI_DESTROY_METHOD
00322 #define UI_method_get_closer UI_METHOD_GET_CLOSER
00323 #define UI_method_get_opener UI_METHOD_GET_OPENER
00324 #define UI_method_get_reader UI_METHOD_GET_READER
00325 #define UI_method_get_writer UI_METHOD_GET_WRITER
00326 #define UI_method_set_closer UI_METHOD_SET_CLOSER
00327 #define UI_method_set_opener UI_METHOD_SET_OPENER
00328 #define UI_method_set_reader UI_METHOD_SET_READER
00329 #define UI_method_set_writer UI_METHOD_SET_WRITER
00330 #define UI_OpenSSL UI_OPENSSL
00331 #define UI_set_result UI_SET_RESULT
00332 #define X509V3_EXT_print X509V3_EXT_PRINT
00333 #define X509_EXTENSION_get_critical X509_EXTENSION_GET_CRITICAL
00334 #define X509_EXTENSION_get_data X509_EXTENSION_GET_DATA
00335 #define X509_EXTENSION_get_object X509_EXTENSION_GET_OBJECT
00336 #define X509_LOOKUP_file X509_LOOKUP_FILE
00337 #define X509_NAME_ENTRY_get_data X509_NAME_ENTRY_GET_DATA
00338 #define X509_NAME_get_entry X509_NAME_GET_ENTRY
00339 #define X509_NAME_get_index_by_NID X509_NAME_GET_INDEX_BY_NID
00340 #define X509_NAME_print_ex X509_NAME_PRINT_EX
00341 #define X509_STORE_CTX_get_current_cert X509_STORE_CTX_GET_CURRENT_CERT
00342 #define X509_STORE_add_lookup X509_STORE_ADD_LOOKUP
00343 #define X509_STORE_set_flags X509_STORE_SET_FLAGS
00344 #define X509_check_issued X509_CHECK_ISSUED
00345 #define X509_free X509_FREE
00346 #define X509_get_ext_d2i X509_GET_EXT_D2I
00347 #define X509_get_issuer_name X509_GET_ISSUER_NAME
00348 #define X509_get_pubkey X509_GET_PUBKEY
00349 #define X509_get_serialNumber X509_GET_SERIALNUMBER
00350 #define X509_get_subject_name X509_GET_SUBJECT_NAME
00351 #define X509_load_crl_file X509_LOAD_CRL_FILE
00352 #define X509_verify_cert_error_string X509_VERIFY_CERT_ERROR_STRING
00353 #define d2i_PKCS12_fp D2I_PKCS12_FP
00354 #define i2t_ASN1_OBJECT I2T_ASN1_OBJECT
00355 #define sk_num SK_NUM
00356 #define sk_pop SK_POP
00357 #define sk_pop_free SK_POP_FREE
00358 #define sk_value SK_VALUE
00359 #ifdef __VAX
00360 #define OPENSSL_NO_SHA256
00361 #endif
00362 #define SHA256_Final SHA256_FINAL
00363 #define SHA256_Init SHA256_INIT
00364 #define SHA256_Update SHA256_UPDATE
00365 
00366 #define USE_UPPERCASE_GSSAPI 1
00367 #define gss_seal GSS_SEAL
00368 #define gss_unseal GSS_UNSEAL
00369 
00370 #define USE_UPPERCASE_KRBAPI 1
00371 
00372 /* AI_NUMERICHOST needed for IP V6 support in Curl */
00373 #ifdef HAVE_NETDB_H
00374 #include <netdb.h>
00375 #ifndef AI_NUMERICHOST
00376 #ifdef ENABLE_IPV6
00377 #undef ENABLE_IPV6
00378 #endif
00379 #endif
00380 #endif
00381 
00382 /* VAX symbols are always in uppercase */
00383 #ifdef __VAX
00384 #define inflate INFLATE
00385 #define inflateEnd INFLATEEND
00386 #define inflateInit2_ INFLATEINIT2_
00387 #define inflateInit_ INFLATEINIT_
00388 #define zlibVersion ZLIBVERSION
00389 #endif
00390 
00391 /* Older VAX OpenSSL port defines these as Macros */
00392 /* Need to include the headers first and then redefine */
00393 /* that way a newer port will also work if some one has one */
00394 #ifdef __VAX
00395 
00396 #   if (OPENSSL_VERSION_NUMBER < 0x00907001L)
00397 #       define des_set_odd_parity DES_SET_ODD_PARITY
00398 #       define des_set_key DES_SET_KEY
00399 #       define des_ecb_encrypt DES_ECB_ENCRYPT
00400 
00401 #   endif
00402 #   include <openssl/evp.h>
00403 #   ifndef OpenSSL_add_all_algorithms
00404 #       define OpenSSL_add_all_algorithms OPENSSL_ADD_ALL_ALGORITHMS
00405         void OPENSSL_ADD_ALL_ALGORITHMS(void);
00406 #   endif
00407 
00408     /* Curl defines these to lower case and VAX needs them in upper case */
00409     /* So we need static routines */
00410 #   if (OPENSSL_VERSION_NUMBER < 0x00907001L)
00411 
00412 #       undef des_set_odd_parity
00413 #       undef DES_set_odd_parity
00414 #       undef des_set_key
00415 #       undef DES_set_key
00416 #       undef des_ecb_encrypt
00417 #       undef DES_ecb_encrypt
00418 
00419         static void des_set_odd_parity(des_cblock *key) {
00420             DES_SET_ODD_PARITY(key);
00421         }
00422 
00423         static int des_set_key(const_des_cblock *key,
00424                                des_key_schedule schedule) {
00425             return DES_SET_KEY(key, schedule);
00426         }
00427 
00428         static void des_ecb_encrypt(const_des_cblock *input,
00429                                     des_cblock *output,
00430                                     des_key_schedule ks, int enc) {
00431             DES_ECB_ENCRYPT(input, output, ks, enc);
00432         }
00433 #endif
00434 /* Need this to stop a macro redefinition error */
00435 #if OPENSSL_VERSION_NUMBER < 0x00907000L
00436 #   ifdef X509_STORE_set_flags
00437 #       undef X509_STORE_set_flags
00438 #       define X509_STORE_set_flags(x,y) Curl_nop_stmt
00439 #   endif
00440 #endif
00441 #endif
00442 
00443 #endif /* HEADER_CURL_SETUP_VMS_H */


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:06