summaryrefslogtreecommitdiffstats
path: root/secure/lib/libcrypto/man/CONF_modules_load_file.3
diff options
context:
space:
mode:
Diffstat (limited to 'secure/lib/libcrypto/man/CONF_modules_load_file.3')
-rw-r--r--secure/lib/libcrypto/man/CONF_modules_load_file.3100
1 files changed, 92 insertions, 8 deletions
diff --git a/secure/lib/libcrypto/man/CONF_modules_load_file.3 b/secure/lib/libcrypto/man/CONF_modules_load_file.3
index e99a68c..1d2a69c 100644
--- a/secure/lib/libcrypto/man/CONF_modules_load_file.3
+++ b/secure/lib/libcrypto/man/CONF_modules_load_file.3
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
+.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.30)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "CONF_modules_load_file 3"
-.TH CONF_modules_load_file 3 "2015-01-15" "1.0.1l" "OpenSSL"
+.TH CONF_modules_load_file 3 "2015-03-19" "1.0.1m" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -148,9 +148,9 @@
\& #include <openssl/conf.h>
\&
\& int CONF_modules_load_file(const char *filename, const char *appname,
-\& unsigned long flags);
+\& unsigned long flags);
\& int CONF_modules_load(const CONF *cnf, const char *appname,
-\& unsigned long flags);
+\& unsigned long flags);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
@@ -161,14 +161,14 @@ the standard OpenSSL configuration file is used. If \fBappname\fR is
The behaviour can be cutomized using \fBflags\fR.
.PP
\&\fICONF_modules_load()\fR is idential to \fICONF_modules_load_file()\fR except it
-read configuration information from \fBcnf\fR.
+reads configuration information from \fBcnf\fR.
.SH "NOTES"
.IX Header "NOTES"
The following \fBflags\fR are currently recognized:
.PP
\&\fB\s-1CONF_MFLAGS_IGNORE_ERRORS\s0\fR 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 loads.
+considered fatal and no further modules are loaded.
.PP
Normally any modules errors will add error information to the error queue. If
\&\fB\s-1CONF_MFLAGS_SILENT\s0\fR is set no error information is added.
@@ -179,8 +179,92 @@ disabled.
\&\fB\s-1CONF_MFLAGS_IGNORE_MISSING_FILE\s0\fR if set will make \fICONF_load_modules_file()\fR
ignore missing configuration files. Normally a missing configuration file
return an error.
-.SH "RETURN VALUE"
-.IX Header "RETURN VALUE"
+.PP
+\&\fB\s-1CONF_MFLAGS_DEFAULT_SECTION\s0\fR if set and \fBappname\fR is not \s-1NULL\s0 will use the
+default section pointed to by \fBopenssl_conf\fR if \fBappname\fR does not exist.
+.PP
+Applications should call these functions after loading builtin modules using
+\&\fIOPENSSL_load_builtin_modules()\fR, any ENGINEs for example using
+\&\fIENGINE_load_builtin_engines()\fR, any algorithms for example
+\&\fIOPENSSL_add_all_algorithms()\fR and (if the application uses libssl)
+\&\fISSL_library_init()\fR.
+.PP
+By using \fICONF_modules_load_file()\fR 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 \fB\s-1CONF_MFLAGS_IGNORE_MISSING_FILE\s0\fR would be set.
+.PP
+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.
+.PP
+Applications can use the \fICONF_modules_load()\fR function if they wish to load a
+configuration file themselves and have finer control over how errors are
+treated.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Load a configuration file and print out any errors and exit (missing file
+considered fatal):
+.PP
+.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
+.PP
+Load default configuration file using the section indicated by \*(L"myapp\*(R",
+tolerate missing files, but exit on other errors:
+.PP
+.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
+.PP
+Load custom configuration file and section, only print warnings on error,
+missing configuration file ignored:
+.PP
+.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
+.PP
+Load and parse configuration file manually, custom error handling:
+.PP
+.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
+.SH "RETURN VALUES"
+.IX 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).
OpenPOWER on IntegriCloud