mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-09 16:01:19 +01:00
K&Rify
This commit is contained in:
parent
982ab0744f
commit
99e6f41350
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56074
@ -81,7 +81,7 @@ static struct in_addr *addrs;
|
||||
/* find_local - find all IP addresses for this host */
|
||||
|
||||
static int
|
||||
find_local(void)
|
||||
find_local()
|
||||
{
|
||||
int mib[6], n, s, alloced;
|
||||
size_t needed;
|
||||
@ -172,7 +172,8 @@ find_local(void)
|
||||
/* from_local - determine whether request comes from the local system */
|
||||
|
||||
int
|
||||
from_local(struct sockaddr_in *addr)
|
||||
from_local(addr)
|
||||
struct sockaddr_in *addr;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -190,7 +191,9 @@ from_local(struct sockaddr_in *addr)
|
||||
#ifdef TEST
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *inet_ntoa();
|
||||
int i;
|
||||
|
@ -63,8 +63,8 @@ static const char rcsid[] =
|
||||
#define YPPROC_DOMAIN_NONACK ((u_long) 2)
|
||||
#define MOUNTPROC_MNT ((u_long) 1)
|
||||
|
||||
static void logit(int, struct sockaddr_in *, u_long, u_long, const char *);
|
||||
static void toggle_verboselog(int);
|
||||
static void logit __P((int, struct sockaddr_in *, u_long, u_long, const char *));
|
||||
static void toggle_verboselog __P((int));
|
||||
|
||||
int verboselog = 0;
|
||||
int allow_severity = LOG_INFO;
|
||||
@ -112,7 +112,9 @@ check_startup()
|
||||
/* check_default - additional checks for NULL, DUMP, GETPORT and unknown */
|
||||
|
||||
int
|
||||
check_default(struct sockaddr_in *addr, u_long proc, u_long prog)
|
||||
check_default(addr, proc, prog)
|
||||
struct sockaddr_in *addr;
|
||||
u_long proc, prog;
|
||||
{
|
||||
#ifdef HOSTS_ACCESS
|
||||
if (!(from_local(addr) || good_client(addr))) {
|
||||
@ -128,8 +130,9 @@ check_default(struct sockaddr_in *addr, u_long proc, u_long prog)
|
||||
/* check_privileged_port - additional checks for privileged-port updates */
|
||||
|
||||
int
|
||||
check_privileged_port(struct sockaddr_in *addr, u_long proc, u_long prog,
|
||||
u_long port)
|
||||
check_privileged_port(addr, proc, prog, port)
|
||||
struct sockaddr_in *addr;
|
||||
u_long proc, prog, port;
|
||||
{
|
||||
#ifdef CHECK_PORT
|
||||
if (!legal_port(addr, port)) {
|
||||
@ -143,7 +146,9 @@ check_privileged_port(struct sockaddr_in *addr, u_long proc, u_long prog,
|
||||
/* check_setunset - additional checks for update requests */
|
||||
|
||||
int
|
||||
check_setunset(struct sockaddr_in *addr, u_long proc, u_long prog, u_long port)
|
||||
check_setunset(addr, proc, prog, port)
|
||||
struct sockaddr_in *addr;
|
||||
u_long proc, prog, port;
|
||||
{
|
||||
if (!from_local(addr)) {
|
||||
#ifdef HOSTS_ACCESS
|
||||
@ -162,7 +167,9 @@ check_setunset(struct sockaddr_in *addr, u_long proc, u_long prog, u_long port)
|
||||
/* check_callit - additional checks for forwarded requests */
|
||||
|
||||
int
|
||||
check_callit(struct sockaddr_in *addr, u_long proc, u_long prog, u_long aproc)
|
||||
check_callit(addr, proc, prog, aproc)
|
||||
struct sockaddr_in *addr;
|
||||
u_long proc, prog, aproc;
|
||||
{
|
||||
#ifdef HOSTS_ACCESS
|
||||
if (!(from_local(addr) || good_client(addr))) {
|
||||
@ -184,7 +191,8 @@ check_callit(struct sockaddr_in *addr, u_long proc, u_long prog, u_long aproc)
|
||||
/* toggle_verboselog - toggle verbose logging flag */
|
||||
|
||||
static void
|
||||
toggle_verboselog(int sig)
|
||||
toggle_verboselog(sig)
|
||||
int sig;
|
||||
{
|
||||
(void) signal(sig, toggle_verboselog);
|
||||
verboselog = !verboselog;
|
||||
@ -193,8 +201,11 @@ toggle_verboselog(int sig)
|
||||
/* logit - report events of interest via the syslog daemon */
|
||||
|
||||
static void
|
||||
logit(int severity, struct sockaddr_in *addr, u_long procnum, u_long prognum,
|
||||
const char *text)
|
||||
logit(severity, addr, procnum, prognum, text)
|
||||
int severity;
|
||||
struct sockaddr_in *addr;
|
||||
u_long procnum, prognum;
|
||||
const char *text;
|
||||
{
|
||||
const char *procname;
|
||||
char procbuf[4 * sizeof(u_long)];
|
||||
|
@ -28,12 +28,13 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
extern int from_local(struct sockaddr_in *);
|
||||
extern void check_startup(void);
|
||||
extern int check_default(struct sockaddr_in *, u_long, u_long);
|
||||
extern int check_setunset(struct sockaddr_in *, u_long, u_long, u_long);
|
||||
extern int check_privileged_port(struct sockaddr_in *, u_long, u_long, u_long);
|
||||
extern int check_callit(struct sockaddr_in *, u_long, u_long, u_long);
|
||||
extern int from_local __P((struct sockaddr_in *));
|
||||
extern void check_startup __P((void));
|
||||
extern int check_default __P((struct sockaddr_in *, u_long, u_long));
|
||||
extern int check_setunset __P((struct sockaddr_in *, u_long, u_long, u_long));
|
||||
extern int check_privileged_port __P((struct sockaddr_in *, u_long, u_long,
|
||||
u_long));
|
||||
extern int check_callit __P((struct sockaddr_in *, u_long, u_long, u_long));
|
||||
|
||||
extern int verboselog;
|
||||
extern int allow_severity;
|
||||
|
@ -25,10 +25,12 @@ static const char rcsid[] =
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
|
||||
static const char *protoname(u_long);
|
||||
static const char *protoname __P((u_long));
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
register struct pmaplist *list;
|
||||
@ -50,7 +52,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
static const char *
|
||||
protoname(u_long proto)
|
||||
protoname(proto)
|
||||
u_long proto;
|
||||
{
|
||||
static char buf[BUFSIZ];
|
||||
|
||||
|
@ -22,10 +22,12 @@ static const char rcsid[] =
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
|
||||
static int parse_line (char *, u_long *, u_long *, int *, unsigned *);
|
||||
static int parse_line __P((char *, u_long *, u_long *, int *, unsigned *));
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
char buf[BUFSIZ];
|
||||
@ -50,7 +52,11 @@ main(int argc, char **argv)
|
||||
/* parse_line - convert line to numbers */
|
||||
|
||||
static int
|
||||
parse_line(char *buf, u_long *prog, u_long *vers, int *prot, unsigned *port)
|
||||
parse_line(buf, prog, vers, prot, port)
|
||||
char *buf;
|
||||
u_long *prog, *vers;
|
||||
int *prot;
|
||||
unsigned *port;
|
||||
{
|
||||
char proto_name[BUFSIZ];
|
||||
|
||||
|
@ -102,16 +102,18 @@ static char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
|
||||
|
||||
#include "pmap_check.h"
|
||||
|
||||
static void reg_service(struct svc_req *, SVCXPRT *);
|
||||
static void reap(int);
|
||||
static void callit(struct svc_req *, SVCXPRT *);
|
||||
static void usage(void);
|
||||
static void reg_service __P((struct svc_req *, SVCXPRT *));
|
||||
static void reap __P((int));
|
||||
static void callit __P((struct svc_req *, SVCXPRT *));
|
||||
static void usage __P((void));
|
||||
|
||||
struct pmaplist *pmaplist;
|
||||
int debugging = 0;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
SVCXPRT *xprt;
|
||||
int sock, c;
|
||||
@ -212,13 +214,13 @@ void
|
||||
perror(what)
|
||||
const char *what;
|
||||
{
|
||||
|
||||
syslog(LOG_ERR, "%s: %m", what);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct pmaplist *
|
||||
find_service(u_long prog, u_long vers, u_long prot)
|
||||
find_service(prog, vers, prot)
|
||||
u_long prog, vers, prot;
|
||||
{
|
||||
register struct pmaplist *hit = NULL;
|
||||
register struct pmaplist *pml;
|
||||
@ -238,7 +240,9 @@ find_service(u_long prog, u_long vers, u_long prot)
|
||||
* 1 OK, 0 not
|
||||
*/
|
||||
static void
|
||||
reg_service(struct svc_req *rqstp, SVCXPRT *xprt)
|
||||
reg_service(rqstp, xprt)
|
||||
struct svc_req *rqstp;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
struct pmap reg;
|
||||
struct pmaplist *pml, *prevpml, *fnd;
|
||||
@ -448,7 +452,9 @@ struct encap_parms {
|
||||
};
|
||||
|
||||
static bool_t
|
||||
xdr_encap_parms(XDR *xdrs, struct encap_parms *epp)
|
||||
xdr_encap_parms(xdrs, epp)
|
||||
XDR *xdrs;
|
||||
struct encap_parms *epp;
|
||||
{
|
||||
|
||||
return (xdr_bytes(xdrs, &(epp->args), &(epp->arglen), ARGSIZE));
|
||||
@ -463,7 +469,9 @@ struct rmtcallargs {
|
||||
};
|
||||
|
||||
static bool_t
|
||||
xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
|
||||
xdr_rmtcall_args(xdrs, cap)
|
||||
XDR *xdrs;
|
||||
struct rmtcallargs *cap;
|
||||
{
|
||||
|
||||
/* does not get a port number */
|
||||
@ -476,7 +484,9 @@ xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdr_rmtcall_result(XDR *xdrs, struct rmtcallargs *cap)
|
||||
xdr_rmtcall_result(xdrs, cap)
|
||||
XDR *xdrs;
|
||||
struct rmtcallargs *cap;
|
||||
{
|
||||
if (xdr_u_long(xdrs, &(cap->rmt_port)))
|
||||
return (xdr_encap_parms(xdrs, &(cap->rmt_args)));
|
||||
@ -488,9 +498,10 @@ xdr_rmtcall_result(XDR *xdrs, struct rmtcallargs *cap)
|
||||
* The arglen must already be set!!
|
||||
*/
|
||||
static bool_t
|
||||
xdr_opaque_parms(XDR *xdrs, struct rmtcallargs *cap)
|
||||
xdr_opaque_parms(xdrs, cap)
|
||||
XDR *xdrs;
|
||||
struct rmtcallargs *cap;
|
||||
{
|
||||
|
||||
return (xdr_opaque(xdrs, cap->rmt_args.args, cap->rmt_args.arglen));
|
||||
}
|
||||
|
||||
@ -499,7 +510,9 @@ xdr_opaque_parms(XDR *xdrs, struct rmtcallargs *cap)
|
||||
* and then calls xdr_opaque_parms.
|
||||
*/
|
||||
static bool_t
|
||||
xdr_len_opaque_parms(XDR *xdrs, struct rmtcallargs *cap)
|
||||
xdr_len_opaque_parms(xdrs, cap)
|
||||
XDR *xdrs;
|
||||
struct rmtcallargs *cap;
|
||||
{
|
||||
register u_int beginpos, lowpos, highpos, currpos, pos;
|
||||
|
||||
@ -530,7 +543,9 @@ xdr_len_opaque_parms(XDR *xdrs, struct rmtcallargs *cap)
|
||||
* back to the portmapper.
|
||||
*/
|
||||
static void
|
||||
callit(struct svc_req *rqstp, SVCXPRT *xprt)
|
||||
callit(rqstp, xprt)
|
||||
struct svc_req *rqstp;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
struct rmtcallargs a;
|
||||
struct pmaplist *pml;
|
||||
@ -586,7 +601,8 @@ callit(struct svc_req *rqstp, SVCXPRT *xprt)
|
||||
}
|
||||
|
||||
static void
|
||||
reap(int sig)
|
||||
reap(sig)
|
||||
int sig;
|
||||
{
|
||||
int save_errno;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user