mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-24 19:21:38 +01:00
Use err(3), cosmetic in usage().
This commit is contained in:
parent
0e76f40d09
commit
81c44dca8a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27936
@ -1,5 +1,5 @@
|
||||
.\" from: @(#)rpcinfo.8c 2.2 88/08/03 4.0 RPCSRC; from 1.24 88/02/25 SMI
|
||||
.\" $Id$
|
||||
.\" $Id: rpcinfo.8,v 1.3 1997/02/22 19:56:44 peter Exp $
|
||||
.\"
|
||||
.Dd December 17, 1987
|
||||
.Dt RPCINFO 8
|
||||
@ -28,7 +28,7 @@
|
||||
.Fl d
|
||||
.Ar program version
|
||||
.Sh DESCRIPTION
|
||||
.Nm rpcinfo
|
||||
.Nm Rpcinfo
|
||||
makes an
|
||||
.Tn RPC
|
||||
call to an
|
||||
@ -100,17 +100,17 @@ argument can be either a name or a number.
|
||||
If a
|
||||
.Ar version
|
||||
is specified,
|
||||
.Nm rpcinfo
|
||||
.Nm
|
||||
attempts to call that version of the specified
|
||||
.Ar program .
|
||||
Otherwise,
|
||||
.Nm rpcinfo
|
||||
.Nm
|
||||
attempts to find all the registered version
|
||||
numbers for the specified
|
||||
.Ar program
|
||||
by calling version 0 (which is presumed not
|
||||
to exist; if it does exist,
|
||||
.Ar rpcinfo
|
||||
.Nm
|
||||
attempts to obtain this information by calling
|
||||
an extremely high version
|
||||
number instead) and attempts to call each registered version.
|
||||
@ -158,7 +158,7 @@ service use:
|
||||
.Sh BUGS
|
||||
In releases prior to SunOS 3.0, the Network File System (NFS) did not
|
||||
register itself with the portmapper;
|
||||
.Nm rpcinfo
|
||||
.Nm
|
||||
cannot be used to make
|
||||
.Tn RPC
|
||||
calls to the
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)rpcinfo.c 1.22 87/08/12 SMI";*/
|
||||
/*static char sccsid[] = "from: @(#)rpcinfo.c 2.2 88/08/11 4.0 RPCSRC";*/
|
||||
static char rcsid[] = "$Id: rpcinfo.c,v 1.4 1997/02/22 19:56:45 peter Exp $";
|
||||
static char rcsid[] =
|
||||
"$Id: rpcinfo.c,v 1.5 1997/03/29 04:31:57 imp Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -42,6 +43,8 @@ static char rcsid[] = "$Id: rpcinfo.c,v 1.4 1997/02/22 19:56:45 peter Exp $";
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <ctype.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
@ -49,7 +52,6 @@ static char rcsid[] = "$Id: rpcinfo.c,v 1.4 1997/02/22 19:56:45 peter Exp $";
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define MAXHOSTLEN 256
|
||||
|
||||
@ -591,27 +593,24 @@ deletereg(argc, argv)
|
||||
usage() ;
|
||||
exit(1) ;
|
||||
}
|
||||
if (getuid()) { /* This command allowed only to root */
|
||||
fprintf(stderr, "Sorry. You are not root\n") ;
|
||||
exit(1) ;
|
||||
}
|
||||
if (getuid()) /* This command allowed only to root */
|
||||
errx(1, "sorry, you are not root") ;
|
||||
prog_num = getprognum(argv[0]);
|
||||
version_num = getvers(argv[1]);
|
||||
if ((pmap_unset(prog_num, version_num)) == 0) {
|
||||
fprintf(stderr, "rpcinfo: Could not delete registration for prog %s version %s\n",
|
||||
if ((pmap_unset(prog_num, version_num)) == 0)
|
||||
errx(1, "could not delete registration for prog %s version %s",
|
||||
argv[0], argv[1]) ;
|
||||
exit(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "Usage: rpcinfo [ -n portnum ] -u host prognum [ versnum ]\n");
|
||||
fprintf(stderr, " rpcinfo [ -n portnum ] -t host prognum [ versnum ]\n");
|
||||
fprintf(stderr, " rpcinfo -p [ host ]\n");
|
||||
fprintf(stderr, " rpcinfo -b prognum versnum\n");
|
||||
fprintf(stderr, " rpcinfo -d prognum versnum\n") ;
|
||||
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
||||
"usage: rpcinfo [-n portnum] -u host prognum [versnum]",
|
||||
" rpcinfo [-n portnum] -t host prognum [versnum]",
|
||||
" rpcinfo -p [host]",
|
||||
" rpcinfo -b prognum versnum",
|
||||
" rpcinfo -d prognum versnum");
|
||||
}
|
||||
|
||||
static u_long
|
||||
@ -623,11 +622,8 @@ getprognum(arg)
|
||||
|
||||
if (isalpha(*arg)) {
|
||||
rpc = getrpcbyname(arg);
|
||||
if (rpc == NULL) {
|
||||
fprintf(stderr, "rpcinfo: %s is unknown service\n",
|
||||
arg);
|
||||
exit(1);
|
||||
}
|
||||
if (rpc == NULL)
|
||||
errx(1, "%s is unknown service", arg);
|
||||
prognum = rpc->r_number;
|
||||
} else {
|
||||
prognum = (u_long) atoi(arg);
|
||||
@ -656,10 +652,8 @@ get_inet_address(addr, host)
|
||||
bzero((char *)addr, sizeof *addr);
|
||||
addr->sin_addr.s_addr = (u_long) inet_addr(host);
|
||||
if (addr->sin_addr.s_addr == -1 || addr->sin_addr.s_addr == 0) {
|
||||
if ((hp = gethostbyname(host)) == NULL) {
|
||||
fprintf(stderr, "rpcinfo: %s is unknown host\n", host);
|
||||
exit(1);
|
||||
}
|
||||
if ((hp = gethostbyname(host)) == NULL)
|
||||
errx(1, "%s is unknown host", host);
|
||||
bcopy(hp->h_addr, (char *)&addr->sin_addr, hp->h_length);
|
||||
}
|
||||
addr->sin_family = AF_INET;
|
||||
|
Loading…
Reference in New Issue
Block a user