[arch-commits] Commit in rpcbind/repos (10 files)

Tobias Powalowski tpowa at archlinux.org
Thu Apr 12 15:32:54 UTC 2012


    Date: Thursday, April 12, 2012 @ 11:32:54
  Author: tpowa
Revision: 156056

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  rpcbind/repos/testing-i686/
  rpcbind/repos/testing-i686/0001-rpcbind-add-support-for-systemd-socket-activation.patch
    (from rev 156055, rpcbind/trunk/0001-rpcbind-add-support-for-systemd-socket-activation.patch)
  rpcbind/repos/testing-i686/PKGBUILD
    (from rev 156055, rpcbind/trunk/PKGBUILD)
  rpcbind/repos/testing-i686/rpcbind
    (from rev 156055, rpcbind/trunk/rpcbind)
  rpcbind/repos/testing-i686/rpcbind-sunrpc.patch
    (from rev 156055, rpcbind/trunk/rpcbind-sunrpc.patch)
  rpcbind/repos/testing-x86_64/
  rpcbind/repos/testing-x86_64/0001-rpcbind-add-support-for-systemd-socket-activation.patch
    (from rev 156055, rpcbind/trunk/0001-rpcbind-add-support-for-systemd-socket-activation.patch)
  rpcbind/repos/testing-x86_64/PKGBUILD
    (from rev 156055, rpcbind/trunk/PKGBUILD)
  rpcbind/repos/testing-x86_64/rpcbind
    (from rev 156055, rpcbind/trunk/rpcbind)
  rpcbind/repos/testing-x86_64/rpcbind-sunrpc.patch
    (from rev 156055, rpcbind/trunk/rpcbind-sunrpc.patch)

-----------------------------------------------------------------------------+
 testing-i686/0001-rpcbind-add-support-for-systemd-socket-activation.patch   |  271 ++++++++++
 testing-i686/PKGBUILD                                                       |   47 +
 testing-i686/rpcbind                                                        |   39 +
 testing-i686/rpcbind-sunrpc.patch                                           |   22 
 testing-x86_64/0001-rpcbind-add-support-for-systemd-socket-activation.patch |  271 ++++++++++
 testing-x86_64/PKGBUILD                                                     |   47 +
 testing-x86_64/rpcbind                                                      |   39 +
 testing-x86_64/rpcbind-sunrpc.patch                                         |   22 
 8 files changed, 758 insertions(+)

