Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
CONF_modules_load_file, CONF_modules_load, X509_get_default_cert_area — OpenSSL configuration functionsSYNOPSIS
#include <openssl/conf.h>CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags);
CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags);
X509_get_default_cert_area(void);
DESCRIPTION
The function CONF_modules_load_file() configures OpenSSL using the file filename in openssl.cnf(5) format and the application name appname. If filename is NULL, the standard OpenSSL configuration file /etc/ssl/openssl.cnf is used. If appname is NULL, the standard OpenSSL application name “openssl_conf” is used. The behaviour can be customized using flags.- CONF_MFLAGS_IGNORE_ERRORS
- Ignore errors returned by individual configuration modules. By default, the first module error is considered fatal and no further modules are loaded.
- CONF_MFLAGS_SILENT
- Do not add any error information. By default, all module errors add error information to the error queue.
- CONF_MFLAGS_NO_DSO
- Disable loading of configuration modules from DSOs. This flag is provided for compatibility and has no effect.
- CONF_MFLAGS_IGNORE_MISSING_FILE
- Let CONF_modules_load_file() ignore missing configuration files. By default, a missing configuration file returns an error.
- CONF_MFLAGS_DEFAULT_SECTION
- If appname is not NULL but does not exist, fall back to the default section “openssl_conf”.
RETURN VALUES
CONF_modules_load_file() and CONF_modules_load() return 1 for success and zero or a negative value for failure. If module errors are not ignored, the return code will reflect the return value of the failing module (this will always be zero or negative).FILES
- /etc/ssl
- standard configuration directory
- /etc/ssl/openssl.cnf
- standard configuration file
EXAMPLES
Load a configuration file and print out any errors and exit (missing file considered fatal):if (CONF_modules_load_file(NULL, NULL, 0) <= 0) { fprintf(stderr, "FATAL: error loading configuration file\n"); ERR_print_errors_fp(stderr); exit(1); }
if (CONF_modules_load_file(NULL, "myapp", CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { fprintf(stderr, "FATAL: error loading configuration file\n"); ERR_print_errors_fp(stderr); exit(1); }
OPENSSL_no_config(); OPENSSL_load_builtin_modules(); if (CONF_modules_load_file("/something/app.cnf", "myapp", CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { fprintf(stderr, "WARNING: error loading configuration file\n"); ERR_print_errors_fp(stderr); }
FILE *fp; CONF *cnf = NULL; long eline; fp = fopen("/somepath/app.cnf", "r"); if (fp == NULL) { fprintf(stderr, "Error opening configuration file\n"); /* Other missing configuration file behaviour */ } else { cnf = NCONF_new(NULL); if (NCONF_load_fp(cnf, fp, &eline) == 0) { fprintf(stderr, "Error on line %ld of configuration file\n", eline); ERR_print_errors_fp(stderr); /* Other malformed configuration file behaviour */ } else if (CONF_modules_load(cnf, "appname", 0) <= 0) { fprintf(stderr, "Error configuring application\n"); ERR_print_errors_fp(stderr); /* Other configuration error behaviour */ } fclose(fp); NCONF_free(cnf); }