ksmbd: Fix ZDI-CAN-18259
[openwrt/openwrt.git] / package / kernel / ksmbd / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=ksmbd
4 PKG_VERSION:=3.4.6
5 PKG_RELEASE:=2
6
7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
8 PKG_SOURCE_URL:=https://codeload.github.com/cifsd-team/cifsd/tar.gz/$(PKG_VERSION)?
9 PKG_HASH:=d742992692dbe164060d2a0ea668895ed2b86252f10427db3d3a002df44c445b
10
11 PKG_LICENSE:=GPL-2.0-or-later
12 PKG_LICENSE_FILES:=COPYING
13
14 include $(INCLUDE_DIR)/kernel.mk
15 include $(INCLUDE_DIR)/package.mk
16
17 TAR_OPTIONS+= --strip-components 1
18 TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
19
20 define KernelPackage/fs-ksmbd
21 SUBMENU:=Filesystems
22 TITLE:=SMB kernel server support
23 URL:=https://github.com/cifsd-team/cifsd
24 FILES:=$(PKG_BUILD_DIR)/ksmbd.ko
25 DEPENDS:= \
26 +kmod-nls-base \
27 +kmod-nls-utf8 \
28 +kmod-crypto-md4 \
29 +kmod-crypto-md5 \
30 +kmod-crypto-hmac \
31 +kmod-crypto-ecb \
32 +kmod-crypto-des \
33 +kmod-crypto-sha256 \
34 +kmod-crypto-cmac \
35 +kmod-crypto-sha512 \
36 +kmod-crypto-aead \
37 +kmod-crypto-ccm \
38 +kmod-crypto-gcm \
39 +kmod-asn1-decoder \
40 +kmod-oid-registry
41 endef
42
43 # The last two DEPENDS are hacks in order to get CONFIG_ASN1 and CONFIG_OID_REGISTRY
44 # which it seems can't be selected independently. Some bug in either base or upstream.
45
46 define KernelPackage/fs-ksmbd/description
47 Ksmbd is an In-kernel SMBv(1)2/3 fileserver.
48 It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network.
49 endef
50
51 define KernelPackage/fs-ksmbd/config
52 config KSMBD_SMB_INSECURE_SERVER
53 bool "Support for insecure SMB1/CIFS and SMB2.0 protocols"
54 depends on PACKAGE_kmod-fs-ksmbd
55 help
56 This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0.
57 default y
58 endef
59
60 ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y)
61 PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y
62 EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1
63 endif
64
65 define Build/Compile
66 $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \
67 EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
68 $(PKG_EXTRA_KCONFIG) \
69 CONFIG_SMB_SERVER=m \
70 modules
71 endef
72
73 $(eval $(call KernelPackage,fs-ksmbd))