]>
Commit | Line | Data |
---|---|---|
8e64faef | 1 | /* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc. |
e61abf83 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
e61abf83 UD |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
e61abf83 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
e61abf83 UD |
19 | |
20 | #include <errno.h> | |
21 | #include <syslog.h> | |
76b87c03 | 22 | #include <string.h> |
4360eafd | 23 | #include <libintl.h> |
e61abf83 | 24 | #include <rpcsvc/nis.h> |
e61abf83 UD |
25 | |
26 | ||
a334319f | 27 | static const char *nis_errlist[] = |
e61abf83 | 28 | { |
a334319f UD |
29 | N_("Success"), |
30 | N_("Probable success"), | |
31 | N_("Not found"), | |
32 | N_("Probably not found"), | |
33 | N_("Cache expired"), | |
34 | N_("NIS+ servers unreachable"), | |
35 | N_("Unknown object"), | |
36 | N_("Server busy, try again"), | |
37 | N_("Generic system error"), | |
38 | N_("First/next chain broken"), | |
39 | N_("Permission denied"), | |
40 | N_("Not owner"), | |
41 | N_("Name not served by this server"), | |
42 | N_("Server out of memory"), | |
43 | N_("Object with same name exists"), | |
44 | N_("Not master server for this domain"), | |
45 | N_("Invalid object for operation"), | |
46 | N_("Malformed name, or illegal name"), | |
47 | N_("Unable to create callback"), | |
48 | N_("Results sent to callback proc"), | |
49 | N_("Not found, no such name"), | |
50 | N_("Name/entry isn't unique"), | |
51 | N_("Modification failed"), | |
52 | N_("Database for table does not exist"), | |
53 | N_("Entry/table type mismatch"), | |
54 | N_("Link points to illegal name"), | |
55 | N_("Partial success"), | |
56 | N_("Too many attributes"), | |
57 | N_("Error in RPC subsystem"), | |
58 | N_("Missing or malformed attribute"), | |
59 | N_("Named object is not searchable"), | |
60 | N_("Error while talking to callback proc"), | |
61 | N_("Non NIS+ namespace encountered"), | |
62 | N_("Illegal object type for operation"), | |
63 | N_("Passed object is not the same object on server"), | |
64 | N_("Modify operation failed"), | |
65 | N_("Query illegal for named table"), | |
66 | N_("Attempt to remove a non-empty table"), | |
67 | N_("Error in accessing NIS+ cold start file. Is NIS+ installed?"), | |
68 | N_("Full resync required for directory"), | |
69 | N_("NIS+ operation failed"), | |
70 | N_("NIS+ service is unavailable or not installed"), | |
71 | N_("Yes, 42 is the meaning of life"), | |
72 | N_("Unable to authenticate NIS+ server"), | |
73 | N_("Unable to authenticate NIS+ client"), | |
74 | N_("No file space on server"), | |
75 | N_("Unable to create process on server"), | |
76 | N_("Master server busy, full dump rescheduled.") | |
77 | }; | |
e61abf83 UD |
78 | |
79 | const char * | |
80 | nis_sperrno (const nis_error status) | |
81 | { | |
a334319f | 82 | if (status >= (sizeof (nis_errlist) / sizeof (nis_errlist[0]))) |
e61abf83 UD |
83 | return "???"; |
84 | else | |
a334319f | 85 | return gettext (nis_errlist[status]); |
e61abf83 | 86 | } |
7440c23e | 87 | libnsl_hidden_def (nis_sperrno) |
e61abf83 UD |
88 | |
89 | void | |
90 | nis_perror (const nis_error status, const char *label) | |
91 | { | |
92 | fprintf (stderr, "%s: %s\n", label, nis_sperrno (status)); | |
93 | } | |
94 | ||
95 | void | |
96 | nis_lerror (const nis_error status, const char *label) | |
97 | { | |
98 | syslog (LOG_ERR, "%s: %s", label, nis_sperrno (status)); | |
99 | } | |
100 | ||
101 | char * | |
102 | nis_sperror_r (const nis_error status, const char *label, | |
103 | char *buffer, size_t buflen) | |
104 | { | |
8e64faef UD |
105 | if (snprintf (buffer, buflen, "%s: %s", label, nis_sperrno (status)) |
106 | >= buflen) | |
e61abf83 | 107 | { |
a334319f | 108 | errno = ERANGE; |
e61abf83 UD |
109 | return NULL; |
110 | } | |
111 | ||
8e64faef | 112 | return buffer; |
e61abf83 | 113 | } |
7440c23e | 114 | libnsl_hidden_def (nis_sperror_r) |
e61abf83 UD |
115 | |
116 | char * | |
117 | nis_sperror (const nis_error status, const char *label) | |
118 | { | |
8e64faef | 119 | static char buffer[NIS_MAXNAMELEN + 1]; |
e61abf83 UD |
120 | |
121 | return nis_sperror_r (status, label, buffer, sizeof (buffer)); | |
122 | } |