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@@ -663,4 +663,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--- a/source3/rpc_client/cli_pipe.c 255+++ b/source3/rpc_client/cli_pipe.c 256@@ -445,7 +445,6 @@ static NTSTATUS cli_pipe_validate_curren 257 rpccli_pipe_txt(talloc_tos(), cli), 258 pkt->ptype, expected_pkt_type, 259 nt_errstr(ret))); 260- NDR_PRINT_DEBUG(ncacn_packet, pkt); 261 return ret; 262 } 263 264@@ -466,7 +465,6 @@ static NTSTATUS cli_pipe_validate_curren 265 rpccli_pipe_txt(talloc_tos(), cli), 266 pkt->ptype, expected_pkt_type, 267 nt_errstr(ret))); 268- NDR_PRINT_DEBUG(ncacn_packet, pkt); 269 return ret; 270 } 271 272@@ -486,7 +484,6 @@ static NTSTATUS cli_pipe_validate_curren 273 rpccli_pipe_txt(talloc_tos(), cli), 274 pkt->ptype, expected_pkt_type, 275 nt_errstr(ret))); 276- NDR_PRINT_DEBUG(ncacn_packet, pkt); 277 return ret; 278 } 279 280@@ -508,7 +505,6 @@ static NTSTATUS cli_pipe_validate_curren 281 rpccli_pipe_txt(talloc_tos(), cli), 282 pkt->ptype, expected_pkt_type, 283 nt_errstr(ret))); 284- NDR_PRINT_DEBUG(ncacn_packet, pkt); 285 return ret; 286 } 287 288@@ -526,7 +522,6 @@ static NTSTATUS cli_pipe_validate_curren 289 rpccli_pipe_txt(talloc_tos(), cli), 290 pkt->ptype, expected_pkt_type, 291 nt_errstr(ret))); 292- NDR_PRINT_DEBUG(ncacn_packet, pkt); 293 return ret; 294 } 295 296@@ -570,7 +565,6 @@ static NTSTATUS cli_pipe_validate_curren 297 rpccli_pipe_txt(talloc_tos(), cli), 298 pkt->ptype, expected_pkt_type, 299 nt_errstr(ret))); 300- NDR_PRINT_DEBUG(ncacn_packet, pkt); 301 return ret; 302 } 303 304--- a/source3/rpc_server/srv_pipe.c 305+++ b/source3/rpc_server/srv_pipe.c 306@@ -996,7 +996,6 @@ static bool api_pipe_bind_req(struct pip 307 if (!NT_STATUS_IS_OK(status)) { 308 DEBUG(1, ("api_pipe_bind_req: invalid pdu: %s\n", 309 nt_errstr(status))); 310- NDR_PRINT_DEBUG(ncacn_packet, pkt); 311 goto err_exit; 312 } 313 314@@ -1330,7 +1329,6 @@ bool api_pipe_bind_auth3(struct pipes_st 315 if (!NT_STATUS_IS_OK(status)) { 316 DEBUG(1, ("api_pipe_bind_auth3: invalid pdu: %s\n", 317 nt_errstr(status))); 318- NDR_PRINT_DEBUG(ncacn_packet, pkt); 319 goto err; 320 } 321 322@@ -1488,7 +1486,6 @@ static bool api_pipe_alter_context(struc 323 if (!NT_STATUS_IS_OK(status)) { 324 DEBUG(1, ("api_pipe_alter_context: invalid pdu: %s\n", 325 nt_errstr(status))); 326- NDR_PRINT_DEBUG(ncacn_packet, pkt); 327 goto err_exit; 328 } 329 330@@ -2062,7 +2059,6 @@ static bool process_request_pdu(struct p 331 if (!NT_STATUS_IS_OK(status)) { 332 DEBUG(1, ("process_request_pdu: invalid pdu: %s\n", 333 nt_errstr(status))); 334- NDR_PRINT_DEBUG(ncacn_packet, pkt); 335 set_incoming_fault(p); 336 return false; 337 } 338