2003-01-16 07:27:30 +00:00
|
|
|
/* $NetBSD: rpcbind.c,v 1.3 2002/11/08 00:16:40 fvdl Exp $ */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
/* $FreeBSD$ */
|
|
|
|
|
2013-11-25 16:44:02 +00:00
|
|
|
/*-
|
2017-11-20 19:49:47 +00:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
2013-11-25 16:44:02 +00:00
|
|
|
* Copyright (c) 2009, Sun Microsystems, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
* - Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1984 - 1991 by Sun Microsystems, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* #ident "@(#)rpcbind.c 1.19 94/04/25 SMI" */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#ifndef lint
|
|
|
|
static char sccsid[] = "@(#)rpcbind.c 1.35 89/04/21 Copyr 1984 Sun Micro";
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rpcbind.c
|
|
|
|
* Implements the program, version to address mapping for rpc.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <rpc/rpc.h>
|
2003-01-16 07:27:30 +00:00
|
|
|
#include <rpc/rpc_com.h>
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#ifdef PORTMAP
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif
|
2002-10-07 02:56:59 +00:00
|
|
|
#include <arpa/inet.h>
|
2002-12-10 08:47:18 +00:00
|
|
|
#include <fcntl.h>
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#include <netdb.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <netconfig.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <syslog.h>
|
|
|
|
#include <err.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include "rpcbind.h"
|
|
|
|
|
|
|
|
/* Global variables */
|
|
|
|
int debugging = 0; /* Tell me what's going on */
|
|
|
|
int doabort = 0; /* When debugging, do an abort on errors */
|
2018-01-02 00:48:19 +00:00
|
|
|
volatile sig_atomic_t doterminate = 0; /* Terminal signal received */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
|
2018-01-02 00:48:19 +00:00
|
|
|
int rpcbindlockfd;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
|
|
|
/* who to suid to if -s is given */
|
|
|
|
#define RUN_AS "daemon"
|
|
|
|
|
2002-12-10 08:47:18 +00:00
|
|
|
#define RPCBINDDLOCK "/var/run/rpcbind.lock"
|
|
|
|
|
2016-05-29 07:01:12 +00:00
|
|
|
static int runasdaemon = 0;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
int insecure = 0;
|
|
|
|
int oldstyle_local = 0;
|
2014-03-06 17:33:27 +00:00
|
|
|
#ifdef LIBWRAP
|
|
|
|
int libwrap = 0;
|
|
|
|
#endif
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
int verboselog = 0;
|
|
|
|
|
2016-05-29 07:01:12 +00:00
|
|
|
static char **hosts = NULL;
|
|
|
|
static struct sockaddr **bound_sa;
|
|
|
|
static int ipv6_only = 0;
|
|
|
|
static int nhosts = 0;
|
|
|
|
static int on = 1;
|
2002-07-11 16:19:43 +00:00
|
|
|
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#ifdef WARMSTART
|
|
|
|
/* Local Variable */
|
2003-01-01 18:49:04 +00:00
|
|
|
static int warmstart = 0; /* Grab an old copy of registrations. */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PORTMAP
|
|
|
|
struct pmaplist *list_pml; /* A list of version 2 rpcbind services */
|
|
|
|
char *udptrans; /* Name of UDP transport */
|
|
|
|
char *tcptrans; /* Name of TCP transport */
|
|
|
|
char *udp_uaddr; /* Universal UDP address */
|
|
|
|
char *tcp_uaddr; /* Universal TCP address */
|
|
|
|
#endif
|
|
|
|
static char servname[] = "rpcbind";
|
|
|
|
static char superuser[] = "superuser";
|
|
|
|
|
2007-11-07 10:53:41 +00:00
|
|
|
int main(int, char *[]);
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
2007-11-07 10:53:41 +00:00
|
|
|
static int init_transport(struct netconfig *);
|
|
|
|
static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *,
|
|
|
|
struct netbuf *);
|
|
|
|
static void terminate(int);
|
|
|
|
static void parseargs(int, char *[]);
|
2010-02-09 18:10:56 +00:00
|
|
|
static void update_bound_sa(void);
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
struct netconfig *nconf;
|
|
|
|
void *nc_handle; /* Net config handle */
|
|
|
|
struct rlimit rl;
|
2003-01-16 07:27:30 +00:00
|
|
|
int maxrec = RPC_MAXDATASIZE;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
|
|
|
parseargs(argc, argv);
|
|
|
|
|
2010-02-09 18:10:56 +00:00
|
|
|
update_bound_sa();
|
|
|
|
|
2002-12-10 08:47:18 +00:00
|
|
|
/* Check that another rpcbind isn't already running. */
|
|
|
|
if ((rpcbindlockfd = (open(RPCBINDDLOCK,
|
|
|
|
O_RDONLY|O_CREAT, 0444))) == -1)
|
|
|
|
err(1, "%s", RPCBINDDLOCK);
|
|
|
|
|
|
|
|
if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
|
|
|
|
errx(1, "another rpcbind is already running. Aborting");
|
|
|
|
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
getrlimit(RLIMIT_NOFILE, &rl);
|
|
|
|
if (rl.rlim_cur < 128) {
|
|
|
|
if (rl.rlim_max <= 128)
|
|
|
|
rl.rlim_cur = rl.rlim_max;
|
|
|
|
else
|
|
|
|
rl.rlim_cur = 128;
|
|
|
|
setrlimit(RLIMIT_NOFILE, &rl);
|
|
|
|
}
|
|
|
|
openlog("rpcbind", LOG_CONS, LOG_DAEMON);
|
|
|
|
if (geteuid()) { /* This command allowed only to root */
|
|
|
|
fprintf(stderr, "Sorry. You are not superuser\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
nc_handle = setnetconfig(); /* open netconfig file */
|
|
|
|
if (nc_handle == NULL) {
|
|
|
|
syslog(LOG_ERR, "could not read /etc/netconfig");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
#ifdef PORTMAP
|
|
|
|
udptrans = "";
|
|
|
|
tcptrans = "";
|
|
|
|
#endif
|
|
|
|
|
2002-12-16 22:24:26 +00:00
|
|
|
nconf = getnetconfigent("local");
|
|
|
|
if (nconf == NULL)
|
|
|
|
nconf = getnetconfigent("unix");
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
if (nconf == NULL) {
|
|
|
|
syslog(LOG_ERR, "%s: can't find local transport\n", argv[0]);
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-01-16 07:27:30 +00:00
|
|
|
|
|
|
|
rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
|
|
|
|
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
init_transport(nconf);
|
|
|
|
|
|
|
|
while ((nconf = getnetconfig(nc_handle))) {
|
2011-07-14 07:28:49 +00:00
|
|
|
if (nconf->nc_flag & NC_VISIBLE) {
|
2007-04-23 07:09:25 +00:00
|
|
|
if (ipv6_only == 1 && strcmp(nconf->nc_protofmly,
|
|
|
|
"inet") == 0) {
|
|
|
|
/* DO NOTHING */
|
|
|
|
} else
|
|
|
|
init_transport(nconf);
|
2011-07-14 07:28:49 +00:00
|
|
|
}
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
endnetconfig(nc_handle);
|
|
|
|
|
|
|
|
/* catch the usual termination signals for graceful exit */
|
|
|
|
(void) signal(SIGCHLD, reap);
|
|
|
|
(void) signal(SIGINT, terminate);
|
|
|
|
(void) signal(SIGTERM, terminate);
|
|
|
|
(void) signal(SIGQUIT, terminate);
|
|
|
|
/* ignore others that could get sent */
|
|
|
|
(void) signal(SIGPIPE, SIG_IGN);
|
|
|
|
(void) signal(SIGHUP, SIG_IGN);
|
|
|
|
(void) signal(SIGUSR1, SIG_IGN);
|
|
|
|
(void) signal(SIGUSR2, SIG_IGN);
|
|
|
|
#ifdef WARMSTART
|
|
|
|
if (warmstart) {
|
|
|
|
read_warmstart();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (debugging) {
|
|
|
|
printf("rpcbind debugging enabled.");
|
|
|
|
if (doabort) {
|
|
|
|
printf(" Will abort on errors!\n");
|
|
|
|
} else {
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (daemon(0, 0))
|
|
|
|
err(1, "fork failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runasdaemon) {
|
|
|
|
struct passwd *p;
|
|
|
|
|
|
|
|
if((p = getpwnam(RUN_AS)) == NULL) {
|
|
|
|
syslog(LOG_ERR, "cannot get uid of daemon: %m");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
if (setuid(p->pw_uid) == -1) {
|
|
|
|
syslog(LOG_ERR, "setuid to daemon failed: %m");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
network_init();
|
|
|
|
|
|
|
|
my_svc_run();
|
|
|
|
syslog(LOG_ERR, "svc_run returned unexpectedly");
|
|
|
|
rpcbind_abort();
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
init_transport(struct netconfig *nconf)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
struct t_bind taddr;
|
|
|
|
struct addrinfo hints, *res = NULL;
|
|
|
|
struct __rpc_sockinfo si;
|
|
|
|
SVCXPRT *my_xprt;
|
|
|
|
int status; /* bound checking ? */
|
|
|
|
int aicode;
|
|
|
|
int addrlen;
|
2002-07-11 16:19:43 +00:00
|
|
|
int nhostsbak;
|
2008-02-14 20:12:23 +00:00
|
|
|
int bound;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
struct sockaddr *sa;
|
2002-07-11 16:19:43 +00:00
|
|
|
u_int32_t host_addr[4]; /* IPv4 or IPv6 */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
struct sockaddr_un sun;
|
|
|
|
mode_t oldmask;
|
|
|
|
|
|
|
|
if ((nconf->nc_semantics != NC_TPI_CLTS) &&
|
2007-04-23 07:09:25 +00:00
|
|
|
(nconf->nc_semantics != NC_TPI_COTS) &&
|
|
|
|
(nconf->nc_semantics != NC_TPI_COTS_ORD))
|
|
|
|
return (1); /* not my type */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#ifdef ND_DEBUG
|
|
|
|
if (debugging) {
|
2007-04-23 07:09:25 +00:00
|
|
|
int i;
|
|
|
|
char **s;
|
|
|
|
|
|
|
|
(void)fprintf(stderr, "%s: %ld lookup routines :\n",
|
|
|
|
nconf->nc_netid, nconf->nc_nlookups);
|
|
|
|
for (i = 0, s = nconf->nc_lookups; i < nconf->nc_nlookups;
|
|
|
|
i++, s++)
|
|
|
|
fprintf(stderr, "[%d] - %s\n", i, *s);
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
2007-04-23 07:09:25 +00:00
|
|
|
* XXX - using RPC library internal functions.
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
*/
|
2007-05-01 14:47:35 +00:00
|
|
|
if ((strcmp(nconf->nc_netid, "local") == 0) ||
|
|
|
|
(strcmp(nconf->nc_netid, "unix") == 0)) {
|
|
|
|
/*
|
|
|
|
* For other transports we call this later, for each socket we
|
|
|
|
* like to bind.
|
|
|
|
*/
|
|
|
|
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
|
|
|
|
int non_fatal = 0;
|
2012-12-21 15:54:13 +00:00
|
|
|
if (errno == EAFNOSUPPORT)
|
2007-05-01 14:47:35 +00:00
|
|
|
non_fatal = 1;
|
|
|
|
syslog(non_fatal?LOG_DEBUG:LOG_ERR, "cannot create socket for %s",
|
|
|
|
nconf->nc_netid);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
|
|
|
if (!__rpc_nconf2sockinfo(nconf, &si)) {
|
2007-04-23 07:09:25 +00:00
|
|
|
syslog(LOG_ERR, "cannot get information for %s",
|
|
|
|
nconf->nc_netid);
|
|
|
|
return (1);
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
|
2002-12-16 22:24:26 +00:00
|
|
|
if ((strcmp(nconf->nc_netid, "local") == 0) ||
|
|
|
|
(strcmp(nconf->nc_netid, "unix") == 0)) {
|
2007-04-23 07:09:25 +00:00
|
|
|
memset(&sun, 0, sizeof sun);
|
|
|
|
sun.sun_family = AF_LOCAL;
|
|
|
|
unlink(_PATH_RPCBINDSOCK);
|
|
|
|
strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
|
|
|
|
sun.sun_len = SUN_LEN(&sun);
|
|
|
|
addrlen = sizeof (struct sockaddr_un);
|
|
|
|
sa = (struct sockaddr *)&sun;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
} else {
|
2007-04-23 07:09:25 +00:00
|
|
|
/* Get rpcbind's address on this transport */
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
2007-04-23 07:09:25 +00:00
|
|
|
memset(&hints, 0, sizeof hints);
|
|
|
|
hints.ai_flags = AI_PASSIVE;
|
|
|
|
hints.ai_family = si.si_af;
|
|
|
|
hints.ai_socktype = si.si_socktype;
|
|
|
|
hints.ai_protocol = si.si_proto;
|
|
|
|
}
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
2007-05-01 14:47:35 +00:00
|
|
|
if ((strcmp(nconf->nc_netid, "local") != 0) &&
|
|
|
|
(strcmp(nconf->nc_netid, "unix") != 0)) {
|
2007-04-23 07:09:25 +00:00
|
|
|
/*
|
2007-05-01 14:47:35 +00:00
|
|
|
* If no hosts were specified, just bind to INADDR_ANY.
|
|
|
|
* Otherwise make sure 127.0.0.1 is added to the list.
|
2007-04-23 07:09:25 +00:00
|
|
|
*/
|
2010-02-09 18:10:56 +00:00
|
|
|
nhostsbak = nhosts + 1;
|
2007-05-01 14:47:35 +00:00
|
|
|
hosts = realloc(hosts, nhostsbak * sizeof(char *));
|
|
|
|
if (nhostsbak == 1)
|
|
|
|
hosts[0] = "*";
|
|
|
|
else {
|
|
|
|
if (hints.ai_family == AF_INET) {
|
|
|
|
hosts[nhostsbak - 1] = "127.0.0.1";
|
|
|
|
} else if (hints.ai_family == AF_INET6) {
|
|
|
|
hosts[nhostsbak - 1] = "::1";
|
|
|
|
} else
|
|
|
|
return 1;
|
2007-04-23 07:09:25 +00:00
|
|
|
}
|
2007-05-01 14:47:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Bind to specific IPs if asked to
|
|
|
|
*/
|
2008-02-14 20:12:23 +00:00
|
|
|
bound = 0;
|
2007-05-01 14:47:35 +00:00
|
|
|
while (nhostsbak > 0) {
|
|
|
|
--nhostsbak;
|
|
|
|
/*
|
|
|
|
* XXX - using RPC library internal functions.
|
|
|
|
*/
|
|
|
|
if ((fd = __rpc_nconf2fd(nconf)) < 0) {
|
|
|
|
int non_fatal = 0;
|
2012-12-21 15:54:13 +00:00
|
|
|
if (errno == EAFNOSUPPORT &&
|
2007-05-01 14:47:35 +00:00
|
|
|
nconf->nc_semantics != NC_TPI_CLTS)
|
|
|
|
non_fatal = 1;
|
|
|
|
syslog(non_fatal ? LOG_DEBUG : LOG_ERR,
|
|
|
|
"cannot create socket for %s", nconf->nc_netid);
|
|
|
|
return (1);
|
2002-07-11 16:19:43 +00:00
|
|
|
}
|
2007-05-01 14:47:35 +00:00
|
|
|
switch (hints.ai_family) {
|
|
|
|
case AF_INET:
|
2007-04-23 07:09:25 +00:00
|
|
|
if (inet_pton(AF_INET, hosts[nhostsbak],
|
2007-05-01 14:47:35 +00:00
|
|
|
host_addr) == 1) {
|
|
|
|
hints.ai_flags &= AI_NUMERICHOST;
|
|
|
|
} else {
|
|
|
|
/*
|
2011-12-30 10:58:14 +00:00
|
|
|
* Skip if we have an AF_INET6 address.
|
2007-05-01 14:47:35 +00:00
|
|
|
*/
|
|
|
|
if (inet_pton(AF_INET6,
|
2007-10-23 07:35:17 +00:00
|
|
|
hosts[nhostsbak], host_addr) == 1) {
|
|
|
|
close(fd);
|
2007-05-01 14:47:35 +00:00
|
|
|
continue;
|
2007-10-23 07:35:17 +00:00
|
|
|
}
|
2007-05-01 14:47:35 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AF_INET6:
|
|
|
|
if (inet_pton(AF_INET6, hosts[nhostsbak],
|
|
|
|
host_addr) == 1) {
|
|
|
|
hints.ai_flags &= AI_NUMERICHOST;
|
|
|
|
} else {
|
|
|
|
/*
|
2011-12-30 10:58:14 +00:00
|
|
|
* Skip if we have an AF_INET address.
|
2007-05-01 14:47:35 +00:00
|
|
|
*/
|
|
|
|
if (inet_pton(AF_INET, hosts[nhostsbak],
|
2007-10-23 07:35:17 +00:00
|
|
|
host_addr) == 1) {
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
2007-05-01 14:47:35 +00:00
|
|
|
}
|
|
|
|
if (setsockopt(fd, IPPROTO_IPV6,
|
|
|
|
IPV6_V6ONLY, &on, sizeof on) < 0) {
|
|
|
|
syslog(LOG_ERR,
|
|
|
|
"can't set v6-only binding for "
|
|
|
|
"ipv6 socket: %m");
|
2007-04-23 07:09:25 +00:00
|
|
|
continue;
|
2007-05-01 14:47:35 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-07-11 16:19:43 +00:00
|
|
|
}
|
2007-04-23 07:09:25 +00:00
|
|
|
|
2007-05-01 14:47:35 +00:00
|
|
|
/*
|
|
|
|
* If no hosts were specified, just bind to INADDR_ANY
|
|
|
|
*/
|
|
|
|
if (strcmp("*", hosts[nhostsbak]) == 0)
|
|
|
|
hosts[nhostsbak] = NULL;
|
|
|
|
if ((strcmp(nconf->nc_netid, "local") != 0) &&
|
|
|
|
(strcmp(nconf->nc_netid, "unix") != 0)) {
|
|
|
|
if ((aicode = getaddrinfo(hosts[nhostsbak],
|
2007-04-23 07:09:25 +00:00
|
|
|
servname, &hints, &res)) != 0) {
|
2007-05-01 14:47:35 +00:00
|
|
|
syslog(LOG_ERR,
|
|
|
|
"cannot get local address for %s: %s",
|
|
|
|
nconf->nc_netid, gai_strerror(aicode));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
addrlen = res->ai_addrlen;
|
|
|
|
sa = (struct sockaddr *)res->ai_addr;
|
|
|
|
}
|
|
|
|
oldmask = umask(S_IXUSR|S_IXGRP|S_IXOTH);
|
|
|
|
if (bind(fd, sa, addrlen) != 0) {
|
|
|
|
syslog(LOG_ERR, "cannot bind %s on %s: %m",
|
|
|
|
(hosts[nhostsbak] == NULL) ? "*" :
|
|
|
|
hosts[nhostsbak], nconf->nc_netid);
|
|
|
|
if (res != NULL)
|
|
|
|
freeaddrinfo(res);
|
2007-04-23 07:09:25 +00:00
|
|
|
continue;
|
2007-05-01 14:47:35 +00:00
|
|
|
} else
|
2008-02-14 20:12:23 +00:00
|
|
|
bound = 1;
|
2007-05-01 14:47:35 +00:00
|
|
|
(void)umask(oldmask);
|
|
|
|
|
|
|
|
/* Copy the address */
|
|
|
|
taddr.addr.len = taddr.addr.maxlen = addrlen;
|
|
|
|
taddr.addr.buf = malloc(addrlen);
|
|
|
|
if (taddr.addr.buf == NULL) {
|
|
|
|
syslog(LOG_ERR,
|
|
|
|
"cannot allocate memory for %s address",
|
|
|
|
nconf->nc_netid);
|
|
|
|
if (res != NULL)
|
|
|
|
freeaddrinfo(res);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
memcpy(taddr.addr.buf, sa, addrlen);
|
|
|
|
#ifdef ND_DEBUG
|
|
|
|
if (debugging) {
|
|
|
|
/*
|
|
|
|
* for debugging print out our universal
|
|
|
|
* address
|
|
|
|
*/
|
|
|
|
char *uaddr;
|
|
|
|
struct netbuf nb;
|
|
|
|
|
|
|
|
nb.buf = sa;
|
|
|
|
nb.len = nb.maxlen = sa->sa_len;
|
|
|
|
uaddr = taddr2uaddr(nconf, &nb);
|
|
|
|
(void)fprintf(stderr,
|
|
|
|
"rpcbind : my address is %s\n", uaddr);
|
|
|
|
(void)free(uaddr);
|
|
|
|
}
|
|
|
|
#endif
|
2007-06-09 09:20:22 +00:00
|
|
|
|
2007-05-01 14:47:35 +00:00
|
|
|
if (nconf->nc_semantics != NC_TPI_CLTS)
|
|
|
|
listen(fd, SOMAXCONN);
|
|
|
|
|
|
|
|
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;
|
2002-07-11 16:19:43 +00:00
|
|
|
}
|
2007-04-23 07:09:25 +00:00
|
|
|
}
|
2008-02-14 20:12:23 +00:00
|
|
|
if (!bound)
|
2007-05-01 14:47:35 +00:00
|
|
|
return 1;
|
|
|
|
} else {
|
2007-04-23 07:09:25 +00:00
|
|
|
oldmask = umask(S_IXUSR|S_IXGRP|S_IXOTH);
|
2007-05-01 14:47:35 +00:00
|
|
|
if (bind(fd, sa, addrlen) < 0) {
|
|
|
|
syslog(LOG_ERR, "cannot bind %s: %m", nconf->nc_netid);
|
2007-04-23 07:09:25 +00:00
|
|
|
if (res != NULL)
|
|
|
|
freeaddrinfo(res);
|
2007-05-01 14:47:35 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
(void) umask(oldmask);
|
2007-04-23 07:09:25 +00:00
|
|
|
|
|
|
|
/* Copy the address */
|
|
|
|
taddr.addr.len = taddr.addr.maxlen = addrlen;
|
|
|
|
taddr.addr.buf = malloc(addrlen);
|
|
|
|
if (taddr.addr.buf == NULL) {
|
2007-05-01 14:47:35 +00:00
|
|
|
syslog(LOG_ERR, "cannot allocate memory for %s address",
|
2007-04-23 07:09:25 +00:00
|
|
|
nconf->nc_netid);
|
|
|
|
if (res != NULL)
|
|
|
|
freeaddrinfo(res);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
memcpy(taddr.addr.buf, sa, addrlen);
|
2002-07-11 16:19:43 +00:00
|
|
|
#ifdef ND_DEBUG
|
2007-04-23 07:09:25 +00:00
|
|
|
if (debugging) {
|
2007-05-01 14:47:35 +00:00
|
|
|
/* for debugging print out our universal address */
|
2007-04-23 07:09:25 +00:00
|
|
|
char *uaddr;
|
|
|
|
struct netbuf nb;
|
|
|
|
|
|
|
|
nb.buf = sa;
|
|
|
|
nb.len = nb.maxlen = sa->sa_len;
|
|
|
|
uaddr = taddr2uaddr(nconf, &nb);
|
2007-05-01 14:47:35 +00:00
|
|
|
(void) fprintf(stderr, "rpcbind : my address is %s\n",
|
|
|
|
uaddr);
|
|
|
|
(void) free(uaddr);
|
2007-04-23 07:09:25 +00:00
|
|
|
}
|
2002-07-11 16:19:43 +00:00
|
|
|
#endif
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
|
2007-04-23 07:09:25 +00:00
|
|
|
if (nconf->nc_semantics != NC_TPI_CLTS)
|
|
|
|
listen(fd, SOMAXCONN);
|
2002-07-11 16:19:43 +00:00
|
|
|
|
2007-04-23 07:09:25 +00:00
|
|
|
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;
|
|
|
|
}
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PORTMAP
|
|
|
|
/*
|
|
|
|
* Register both the versions for tcp/ip, udp/ip and local.
|
|
|
|
*/
|
|
|
|
if ((strcmp(nconf->nc_protofmly, NC_INET) == 0 &&
|
|
|
|
(strcmp(nconf->nc_proto, NC_TCP) == 0 ||
|
|
|
|
strcmp(nconf->nc_proto, NC_UDP) == 0)) ||
|
2002-12-16 22:24:26 +00:00
|
|
|
(strcmp(nconf->nc_netid, "unix") == 0) ||
|
|
|
|
(strcmp(nconf->nc_netid, "local") == 0)) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
struct pmaplist *pml;
|
|
|
|
|
|
|
|
if (!svc_register(my_xprt, PMAPPROG, PMAPVERS,
|
2003-10-29 09:31:41 +00:00
|
|
|
pmap_service, 0)) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
syslog(LOG_ERR, "could not register on %s",
|
|
|
|
nconf->nc_netid);
|
|
|
|
goto error;
|
|
|
|
}
|
2002-05-17 05:27:52 +00:00
|
|
|
pml = malloc(sizeof (struct pmaplist));
|
|
|
|
if (pml == NULL) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
syslog(LOG_ERR, "no memory!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
pml->pml_map.pm_prog = PMAPPROG;
|
|
|
|
pml->pml_map.pm_vers = PMAPVERS;
|
|
|
|
pml->pml_map.pm_port = PMAPPORT;
|
|
|
|
if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
|
|
|
|
if (tcptrans[0]) {
|
|
|
|
syslog(LOG_ERR,
|
|
|
|
"cannot have more than one TCP transport");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
tcptrans = strdup(nconf->nc_netid);
|
|
|
|
pml->pml_map.pm_prot = IPPROTO_TCP;
|
|
|
|
|
|
|
|
/* Let's snarf the universal address */
|
|
|
|
/* "h1.h2.h3.h4.p1.p2" */
|
|
|
|
tcp_uaddr = taddr2uaddr(nconf, &taddr.addr);
|
|
|
|
} else if (strcmp(nconf->nc_proto, NC_UDP) == 0) {
|
|
|
|
if (udptrans[0]) {
|
|
|
|
syslog(LOG_ERR,
|
|
|
|
"cannot have more than one UDP transport");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
udptrans = strdup(nconf->nc_netid);
|
|
|
|
pml->pml_map.pm_prot = IPPROTO_UDP;
|
|
|
|
|
|
|
|
/* Let's snarf the universal address */
|
|
|
|
/* "h1.h2.h3.h4.p1.p2" */
|
|
|
|
udp_uaddr = taddr2uaddr(nconf, &taddr.addr);
|
2002-12-16 22:24:26 +00:00
|
|
|
} else if (strcmp(nconf->nc_netid, "local") == 0)
|
|
|
|
pml->pml_map.pm_prot = IPPROTO_ST;
|
|
|
|
else if (strcmp(nconf->nc_netid, "unix") == 0)
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
pml->pml_map.pm_prot = IPPROTO_ST;
|
|
|
|
pml->pml_next = list_pml;
|
|
|
|
list_pml = pml;
|
|
|
|
|
|
|
|
/* Add version 3 information */
|
2002-05-17 05:27:52 +00:00
|
|
|
pml = malloc(sizeof (struct pmaplist));
|
|
|
|
if (pml == NULL) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
syslog(LOG_ERR, "no memory!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
pml->pml_map = list_pml->pml_map;
|
|
|
|
pml->pml_map.pm_vers = RPCBVERS;
|
|
|
|
pml->pml_next = list_pml;
|
|
|
|
list_pml = pml;
|
|
|
|
|
|
|
|
/* Add version 4 information */
|
2002-05-17 05:27:52 +00:00
|
|
|
pml = malloc (sizeof (struct pmaplist));
|
|
|
|
if (pml == NULL) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
syslog(LOG_ERR, "no memory!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
pml->pml_map = list_pml->pml_map;
|
|
|
|
pml->pml_map.pm_vers = RPCBVERS4;
|
|
|
|
pml->pml_next = list_pml;
|
|
|
|
list_pml = pml;
|
|
|
|
|
|
|
|
/* Also add version 2 stuff to rpcbind list */
|
|
|
|
rbllist_add(PMAPPROG, PMAPVERS, nconf, &taddr.addr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* version 3 registration */
|
|
|
|
if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS, rpcb_service_3, NULL)) {
|
|
|
|
syslog(LOG_ERR, "could not register %s version 3",
|
|
|
|
nconf->nc_netid);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
rbllist_add(RPCBPROG, RPCBVERS, nconf, &taddr.addr);
|
|
|
|
|
|
|
|
/* version 4 registration */
|
|
|
|
if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS4, rpcb_service_4, NULL)) {
|
|
|
|
syslog(LOG_ERR, "could not register %s version 4",
|
|
|
|
nconf->nc_netid);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
rbllist_add(RPCBPROG, RPCBVERS4, nconf, &taddr.addr);
|
|
|
|
|
|
|
|
/* decide if bound checking works for this transport */
|
|
|
|
status = add_bndlist(nconf, &taddr.addr);
|
|
|
|
#ifdef BIND_DEBUG
|
|
|
|
if (debugging) {
|
|
|
|
if (status < 0) {
|
|
|
|
fprintf(stderr, "Error in finding bind status for %s\n",
|
|
|
|
nconf->nc_netid);
|
|
|
|
} else if (status == 0) {
|
|
|
|
fprintf(stderr, "check binding for %s\n",
|
|
|
|
nconf->nc_netid);
|
|
|
|
} else if (status > 0) {
|
|
|
|
fprintf(stderr, "No check binding for %s\n",
|
|
|
|
nconf->nc_netid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* rmtcall only supported on CLTS transports for now.
|
|
|
|
*/
|
|
|
|
if (nconf->nc_semantics == NC_TPI_CLTS) {
|
|
|
|
status = create_rmtcall_fd(nconf);
|
|
|
|
|
|
|
|
#ifdef BIND_DEBUG
|
|
|
|
if (debugging) {
|
|
|
|
if (status < 0) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"Could not create rmtcall fd for %s\n",
|
|
|
|
nconf->nc_netid);
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "rmtcall fd for %s is %d\n",
|
|
|
|
nconf->nc_netid, status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
error:
|
|
|
|
close(fd);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2010-02-09 18:10:56 +00:00
|
|
|
/*
|
|
|
|
* Create the list of addresses that we're bound to. Normally, this
|
|
|
|
* list is empty because we're listening on the wildcard address
|
|
|
|
* (nhost == 0). If -h is specified on the command line, then
|
|
|
|
* bound_sa will have a list of the addresses that the program binds
|
|
|
|
* to specifically. This function takes that list and converts them to
|
|
|
|
* struct sockaddr * and stores them in bound_sa.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
update_bound_sa(void)
|
|
|
|
{
|
|
|
|
struct addrinfo hints, *res = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (nhosts == 0)
|
|
|
|
return;
|
|
|
|
bound_sa = malloc(sizeof(*bound_sa) * nhosts);
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
|
|
|
hints.ai_family = PF_UNSPEC;
|
|
|
|
for (i = 0; i < nhosts; i++) {
|
|
|
|
if (getaddrinfo(hosts[i], NULL, &hints, &res) != 0)
|
|
|
|
continue;
|
|
|
|
bound_sa[i] = malloc(res->ai_addrlen);
|
|
|
|
memcpy(bound_sa[i], res->ai_addr, res->ai_addrlen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Match the sa against the list of addresses we've bound to. If
|
|
|
|
* we've not specifically bound to anything, we match everything.
|
|
|
|
* Otherwise, if the IPv4 or IPv6 address matches one of the addresses
|
|
|
|
* in bound_sa, we return true. If not, we return false.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
listen_addr(const struct sockaddr *sa)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If nhosts == 0, then there were no -h options on the
|
|
|
|
* command line, so all addresses are addresses we're
|
|
|
|
* listening to.
|
|
|
|
*/
|
|
|
|
if (nhosts == 0)
|
|
|
|
return 1;
|
|
|
|
for (i = 0; i < nhosts; i++) {
|
|
|
|
if (bound_sa[i] == NULL ||
|
|
|
|
sa->sa_family != bound_sa[i]->sa_family)
|
|
|
|
continue;
|
|
|
|
switch (sa->sa_family) {
|
|
|
|
case AF_INET:
|
|
|
|
if (memcmp(&SA2SINADDR(sa), &SA2SINADDR(bound_sa[i]),
|
|
|
|
sizeof(struct in_addr)) == 0)
|
|
|
|
return (1);
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
|
|
|
case AF_INET6:
|
|
|
|
if (memcmp(&SA2SIN6ADDR(sa), &SA2SIN6ADDR(bound_sa[i]),
|
|
|
|
sizeof(struct in6_addr)) == 0)
|
|
|
|
return (1);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
static void
|
|
|
|
rbllist_add(rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf,
|
|
|
|
struct netbuf *addr)
|
|
|
|
{
|
|
|
|
rpcblist_ptr rbl;
|
|
|
|
|
2002-05-17 05:27:52 +00:00
|
|
|
rbl = malloc(sizeof (rpcblist));
|
|
|
|
if (rbl == NULL) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
syslog(LOG_ERR, "no memory!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
rbl->rpcb_map.r_prog = prog;
|
|
|
|
rbl->rpcb_map.r_vers = vers;
|
|
|
|
rbl->rpcb_map.r_netid = strdup(nconf->nc_netid);
|
|
|
|
rbl->rpcb_map.r_addr = taddr2uaddr(nconf, addr);
|
|
|
|
rbl->rpcb_map.r_owner = strdup(superuser);
|
|
|
|
rbl->rpcb_next = list_rbl; /* Attach to global list */
|
|
|
|
list_rbl = rbl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Catch the signal and die
|
|
|
|
*/
|
|
|
|
static void
|
2018-01-02 00:48:19 +00:00
|
|
|
terminate(int signum)
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
{
|
2018-01-02 00:48:19 +00:00
|
|
|
|
|
|
|
doterminate = signum;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-07-14 07:28:49 +00:00
|
|
|
rpcbind_abort(void)
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
{
|
|
|
|
#ifdef WARMSTART
|
|
|
|
write_warmstart(); /* Dump yourself */
|
|
|
|
#endif
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get command line options */
|
|
|
|
static void
|
|
|
|
parseargs(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
|
2004-11-07 04:32:51 +00:00
|
|
|
#ifdef WARMSTART
|
|
|
|
#define WSOP "w"
|
|
|
|
#else
|
|
|
|
#define WSOP ""
|
|
|
|
#endif
|
2014-03-06 17:33:27 +00:00
|
|
|
#ifdef LIBWRAP
|
|
|
|
#define WRAPOP "W"
|
|
|
|
#else
|
|
|
|
#define WRAPOP ""
|
|
|
|
#endif
|
|
|
|
while ((c = getopt(argc, argv, "6adh:iLls" WRAPOP WSOP)) != -1) {
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
switch (c) {
|
2007-04-23 07:09:25 +00:00
|
|
|
case '6':
|
|
|
|
ipv6_only = 1;
|
|
|
|
break;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
case 'a':
|
|
|
|
doabort = 1; /* when debugging, do an abort on */
|
|
|
|
break; /* errors; for rpcbind developers */
|
|
|
|
/* only! */
|
|
|
|
case 'd':
|
|
|
|
debugging = 1;
|
|
|
|
break;
|
2002-07-11 16:19:43 +00:00
|
|
|
case 'h':
|
|
|
|
++nhosts;
|
|
|
|
hosts = realloc(hosts, nhosts * sizeof(char *));
|
|
|
|
if (hosts == NULL)
|
|
|
|
errx(1, "Out of memory");
|
|
|
|
hosts[nhosts - 1] = strdup(optarg);
|
|
|
|
if (hosts[nhosts - 1] == NULL)
|
|
|
|
errx(1, "Out of memory");
|
|
|
|
break;
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
case 'i':
|
|
|
|
insecure = 1;
|
|
|
|
break;
|
|
|
|
case 'L':
|
|
|
|
oldstyle_local = 1;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
verboselog = 1;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
runasdaemon = 1;
|
|
|
|
break;
|
2014-03-06 17:33:27 +00:00
|
|
|
#ifdef LIBWRAP
|
|
|
|
case 'W':
|
|
|
|
libwrap = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
#ifdef WARMSTART
|
|
|
|
case 'w':
|
|
|
|
warmstart = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default: /* error */
|
2004-11-07 04:32:51 +00:00
|
|
|
fprintf(stderr,
|
2014-03-06 17:33:27 +00:00
|
|
|
"usage: rpcbind [-6adiLls%s%s] [-h bindip]\n",
|
|
|
|
WRAPOP, WSOP);
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (doabort && !debugging) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"-a (abort) specified without -d (debugging) -- ignored.\n");
|
|
|
|
doabort = 0;
|
|
|
|
}
|
2004-11-07 04:32:51 +00:00
|
|
|
#undef WSOP
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-07 02:56:59 +00:00
|
|
|
reap(int dummy __unused)
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
{
|
|
|
|
int save_errno = errno;
|
|
|
|
|
|
|
|
while (wait3(NULL, WNOHANG, NULL) > 0)
|
|
|
|
;
|
|
|
|
errno = save_errno;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-07 02:56:59 +00:00
|
|
|
toggle_verboselog(int dummy __unused)
|
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
|
|
|
{
|
|
|
|
verboselog = !verboselog;
|
|
|
|
}
|