X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fstatd%2Fsimu.c;h=a7ecb85c275509e687c4351955c4c5b4d1e3c03d;hp=25e8badad160246f2efb600a51659deed8fb4d9e;hb=27a49079b03316eebcbc74197b73988b01b58ecc;hpb=5529fdbb4acb2507b79acf07e08c2a88c1df9e38 diff --git a/utils/statd/simu.c b/utils/statd/simu.c index 25e8bad..a7ecb85 100644 --- a/utils/statd/simu.c +++ b/utils/statd/simu.c @@ -7,8 +7,10 @@ #ifdef HAVE_CONFIG_H #include #endif + #include +#include "rpcmisc.h" #include "statd.h" #include "notlist.h" @@ -21,17 +23,23 @@ extern void my_svc_exit (void); void * sm_simu_crash_1_svc (void *argp, struct svc_req *rqstp) { + struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt); static char *result = NULL; struct in_addr caller; - caller = svc_getcaller(rqstp->rq_xprt)->sin_addr; + if (sin->sin_family != AF_INET) { + note(N_WARNING, "Call to statd from non-AF_INET address"); + goto failure; + } + + caller = sin->sin_addr; if (caller.s_addr != htonl(INADDR_LOOPBACK)) { note(N_WARNING, "Call to statd from non-local host %s", inet_ntoa(caller)); goto failure; } - if (ntohs(svc_getcaller(rqstp->rq_xprt)->sin_port) >= 1024) { + if (ntohs(sin->sin_port) >= 1024) { note(N_WARNING, "Call to statd-simu-crash from unprivileged port"); goto failure; }