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