samba36: more size optimizations and configurable debug level
git-svn-id: svn://svn.openwrt.org/openwrt/packages@30513 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
7d488967e3
commit
d5140c590c
@ -31,6 +31,13 @@ define Package/samba36-server
|
||||
URL:=http://www.samba.org/
|
||||
endef
|
||||
|
||||
define Package/samba36-server/config
|
||||
config PACKAGE_SAMBA_MAX_DEBUG_LEVEL
|
||||
int "Maximum level of compiled-in debug messages"
|
||||
default -1
|
||||
|
||||
endef
|
||||
|
||||
define Package/samba36-server/description
|
||||
The Samba software suite is a collection of programs that implements the
|
||||
SMB protocol for UNIX systems, allowing you to serve files and printers to
|
||||
@ -38,7 +45,7 @@ define Package/samba36-server/description
|
||||
to as the LanManager or Netbios protocol.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DMAX_DEBUG_LEVEL=2 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections
|
||||
TARGET_CFLAGS += -DMAX_DEBUG_LEVEL=$(CONFIG_PACKAGE_SAMBA_MAX_DEBUG_LEVEL) -D__location__=\\\"\\\" -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
|
242
net/samba36/patches/310-remove_error_strings.patch
Normal file
242
net/samba36/patches/310-remove_error_strings.patch
Normal file
@ -0,0 +1,242 @@
|
||||
--- 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
|
||||
@@ -598,4 +598,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/source3/smbd/build_options.c
|
||||
+++ b/source3/smbd/build_options.c
|
||||
@@ -54,7 +54,7 @@ options set at build time for the samba
|
||||
****************************************************************************/
|
||||
void build_options(bool screen)
|
||||
{
|
||||
- if ((DEBUGLEVEL < 4) && (!screen)) {
|
||||
+ if ((DEBUGLEVEL < 4) || (!screen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
--- 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);
|
22
net/samba36/patches/320-debug_level_checks.patch
Normal file
22
net/samba36/patches/320-debug_level_checks.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- a/lib/util/debug.h
|
||||
+++ b/lib/util/debug.h
|
||||
@@ -45,7 +45,7 @@ bool dbghdr( int level, const char *loca
|
||||
* Redefine DEBUGLEVEL because so we don't have to change every source file
|
||||
* that *unnecessarily* references it.
|
||||
*/
|
||||
-#define DEBUGLEVEL DEBUGLEVEL_CLASS[DBGC_ALL]
|
||||
+#define DEBUGLEVEL 0
|
||||
|
||||
/*
|
||||
* Define all new debug classes here. A class is represented by an entry in
|
||||
--- a/source3/nmbd/asyncdns.c
|
||||
+++ b/source3/nmbd/asyncdns.c
|
||||
@@ -85,7 +85,7 @@ static void asyncdns_process(void)
|
||||
struct query_record r;
|
||||
unstring qname;
|
||||
|
||||
- DEBUGLEVEL = -1;
|
||||
+ DEBUGLEVEL_CLASS[DBGC_ALL] = -1;
|
||||
|
||||
while (1) {
|
||||
NTSTATUS status;
|
Loading…
x
Reference in New Issue
Block a user