samba36: add even more size optimizations, binary size is now down to about 2.7M uncompressed
git-svn-id: svn://svn.openwrt.org/openwrt/packages@30509 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
c886beea6e
commit
fbf4719065
@ -38,7 +38,7 @@ define Package/samba36-server/description
|
||||
to as the LanManager or Netbios protocol.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DMAX_DEBUG_LEVEL=2 -ffunction-sections -fdata-sections
|
||||
TARGET_CFLAGS += -DMAX_DEBUG_LEVEL=2 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
@ -67,6 +67,7 @@ CONFIGURE_ARGS += \
|
||||
--disable-relro \
|
||||
--disable-static \
|
||||
--disable-swat \
|
||||
--disable-shared-libs \
|
||||
--with-codepagedir=/etc/samba \
|
||||
--with-configdir=/etc/samba \
|
||||
--with-included-iniparser \
|
||||
@ -82,9 +83,16 @@ CONFIGURE_ARGS += \
|
||||
--without-krb5 \
|
||||
--without-ldap \
|
||||
--without-pam \
|
||||
--without-winbind
|
||||
--without-winbind \
|
||||
--without-libtdb \
|
||||
--without-libtalloc \
|
||||
--without-libnetapi \
|
||||
--without-libsmbclient \
|
||||
--without-libsmbsharemodes \
|
||||
--without-libaddns \
|
||||
--with-shared-modules=
|
||||
|
||||
MAKE_FLAGS += DYNEXP=
|
||||
MAKE_FLAGS += DYNEXP= PICFLAG= MODULES=
|
||||
|
||||
define Package/samba36-server/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
@ -94,9 +102,6 @@ define Package/samba36-server/install
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/lowcase.dat $(1)/etc/samba
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/upcase.dat $(1)/etc/samba
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/valid.dat $(1)/etc/samba
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_BIN)/libtalloc.so.2 $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_BIN)/libtdb.so.1 $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/samba.init $(1)/etc/init.d/samba
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
@ -121,3 +121,52 @@
|
||||
if (!r->in.account || !r->in.encrypted_password) {
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
--- a/source3/libsmb/trusts_util.c
|
||||
+++ b/source3/libsmb/trusts_util.c
|
||||
@@ -46,9 +46,11 @@ NTSTATUS trust_pw_change_and_store_it(st
|
||||
NTSTATUS nt_status;
|
||||
|
||||
switch (sec_channel_type) {
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
case SEC_CHAN_WKSTA:
|
||||
case SEC_CHAN_DOMAIN:
|
||||
break;
|
||||
+#endif
|
||||
default:
|
||||
return NT_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -159,6 +161,11 @@ bool enumerate_domain_trusts( TALLOC_CTX
|
||||
*num_domains = 0;
|
||||
*sids = NULL;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* lookup a DC first */
|
||||
|
||||
if ( !get_dc_name(domain, NULL, dc_name, &dc_ss) ) {
|
||||
@@ -243,6 +250,10 @@ NTSTATUS change_trust_account_password(
|
||||
struct cli_state *cli = NULL;
|
||||
struct rpc_pipe_client *netlogon_pipe = NULL;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return NT_STATUS_UNSUCCESSFUL;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("change_trust_account_password: Attempting to change trust account password in domain %s....\n",
|
||||
domain));
|
||||
|
||||
--- a/source3/auth/auth_domain.c
|
||||
+++ b/source3/auth/auth_domain.c
|
||||
@@ -538,7 +538,9 @@ static NTSTATUS auth_init_trustdomain(st
|
||||
|
||||
NTSTATUS auth_domain_init(void)
|
||||
{
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
smb_register_auth(AUTH_INTERFACE_VERSION, "trustdomain", auth_init_trustdomain);
|
||||
smb_register_auth(AUTH_INTERFACE_VERSION, "ntdomain", auth_init_ntdomain);
|
||||
+#endif
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -1,3 +1,19 @@
|
||||
--- a/source3/rpc_server/rpc_handles.c
|
||||
+++ b/source3/rpc_server/rpc_handles.c
|
||||
@@ -59,8 +59,11 @@ struct handle_list {
|
||||
|
||||
static bool is_samr_lsa_pipe(const struct ndr_syntax_id *syntax)
|
||||
{
|
||||
- return (ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id)
|
||||
- || ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id));
|
||||
+ return
|
||||
+#ifdef SAMR_SUPPORT
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
|
||||
+#endif
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
|
||||
}
|
||||
|
||||
size_t num_pipe_handles(struct pipes_struct *p)
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -100,9 +100,11 @@ static bool initialize_interfaces(void)
|
||||
@ -69,3 +85,71 @@
|
||||
#ifdef PRINTER_SUPPORT
|
||||
spoolss_commands,
|
||||
#endif
|
||||
--- a/source3/smbd/lanman.c
|
||||
+++ b/source3/smbd/lanman.c
|
||||
@@ -2353,6 +2353,10 @@ static bool api_RNetGroupEnum(struct smb
|
||||
NTSTATUS status, result;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2541,6 +2545,10 @@ static bool api_NetUserGetGroups(struct
|
||||
NTSTATUS status, result;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !UserName || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2733,6 +2741,10 @@ static bool api_RNetUserEnum(struct smbd
|
||||
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2979,6 +2991,10 @@ static bool api_SetUserPassword(struct s
|
||||
int min_pwd_length;
|
||||
struct dcerpc_binding_handle *b = NULL;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
/* Skip 2 strings. */
|
||||
p = skip_string(param,tpscnt,np);
|
||||
p = skip_string(param,tpscnt,p);
|
||||
@@ -3224,6 +3240,10 @@ static bool api_SamOEMChangePassword(str
|
||||
int bufsize;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
*rparam_len = 4;
|
||||
*rparam = smb_realloc_limit(*rparam,*rparam_len);
|
||||
if (!*rparam) {
|
||||
@@ -4265,6 +4285,10 @@ static bool api_RNetUserGetInfo(struct s
|
||||
union samr_UserInfo *info;
|
||||
struct dcerpc_binding_handle *b = NULL;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !UserName || !p) {
|
||||
return False;
|
||||
}
|
||||
|
@ -28,3 +28,16 @@
|
||||
libnetapi_set_error_string(ctx,
|
||||
"Configuration manipulation requested but not "
|
||||
"supported by backend");
|
||||
--- a/source3/smbd/server.c
|
||||
+++ b/source3/smbd/server.c
|
||||
@@ -1210,8 +1210,10 @@ extern void build_options(bool screen);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+#ifdef REGISTRY_BACKEND
|
||||
if (!W_ERROR_IS_OK(registry_init_full()))
|
||||
exit(1);
|
||||
+#endif
|
||||
|
||||
#ifdef PRINTER_SUPPORT
|
||||
if (!print_backend_init(smbd_messaging_context()))
|
||||
|
143
net/samba36/patches/280-strip_srvsvc.patch
Normal file
143
net/samba36/patches/280-strip_srvsvc.patch
Normal file
@ -0,0 +1,143 @@
|
||||
--- a/source3/smbd/lanman.c
|
||||
+++ b/source3/smbd/lanman.c
|
||||
@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
|
||||
struct srvsvc_NetShareInfo2 info2;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SRVSVC_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -3838,10 +3842,7 @@ static bool api_RNetServerGetInfo(struct
|
||||
NTSTATUS status;
|
||||
WERROR werr;
|
||||
TALLOC_CTX *mem_ctx = talloc_tos();
|
||||
- struct rpc_pipe_client *cli = NULL;
|
||||
- union srvsvc_NetSrvInfo info;
|
||||
int errcode;
|
||||
- struct dcerpc_binding_handle *b;
|
||||
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
@@ -3904,66 +3905,16 @@ static bool api_RNetServerGetInfo(struct
|
||||
p = *rdata;
|
||||
p2 = p + struct_len;
|
||||
|
||||
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
|
||||
- conn->session_info,
|
||||
- &conn->sconn->client_id,
|
||||
- conn->sconn->msg_ctx,
|
||||
- &cli);
|
||||
- if (!NT_STATUS_IS_OK(status)) {
|
||||
- DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
|
||||
- nt_errstr(status)));
|
||||
- errcode = W_ERROR_V(ntstatus_to_werror(status));
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- b = cli->binding_handle;
|
||||
-
|
||||
- status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
|
||||
- NULL,
|
||||
- 101,
|
||||
- &info,
|
||||
- &werr);
|
||||
- if (!NT_STATUS_IS_OK(status)) {
|
||||
- errcode = W_ERROR_V(ntstatus_to_werror(status));
|
||||
- goto out;
|
||||
- }
|
||||
- if (!W_ERROR_IS_OK(werr)) {
|
||||
- errcode = W_ERROR_V(werr);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (info.info101 == NULL) {
|
||||
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
if (uLevel != 20) {
|
||||
- srvstr_push(NULL, 0, p, info.info101->server_name, 16,
|
||||
+ srvstr_push(NULL, 0, p, global_myname(), 16,
|
||||
STR_ASCII|STR_UPPER|STR_TERMINATE);
|
||||
- }
|
||||
+ }
|
||||
p += 16;
|
||||
if (uLevel > 0) {
|
||||
- SCVAL(p,0,info.info101->version_major);
|
||||
- SCVAL(p,1,info.info101->version_minor);
|
||||
- SIVAL(p,2,info.info101->server_type);
|
||||
-
|
||||
- if (mdrcnt == struct_len) {
|
||||
- SIVAL(p,6,0);
|
||||
- } else {
|
||||
- SIVAL(p,6,PTR_DIFF(p2,*rdata));
|
||||
- if (mdrcnt - struct_len <= 0) {
|
||||
- return false;
|
||||
- }
|
||||
- push_ascii(p2,
|
||||
- info.info101->comment,
|
||||
- MIN(mdrcnt - struct_len,
|
||||
- MAX_SERVER_STRING_LENGTH),
|
||||
- STR_TERMINATE);
|
||||
- p2 = skip_string(*rdata,*rdata_len,p2);
|
||||
- if (!p2) {
|
||||
- return False;
|
||||
- }
|
||||
- }
|
||||
+ SCVAL(p,0,lp_major_announce_version());
|
||||
+ SCVAL(p,1,lp_minor_announce_version());
|
||||
+ SIVAL(p,2,lp_default_server_announce());
|
||||
+ SIVAL(p,6,0);
|
||||
}
|
||||
|
||||
if (uLevel > 1) {
|
||||
@@ -5654,6 +5605,10 @@ static bool api_RNetSessionEnum(struct s
|
||||
uint32_t totalentries, resume_handle = 0;
|
||||
uint32_t count = 0;
|
||||
|
||||
+#ifndef SRVSVC_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
|
||||
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
|
||||
@@ -1533,6 +1533,10 @@ WERROR _srvsvc_NetShareSetInfo(struct pi
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
union srvsvc_NetShareInfo *info = r->in.info;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
|
||||
|
||||
if (!r->in.share_name) {
|
||||
@@ -1763,6 +1767,10 @@ WERROR _srvsvc_NetShareAdd(struct pipes_
|
||||
int max_connections = 0;
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
|
||||
|
||||
if (r->out.parm_error) {
|
||||
@@ -1945,6 +1953,10 @@ WERROR _srvsvc_NetShareDel(struct pipes_
|
||||
struct share_params *params;
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
|
||||
|
||||
if (!r->in.share_name) {
|
73
net/samba36/patches/290-remove_lsa.patch
Normal file
73
net/samba36/patches/290-remove_lsa.patch
Normal file
@ -0,0 +1,73 @@
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -92,9 +92,11 @@ bool smb_register_ndr_interface(const st
|
||||
|
||||
static bool initialize_interfaces(void)
|
||||
{
|
||||
+#ifdef LSA_SUPPORT
|
||||
if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
#ifdef ACTIVE_DIRECTORY
|
||||
if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
|
||||
return false;
|
||||
--- a/source3/smbd/server_exit.c
|
||||
+++ b/source3/smbd/server_exit.c
|
||||
@@ -163,7 +163,9 @@ static void exit_server_common(enum serv
|
||||
#ifdef SAMR_SUPPORT
|
||||
rpc_samr_shutdown();
|
||||
#endif
|
||||
+#ifdef LSA_SUPPORT
|
||||
rpc_lsarpc_shutdown();
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
||||
--- a/source3/rpc_server/rpc_ep_setup.c
|
||||
+++ b/source3/rpc_server/rpc_ep_setup.c
|
||||
@@ -508,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
+#ifdef LSA_SUPPORT
|
||||
static bool lsarpc_init_cb(void *ptr)
|
||||
{
|
||||
struct dcesrv_ep_context *ep_ctx =
|
||||
@@ -556,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
|
||||
|
||||
return true;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef SAMR_SUPPORT
|
||||
static bool samr_init_cb(void *ptr)
|
||||
@@ -1106,12 +1108,14 @@ bool dcesrv_ep_setup(struct tevent_conte
|
||||
}
|
||||
|
||||
|
||||
+#ifdef LSA_SUPPORT
|
||||
lsarpc_cb.init = lsarpc_init_cb;
|
||||
lsarpc_cb.shutdown = NULL;
|
||||
lsarpc_cb.private_data = ep_ctx;
|
||||
if (!NT_STATUS_IS_OK(rpc_lsarpc_init(&lsarpc_cb))) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef SAMR_SUPPORT
|
||||
samr_cb.init = samr_init_cb;
|
||||
--- a/source3/rpc_server/rpc_handles.c
|
||||
+++ b/source3/rpc_server/rpc_handles.c
|
||||
@@ -63,7 +63,10 @@ static bool is_samr_lsa_pipe(const struc
|
||||
#ifdef SAMR_SUPPORT
|
||||
ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
|
||||
#endif
|
||||
- ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
|
||||
+#ifdef LSA_SUPPORT
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id) ||
|
||||
+#endif
|
||||
+ false;
|
||||
}
|
||||
|
||||
size_t num_pipe_handles(struct pipes_struct *p)
|
Loading…
x
Reference in New Issue
Block a user