summaryrefslogtreecommitdiff
path: root/opt/rpcbind
diff options
context:
space:
mode:
Diffstat (limited to 'opt/rpcbind')
-rw-r--r--opt/rpcbind/.footprint21
-rw-r--r--opt/rpcbind/.signature9
-rw-r--r--opt/rpcbind/MAKEPKG81
-rw-r--r--opt/rpcbind/musl-rpc-compat.c26
-rw-r--r--opt/rpcbind/musl-sunrpc.patch25
-rw-r--r--opt/rpcbind/rpcbind-sunrpc.patch11
6 files changed, 173 insertions, 0 deletions
diff --git a/opt/rpcbind/.footprint b/opt/rpcbind/.footprint
new file mode 100644
index 0000000..3ad18b9
--- /dev/null
+++ b/opt/rpcbind/.footprint
@@ -0,0 +1,21 @@
+drwxr-xr-x root/root etc/
+drwxr-xr-x root/root etc/sv/
+drwxr-xr-x root/root etc/sv/rpcbind/
+-rwxr-xr-x root/root etc/sv/rpcbind/run
+drwxr-xr-x root/root etc/sv/rpcbind/log/
+-rwxr-xr-x root/root etc/sv/rpcbind/log/run
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/sbin/
+-rwxr-xr-x root/root usr/sbin/rpcbind
+-rwxr-xr-x root/root usr/sbin/rpcinfo
+drwxr-xr-x root/root usr/share/
+drwxr-xr-x root/root usr/share/man/
+drwxr-xr-x root/root usr/share/man/man8/
+-rw-r--r-- root/root usr/share/man/man8/rpcbind.8.gz
+-rw-r--r-- root/root usr/share/man/man8/rpcinfo.8.gz
+drwxr-xr-x root/root var/
+drwxr-xr-x root/root var/lib/
+drwxr-xr-x root/root var/lib/pkg/
+drwxr-xr-x root/root var/lib/pkg/meta/
+-rw-r--r-- root/root var/lib/pkg/meta/rpcbind
+drwxr-xr-x root/root var/lib/rpcbind/
diff --git a/opt/rpcbind/.signature b/opt/rpcbind/.signature
new file mode 100644
index 0000000..11c6ddf
--- /dev/null
+++ b/opt/rpcbind/.signature
@@ -0,0 +1,9 @@
+RWTZ9IduCSQ/mMLRoqsRGj/7ntbRzMfRpSkZZ0Liambd0hWOyHy9P/cJo2dtcMb4Nv/mgH/BsZLAGA1EZ18NmGFh7NuSw1sLogk=
+
+SHA256 (MAKEPKG) = 737ea7a9b6aeb741c3ca8aeccb8ccdd35ee29128199c1560456fc0d0066711eb
+SHA256 (.footprint) = 1d5bfd8ab8a1117783e55e4164d72b8ed9b359f88a848492418217aef0e27839
+SHA256 (rpcbind-1.3.1.tar.bz2) = 8e551b445f5172f8ef218845af342fb2a2d741b57ce8c777c781a01ea92f92a5
+SHA256 (musl-sunrpc.patch) = 8852c055fa257113d3df3525a5600e6f02f4eacba29cf98a8c0c714e4551cfc9
+SHA256 (rpcbind-sunrpc.patch) = d0fdffce3e55d1d2170647e1a0949df579d20ff5dbbdcab0df353d7d71a87370
+SHA256 (musl-rpc-compat.c) = 82e80caa07bb84e2928f55e47bcb256a794218f19866d493e8002e4b3d539d19
+SHA256 (rpcbind#1.3.1-1.pkg.tar.gz) = ec43e516249ec58ce6743174d3ccd65244236e300f7cc46f127965390f2cf569
diff --git a/opt/rpcbind/MAKEPKG b/opt/rpcbind/MAKEPKG
new file mode 100644
index 0000000..3af1794
--- /dev/null
+++ b/opt/rpcbind/MAKEPKG
@@ -0,0 +1,81 @@
+#!/bin/mkpkg
+# description: RPC program number to address mapper
+# url: https://sourceforge.net/projects/rpcbind/
+name=rpcbind
+version=1.3.1
+release=1
+depends=(libtirpc)
+makedeps=(bsd-headers)
+services=(rpcbind)
+source=(https://downloads.sourceforge.net/$name/$name-$version.tar.bz2
+ musl-sunrpc.patch
+ rpcbind-sunrpc.patch
+ musl-rpc-compat.c)
+sha256sums=(
+ "8e551b445f5172f8ef218845af342fb2a2d741b57ce8c777c781a01ea92f92a5"
+ "8852c055fa257113d3df3525a5600e6f02f4eacba29cf98a8c0c714e4551cfc9"
+ "d0fdffce3e55d1d2170647e1a0949df579d20ff5dbbdcab0df353d7d71a87370"
+ "82e80caa07bb84e2928f55e47bcb256a794218f19866d493e8002e4b3d539d19"
+)
+
+patch() {
+ cd $name-$version
+
+ # musl getaddrinfo does not support service name aliases;
+ # use "sunrpc" (canonical /etc/services entry) instead of
+ # "rpcbind" and "portmapper"
+ patch -p1 < $SRC/rpcbind-sunrpc.patch
+ patch -p1 < $SRC/musl-sunrpc.patch
+
+ # musl lacks getrpcbynumber/getrpcbyname (glibc NSS functions)
+ # Stub in security.c directly (only used for logging)
+ sed -i '1i struct rpcent *getrpcbynumber(int __number) { return 0; }' src/security.c
+}
+
+build() {
+ cd $name-$version
+
+ # Build compat stubs as static lib and inject
+ cc $CFLAGS -c $SRC/musl-rpc-compat.c -o musl-rpc-compat.o
+ ar rcs libmusl-rpc-compat.a musl-rpc-compat.o
+
+ ./configure \
+ --prefix=/usr \
+ --bindir=/usr/sbin \
+ --with-rpcuser=root \
+ --enable-warmstarts \
+ --without-systemdsystemunitdir
+
+ sed -i "s|^LIBS = |LIBS = -L$PWD -lmusl-rpc-compat |" Makefile
+
+ make
+ make DESTDIR=$PKG install
+
+ install -dm755 $PKG/var/lib/rpcbind
+}
+
+post_build() {
+ # runit service
+ install -d $PKG/etc/sv/rpcbind/log
+
+ printf '%s\n' \
+ '#!/bin/sh' \
+ 'exec 2>&1' \
+ 'exec rpcbind -f -w 2>&1' \
+ > $PKG/etc/sv/rpcbind/run
+
+ printf '%s\n' \
+ '#!/bin/sh' \
+ 'mkdir -p /var/log/rpcbind' \
+ 'exec svlogd -tt /var/log/rpcbind' \
+ > $PKG/etc/sv/rpcbind/log/run
+
+ chmod 755 $PKG/etc/sv/rpcbind/run
+ chmod 755 $PKG/etc/sv/rpcbind/log/run
+}
+
+signify() {
+ untrusted comment: public key
+ RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
+}
+# vim: filetype=sh
diff --git a/opt/rpcbind/musl-rpc-compat.c b/opt/rpcbind/musl-rpc-compat.c
new file mode 100644
index 0000000..08dd3e4
--- /dev/null
+++ b/opt/rpcbind/musl-rpc-compat.c
@@ -0,0 +1,26 @@
+/*
+ * musl-rpc-compat.c - stubs for glibc NSS RPC functions missing in musl
+ *
+ * getrpcbynumber() and getrpcbyname() look up RPC service entries
+ * from /etc/rpc. musl does not implement these. The functions are
+ * only used for logging/display purposes in rpcbind, so returning
+ * NULL (not found) is safe.
+ */
+
+#include <stddef.h>
+
+struct rpcent {
+ char *r_name;
+ char **r_aliases;
+ int r_number;
+};
+
+struct rpcent *getrpcbynumber(int number) {
+ (void)number;
+ return NULL;
+}
+
+struct rpcent *getrpcbyname(const char *name) {
+ (void)name;
+ return NULL;
+}
diff --git a/opt/rpcbind/musl-sunrpc.patch b/opt/rpcbind/musl-sunrpc.patch
new file mode 100644
index 0000000..d8a2e27
--- /dev/null
+++ b/opt/rpcbind/musl-sunrpc.patch
@@ -0,0 +1,25 @@
+The musl implementation of getaddrinfo and getservbyname does not
+aliases. As a workaround we use "sunprc" instead of "portmapper"
+
+diff --git a/src/rpcbind.c b/src/rpcbind.c
+index 83dbe93..9404df7 100644
+--- a/src/rpcbind.c
++++ b/src/rpcbind.c
+@@ -416,7 +416,7 @@ init_transport(struct netconfig *nconf)
+ if ((aicode = getaddrinfo(hosts[nhostsbak],
+ servname, &hints, &res)) != 0) {
+ if ((aicode = getaddrinfo(hosts[nhostsbak],
+- "portmapper", &hints, &res)) != 0) {
++ "sunrpc", &hints, &res)) != 0) {
+ syslog(LOG_ERR,
+ "cannot get local address for %s: %s",
+ nconf->nc_netid, gai_strerror(aicode));
+@@ -489,7 +489,7 @@ init_transport(struct netconfig *nconf)
+ if ((strcmp(nconf->nc_netid, "local") != 0) &&
+ (strcmp(nconf->nc_netid, "unix") != 0)) {
+ if ((aicode = getaddrinfo(NULL, servname, &hints, &res))!= 0) {
+- if ((aicode = getaddrinfo(NULL, "portmapper", &hints, &res))!= 0) {
++ if ((aicode = getaddrinfo(NULL, "sunrpc", &hints, &res))!= 0) {
+ printf("cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode));
+ syslog(LOG_ERR,
+ "cannot get local address for %s: %s",
diff --git a/opt/rpcbind/rpcbind-sunrpc.patch b/opt/rpcbind/rpcbind-sunrpc.patch
new file mode 100644
index 0000000..9724a30
--- /dev/null
+++ b/opt/rpcbind/rpcbind-sunrpc.patch
@@ -0,0 +1,11 @@
+--- a/src/rpcbind.c 2015-04-27 16:07:43.000000000 +0200
++++ b/src/rpcbind.c 2015-04-27 19:48:44.518124944 +0200
+@@ -132,7 +132,7 @@
+ char *udp_uaddr; /* Universal UDP address */
+ char *tcp_uaddr; /* Universal TCP address */
+ #endif
+-static char servname[] = "rpcbind";
++static char servname[] = "sunrpc";
+ static char superuser[] = "superuser";
+
+ int main __P((int, char *[]));