4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include "wanboot_conf.h"
33 * This function maps an error code (one of those defined in wanboot_conf.h)
34 * into an error message.
36 * Returns: the error message string.
39 bootconf_errmsg(bc_handle_t
*handle
)
41 static char errmsg
[256];
45 errstr
= gettext("bootconf_errmsg: internal error");
47 switch (handle
->bc_error_code
) {
49 errstr
= gettext("No error");
52 errstr
= gettext("Can't open configuration file");
55 errstr
= gettext("Error creating/adding to nvlist");
58 errstr
= gettext("Error reading/closing configuration file");
61 if ((chars
= snprintf(errmsg
, sizeof (errmsg
),
62 gettext("Line %d of configuration file is too long"),
63 handle
->bc_error_pos
)) > 0 && chars
< sizeof (errmsg
)) {
68 if ((chars
= snprintf(errmsg
, sizeof (errmsg
),
69 gettext("Syntax error on line %d of configuration file"),
70 handle
->bc_error_pos
)) > 0 && chars
< sizeof (errmsg
)) {
74 case BC_E_UNKNOWN_NAME
:
75 if ((chars
= snprintf(errmsg
, sizeof (errmsg
),
76 gettext("Unknown name on line %d of configuration file"),
77 handle
->bc_error_pos
)) > 0 && chars
< sizeof (errmsg
)) {
81 case BC_E_ENCRYPTION_ILLEGAL
:
82 errstr
= gettext("Illegal encryption_type");
84 case BC_E_SIGNATURE_ILLEGAL
:
85 errstr
= gettext("Illegal signature_type");
87 case BC_E_CLIENT_AUTH_ILLEGAL
:
88 errstr
= gettext("Illegal client_authentication");
90 case BC_E_SERVER_AUTH_ILLEGAL
:
91 errstr
= gettext("Illegal server_authentication");
93 case BC_E_ROOT_SERVER_BAD
:
94 errstr
= gettext("The root_server URL is malformed");
96 case BC_E_ROOT_SERVER_ABSENT
:
97 errstr
= gettext("A root_server must be provided");
99 case BC_E_ROOT_FILE_ABSENT
:
100 errstr
= gettext("The root_server URL is malformed");
102 case BC_E_BOOT_LOGGER_BAD
:
103 errstr
= gettext("The boot_logger URL is malformed");
105 case BC_E_ENCRYPTED_NOT_SIGNED
:
106 errstr
= gettext("When encryption_type is specified "
107 "signature_type must also be specified");
109 case BC_E_CLIENT_AUTH_NOT_ENCRYPTED
:
110 errstr
= gettext("When client_authentication is \"yes\" "
111 "encryption_type must also be specified");
113 case BC_E_CLIENT_AUTH_NOT_SERVER
:
114 errstr
= gettext("When client_authentication is \"yes\" "
115 "server_authentication must also be \"yes\"");
117 case BC_E_SERVER_AUTH_NOT_SIGNED
:
118 errstr
= gettext("When server_authentication is \"yes\" "
119 "signature_type must also be specified");
121 case BC_E_SERVER_AUTH_NOT_HTTPS
:
122 errstr
= gettext("When server_authentication is \"yes\" "
123 "root_server must specify a secure URL");
125 case BC_E_SERVER_AUTH_NOT_HTTP
:
126 errstr
= gettext("When server_authentication is \"no\" "
127 "root_server must not specify a secure URL");
129 case BC_E_BOOTLOGGER_AUTH_NOT_HTTP
:
130 errstr
= gettext("When server_authentication is \"no\" "
131 "boot_logger must not specify a secure URL");
134 if ((chars
= snprintf(errmsg
, sizeof (errmsg
),
135 gettext("Unknown error %d"),
136 handle
->bc_error_code
)) > 0 && chars
< sizeof (errmsg
)) {