Root/package/network/services/samba36/patches/310-remove_error_strings.patch

1--- a/libcli/util/doserr.c
2+++ b/libcli/util/doserr.c
3@@ -28,6 +28,7 @@ struct werror_code_struct {
4 
5 static const struct werror_code_struct dos_errs[] =
6 {
7+#ifdef VERBOSE_ERROR
8     { "WERR_OK", WERR_OK },
9     { "WERR_BADFILE", WERR_BADFILE },
10     { "WERR_ACCESS_DENIED", WERR_ACCESS_DENIED },
11@@ -2668,6 +2669,7 @@ static const struct werror_code_struct d
12     { "WERR_AMBIGUOUS_SYSTEM_DEVICE", WERR_AMBIGUOUS_SYSTEM_DEVICE },
13     { "WERR_SYSTEM_DEVICE_NOT_FOUND", WERR_SYSTEM_DEVICE_NOT_FOUND },
14     /* END GENERATED-WIN32-ERROR-CODES */
15+#endif
16     { NULL, W_ERROR(0) }
17 };
18 
19@@ -2684,12 +2686,14 @@ const char *win_errstr(WERROR werror)
20         static char msg[40];
21         int idx = 0;
22 
23+#ifdef VERBOSE_ERROR
24     while (dos_errs[idx].dos_errstr != NULL) {
25         if (W_ERROR_V(dos_errs[idx].werror) ==
26                     W_ERROR_V(werror))
27                         return dos_errs[idx].dos_errstr;
28         idx++;
29     }
30+#endif
31 
32     slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror));
33 
34@@ -2702,6 +2706,7 @@ struct werror_str_struct {
35 };
36 
37 const struct werror_str_struct dos_err_strs[] = {
38+#ifdef VERBOSE_ERROR
39     { WERR_OK, "Success" },
40     { WERR_ACCESS_DENIED, "Access is denied" },
41     { WERR_INVALID_PARAM, "Invalid parameter" },
42@@ -5324,6 +5329,7 @@ const struct werror_str_struct dos_err_s
43     { WERR_AMBIGUOUS_SYSTEM_DEVICE, "The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria." },
44     { WERR_SYSTEM_DEVICE_NOT_FOUND, "The requested system device cannot be found." },
45     /* END GENERATED-WIN32-ERROR-CODES-DESC */
46+#endif
47 };
48 
49 
50@@ -5334,6 +5340,7 @@ const struct werror_str_struct dos_err_s
51 
52 const char *get_friendly_werror_msg(WERROR werror)
53 {
54+#ifdef VERBOSE_ERROR
55     int i = 0;
56 
57     for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) {
58@@ -5342,6 +5349,7 @@ const char *get_friendly_werror_msg(WERR
59             return dos_err_strs[i].friendly_errstr;
60         }
61     }
62+#endif
63 
64     return win_errstr(werror);
65 }
66--- a/librpc/ndr/libndr.h
67+++ b/librpc/ndr/libndr.h
68@@ -598,4 +598,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_enum
69 
70 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
71 
72+#ifndef VERBOSE_ERROR
73+#define ndr_print_bool(...) do {} while (0)
74+#define ndr_print_struct(...) do {} while (0)
75+#define ndr_print_null(...) do {} while (0)
76+#define ndr_print_enum(...) do {} while (0)
77+#define ndr_print_bitmap_flag(...) do {} while (0)
78+#define ndr_print_ptr(...) do {} while (0)
79+#define ndr_print_union(...) do {} while (0)
80+#define ndr_print_bad_level(...) do {} while (0)
81+#define ndr_print_array_uint8(...) do {} while (0)
82+#define ndr_print_string_array(...) do {} while (0)
83+#define ndr_print_string_array(...) do {} while (0)
84+#define ndr_print_NTSTATUS(...) do {} while (0)
85+#define ndr_print_WERROR(...) do {} while (0)
86+#endif
87+
88 #endif /* __LIBNDR_H__ */
89--- a/librpc/ndr/ndr_basic.c
90+++ b/librpc/ndr/ndr_basic.c
91@@ -31,6 +31,19 @@
92 #define NDR_SIVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVAL(ndr->data,ofs,v); } else SIVAL(ndr->data,ofs,v); } while (0)
93 #define NDR_SIVALS(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVALS(ndr->data,ofs,v); } else SIVALS(ndr->data,ofs,v); } while (0)
94 
95+#undef ndr_print_bool
96+#undef ndr_print_struct
97+#undef ndr_print_null
98+#undef ndr_print_enum
99+#undef ndr_print_bitmap_flag
100+#undef ndr_print_ptr
101+#undef ndr_print_union
102+#undef ndr_print_bad_level
103+#undef ndr_print_array_uint8
104+#undef ndr_print_string_array
105+#undef ndr_print_string_array
106+#undef ndr_print_NTSTATUS
107+#undef ndr_print_WERROR
108 
109 /*
110   check for data leaks from the server by looking for non-zero pad bytes
111--- a/librpc/ndr/ndr_string.c
112+++ b/librpc/ndr/ndr_string.c
113@@ -588,6 +588,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_stri
114     return NDR_ERR_SUCCESS;
115 }
116 
117+#undef ndr_print_string_array
118 _PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a)
119 {
120     uint32_t count;
121--- a/librpc/rpc/dcerpc_error.c
122+++ b/librpc/rpc/dcerpc_error.c
123@@ -31,6 +31,7 @@ struct dcerpc_fault_table {
124 static const struct dcerpc_fault_table dcerpc_faults[] =
125 {
126 #define _FAULT_STR(x) { #x , x }
127+#ifdef VERBOSE_ERROR
128     _FAULT_STR(DCERPC_NCA_S_COMM_FAILURE),
129     _FAULT_STR(DCERPC_NCA_S_OP_RNG_ERROR),
130     _FAULT_STR(DCERPC_NCA_S_UNKNOWN_IF),
131@@ -78,6 +79,7 @@ static const struct dcerpc_fault_table d
132     _FAULT_STR(DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR),
133     _FAULT_STR(DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND),
134     _FAULT_STR(DCERPC_NCA_S_FAULT_NO_CLIENT_STUB),
135+#endif
136     { NULL, 0 }
137 #undef _FAULT_STR
138 };
139@@ -87,12 +89,14 @@ _PUBLIC_ const char *dcerpc_errstr(TALLO
140     int idx = 0;
141     WERROR werr = W_ERROR(fault_code);
142 
143+#ifdef VERBOSE_ERROR
144     while (dcerpc_faults[idx].errstr != NULL) {
145         if (dcerpc_faults[idx].faultcode == fault_code) {
146             return dcerpc_faults[idx].errstr;
147         }
148         idx++;
149     }
150+#endif
151 
152     return win_errstr(werr);
153 }
154--- a/source3/libsmb/nterr.c
155+++ b/source3/libsmb/nterr.c
156@@ -702,6 +702,7 @@ const char *nt_errstr(NTSTATUS nt_code)
157                     NT_STATUS_DOS_CODE(nt_code));
158     }
159 
160+#ifdef VERBOSE_ERROR
161     while (nt_errs[idx].nt_errstr != NULL) {
162         if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
163             NT_STATUS_V(nt_code)) {
164@@ -709,6 +710,7 @@ const char *nt_errstr(NTSTATUS nt_code)
165         }
166         idx++;
167     }
168+#endif
169 
170     result = talloc_asprintf(talloc_tos(), "NT code 0x%08x",
171                  NT_STATUS_V(nt_code));
172@@ -724,12 +726,14 @@ const char *get_friendly_nt_error_msg(NT
173 {
174     int idx = 0;
175 
176+#ifdef VERBOSE_ERROR
177     while (nt_err_desc[idx].nt_errstr != NULL) {
178         if (NT_STATUS_V(nt_err_desc[idx].nt_errcode) == NT_STATUS_V(nt_code)) {
179             return nt_err_desc[idx].nt_errstr;
180         }
181         idx++;
182     }
183+#endif
184 
185     /* fall back to NT_STATUS_XXX string */
186 
187@@ -745,6 +749,7 @@ const char *get_nt_error_c_code(NTSTATUS
188     char *result;
189     int idx = 0;
190 
191+#ifdef VERBOSE_ERROR
192     while (nt_errs[idx].nt_errstr != NULL) {
193         if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
194             NT_STATUS_V(nt_code)) {
195@@ -752,6 +757,7 @@ const char *get_nt_error_c_code(NTSTATUS
196         }
197         idx++;
198     }
199+#endif
200 
201     result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)",
202                  NT_STATUS_V(nt_code));
203@@ -767,12 +773,14 @@ NTSTATUS nt_status_string_to_code(const
204 {
205     int idx = 0;
206 
207+#ifdef VERBOSE_ERROR
208     while (nt_errs[idx].nt_errstr != NULL) {
209         if (strcasecmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) {
210             return nt_errs[idx].nt_errcode;
211         }
212         idx++;
213     }
214+#endif
215     return NT_STATUS_UNSUCCESSFUL;
216 }
217 
218--- a/lib/tdb/common/tdb_private.h
219+++ b/lib/tdb/common/tdb_private.h
220@@ -69,7 +69,11 @@ typedef uint32_t tdb_off_t;
221 /* NB assumes there is a local variable called "tdb" that is the
222  * current context, also takes doubly-parenthesized print-style
223  * argument. */
224+#ifdef VERBOSE_DEBUG
225 #define TDB_LOG(x) tdb->log.log_fn x
226+#else
227+#define TDB_LOG(x) do {} while(0)
228+#endif
229 
230 #ifdef TDB_TRACE
231 void tdb_trace(struct tdb_context *tdb, const char *op);
232--- a/source3/script/mkbuildoptions.awk
233+++ b/source3/script/mkbuildoptions.awk
234@@ -55,7 +55,7 @@ BEGIN {
235     print "****************************************************************************/";
236     print "void build_options(bool screen)";
237     print "{";
238- print " if ((DEBUGLEVEL < 4) && (!screen)) {";
239+ print " if ((DEBUGLEVEL < 4) || (!screen)) {";
240     print " return;";
241     print " }";
242     print "";
243--- a/source3/script/mkbuildoptions-waf.awk
244+++ b/source3/script/mkbuildoptions-waf.awk
245@@ -55,7 +55,7 @@ BEGIN {
246     print "****************************************************************************/";
247     print "void build_options(bool screen)";
248     print "{";
249- print " if ((DEBUGLEVEL < 4) && (!screen)) {";
250+ print " if ((DEBUGLEVEL < 4) || (!screen)) {";
251     print " return;";
252     print " }";
253     print "";
254

Archive Download this file



interactive