]> git.decadent.org.uk Git - nfs-utils.git/blob - debian/patches/14-allow-address-without-name.patch
974c7a9c2b8b126b25f0a098f99b06298a776b98
[nfs-utils.git] / debian / patches / 14-allow-address-without-name.patch
1 From e22f5a9c8e53a2373e8a939771e964ad315cdc5f Mon Sep 17 00:00:00 2001
2 From: Chuck Lever <chuck.lever@oracle.com>
3 Date: Tue, 24 Aug 2010 07:16:10 -0400
4 Subject: [PATCH] statd: statd fails to monitor if no reverse mapping of mon_name exists
5
6 Commit 8ce130c4 switched in the new statd_canonical_name() function
7 that constructs a "unique" name statd can use to uniquely identify a
8 monitor record.
9
10 The legacy statd would monitor a client that sent an IP address with
11 no reverse map as its caller_name.  To remain bug-for-bug compatible,
12 allow this case in the new statd.
13
14 This shouldn't be a problem: statd_canonical_name() needs to create
15 a unique name for the monitored host so it can keep track of monitor
16 requests from the same remote.  The IP address itself should work as
17 well as the host's canonical name, in case there is no reverse
18 mapping.
19
20 We still enforce the requirement that a mon_name that is a DNS name
21 must have a forward map to an IP address.
22
23 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
24 Signed-off-by: Steve Dickson <steved@redhat.com>
25 ---
26  utils/statd/hostname.c |    4 +++-
27  1 files changed, 3 insertions(+), 1 deletions(-)
28
29 diff --git a/utils/statd/hostname.c b/utils/statd/hostname.c
30 index 7d704cc..38f2265 100644
31 --- a/utils/statd/hostname.c
32 +++ b/utils/statd/hostname.c
33 @@ -212,7 +212,9 @@ statd_canonical_name(const char *hostname)
34                                         buf, (socklen_t)sizeof(buf));
35                 freeaddrinfo(ai);
36                 if (!result)
37 -                       return NULL;
38 +                       /* OK to use presentation address,
39 +                        * if no reverse map exists */
40 +                       return strdup(hostname);
41                 return strdup(buf);
42         }
43  
44 -- 
45 1.7.1
46