Accepting request 304803 from home:kukuk:NIS
- Update to rpcbind 0.2.3 - Following patches were accepted upstream: - 0005-Remove-obsolete-function-in6_fillscopeid.patch - 0006-In-init_transport-move-creation-of-COTS-sockets-clos.patch - 0007-The-use-of-AI_NUMERICHOST-in-init_transport-is-broke.patch - 0019-rpcinfo-ip_ping-clean-up-client-ping-create-destroy.patch - 0020-rpcinfo-introduce-new-helper-function-ip_getclient.patch - 0021-rpcinfo-make-t-u-options-support-IPv6-addresses-too.patch - 0022-rpcinfo-remove-obsolete-function-clnt_com_create.patch - 0023-Make-rpcinfo-p-support-IPv6-addresses-too.patch - 0024-rpcinfo-remove-obsolete-function-get_inet_address.patch - Update to current git, which contains the following patches: - 0002-rpcinfo_warmstart-no_warning_about_missing_file.patch - 0003-systemd-no-dualmode.patch - 0004-systemd-sd_notify.patch - 0018-configure-check-for-nss.h.patch OBS-URL: https://build.opensuse.org/request/show/304803 OBS-URL: https://build.opensuse.org/package/show/network/rpcbind?expand=0&rev=54
This commit is contained in:
parent
6b45dda5a8
commit
6e1ee082e3
@ -1,26 +0,0 @@
|
||||
From: Thorsten Kukuk <kukuk@suse.com>
|
||||
Subject: rpcinfo: warmstart - no warning about missing file
|
||||
|
||||
Don't print an error message on warmstart if the
|
||||
startup files don't exist.
|
||||
|
||||
---
|
||||
src/warmstart.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/warmstart.c
|
||||
+++ b/src/warmstart.c
|
||||
@@ -106,9 +106,10 @@ read_struct(char *filename, xdrproc_t st
|
||||
fprintf(stderr, "rpcbind: using '%s' startup file\n", filename);
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL) {
|
||||
- syslog(LOG_ERR,
|
||||
- "Cannot open '%s' file for reading, errno %d (%s)",
|
||||
- filename, errno, strerror(errno));
|
||||
+ if (errno != ENOENT)
|
||||
+ syslog(LOG_ERR,
|
||||
+ "Cannot open '%s' file for reading, errno %d (%s)",
|
||||
+ filename, errno, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
Systemd will, by default, pass a socket that provides both IPv4 and
|
||||
IPv6 services. RPC netconfig requires that sockets be either IPv4
|
||||
or IPv6. Add a warning to rpcbind should the user encounter an issue.
|
||||
|
||||
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
|
||||
--- a/src/rpcbind.c
|
||||
+++ b/src/rpcbind.c 2014/12/10 13:48:28
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
+#include <netinet/in.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpc_com.h>
|
||||
#ifdef PORTMAP
|
||||
@@ -277,6 +285,31 @@
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Normally systemd will open sockets in dual ipv4/ipv6 mode.
|
||||
+ * That won't work with netconfig and we'll only match
|
||||
+ * the ipv6 socket. Convert it to IPV6_V6ONLY and issue
|
||||
+ * a warning for the user to fix their systemd config.
|
||||
+ */
|
||||
+static int
|
||||
+handle_ipv6_socket(int fd)
|
||||
+{
|
||||
+ int opt;
|
||||
+ socklen_t len = sizeof(opt);
|
||||
+
|
||||
+ if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, &len)) {
|
||||
+ syslog(LOG_ERR, "failed to get ipv6 socket opts: %m");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (opt) /* socket is already in V6ONLY mode */
|
||||
+ return 0;
|
||||
+
|
||||
+ syslog(LOG_ERR, "systemd has passed an IPv4/IPv6 dual-mode socket.");
|
||||
+ syslog(LOG_ERR, "Please fix your systemd config by specifying IPv4 and IPv6 sockets separately and using BindIPv6Only=ipv6-only.");
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Adds the entry into the rpcbind database.
|
||||
* If PORTMAP, then for UDP and TCP, it adds the entries for version 2 also
|
||||
* Returns 0 if succeeds, else fails
|
||||
@@ -361,6 +394,9 @@
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (sa.sa.sa_family == AF_INET6 && handle_ipv6_socket(fd))
|
||||
+ goto error;
|
||||
+
|
||||
/* Copy the address */
|
||||
taddr.addr.maxlen = taddr.addr.len = addrlen;
|
||||
taddr.addr.buf = malloc(addrlen);
|
@ -1,20 +0,0 @@
|
||||
Always notify systemd that rpcbind is ready and running.
|
||||
|
||||
Signed-off-by: Thorsten Kukuk <kukuk@suse.de>
|
||||
|
||||
--- a/src/rpcbind.c
|
||||
+++ b/src/rpcbind.c 2014/12/10 13:48:28
|
||||
@@ -268,6 +269,13 @@
|
||||
|
||||
network_init();
|
||||
|
||||
+#ifdef SYSTEMD
|
||||
+ /* Try to notify system of successful startup, regardless of whether we
|
||||
+ * used systemd socket activation or not. When started from the command
|
||||
+ * line, this should not hurt either.
|
||||
+ */
|
||||
+ sd_notify(0, "READY=1");
|
||||
+#endif
|
||||
my_svc_run();
|
||||
syslog(LOG_ERR, "svc_run returned unexpectedly");
|
||||
rpcbind_abort();
|
@ -1,69 +0,0 @@
|
||||
From f474754a2dee2f0b53435b79800611eebcdff2ac Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Tue, 20 Aug 2013 11:43:51 +0200
|
||||
Subject: [PATCH 05/24] Remove obsolete function in6_fillscopeid
|
||||
|
||||
This seems to be an old remnant from the very early days of IPv6
|
||||
when the kernel would include the ifindex in the link-local
|
||||
addresses returned by getifaddrs(). This is no longer the case on
|
||||
Linux, so the code is a no-op.
|
||||
|
||||
A no-op that makes gcc throw warnings about illegal type-punning.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/util.c | 24 ------------------------
|
||||
1 file changed, 24 deletions(-)
|
||||
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 9a5fb69..a6c835b 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -71,9 +71,6 @@
|
||||
#endif
|
||||
|
||||
static int bitmaskcmp __P((void *, void *, void *, int));
|
||||
-#ifdef INET6
|
||||
-static void in6_fillscopeid __P((struct sockaddr_in6 *));
|
||||
-#endif
|
||||
|
||||
/*
|
||||
* For all bits set in "mask", compare the corresponding bits in
|
||||
@@ -93,28 +90,6 @@
|
||||
}
|
||||
|
||||
/*
|
||||
- * Similar to code in ifconfig.c. Fill in the scope ID for link-local
|
||||
- * addresses returned by getifaddrs().
|
||||
- */
|
||||
-#ifdef INET6
|
||||
-static void
|
||||
-in6_fillscopeid(struct sockaddr_in6 *sin6)
|
||||
-{
|
||||
- u_int16_t ifindex;
|
||||
- u_int16_t *addr;
|
||||
-
|
||||
- if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
|
||||
- addr = (u_int16_t *)&sin6->sin6_addr.s6_addr[2];
|
||||
- ifindex = ntohs(*addr);
|
||||
- if (sin6->sin6_scope_id == 0 && ifindex != 0) {
|
||||
- sin6->sin6_scope_id = ifindex;
|
||||
- *addr = 0;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
-/*
|
||||
* Find a server address that can be used by `caller' to contact
|
||||
* the local service specified by `serv_uaddr'. If `clnt_uaddr' is
|
||||
* non-NULL, it is used instead of `caller' as a hint suggesting
|
||||
@@ -211,7 +186,6 @@
|
||||
* a link-local address then use the scope id to see
|
||||
* which one.
|
||||
*/
|
||||
- in6_fillscopeid(SA2SIN6(ifsa));
|
||||
if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(ifsa)) &&
|
||||
IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(caller_sa)) &&
|
||||
IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(hint_sa))) {
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 2dbc060dd45240216ae37217690f974f57a653f6 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Tue, 20 Aug 2013 09:11:45 +0200
|
||||
Subject: [PATCH 06/24] In init_transport, move creation of COTS sockets
|
||||
closer to where they are used
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcbind.c | 18 ++++++------------
|
||||
1 file changed, 6 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/rpcbind.c b/src/rpcbind.c
|
||||
index 7ed72bc..f562f7a 100644
|
||||
--- a/src/rpcbind.c
|
||||
+++ b/src/rpcbind.c
|
||||
@@ -389,18 +389,6 @@
|
||||
if (my_xprt != NULL)
|
||||
goto got_socket;
|
||||
|
||||
- /*
|
||||
- * XXX - using RPC library internal functions. For NC_TPI_CLTS
|
||||
- * we call this later, for each socket we like to bind.
|
||||
- */
|
||||
- if (nconf->nc_semantics != NC_TPI_CLTS) {
|
||||
- if ((fd = __rpc_nconf2fd(nconf)) < 0) {
|
||||
- syslog(LOG_ERR, "cannot create socket 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);
|
||||
@@ -561,6 +549,12 @@
|
||||
if (!checkbind)
|
||||
return 1;
|
||||
} else { /* NC_TPI_COTS */
|
||||
+ if ((fd = __rpc_nconf2fd(nconf)) < 0) {
|
||||
+ syslog(LOG_ERR, "cannot create socket for %s",
|
||||
+ nconf->nc_netid);
|
||||
+ return (1);
|
||||
+ }
|
||||
+
|
||||
if ((strcmp(nconf->nc_netid, "local") != 0) &&
|
||||
(strcmp(nconf->nc_netid, "unix") != 0)) {
|
||||
if ((aicode = getaddrinfo(NULL, servname, &hints, &res))!= 0) {
|
@ -1,49 +0,0 @@
|
||||
From 18c451ad482debbe7dab00699f4df8b075cee112 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Tue, 20 Aug 2013 09:12:49 +0200
|
||||
Subject: [PATCH 07/24] The use of AI_NUMERICHOST in init_transport() is
|
||||
broken.
|
||||
|
||||
In its current form, when seeing a dotted quad or a numeric IPv6 address,
|
||||
it will clear all flags in hints.ai_flags (which has been set to AI_PASSIVE
|
||||
a few lines above).
|
||||
|
||||
What this code should really be doing is to *set* AI_NUMERICHOST if and only
|
||||
if it sees a numeric address.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcbind.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/rpcbind.c b/src/rpcbind.c
|
||||
index f562f7a..896d509 100644
|
||||
--- a/src/rpcbind.c
|
||||
+++ b/src/rpcbind.c
|
||||
@@ -365,11 +365,13 @@ init_transport(struct netconfig *nconf)
|
||||
nconf->nc_netid);
|
||||
return (1);
|
||||
}
|
||||
+
|
||||
+ hints.ai_flags &= ~AI_NUMERICHOST;
|
||||
switch (hints.ai_family) {
|
||||
case AF_INET:
|
||||
if (inet_pton(AF_INET, hosts[nhostsbak],
|
||||
host_addr) == 1) {
|
||||
- hints.ai_flags &= AI_NUMERICHOST;
|
||||
+ hints.ai_flags |= AI_NUMERICHOST;
|
||||
} else {
|
||||
/*
|
||||
* Skip if we have an AF_INET6 adress.
|
||||
@@ -382,7 +384,7 @@ init_transport(struct netconfig *nconf)
|
||||
case AF_INET6:
|
||||
if (inet_pton(AF_INET6, hosts[nhostsbak],
|
||||
host_addr) == 1) {
|
||||
- hints.ai_flags &= AI_NUMERICHOST;
|
||||
+ hints.ai_flags |= AI_NUMERICHOST;
|
||||
} else {
|
||||
/*
|
||||
* Skip if we have an AF_INET adress.
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,21 +0,0 @@
|
||||
configure: check for <nss.h>
|
||||
|
||||
There's code in rpcbind that tries to configure nss lookups so that it
|
||||
avoids NIS when resolving user names or service names. Unfortunately, this
|
||||
code is turned into a no-op unless HAVE_NSS_H is defined. Which it is not
|
||||
unless the configure script actually checks for it.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
configure.ac | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -55,4 +55,6 @@
|
||||
|
||||
AC_SEARCH_LIBS([pthread_create], [pthread])
|
||||
|
||||
+AC_CHECK_HEADERS(nss.h)
|
||||
+
|
||||
AC_OUTPUT([Makefile])
|
@ -1,122 +0,0 @@
|
||||
From 409c1b26b8134589d13768a37ebffd3ff7d031db Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 11:49:15 +0100
|
||||
Subject: [PATCH 19/24] rpcinfo ip_ping: clean up client ping/create/destroy
|
||||
|
||||
The code doing the actual RPC NULL calls and the handling of
|
||||
VERSMISMATCH was a bit convoluted. We would destroy and re-create
|
||||
the client handle, and sometimes the associated file descriptor
|
||||
would be closed and sometimes not.
|
||||
|
||||
Clean this up by introducing a new function ip_ping_one, which
|
||||
does the actual NULL call to the indicated program version without
|
||||
destroying the client handle, ever.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 39 ++++++++++++++++++---------------------
|
||||
1 file changed, 18 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 747eba3..5983b07 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -390,6 +390,19 @@ clnt_com_create (addr, prog, vers, fdp, trans)
|
||||
return (clnt);
|
||||
}
|
||||
|
||||
+static enum clnt_stat
|
||||
+ip_ping_one(client, vers)
|
||||
+ CLIENT *client;
|
||||
+ u_int32_t vers;
|
||||
+{
|
||||
+ struct timeval to = { .tv_sec = 10, .tv_usec = 0 };
|
||||
+
|
||||
+ (void) CLNT_CONTROL (client, CLSET_VERS, &vers);
|
||||
+ return CLNT_CALL (client, NULLPROC, (xdrproc_t) xdr_void,
|
||||
+ (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL,
|
||||
+ to);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* If portnum is 0, then go and get the address from portmapper, which happens
|
||||
* transparently through clnt*_create(); If version number is not given, it
|
||||
@@ -406,7 +419,6 @@ ip_ping (portnum, trans, argc, argv)
|
||||
{
|
||||
CLIENT *client;
|
||||
int fd = RPC_ANYFD;
|
||||
- struct timeval to;
|
||||
struct sockaddr_in addr;
|
||||
enum clnt_stat rpc_stat;
|
||||
u_long prognum, vers, minvers, maxvers;
|
||||
@@ -418,8 +430,6 @@ ip_ping (portnum, trans, argc, argv)
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
- to.tv_sec = 10;
|
||||
- to.tv_usec = 0;
|
||||
prognum = getprognum (argv[1]);
|
||||
get_inet_address (&addr, argv[0]);
|
||||
if (argc == 2)
|
||||
@@ -436,9 +446,7 @@ ip_ping (portnum, trans, argc, argv)
|
||||
}
|
||||
addr.sin_port = htons (portnum);
|
||||
client = clnt_com_create (&addr, prognum, vers, &fd, trans);
|
||||
- rpc_stat = CLNT_CALL (client, NULLPROC, (xdrproc_t) xdr_void,
|
||||
- (char *) NULL, (xdrproc_t) xdr_void, (char *) NULL,
|
||||
- to);
|
||||
+ rpc_stat = ip_ping_one(client, vers);
|
||||
if (argc != 2)
|
||||
{
|
||||
/* Version number was known */
|
||||
@@ -447,8 +455,8 @@ ip_ping (portnum, trans, argc, argv)
|
||||
(void) CLNT_DESTROY (client);
|
||||
return;
|
||||
}
|
||||
+
|
||||
/* Version number not known */
|
||||
- (void) CLNT_CONTROL (client, CLSET_FD_NCLOSE, (char *) NULL);
|
||||
if (rpc_stat == RPC_PROGVERSMISMATCH)
|
||||
{
|
||||
clnt_geterr (client, &rpcerr);
|
||||
@@ -461,12 +469,7 @@ ip_ping (portnum, trans, argc, argv)
|
||||
* Oh dear, it DOES support version 0.
|
||||
* Let's try version MAX_VERS.
|
||||
*/
|
||||
- (void) CLNT_DESTROY (client);
|
||||
- addr.sin_port = htons (portnum);
|
||||
- client = clnt_com_create (&addr, prognum, MAX_VERS, &fd, trans);
|
||||
- rpc_stat = CLNT_CALL (client, NULLPROC, (xdrproc_t) xdr_void,
|
||||
- (char *) NULL, (xdrproc_t) xdr_void,
|
||||
- (char *) NULL, to);
|
||||
+ rpc_stat = ip_ping_one(client, MAX_VERS);
|
||||
if (rpc_stat == RPC_PROGVERSMISMATCH)
|
||||
{
|
||||
clnt_geterr (client, &rpcerr);
|
||||
@@ -495,21 +498,15 @@ ip_ping (portnum, trans, argc, argv)
|
||||
(void) pstatus (client, prognum, (u_long) 0);
|
||||
exit (1);
|
||||
}
|
||||
- (void) CLNT_DESTROY (client);
|
||||
for (vers = minvers; vers <= maxvers; vers++)
|
||||
{
|
||||
- addr.sin_port = htons (portnum);
|
||||
- client = clnt_com_create (&addr, prognum, vers, &fd, trans);
|
||||
- rpc_stat = CLNT_CALL (client, NULLPROC, (xdrproc_t) xdr_void,
|
||||
- (char *) NULL, (xdrproc_t) xdr_void,
|
||||
- (char *) NULL, to);
|
||||
+ rpc_stat = ip_ping_one(client, vers);
|
||||
if (pstatus (client, prognum, vers) < 0)
|
||||
failure = 1;
|
||||
- (void) CLNT_DESTROY (client);
|
||||
}
|
||||
if (failure)
|
||||
exit (1);
|
||||
- (void) close (fd);
|
||||
+ (void) CLNT_DESTROY (client);
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,110 +0,0 @@
|
||||
From 45e77bd50177044aad7812a613b03188d115f665 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 11:43:37 +0100
|
||||
Subject: [PATCH 20/24] rpcinfo: introduce new helper function ip_getclient
|
||||
|
||||
This function tries to obtain the address of a given host/program/version,
|
||||
using the specified protocol (one of udp or tcp), and create a client
|
||||
handle for it.
|
||||
|
||||
This loops over all netconfig entries (according to the order given
|
||||
by netpath and the config file), and tries to resolve the hostname,
|
||||
and obtain the address using rpcb_getaddr.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 71 insertions(+)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 5983b07..89dee56 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -119,6 +119,7 @@ static CLIENT *clnt_com_create (struct sockaddr_in *, u_long, u_long, int *,
|
||||
char *);
|
||||
static void pmapdump (int, char **);
|
||||
static void get_inet_address (struct sockaddr_in *, char *);
|
||||
+static CLIENT *ip_getclient(const char *hostname, rpcprog_t prognum, rpcvers_t versnum, const char *proto);
|
||||
#endif
|
||||
|
||||
static bool_t reply_proc (void *, struct netbuf *, struct netconfig *);
|
||||
@@ -649,6 +650,76 @@ get_inet_address (addr, host)
|
||||
addr->sin_family = AF_INET;
|
||||
}
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Try to obtain the address of a given host/program/version, using the
|
||||
+ * specified protocol (one of udp or tcp).
|
||||
+ * This loops over all netconfig entries (according to the order given by
|
||||
+ * netpath and the config file), and tries to resolve the hostname, and obtain
|
||||
+ * the address using rpcb_getaddr.
|
||||
+ */
|
||||
+CLIENT *
|
||||
+ip_getclient(hostname, prognum, versnum, proto)
|
||||
+ const char *hostname;
|
||||
+ rpcprog_t prognum;
|
||||
+ rpcvers_t versnum;
|
||||
+ const char *proto;
|
||||
+{
|
||||
+ void *handle;
|
||||
+ enum clnt_stat saved_stat = RPC_SUCCESS;
|
||||
+ struct netconfig *nconf, *result = NULL;
|
||||
+ struct netbuf bind_address;
|
||||
+ struct sockaddr_storage __sa;
|
||||
+ CLIENT *client;
|
||||
+
|
||||
+ memset(&bind_address, 0, sizeof(bind_address));
|
||||
+ bind_address.maxlen = sizeof(__sa);
|
||||
+ bind_address.buf = &__sa;
|
||||
+
|
||||
+ handle = setnetconfig();
|
||||
+ while ((nconf = getnetconfig(handle)) != NULL)
|
||||
+ {
|
||||
+ if (!strcmp(nconf->nc_proto, proto)) {
|
||||
+ if (rpcb_getaddr(prognum, versnum, nconf, &bind_address, hostname))
|
||||
+ {
|
||||
+ result = getnetconfigent(nconf->nc_netid);
|
||||
+ endnetconfig(handle);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (rpc_createerr.cf_stat != RPC_UNKNOWNHOST)
|
||||
+ {
|
||||
+ clnt_pcreateerror (hostname);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ saved_stat = rpc_createerr.cf_stat;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (result == NULL)
|
||||
+ {
|
||||
+ if (saved_stat != RPC_SUCCESS)
|
||||
+ {
|
||||
+ rpc_createerr.cf_stat = saved_stat;
|
||||
+ clnt_pcreateerror (hostname);
|
||||
+ }
|
||||
+ else
|
||||
+ fprintf (stderr, "Cannot find suitable transport for protocol %s\n", proto);
|
||||
+
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ client = clnt_tli_create(RPC_ANYFD, result, &bind_address, prognum, versnum, 0, 0);
|
||||
+ if (client == NULL)
|
||||
+ {
|
||||
+ clnt_pcreateerror(hostname);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ freenetconfigent(result);
|
||||
+ return client;
|
||||
+}
|
||||
#endif /* PORTMAP */
|
||||
|
||||
static int
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,71 +0,0 @@
|
||||
From feb828a6db505451e053e4f73332071d53a75c42 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 12:26:40 +0100
|
||||
Subject: [PATCH 21/24] rpcinfo: make -t/-u options support IPv6 addresses,
|
||||
too
|
||||
|
||||
Currently, rpcinfo supports two ways to test whether a given
|
||||
service is alive.
|
||||
|
||||
For IPv4 hosts, you can use -u and -t. But for IPv6, you need
|
||||
to use "rpcinfo -a" and specify the host through a universal
|
||||
address, which is fairly inconvenient.
|
||||
|
||||
This patch modifies ip_ping to allow using -u and -t for IPv6
|
||||
addresses and hosts as well.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 15 ++++++++-------
|
||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 89dee56..3fea753 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -412,16 +412,15 @@ ip_ping_one(client, vers)
|
||||
* version 0 calls succeeds, it tries for MAXVERS call and repeats the same.
|
||||
*/
|
||||
static void
|
||||
-ip_ping (portnum, trans, argc, argv)
|
||||
+ip_ping (portnum, proto, argc, argv)
|
||||
u_short portnum;
|
||||
- char *trans;
|
||||
+ char *proto;
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
CLIENT *client;
|
||||
- int fd = RPC_ANYFD;
|
||||
- struct sockaddr_in addr;
|
||||
enum clnt_stat rpc_stat;
|
||||
+ const char *hostname;
|
||||
u_long prognum, vers, minvers, maxvers;
|
||||
struct rpc_err rpcerr;
|
||||
int failure = 0;
|
||||
@@ -431,8 +430,9 @@ ip_ping (portnum, trans, argc, argv)
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
+
|
||||
+ hostname = argv[0];
|
||||
prognum = getprognum (argv[1]);
|
||||
- get_inet_address (&addr, argv[0]);
|
||||
if (argc == 2)
|
||||
{ /* Version number not known */
|
||||
/*
|
||||
@@ -445,8 +445,9 @@ ip_ping (portnum, trans, argc, argv)
|
||||
{
|
||||
vers = getvers (argv[2]);
|
||||
}
|
||||
- addr.sin_port = htons (portnum);
|
||||
- client = clnt_com_create (&addr, prognum, vers, &fd, trans);
|
||||
+
|
||||
+ client = ip_getclient(hostname, prognum, vers, proto);
|
||||
+
|
||||
rpc_stat = ip_ping_one(client, vers);
|
||||
if (argc != 2)
|
||||
{
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,67 +0,0 @@
|
||||
From a7b8fdf863eca0d992597ff853fd95cb4e375358 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 12:51:29 +0100
|
||||
Subject: [PATCH 22/24] rpcinfo: remove obsolete function clnt_com_create
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 36 ------------------------------------
|
||||
1 file changed, 36 deletions(-)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 3fea753..0da5628 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -115,8 +115,6 @@ struct rpcbdump_short
|
||||
|
||||
#ifdef PORTMAP
|
||||
static void ip_ping (u_short, char *, int, char **);
|
||||
-static CLIENT *clnt_com_create (struct sockaddr_in *, u_long, u_long, int *,
|
||||
- char *);
|
||||
static void pmapdump (int, char **);
|
||||
static void get_inet_address (struct sockaddr_in *, char *);
|
||||
static CLIENT *ip_getclient(const char *hostname, rpcprog_t prognum, rpcvers_t versnum, const char *proto);
|
||||
@@ -357,40 +355,6 @@ local_rpcb (rpcprog_t prog, rpcvers_t vers)
|
||||
}
|
||||
|
||||
#ifdef PORTMAP
|
||||
-static CLIENT *
|
||||
-clnt_com_create (addr, prog, vers, fdp, trans)
|
||||
- struct sockaddr_in *addr;
|
||||
- u_long prog;
|
||||
- u_long vers;
|
||||
- int *fdp;
|
||||
- char *trans;
|
||||
-{
|
||||
- CLIENT *clnt;
|
||||
-
|
||||
- if (strcmp (trans, "tcp") == 0)
|
||||
- {
|
||||
- clnt = clnttcp_create (addr, prog, vers, fdp, 0, 0);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- struct timeval to;
|
||||
-
|
||||
- to.tv_sec = 5;
|
||||
- to.tv_usec = 0;
|
||||
- clnt = clntudp_create (addr, prog, vers, to, fdp);
|
||||
- }
|
||||
- if (clnt == (CLIENT *) NULL)
|
||||
- {
|
||||
- clnt_pcreateerror ("rpcinfo");
|
||||
- if (vers == MIN_VERS)
|
||||
- printf ("program %lu is not available\n", prog);
|
||||
- else
|
||||
- printf ("program %lu version %lu is not available\n", prog, vers);
|
||||
- exit (1);
|
||||
- }
|
||||
- return (clnt);
|
||||
-}
|
||||
-
|
||||
static enum clnt_stat
|
||||
ip_ping_one(client, vers)
|
||||
CLIENT *client;
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,47 +0,0 @@
|
||||
From efe7c73ea490f9cd184fa974f1a4d67bd93d8269 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 13:08:18 +0100
|
||||
Subject: [PATCH 23/24] Make rpcinfo -p support IPv6 addresses, too
|
||||
|
||||
While this is not strictly necessary (you can use "rpcinfo <hostname>" instead),
|
||||
some older scripts may rely on rpcinfo to work with just about any hostname.
|
||||
Let's be gentle with them. It doesn't cost us much.
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 0da5628..2981240 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -484,7 +484,6 @@ pmapdump (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
- struct sockaddr_in server_addr;
|
||||
struct pmaplist *head = NULL;
|
||||
int socket = RPC_ANYSOCK;
|
||||
struct timeval minutetimeout;
|
||||
@@ -502,10 +501,13 @@ pmapdump (argc, argv)
|
||||
if (argc == 1)
|
||||
{
|
||||
host = argv[0];
|
||||
- get_inet_address (&server_addr, host);
|
||||
- server_addr.sin_port = htons (PMAPPORT);
|
||||
- client = clnttcp_create (&server_addr, PMAPPROG, PMAPVERS,
|
||||
- &socket, 50, 500);
|
||||
+
|
||||
+ /* This is a little bit more complicated than it should be.
|
||||
+ * ip_getclient will do an rpcb_getaddr call to identify the
|
||||
+ * port of the portmapper - but it works, and it's easier than
|
||||
+ * creating a copy of ip_getclient that avoids the getaddr call.
|
||||
+ */
|
||||
+ client = ip_getclient(host, PMAPPROG, PMAPVERS, "tcp");
|
||||
}
|
||||
else
|
||||
client = local_rpcb (PMAPPROG, PMAPVERS);
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,76 +0,0 @@
|
||||
From c2d5de2c81e9d8d4cdaaafa2b7ae925c6e62c5ad Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Kirch <okir@suse.de>
|
||||
Date: Mon, 20 Jan 2014 13:09:46 +0100
|
||||
Subject: [PATCH 24/24] rpcinfo: remove obsolete function get_inet_address
|
||||
|
||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
||||
---
|
||||
src/rpcinfo.c | 45 ---------------------------------------------
|
||||
1 file changed, 45 deletions(-)
|
||||
|
||||
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
|
||||
index 2981240..2c7d897 100644
|
||||
--- a/src/rpcinfo.c
|
||||
+++ b/src/rpcinfo.c
|
||||
@@ -116,7 +116,6 @@ struct rpcbdump_short
|
||||
#ifdef PORTMAP
|
||||
static void ip_ping (u_short, char *, int, char **);
|
||||
static void pmapdump (int, char **);
|
||||
-static void get_inet_address (struct sockaddr_in *, char *);
|
||||
static CLIENT *ip_getclient(const char *hostname, rpcprog_t prognum, rpcvers_t versnum, const char *proto);
|
||||
#endif
|
||||
|
||||
@@ -574,50 +573,6 @@ pmapdump (argc, argv)
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-get_inet_address (addr, host)
|
||||
- struct sockaddr_in *addr;
|
||||
- char *host;
|
||||
-{
|
||||
- struct netconfig *nconf;
|
||||
- struct addrinfo hints, *res;
|
||||
- int error;
|
||||
-
|
||||
- (void) memset ((char *) addr, 0, sizeof (*addr));
|
||||
- addr->sin_addr.s_addr = inet_addr (host);
|
||||
- if (addr->sin_addr.s_addr == -1 || addr->sin_addr.s_addr == 0)
|
||||
- {
|
||||
- if ((nconf = __rpc_getconfip ("udp")) == NULL &&
|
||||
- (nconf = __rpc_getconfip ("tcp")) == NULL)
|
||||
- {
|
||||
- fprintf (stderr, "rpcinfo: couldn't find a suitable transport\n");
|
||||
- exit (1);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- memset (&hints, 0, sizeof hints);
|
||||
- hints.ai_family = AF_INET;
|
||||
- if ((error = getaddrinfo (host, "rpcbind", &hints, &res)) != 0 &&
|
||||
- (error = getaddrinfo (host, "portmapper", &hints, &res)) != 0)
|
||||
- {
|
||||
- fprintf (stderr, "rpcinfo: %s: %s\n",
|
||||
- host, gai_strerror (error));
|
||||
- exit (1);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- memcpy (addr, res->ai_addr, res->ai_addrlen);
|
||||
- freeaddrinfo (res);
|
||||
- }
|
||||
- (void) freenetconfigent (nconf);
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- addr->sin_family = AF_INET;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Try to obtain the address of a given host/program/version, using the
|
||||
* specified protocol (one of udp or tcp).
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:13dbc8c796dbe0ce8df873007bea0490c8460b56202d918c9eb6fa0358a08f29
|
||||
size 112793
|
3
rpcbind-0.2.3.tar.bz2
Normal file
3
rpcbind-0.2.3.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9897823a9d820ea011d9ea02054d5ab99469b9ca5346265fee380713c8fed27b
|
||||
size 121306
|
@ -1,3 +1,27 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 30 09:36:21 CEST 2015 - kukuk@suse.de
|
||||
|
||||
- Update to rpcbind 0.2.3
|
||||
- Following patches were accepted upstream:
|
||||
- 0005-Remove-obsolete-function-in6_fillscopeid.patch
|
||||
- 0006-In-init_transport-move-creation-of-COTS-sockets-clos.patch
|
||||
- 0007-The-use-of-AI_NUMERICHOST-in-init_transport-is-broke.patch
|
||||
- 0019-rpcinfo-ip_ping-clean-up-client-ping-create-destroy.patch
|
||||
- 0020-rpcinfo-introduce-new-helper-function-ip_getclient.patch
|
||||
- 0021-rpcinfo-make-t-u-options-support-IPv6-addresses-too.patch
|
||||
- 0022-rpcinfo-remove-obsolete-function-clnt_com_create.patch
|
||||
- 0023-Make-rpcinfo-p-support-IPv6-addresses-too.patch
|
||||
- 0024-rpcinfo-remove-obsolete-function-get_inet_address.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 18 13:56:59 CET 2014 - kukuk@suse.de
|
||||
|
||||
- Update to current git, which contains the following patches:
|
||||
- 0002-rpcinfo_warmstart-no_warning_about_missing_file.patch
|
||||
- 0003-systemd-no-dualmode.patch
|
||||
- 0004-systemd-sd_notify.patch
|
||||
- 0018-configure-check-for-nss.h.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 12 17:01:44 UTC 2014 - jeffm@suse.com
|
||||
|
||||
|
30
rpcbind.spec
30
rpcbind.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package rpcbind
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: rpcbind
|
||||
Version: 0.2.2
|
||||
Version: 0.2.3
|
||||
Release: 0
|
||||
Summary: Transport independent RPC portmapper
|
||||
License: BSD-4-Clause
|
||||
@ -36,24 +36,11 @@ BuildRequires: pkgconfig(libsystemd-daemon)
|
||||
PreReq: %fillup_prereq
|
||||
Requires(pre): /usr/sbin/useradd
|
||||
Patch1: 0001-systemd-unit-files.patch
|
||||
Patch2: 0002-rpcinfo_warmstart-no_warning_about_missing_file.patch
|
||||
Patch3: 0003-systemd-no-dualmode.patch
|
||||
Patch4: 0004-systemd-sd_notify.patch
|
||||
Patch5: 0005-Remove-obsolete-function-in6_fillscopeid.patch
|
||||
Patch6: 0006-In-init_transport-move-creation-of-COTS-sockets-clos.patch
|
||||
Patch7: 0007-The-use-of-AI_NUMERICHOST-in-init_transport-is-broke.patch
|
||||
Patch8: 0008-First-part-of-init_transport-refactoring.patch
|
||||
Patch9: 0009-init_transport-move-the-registration-code-into-a-sep.patch
|
||||
Patch10: 0010-Fix-the-behavior-when-specifying-the-h-option.patch
|
||||
Patch11: 0011-Clean-up-the-way-we-handle-the-h-option-in-init_tran.patch
|
||||
Patch14: 0014-When-using-systemd-redirect-syslog-calls-to-the-syst.patch
|
||||
Patch18: 0018-configure-check-for-nss.h.patch
|
||||
Patch19: 0019-rpcinfo-ip_ping-clean-up-client-ping-create-destroy.patch
|
||||
Patch20: 0020-rpcinfo-introduce-new-helper-function-ip_getclient.patch
|
||||
Patch21: 0021-rpcinfo-make-t-u-options-support-IPv6-addresses-too.patch
|
||||
Patch22: 0022-rpcinfo-remove-obsolete-function-clnt_com_create.patch
|
||||
Patch23: 0023-Make-rpcinfo-p-support-IPv6-addresses-too.patch
|
||||
Patch24: 0024-rpcinfo-remove-obsolete-function-get_inet_address.patch
|
||||
|
||||
%define statefile /var/lib/portmap.state
|
||||
%{?systemd_requires}
|
||||
@ -70,24 +57,11 @@ regards to portmap.
|
||||
%setup -q
|
||||
cp %{SOURCE4} .
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
#%patch8 -p1
|
||||
#%patch9 -p1
|
||||
#%patch10 -p1
|
||||
#%patch11 -p1
|
||||
#%patch14 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
#%patch24 -p0
|
||||
|
||||
%build
|
||||
autoreconf -fiv
|
||||
|
Loading…
Reference in New Issue
Block a user