~ubuntu-branches/ubuntu/lucid/nfs-utils/lucid

« back to all changes in this revision

Viewing changes to utils/statd/simu.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-06-06 01:19:54 UTC
  • mto: (12.1.24 karmic)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090606011954-ojnwbumhfwgivicw
Tags: upstream-1.2.0
ImportĀ upstreamĀ versionĀ 1.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#ifdef HAVE_CONFIG_H
8
8
#include <config.h>
9
9
#endif
 
10
 
10
11
#include <arpa/inet.h>
11
12
 
 
13
#include "rpcmisc.h"
12
14
#include "statd.h"
13
15
#include "notlist.h"
14
16
 
21
23
void *
22
24
sm_simu_crash_1_svc (void *argp, struct svc_req *rqstp)
23
25
{
 
26
  struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
24
27
  static char *result = NULL;
25
28
  struct in_addr caller;
26
29
 
27
 
  caller = svc_getcaller(rqstp->rq_xprt)->sin_addr;
 
30
  if (sin->sin_family != AF_INET) {
 
31
    note(N_WARNING, "Call to statd from non-AF_INET address");
 
32
    goto failure;
 
33
  }
 
34
 
 
35
  caller = sin->sin_addr;
28
36
  if (caller.s_addr != htonl(INADDR_LOOPBACK)) {
29
37
    note(N_WARNING, "Call to statd from non-local host %s",
30
38
      inet_ntoa(caller));
31
39
    goto failure;
32
40
  }
33
41
 
34
 
  if (ntohs(svc_getcaller(rqstp->rq_xprt)->sin_port) >= 1024) {
 
42
  if (ntohs(sin->sin_port) >= 1024) {
35
43
    note(N_WARNING, "Call to statd-simu-crash from unprivileged port");
36
44
    goto failure;
37
45
  }