diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-29 01:07:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-29 01:07:34 +0000 |
commit | cdef624d32c351c90d790b8f5d81863ed562c7ea (patch) | |
tree | a758b1657ddd8d14b89f50b2c86db5e9b7f61b32 /usr.bin/rpcinfo | |
parent | d0d6f2b97052ab8a3b2132c7fb2e0abb17763042 (diff) |
bindresvport if possible; uid 0 check is ridiculous crap
Diffstat (limited to 'usr.bin/rpcinfo')
-rw-r--r-- | usr.bin/rpcinfo/rpcinfo.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c index 6302eaed8ab..7ec8abf9da0 100644 --- a/usr.bin/rpcinfo/rpcinfo.c +++ b/usr.bin/rpcinfo/rpcinfo.c @@ -1,9 +1,9 @@ -/* $OpenBSD: rpcinfo.c,v 1.2 1996/06/26 05:38:45 deraadt Exp $ */ +/* $OpenBSD: rpcinfo.c,v 1.3 1996/06/29 01:07:33 deraadt Exp $ */ #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[] = "$OpenBSD: rpcinfo.c,v 1.2 1996/06/26 05:38:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rpcinfo.c,v 1.3 1996/06/29 01:07:33 deraadt Exp $"; #endif /* @@ -204,11 +204,13 @@ udpping(portnum, argc, argv) prognum = getprognum(argv[1]); get_inet_address(&addr, argv[0]); /* Open the socket here so it will survive calls to clnt_destroy */ - sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP); + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock < 0) { perror("rpcinfo: socket"); exit(1); } + if (getuid() == 0) + bindresvport(sock, NULL); failure = 0; if (argc == 2) { /* @@ -592,10 +594,6 @@ deletereg(argc, argv) usage() ; exit(1) ; } - if (getuid()) { /* This command allowed only to root */ - fprintf(stderr, "Sorry. You are not root\n") ; - exit(1) ; - } prog_num = getprognum(argv[0]); version_num = getvers(argv[1]); if ((pmap_unset(prog_num, version_num)) == 0) { |