Skip to content

Commit

Permalink
shadowsocksr-libev: Upgrade PCRE to PCRE2
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Apr 1, 2024
1 parent 15ec1d7 commit b47885e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
12 changes: 2 additions & 10 deletions shadowsocksr-libev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=shadowsocksr-libev
PKG_VERSION:=2.5.6
PKG_RELEASE:=10
PKG_RELEASE:=11

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/shadowsocksrr/shadowsocksr-libev
Expand All @@ -34,7 +34,7 @@ define Package/shadowsocksr-libev/Default
SUBMENU:=Web Servers/Proxies
TITLE:=shadowsocksr-libev ssr-$(1)
URL:=https://github.com/shadowsocksrr/shadowsocksr-libev
DEPENDS:=+libev +libsodium +libopenssl +libpthread +libpcre2 +libudns +zlib
DEPENDS:=+libev +libsodium +libopenssl +libpthread +libpcre2 +libudns +zlib +PACKAGE_libopenssl-legacy:libopenssl-legacy
endef

define Package/shadowsocksr-libev-ssr-$(1)/install
Expand All @@ -60,14 +60,6 @@ CONFIGURE_ARGS += \
TARGET_CFLAGS += -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed

ifeq ($(CONFIG_GCC_VERSION_12),y)
TARGET_CFLAGS += -Wno-error=use-after-free
endif

ifeq ($(CONFIG_GCC_VERSION_13),y)
TARGET_CFLAGS += -Wno-error=use-after-free
endif

$(foreach component,$(SHADOWSOCKSR_COMPONENTS), \
$(eval $(call BuildPackage,shadowsocksr-libev-ssr-$(component))) \
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
--- a/server/server.c
+++ b/server/server.c
@@ -1943,7 +1943,7 @@ main(int argc, char **argv)
@@ -1942,12 +1942,12 @@
text = (char*)malloc(strlen(protocol) - 11);
memcpy(text, protocol, strlen(protocol) - 11);
int length = strlen(protocol) - 11;
free(protocol);
- obfs = (char*)malloc(length);
+ protocol = (char*)malloc(length);
- free(protocol);
obfs = (char*)malloc(length);
memset(protocol, 0x00, length);
memcpy(protocol, text, length);
LOGI("protocol compatible enable, %s", protocol);
free(text);
+ free(protocol);
protocol_compatible = 1;
}
}
17 changes: 16 additions & 1 deletion shadowsocksr-libev/patches/105-Upgrade-PCRE-to-PCRE2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Signed-off-by: sbwml <[email protected]>
delete mode 100644 m4/pcre.m4
create mode 100644 m4/pcre2.m4

diff --git a/configure.ac b/configure.ac
index f9c51ab..0513db0 100755
--- a/configure.ac
+++ b/configure.ac
@@ -20,10 +20,10 @@ AC_DISABLE_STATIC
Expand All @@ -31,6 +33,9 @@ Signed-off-by: sbwml <[email protected]>
fi

dnl Checks for using shared libraries from system
diff --git a/m4/pcre.m4 b/m4/pcre.m4
deleted file mode 100644
index 4d965bc..0000000
--- a/m4/pcre.m4
+++ /dev/null
@@ -1,152 +0,0 @@
Expand Down Expand Up @@ -186,6 +191,9 @@ Signed-off-by: sbwml <[email protected]>
-AC_SUBST(pcreh)
-AC_SUBST(pcre_pcreh)
-])
diff --git a/m4/pcre2.m4 b/m4/pcre2.m4
new file mode 100644
index 0000000..fcec4b7
--- /dev/null
+++ b/m4/pcre2.m4
@@ -0,0 +1,181 @@
Expand Down Expand Up @@ -370,6 +378,8 @@ Signed-off-by: sbwml <[email protected]>
+AC_SUBST(pcre2h)
+AC_SUBST(pcre2_pcre2h)
+])
diff --git a/src/rule.c b/src/rule.c
index 8aae04e..41ba5e7 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -82,14 +82,28 @@ int
Expand Down Expand Up @@ -407,7 +417,7 @@ Signed-off-by: sbwml <[email protected]>
return 0;
}
}
@@ -109,8 +123,15 @@ lookup_rule(const struct cork_dllist *ru
@@ -109,8 +123,15 @@ lookup_rule(const struct cork_dllist *rules, const char *name, size_t name_len)

cork_dllist_foreach_void(rules, curr, next) {
rule_t *rule = cork_container_of(curr, rule_t, entries);
Expand Down Expand Up @@ -441,6 +451,8 @@ Signed-off-by: sbwml <[email protected]>
+ }
ss_free(rule);
}
diff --git a/src/rule.h b/src/rule.h
index 015bc42..84a89af 100644
--- a/src/rule.h
+++ b/src/rule.h
@@ -33,17 +33,27 @@
Expand Down Expand Up @@ -477,3 +489,6 @@ Signed-off-by: sbwml <[email protected]>

struct cork_dllist_item entries;
} rule_t;
--
2.42.0

1 comment on commit b47885e

@zxlhhyccc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上+PACKAGE_libopenssl-legacy:libopenssl-legacy后出现:
image

Please sign in to comment.