CONF_modules_load_file.3 revision 296317
Automatically generated by Pod::Man 2.28 (Pod::Simple 3.30)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "CONF_modules_load_file 3"
CONF_modules_load_file 3 "2016-03-01" "1.0.1s" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
.Vb 1 CONF_modules_load_file, CONF_modules_load - OpenSSL configuration functions .Ve
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/conf.h> \& int CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags); int CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags); .Ve
"DESCRIPTION"
Header "DESCRIPTION" The function CONF_modules_load_file() configures OpenSSL using file \fBfilename and application name appname. If filename is \s-1NULL\s0 the standard OpenSSL configuration file is used. If appname is \s-1NULL\s0 the standard OpenSSL application name openssl_conf is used. The behaviour can be cutomized using flags.

\fICONF_modules_load() is idential to CONF_modules_load_file() except it reads configuration information from cnf.

"NOTES"
Header "NOTES" The following flags are currently recognized:

\fB\s-1CONF_MFLAGS_IGNORE_ERRORS\s0 if set errors returned by individual configuration modules are ignored. If not set the first module error is considered fatal and no further modules are loaded.

Normally any modules errors will add error information to the error queue. If \fB\s-1CONF_MFLAGS_SILENT\s0 is set no error information is added.

If \s-1CONF_MFLAGS_NO_DSO\s0 is set configuration module loading from DSOs is disabled.

\fB\s-1CONF_MFLAGS_IGNORE_MISSING_FILE\s0 if set will make CONF_load_modules_file() ignore missing configuration files. Normally a missing configuration file return an error.

\fB\s-1CONF_MFLAGS_DEFAULT_SECTION\s0 if set and appname is not \s-1NULL\s0 will use the default section pointed to by openssl_conf if appname does not exist.

Applications should call these functions after loading builtin modules using \fIOPENSSL_load_builtin_modules(), any ENGINEs for example using \fIENGINE_load_builtin_engines(), any algorithms for example \fIOPENSSL_add_all_algorithms() and (if the application uses libssl) \fISSL_library_init().

By using CONF_modules_load_file() with appropriate flags an application can customise application configuration to best suit its needs. In some cases the use of a configuration file is optional and its absence is not an error: in this case \s-1CONF_MFLAGS_IGNORE_MISSING_FILE\s0 would be set.

Errors during configuration may also be handled differently by different applications. For example in some cases an error may simply print out a warning message and the application continue. In other cases an application might consider a configuration file error as fatal and exit immediately.

Applications can use the CONF_modules_load() function if they wish to load a configuration file themselves and have finer control over how errors are treated.

"EXAMPLES"
Header "EXAMPLES" Load a configuration file and print out any errors and exit (missing file considered fatal):

.Vb 5 if (CONF_modules_load_file(NULL, NULL, 0) <= 0) { fprintf(stderr, "FATAL: error loading configuration file\en"); ERR_print_errors_fp(stderr); exit(1); } .Ve

Load default configuration file using the section indicated by \*(L"myapp\*(R", tolerate missing files, but exit on other errors:

.Vb 6 if (CONF_modules_load_file(NULL, "myapp", CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { fprintf(stderr, "FATAL: error loading configuration file\en"); ERR_print_errors_fp(stderr); exit(1); } .Ve

Load custom configuration file and section, only print warnings on error, missing configuration file ignored:

.Vb 5 if (CONF_modules_load_file("/something/app.cnf", "myapp", CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { fprintf(stderr, "WARNING: error loading configuration file\en"); ERR_print_errors_fp(stderr); } .Ve

Load and parse configuration file manually, custom error handling:

.Vb 10 FILE *fp; CONF *cnf = NULL; long eline; fp = fopen("/somepath/app.cnf", "r"); if (fp == NULL) { fprintf(stderr, "Error opening configuration file\en"); /* 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\en", 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\en"); ERR_print_errors_fp(stderr); /* Other configuration error behaviour */ } fclose(fp); NCONF_free(cnf); } .Ve

"RETURN VALUES"
Header "RETURN VALUES" These functions return 1 for success and a zero or 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).
"SEE ALSO"
Header "SEE ALSO" \fIconf\|(5), OPENSSL_config\|(3), \fICONF_free\|(3), err\|(3)
"HISTORY"
Header "HISTORY" CONF_modules_load_file and CONF_modules_load first appeared in OpenSSL 0.9.7.