> Reproduced on Windows 7 (likely on the all old versions) > I use OpenSSL v. 0.9.8k but I has looked the last version and the bug also > exist. > > When we try call OPENSSL_cinfig with the path who specifies on the DvD(or > CD)-ROM without disc the openSSL is exiting.
I've been bitten by that exact bug with latest 1.0.1g too ... This is a huge WTF. Your app works fine on some machines, but starts crashing / exiting on some others, just because you compiled / installed openssl e.g. on D:\ locally, and D:\ turns out to be a CD/RW drive on the deployment machine. Independent from this bug report (untouched since 2011) I came to the exact same conclusions & fix. Any chance this gets some attention? :) If you don't like the idea to map EACCES to BIO_R_NO_SUCH_FILE I can create a patch introducing a BIO_R_ACCESS_ERROR, too ... Regards Kai > It happens because in the function > (version 0.9.8k): .\crypto\bio\bss_file.c > > BIO *BIO_new_file(const char *filename, const char *mode) > { > BIO *ret; > FILE *file; > > if ((file=fopen(filename,mode)) == NULL) > <------------------------ > { > SYSerr(SYS_F_FOPEN,get_last_sys_error()); > > ERR_add_error_data(5,"fopen('",filename,"','",mode,"')"); > > if (errno == ENOENT) <------------------------ > errno == EACCES > > BIOerr(BIO_F_BIO_NEW_FILE,BIO_R_NO_SUCH_FILE); > else > > BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB); <---------------------- > return(NULL); > } > if ((ret=BIO_new(BIO_s_file_internal())) == NULL) > { > fclose(file); > return(NULL); > } > > BIO_clear_flags(ret,BIO_FLAGS_UPLINK); /* we did fopen -> we > disengage UPLINK */ > BIO_set_fp(ret,file,BIO_CLOSE); > return(ret); > } > > The function fopen() returns EACCESS instead of ENOENT if it passes path to > DVD-ROM without disc. > You can check it: > > // C:\ - logical disc exists > FILE * f1 = fopen("C:\\test.fl", "rb"); > int myErrno = errno; // 2 > - ENOENT > > // D:\ - logical disc not exists > f1 = fopen("D:\\test.fl", "rb"); > myErrno = errno; > // 2 - ENOENT > > // N:\ - DVD-ROM without dvd-disk > f1 = fopen("N:\\test.fl", "rb"); > myErrno = errno; > // 13 - EACCES > >Because of this is calling BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB); and at >the end the OPENSSL_config do call exit(1). > >void OPENSSL_config(const char *config_name) >{ >... > ERR_clear_error(); > if (CONF_modules_load_file(NULL, config_name, > CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) > { > BIO *bio_err; > ERR_load_crypto_strings(); > if ((bio_err=BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) > { > BIO_printf(bio_err,"Auto configuration failed\n"); > ERR_print_errors(bio_err); > BIO_free(bio_err); > } > exit(1); <------------------------- > } > > return; >} > >For my project I changed the source of OpenSSL: > >BIO *BIO_new_file(const char *filename, const char *mode) > { > BIO *ret; > FILE *file; > > if ((file=fopen(filename,mode)) == NULL) > { > SYSerr(SYS_F_FOPEN,get_last_sys_error()); > ERR_add_error_data(5,"fopen('",filename,"','",mode,"')"); > > if (errno == ENOENT || errno == EACCES) > BIOerr(BIO_F_BIO_NEW_FILE,BIO_R_NO_SUCH_FILE); > else > BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB); > return(NULL); > } ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org