diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/man/CONF_modules_load_file.3 | 142 |
1 files changed, 138 insertions, 4 deletions
diff --git a/src/lib/libcrypto/man/CONF_modules_load_file.3 b/src/lib/libcrypto/man/CONF_modules_load_file.3 index 6e1a026727..0e594a1544 100644 --- a/src/lib/libcrypto/man/CONF_modules_load_file.3 +++ b/src/lib/libcrypto/man/CONF_modules_load_file.3 | |||
| @@ -1,6 +1,54 @@ | |||
| 1 | .\" $OpenBSD: CONF_modules_load_file.3,v 1.3 2016/11/10 14:34:18 jmc Exp $ | 1 | .\" $OpenBSD: CONF_modules_load_file.3,v 1.4 2016/11/20 19:47:59 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
| 2 | .\" | 3 | .\" |
| 3 | .Dd $Mdocdate: November 10 2016 $ | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| 5 | .\" Copyright (c) 2000, 2015 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | ||
| 7 | .\" Redistribution and use in source and binary forms, with or without | ||
| 8 | .\" modification, are permitted provided that the following conditions | ||
| 9 | .\" are met: | ||
| 10 | .\" | ||
| 11 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer. | ||
| 13 | .\" | ||
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: November 20 2016 $ | ||
| 4 | .Dt CONF_MODULES_LOAD_FILE 3 | 52 | .Dt CONF_MODULES_LOAD_FILE 3 |
| 5 | .Os | 53 | .Os |
| 6 | .Sh NAME | 54 | .Sh NAME |
| @@ -40,11 +88,11 @@ is | |||
| 40 | the standard OpenSSL application name | 88 | the standard OpenSSL application name |
| 41 | .Qq openssl_conf | 89 | .Qq openssl_conf |
| 42 | is used. | 90 | is used. |
| 43 | The behaviour can be cutomized using | 91 | The behaviour can be customized using |
| 44 | .Fa flags . | 92 | .Fa flags . |
| 45 | .Pp | 93 | .Pp |
| 46 | .Fn CONF_modules_load | 94 | .Fn CONF_modules_load |
| 47 | is idential to | 95 | is identical to |
| 48 | .Fn CONF_modules_load_file | 96 | .Fn CONF_modules_load_file |
| 49 | except it reads configuration information from | 97 | except it reads configuration information from |
| 50 | .Fa cnf . | 98 | .Fa cnf . |
| @@ -67,12 +115,98 @@ Let | |||
| 67 | .Fn CONF_modules_load_file | 115 | .Fn CONF_modules_load_file |
| 68 | ignore missing configuration files. | 116 | ignore missing configuration files. |
| 69 | By default, a missing configuration file returns an error. | 117 | By default, a missing configuration file returns an error. |
| 118 | .It CONF_MFLAGS_DEFAULT_SECTION | ||
| 119 | If | ||
| 120 | .Fa appname | ||
| 121 | is not | ||
| 122 | .Dv NULL | ||
| 123 | but does not exist, fall back to the default section | ||
| 124 | .Qq openssl_conf . | ||
| 70 | .El | 125 | .El |
| 126 | .Pp | ||
| 127 | By using | ||
| 128 | .Fn CONF_modules_load_file | ||
| 129 | with appropriate flags, an application can customise application | ||
| 130 | configuration to best suit its needs. | ||
| 131 | In some cases the use of a configuration file is optional and its | ||
| 132 | absence is not an error: in this case | ||
| 133 | .Dv CONF_MFLAGS_IGNORE_MISSING_FILE | ||
| 134 | would be set. | ||
| 135 | .Pp | ||
| 136 | Errors during configuration may also be handled differently by | ||
| 137 | different applications. | ||
| 138 | For example in some cases an error may simply print out a warning | ||
| 139 | message and the application may continue. | ||
| 140 | In other cases an application might consider a configuration file | ||
| 141 | error fatal and exit immediately. | ||
| 142 | .Pp | ||
| 143 | Applications can use the | ||
| 144 | .Fn CONF_modules_load | ||
| 145 | function if they wish to load a configuration file themselves and | ||
| 146 | have finer control over how errors are treated. | ||
| 71 | .Sh RETURN VALUES | 147 | .Sh RETURN VALUES |
| 72 | These functions return 1 for success and zero or a negative value for | 148 | These functions return 1 for success and zero or a negative value for |
| 73 | failure. | 149 | failure. |
| 74 | If module errors are not ignored, the return code will reflect the return | 150 | If module errors are not ignored, the return code will reflect the return |
| 75 | value of the failing module (this will always be zero or negative). | 151 | value of the failing module (this will always be zero or negative). |
| 152 | .Sh EXAMPLES | ||
| 153 | Load a configuration file and print out any errors and exit (missing | ||
| 154 | file considered fatal): | ||
| 155 | .Bd -literal | ||
| 156 | if (CONF_modules_load_file(NULL, NULL, 0) <= 0) { | ||
| 157 | fprintf(stderr, "FATAL: error loading configuration file\n"); | ||
| 158 | ERR_print_errors_fp(stderr); | ||
| 159 | exit(1); | ||
| 160 | } | ||
| 161 | .Ed | ||
| 162 | .Pp | ||
| 163 | Load default configuration file using the section indicated | ||
| 164 | by "myapp", tolerate missing files, but exit on other errors: | ||
| 165 | .Bd -literal | ||
| 166 | if (CONF_modules_load_file(NULL, "myapp", | ||
| 167 | CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { | ||
| 168 | fprintf(stderr, "FATAL: error loading configuration file\n"); | ||
| 169 | ERR_print_errors_fp(stderr); | ||
| 170 | exit(1); | ||
| 171 | } | ||
| 172 | .Ed | ||
| 173 | .Pp | ||
| 174 | Load custom configuration file and section, only print warnings on | ||
| 175 | error, missing configuration file ignored: | ||
| 176 | .Bd -literal | ||
| 177 | if (CONF_modules_load_file("/something/app.cnf", "myapp", | ||
| 178 | CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { | ||
| 179 | fprintf(stderr, "WARNING: error loading configuration file\n"); | ||
| 180 | ERR_print_errors_fp(stderr); | ||
| 181 | } | ||
| 182 | .Ed | ||
| 183 | .Pp | ||
| 184 | Load and parse configuration file manually, custom error handling: | ||
| 185 | .Bd -literal | ||
| 186 | FILE *fp; | ||
| 187 | CONF *cnf = NULL; | ||
| 188 | long eline; | ||
| 189 | |||
| 190 | fp = fopen("/somepath/app.cnf", "r"); | ||
| 191 | if (fp == NULL) { | ||
| 192 | fprintf(stderr, "Error opening configuration file\n"); | ||
| 193 | /* Other missing configuration file behaviour */ | ||
| 194 | } else { | ||
| 195 | cnf = NCONF_new(NULL); | ||
| 196 | if (NCONF_load_fp(cnf, fp, &eline) == 0) { | ||
| 197 | fprintf(stderr, "Error on line %ld of configuration file\n", | ||
| 198 | eline); | ||
| 199 | ERR_print_errors_fp(stderr); | ||
| 200 | /* Other malformed configuration file behaviour */ | ||
| 201 | } else if (CONF_modules_load(cnf, "appname", 0) <= 0) { | ||
| 202 | fprintf(stderr, "Error configuring application\n"); | ||
| 203 | ERR_print_errors_fp(stderr); | ||
| 204 | /* Other configuration error behaviour */ | ||
| 205 | } | ||
| 206 | fclose(fp); | ||
| 207 | NCONF_free(cnf); | ||
| 208 | } | ||
| 209 | .Ed | ||
| 76 | .Sh SEE ALSO | 210 | .Sh SEE ALSO |
| 77 | .Xr CONF_modules_free 3 , | 211 | .Xr CONF_modules_free 3 , |
| 78 | .Xr ERR 3 , | 212 | .Xr ERR 3 , |