Copied: rpcbind/repos/testing-i686/0001-rpcbind-add-support-for-systemd-socket-activation.patch (from rev 156055, rpcbind/trunk/0001-rpcbind-add-support-for-systemd-socket-activation.patch)
===================================================================
--- testing-i686/0001-rpcbind-add-support-for-systemd-socket-activation.patch	                        (rev 0)
+++ testing-i686/0001-rpcbind-add-support-for-systemd-socket-activation.patch	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,271 @@
+From e0a37e07c5ea6557706cc0840802519b8b3fc563 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Thu, 12 Apr 2012 13:30:28 +0200
+Subject: [PATCH] rpcbind: add support for systemd socket activation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Making rpcbind sockect activated will greatly simplify
+its integration in systemd systems. In essence, other services
+may now assume that rpcbind is always available, even during very
+early boot. This means that we no longer need to worry about any
+ordering dependencies.
+
+This is based on a patch originally posted by Lennart Poettering:
+<http://permalink.gmane.org/gmane.linux.nfs/33774>.
+
+That patch was not merged due to the lack of a shared library and
+as systemd was seen to be too Fedora specific.
+
+Systemd now provides a shared library, and it is shipped by defalt in
+OpenSUSE in addition to Fedora, and it is available in Debain, Gentoo,
+Arch, and others.
+
+This version of the patch has three changes from the original:
+
+ * It uses the shared library.
+ * It comes with unit files.
+ * It is rebased on top of master.
+
+A followup patch will sort out the indentation issues, as they are left in
+to make review simpler.
+
+Comments welcome.
+
+v2: correctly enable systemd code at compile time
+    handle the case where not all the required sockets were supplied
+    listen on udp/tcp port 111 in addition to /var/run/rpcbind.sock
+    do not daemonize
+v3: default to compile without systemd support when systemd is not
+    installed at compile time.
+
+Original-patch-by: Lennart Poettering <lennart at poettering.net>
+Cc: systemd-devel at lists.freedesktop.org
+Cc: Steve Dickson <steved at redhat.com>
+Cc: Chuck Lever <chuck.lever at oracle.com>
+Acked-by: Cristian Rodríguez <crrodriguez at opensuse.org>
+Signed-off-by: Tom Gundersen <teg at jklm.no>
+---
+ Makefile.am                |   15 ++++++++
+ configure.in               |   11 ++++++
+ src/rpcbind.c              |   81 ++++++++++++++++++++++++++++++++++++++++----
+ systemd/.gitignore         |    1 +
+ systemd/rpcbind.service.in |    9 +++++
+ systemd/rpcbind.socket     |   12 +++++++
+ 6 files changed, 123 insertions(+), 6 deletions(-)
+ create mode 100644 systemd/.gitignore
+ create mode 100644 systemd/rpcbind.service.in
+ create mode 100644 systemd/rpcbind.socket
+
+diff --git a/Makefile.am b/Makefile.am
+index 9fa608e..194b467 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -38,6 +38,21 @@ rpcbind_SOURCES = \
+ 	src/warmstart.c
+ rpcbind_LDADD = $(TIRPC_LIBS)
+ 
++if SYSTEMD
++AM_CPPFLAGS += $(SYSTEMD_CFLAGS) -DSYSTEMD
++
++rpcbind_LDADD += $(SYSTEMD_LIBS)
++
++systemd/rpcbind.service: systemd/rpcbind.service.in Makefile
++	sed -e 's, at bindir\@,$(bindir),g' \
++		< $< > $@ || rm $@
++
++systemdsystemunit_DATA = \
++	systemd/rpcbind.service \
++	systemd/rpcbind.socket
++
++endif
++
+ rpcinfo_SOURCES =       src/rpcinfo.c
+ rpcinfo_LDADD   =       $(TIRPC_LIBS)
+ 
+diff --git a/configure.in b/configure.in
+index 2b67720..e96cab2 100644
+--- a/configure.in
++++ b/configure.in
+@@ -29,6 +29,17 @@ AC_SUBST([rpcuser], [$with_rpcuser])
+  
+ PKG_CHECK_MODULES([TIRPC], [libtirpc])
+ 
++PKG_PROG_PKG_CONFIG
++AC_ARG_WITH([systemdsystemunitdir],
++  AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
++  [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
++  if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno; then
++    AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
++    PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon])
++  fi
++AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
++
++
+ AS_IF([test x$enable_libwrap = xyes], [
+ 	AC_CHECK_LIB([wrap], [hosts_access], ,
+ 		AC_MSG_ERROR([libwrap support requested but unable to find libwrap]))
+diff --git a/src/rpcbind.c b/src/rpcbind.c
+index 9a0504d..eba32ac 100644
+--- a/src/rpcbind.c
++++ b/src/rpcbind.c
+@@ -56,6 +56,9 @@
+ #include <netinet/in.h>
+ #endif
+ #include <arpa/inet.h>
++#ifdef SYSTEMD
++#include <systemd/sd-daemon.h>
++#endif
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <stdio.h>
+@@ -285,6 +288,7 @@ init_transport(struct netconfig *nconf)
+ 	u_int32_t host_addr[4];  /* IPv4 or IPv6 */
+ 	struct sockaddr_un sun;
+ 	mode_t oldmask;
++	int n = 0;
+         res = NULL;
+ 
+ 	if ((nconf->nc_semantics != NC_TPI_CLTS) &&
+@@ -304,6 +308,76 @@ init_transport(struct netconfig *nconf)
+ 	}
+ #endif
+ 
++	if (!__rpc_nconf2sockinfo(nconf, &si)) {
++		syslog(LOG_ERR, "cannot get information for %s",
++		    nconf->nc_netid);
++		return (1);
++	}
++
++#ifdef SYSTEMD
++	n = sd_listen_fds(0);
++	if (n < 0) {
++		syslog(LOG_ERR, "failed to acquire systemd scokets: %s", strerror(-n));
++		return 1;
++	}
++
++	/* Try to find if one of the systemd sockets we were given match
++	 * our netconfig structure. */
++
++	for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) {
++		struct __rpc_sockinfo si_other;
++		union {
++			struct sockaddr sa;
++			struct sockaddr_un un;
++			struct sockaddr_in in4;
++			struct sockaddr_in6 in6;
++			struct sockaddr_storage storage;
++		} sa;
++		socklen_t addrlen = sizeof(sa);
++
++		if (!__rpc_fd2sockinfo(fd, &si_other)) {
++			syslog(LOG_ERR, "cannot get information for fd %i", fd);
++			return 1;
++		}
++
++		if (si.si_af != si_other.si_af ||
++                    si.si_socktype != si_other.si_socktype ||
++                    si.si_proto != si_other.si_proto)
++			continue;
++
++		if (getsockname(fd, &sa.sa, &addrlen) < 0) {
++			syslog(LOG_ERR, "failed to query socket name: %s",
++                               strerror(errno));
++			goto error;
++		}
++
++		/* Copy the address */
++		taddr.addr.maxlen = taddr.addr.len = addrlen;
++		taddr.addr.buf = malloc(addrlen);
++		if (taddr.addr.buf == NULL) {
++			syslog(LOG_ERR,
++                               "cannot allocate memory for %s address",
++                               nconf->nc_netid);
++			goto error;
++		}
++		memcpy(taddr.addr.buf, &sa, addrlen);
++
++		my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr,
++                          RPC_MAXDATASIZE, RPC_MAXDATASIZE);
++		if (my_xprt == (SVCXPRT *)NULL) {
++			syslog(LOG_ERR, "%s: could not create service",
++                               nconf->nc_netid);
++			goto error;
++		}
++	}
++
++	/* if none of the systemd sockets matched, we set up the socket in
++	 * the normal way:
++	 */
++#endif
++
++	if(my_xprt == (SVCXPRT *)NULL) {
++
+ 	/*
+ 	 * XXX - using RPC library internal functions. For NC_TPI_CLTS
+ 	 * we call this later, for each socket we like to bind.
+@@ -316,12 +390,6 @@ init_transport(struct netconfig *nconf)
+ 		}
+ 	}
+ 
+-	if (!__rpc_nconf2sockinfo(nconf, &si)) {
+-		syslog(LOG_ERR, "cannot get information for %s",
+-		    nconf->nc_netid);
+-		return (1);
+-	}
+-
+ 	if ((strcmp(nconf->nc_netid, "local") == 0) ||
+ 	    (strcmp(nconf->nc_netid, "unix") == 0)) {
+ 		memset(&sun, 0, sizeof sun);
+@@ -558,6 +626,7 @@ init_transport(struct netconfig *nconf)
+ 			goto error;
+ 		}
+ 	}
++	}
+ 
+ #ifdef PORTMAP
+ 	/*
+diff --git a/systemd/.gitignore b/systemd/.gitignore
+new file mode 100644
+index 0000000..b7b4561
+--- /dev/null
++++ b/systemd/.gitignore
+@@ -0,0 +1 @@
++rpcbind.service
+diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
+new file mode 100644
+index 0000000..58ae5de
+--- /dev/null
++++ b/systemd/rpcbind.service.in
+@@ -0,0 +1,9 @@
++[Unit]
++Description=RPC Bind
++
++[Service]
++ExecStart=@bindir@/rpcbind -w -f
++
++[Install]
++WantedBy=multi-user.target
++Also=rpcbind.socket
+diff --git a/systemd/rpcbind.socket b/systemd/rpcbind.socket
+new file mode 100644
+index 0000000..ad5fd62
+--- /dev/null
++++ b/systemd/rpcbind.socket
+@@ -0,0 +1,12 @@
++[Unit]
++Description=RPCbind Server Activation Socket
++Wants=rpcbind.target
++Before=rpcbind.target
++
++[Socket]
++ListenStream=/var/run/rpcbind.sock
++ListenStream=111
++ListenDatagram=111
++
++[Install]
++WantedBy=sockets.target
+-- 
+1.7.10
+

Copied: rpcbind/repos/testing-i686/PKGBUILD (from rev 156055, rpcbind/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD	                        (rev 0)
+++ testing-i686/PKGBUILD	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,47 @@
+# $Id$
+# Maintainer: Tobias Powalowski <tpowa at archlinux.org>
+
+pkgname=rpcbind
+pkgver=0.2.0
+pkgrel=7
+pkgdesc="portmap replacement which supports RPC over various protocols"
+arch=(i686 x86_64)
+depends=('bash' 'glibc' 'libtirpc')
+url="http://rpcbind.sourceforge.net"
+license=('custom')
+replaces=('portmap')
+source=(#http://downloads.sourceforge.net/sourceforge/rpcbind/rpcbind-0.2.0.tar.bz2
+        ftp://ftp.archlinux.org/other/rpcbind/rpcbind-0.2.0.tar.gz
+        0001-rpcbind-add-support-for-systemd-socket-activation.patch
+        rpcbind-sunrpc.patch
+        rpcbind)
+md5sums=('1cb086aa6503b97b55382c224c7c77d4'
+         'df50ef1e5520ab13d53143899eef82f5'
+         'c02ac36a98baac70b8a26190524b7b73'
+         '78a963654f57cbb209e228884767836e')
+
+build() {
+  cd $srcdir/$pkgname-$pkgver
+  # patch for iana services file
+  patch -Np1 -i ../rpcbind-sunrpc.patch
+  # add systemd support
+  patch -Np1 -i ../0001-rpcbind-add-support-for-systemd-socket-activation.patch
+  ./configure --prefix=/usr --enable-warmstarts --with-statedir=/run
+  make
+}
+
+check() {
+  cd $srcdir/$pkgname-$pkgver
+  make check
+}
+
+package() {
+  cd $srcdir/$pkgname-$pkgver
+  make DESTDIR=$pkgdir install
+  # install missing man page - https://bugs.archlinux.org/task/21271
+  install -m644 man/rpcinfo.8 $pkgdir/usr/share/man/man8/
+  # install daemon 
+  install -D -m755 $srcdir/rpcbind $pkgdir/etc/rc.d/rpcbind
+  # install license
+  install -D -m644 COPYING $pkgdir/usr/share/licenses/rpcbind/COPYING
+}

Copied: rpcbind/repos/testing-i686/rpcbind (from rev 156055, rpcbind/trunk/rpcbind)
===================================================================
--- testing-i686/rpcbind	                        (rev 0)
+++ testing-i686/rpcbind	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$(pidof -o %PPID /usr/bin/rpcbind)"
+case "$1" in
+  start)
+    stat_busy "Starting rpcbind"
+    [ -z "$PID" ] && /usr/bin/rpcbind &>/dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      PID=$(pidof -o %PPID /usr/bin/rpcbind)
+      echo $PID > /var/run/rpcbind.pid
+      add_daemon rpcbind
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping rpcbind"
+    [ ! -z "$PID" ]  && kill $PID &> /dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm /var/run/rpcbind.pid
+      rm_daemon rpcbind
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"  
+esac
+exit 0

Copied: rpcbind/repos/testing-i686/rpcbind-sunrpc.patch (from rev 156055, rpcbind/trunk/rpcbind-sunrpc.patch)
===================================================================
--- testing-i686/rpcbind-sunrpc.patch	                        (rev 0)
+++ testing-i686/rpcbind-sunrpc.patch	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,22 @@
+--- rpcbind-0.1.7/src/rpcbind.c.orig	2008-11-19 14:17:34.000000000 +0100
++++ rpcbind-0.1.7/src/rpcbind.c	2010-01-07 13:03:37.416632894 +0100
+@@ -114,7 +114,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 *[]));
+--- rpcbind-0.1.7/src/rpcinfo.c~	2010-01-08 16:14:24.592156602 +0000
++++ rpcbind-0.1.7/src/rpcinfo.c	2010-01-08 16:14:31.578838609 +0000
+@@ -633,7 +633,7 @@
+ 	{
+ 	  memset (&hints, 0, sizeof hints);
+ 	  hints.ai_family = AF_INET;
+-	  if ((error = getaddrinfo (host, "rpcbind", &hints, &res)) != 0 &&
++	  if ((error = getaddrinfo (host, "sunrpc", &hints, &res)) != 0 &&
+               (error = getaddrinfo (host, "portmapper", &hints, &res)) != 0)
+ 	    {
+ 	      fprintf (stderr, "rpcinfo: %s: %s\n",

Copied: rpcbind/repos/testing-x86_64/0001-rpcbind-add-support-for-systemd-socket-activation.patch (from rev 156055, rpcbind/trunk/0001-rpcbind-add-support-for-systemd-socket-activation.patch)
===================================================================
--- testing-x86_64/0001-rpcbind-add-support-for-systemd-socket-activation.patch	                        (rev 0)
+++ testing-x86_64/0001-rpcbind-add-support-for-systemd-socket-activation.patch	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,271 @@
+From e0a37e07c5ea6557706cc0840802519b8b3fc563 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Thu, 12 Apr 2012 13:30:28 +0200
+Subject: [PATCH] rpcbind: add support for systemd socket activation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Making rpcbind sockect activated will greatly simplify
+its integration in systemd systems. In essence, other services
+may now assume that rpcbind is always available, even during very
+early boot. This means that we no longer need to worry about any
+ordering dependencies.
+
+This is based on a patch originally posted by Lennart Poettering:
+<http://permalink.gmane.org/gmane.linux.nfs/33774>.
+
+That patch was not merged due to the lack of a shared library and
+as systemd was seen to be too Fedora specific.
+
+Systemd now provides a shared library, and it is shipped by defalt in
+OpenSUSE in addition to Fedora, and it is available in Debain, Gentoo,
+Arch, and others.
+
+This version of the patch has three changes from the original:
+
+ * It uses the shared library.
+ * It comes with unit files.
+ * It is rebased on top of master.
+
+A followup patch will sort out the indentation issues, as they are left in
+to make review simpler.
+
+Comments welcome.
+
+v2: correctly enable systemd code at compile time
+    handle the case where not all the required sockets were supplied
+    listen on udp/tcp port 111 in addition to /var/run/rpcbind.sock
+    do not daemonize
+v3: default to compile without systemd support when systemd is not
+    installed at compile time.
+
+Original-patch-by: Lennart Poettering <lennart at poettering.net>
+Cc: systemd-devel at lists.freedesktop.org
+Cc: Steve Dickson <steved at redhat.com>
+Cc: Chuck Lever <chuck.lever at oracle.com>
+Acked-by: Cristian Rodríguez <crrodriguez at opensuse.org>
+Signed-off-by: Tom Gundersen <teg at jklm.no>
+---
+ Makefile.am                |   15 ++++++++
+ configure.in               |   11 ++++++
+ src/rpcbind.c              |   81 ++++++++++++++++++++++++++++++++++++++++----
+ systemd/.gitignore         |    1 +
+ systemd/rpcbind.service.in |    9 +++++
+ systemd/rpcbind.socket     |   12 +++++++
+ 6 files changed, 123 insertions(+), 6 deletions(-)
+ create mode 100644 systemd/.gitignore
+ create mode 100644 systemd/rpcbind.service.in
+ create mode 100644 systemd/rpcbind.socket
+
+diff --git a/Makefile.am b/Makefile.am
+index 9fa608e..194b467 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -38,6 +38,21 @@ rpcbind_SOURCES = \
+ 	src/warmstart.c
+ rpcbind_LDADD = $(TIRPC_LIBS)
+ 
++if SYSTEMD
++AM_CPPFLAGS += $(SYSTEMD_CFLAGS) -DSYSTEMD
++
++rpcbind_LDADD += $(SYSTEMD_LIBS)
++
++systemd/rpcbind.service: systemd/rpcbind.service.in Makefile
++	sed -e 's, at bindir\@,$(bindir),g' \
++		< $< > $@ || rm $@
++
++systemdsystemunit_DATA = \
++	systemd/rpcbind.service \
++	systemd/rpcbind.socket
++
++endif
++
+ rpcinfo_SOURCES =       src/rpcinfo.c
+ rpcinfo_LDADD   =       $(TIRPC_LIBS)
+ 
+diff --git a/configure.in b/configure.in
+index 2b67720..e96cab2 100644
+--- a/configure.in
++++ b/configure.in
+@@ -29,6 +29,17 @@ AC_SUBST([rpcuser], [$with_rpcuser])
+  
+ PKG_CHECK_MODULES([TIRPC], [libtirpc])
+ 
++PKG_PROG_PKG_CONFIG
++AC_ARG_WITH([systemdsystemunitdir],
++  AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
++  [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
++  if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno; then
++    AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
++    PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon])
++  fi
++AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
++
++
+ AS_IF([test x$enable_libwrap = xyes], [
+ 	AC_CHECK_LIB([wrap], [hosts_access], ,
+ 		AC_MSG_ERROR([libwrap support requested but unable to find libwrap]))
+diff --git a/src/rpcbind.c b/src/rpcbind.c
+index 9a0504d..eba32ac 100644
+--- a/src/rpcbind.c
++++ b/src/rpcbind.c
+@@ -56,6 +56,9 @@
+ #include <netinet/in.h>
+ #endif
+ #include <arpa/inet.h>
++#ifdef SYSTEMD
++#include <systemd/sd-daemon.h>
++#endif
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <stdio.h>
+@@ -285,6 +288,7 @@ init_transport(struct netconfig *nconf)
+ 	u_int32_t host_addr[4];  /* IPv4 or IPv6 */
+ 	struct sockaddr_un sun;
+ 	mode_t oldmask;
++	int n = 0;
+         res = NULL;
+ 
+ 	if ((nconf->nc_semantics != NC_TPI_CLTS) &&
+@@ -304,6 +308,76 @@ init_transport(struct netconfig *nconf)
+ 	}
+ #endif
+ 
++	if (!__rpc_nconf2sockinfo(nconf, &si)) {
++		syslog(LOG_ERR, "cannot get information for %s",
++		    nconf->nc_netid);
++		return (1);
++	}
++
++#ifdef SYSTEMD
++	n = sd_listen_fds(0);
++	if (n < 0) {
++		syslog(LOG_ERR, "failed to acquire systemd scokets: %s", strerror(-n));
++		return 1;
++	}
++
++	/* Try to find if one of the systemd sockets we were given match
++	 * our netconfig structure. */
++
++	for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) {
++		struct __rpc_sockinfo si_other;
++		union {
++			struct sockaddr sa;
++			struct sockaddr_un un;
++			struct sockaddr_in in4;
++			struct sockaddr_in6 in6;
++			struct sockaddr_storage storage;
++		} sa;
++		socklen_t addrlen = sizeof(sa);
++
++		if (!__rpc_fd2sockinfo(fd, &si_other)) {
++			syslog(LOG_ERR, "cannot get information for fd %i", fd);
++			return 1;
++		}
++
++		if (si.si_af != si_other.si_af ||
++                    si.si_socktype != si_other.si_socktype ||
++                    si.si_proto != si_other.si_proto)
++			continue;
++
++		if (getsockname(fd, &sa.sa, &addrlen) < 0) {
++			syslog(LOG_ERR, "failed to query socket name: %s",
++                               strerror(errno));
++			goto error;
++		}
++
++		/* Copy the address */
++		taddr.addr.maxlen = taddr.addr.len = addrlen;
++		taddr.addr.buf = malloc(addrlen);
++		if (taddr.addr.buf == NULL) {
++			syslog(LOG_ERR,
++                               "cannot allocate memory for %s address",
++                               nconf->nc_netid);
++			goto error;
++		}
++		memcpy(taddr.addr.buf, &sa, addrlen);
++
++		my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr,
++                          RPC_MAXDATASIZE, RPC_MAXDATASIZE);
++		if (my_xprt == (SVCXPRT *)NULL) {
++			syslog(LOG_ERR, "%s: could not create service",
++                               nconf->nc_netid);
++			goto error;
++		}
++	}
++
++	/* if none of the systemd sockets matched, we set up the socket in
++	 * the normal way:
++	 */
++#endif
++
++	if(my_xprt == (SVCXPRT *)NULL) {
++
+ 	/*
+ 	 * XXX - using RPC library internal functions. For NC_TPI_CLTS
+ 	 * we call this later, for each socket we like to bind.
+@@ -316,12 +390,6 @@ init_transport(struct netconfig *nconf)
+ 		}
+ 	}
+ 
+-	if (!__rpc_nconf2sockinfo(nconf, &si)) {
+-		syslog(LOG_ERR, "cannot get information for %s",
+-		    nconf->nc_netid);
+-		return (1);
+-	}
+-
+ 	if ((strcmp(nconf->nc_netid, "local") == 0) ||
+ 	    (strcmp(nconf->nc_netid, "unix") == 0)) {
+ 		memset(&sun, 0, sizeof sun);
+@@ -558,6 +626,7 @@ init_transport(struct netconfig *nconf)
+ 			goto error;
+ 		}
+ 	}
++	}
+ 
+ #ifdef PORTMAP
+ 	/*
+diff --git a/systemd/.gitignore b/systemd/.gitignore
+new file mode 100644
+index 0000000..b7b4561
+--- /dev/null
++++ b/systemd/.gitignore
+@@ -0,0 +1 @@
++rpcbind.service
+diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
+new file mode 100644
+index 0000000..58ae5de
+--- /dev/null
++++ b/systemd/rpcbind.service.in
+@@ -0,0 +1,9 @@
++[Unit]
++Description=RPC Bind
++
++[Service]
++ExecStart=@bindir@/rpcbind -w -f
++
++[Install]
++WantedBy=multi-user.target
++Also=rpcbind.socket
+diff --git a/systemd/rpcbind.socket b/systemd/rpcbind.socket
+new file mode 100644
+index 0000000..ad5fd62
+--- /dev/null
++++ b/systemd/rpcbind.socket
+@@ -0,0 +1,12 @@
++[Unit]
++Description=RPCbind Server Activation Socket
++Wants=rpcbind.target
++Before=rpcbind.target
++
++[Socket]
++ListenStream=/var/run/rpcbind.sock
++ListenStream=111
++ListenDatagram=111
++
++[Install]
++WantedBy=sockets.target
+-- 
+1.7.10
+

Copied: rpcbind/repos/testing-x86_64/PKGBUILD (from rev 156055, rpcbind/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,47 @@
+# $Id$
+# Maintainer: Tobias Powalowski <tpowa at archlinux.org>
+
+pkgname=rpcbind
+pkgver=0.2.0
+pkgrel=7
+pkgdesc="portmap replacement which supports RPC over various protocols"
+arch=(i686 x86_64)
+depends=('bash' 'glibc' 'libtirpc')
+url="http://rpcbind.sourceforge.net"
+license=('custom')
+replaces=('portmap')
+source=(#http://downloads.sourceforge.net/sourceforge/rpcbind/rpcbind-0.2.0.tar.bz2
+        ftp://ftp.archlinux.org/other/rpcbind/rpcbind-0.2.0.tar.gz
+        0001-rpcbind-add-support-for-systemd-socket-activation.patch
+        rpcbind-sunrpc.patch
+        rpcbind)
+md5sums=('1cb086aa6503b97b55382c224c7c77d4'
+         'df50ef1e5520ab13d53143899eef82f5'
+         'c02ac36a98baac70b8a26190524b7b73'
+         '78a963654f57cbb209e228884767836e')
+
+build() {
+  cd $srcdir/$pkgname-$pkgver
+  # patch for iana services file
+  patch -Np1 -i ../rpcbind-sunrpc.patch
+  # add systemd support
+  patch -Np1 -i ../0001-rpcbind-add-support-for-systemd-socket-activation.patch
+  ./configure --prefix=/usr --enable-warmstarts --with-statedir=/run
+  make
+}
+
+check() {
+  cd $srcdir/$pkgname-$pkgver
+  make check
+}
+
+package() {
+  cd $srcdir/$pkgname-$pkgver
+  make DESTDIR=$pkgdir install
+  # install missing man page - https://bugs.archlinux.org/task/21271
+  install -m644 man/rpcinfo.8 $pkgdir/usr/share/man/man8/
+  # install daemon 
+  install -D -m755 $srcdir/rpcbind $pkgdir/etc/rc.d/rpcbind
+  # install license
+  install -D -m644 COPYING $pkgdir/usr/share/licenses/rpcbind/COPYING
+}

Copied: rpcbind/repos/testing-x86_64/rpcbind (from rev 156055, rpcbind/trunk/rpcbind)
===================================================================
--- testing-x86_64/rpcbind	                        (rev 0)
+++ testing-x86_64/rpcbind	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$(pidof -o %PPID /usr/bin/rpcbind)"
+case "$1" in
+  start)
+    stat_busy "Starting rpcbind"
+    [ -z "$PID" ] && /usr/bin/rpcbind &>/dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      PID=$(pidof -o %PPID /usr/bin/rpcbind)
+      echo $PID > /var/run/rpcbind.pid
+      add_daemon rpcbind
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping rpcbind"
+    [ ! -z "$PID" ]  && kill $PID &> /dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm /var/run/rpcbind.pid
+      rm_daemon rpcbind
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"  
+esac
+exit 0

Copied: rpcbind/repos/testing-x86_64/rpcbind-sunrpc.patch (from rev 156055, rpcbind/trunk/rpcbind-sunrpc.patch)
===================================================================
--- testing-x86_64/rpcbind-sunrpc.patch	                        (rev 0)
+++ testing-x86_64/rpcbind-sunrpc.patch	2012-04-12 15:32:54 UTC (rev 156056)
@@ -0,0 +1,22 @@
+--- rpcbind-0.1.7/src/rpcbind.c.orig	2008-11-19 14:17:34.000000000 +0100
++++ rpcbind-0.1.7/src/rpcbind.c	2010-01-07 13:03:37.416632894 +0100
+@@ -114,7 +114,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 *[]));
+--- rpcbind-0.1.7/src/rpcinfo.c~	2010-01-08 16:14:24.592156602 +0000
++++ rpcbind-0.1.7/src/rpcinfo.c	2010-01-08 16:14:31.578838609 +0000
+@@ -633,7 +633,7 @@
+ 	{
+ 	  memset (&hints, 0, sizeof hints);
+ 	  hints.ai_family = AF_INET;
+-	  if ((error = getaddrinfo (host, "rpcbind", &hints, &res)) != 0 &&
++	  if ((error = getaddrinfo (host, "sunrpc", &hints, &res)) != 0 &&
+               (error = getaddrinfo (host, "portmapper", &hints, &res)) != 0)
+ 	    {
+ 	      fprintf (stderr, "rpcinfo: %s: %s\n",




More information about the arch-commits mailing list