aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-10-01 11:34:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-10-01 11:34:20 +0000
commit37134a50200ae64dcd796adea8ccf8b1e6265f94 (patch)
tree418ae50fb0542f37d110db3c57aa7955960bc46f
parent271cd0177467593dab6ec6a6b697dea04d075e8c (diff)
downloadalpine_aports-37134a50200ae64dcd796adea8ccf8b1e6265f94.tar.bz2
alpine_aports-37134a50200ae64dcd796adea8ccf8b1e6265f94.tar.xz
alpine_aports-37134a50200ae64dcd796adea8ccf8b1e6265f94.zip
main/nfs-utils: upgrade to 1.3.1
-rw-r--r--main/nfs-utils/0001-conffile-use-standard-uint-_t-and-unsigned-char.patch74
-rw-r--r--main/nfs-utils/0002-Fix-header-include-for-definition-of-NULL.patch27
-rw-r--r--main/nfs-utils/0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch30
-rw-r--r--main/nfs-utils/0004-replace-__attribute_malloc__-with-the-more-portable-.patch208
-rw-r--r--main/nfs-utils/0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch29
-rw-r--r--main/nfs-utils/0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch27
-rw-r--r--main/nfs-utils/0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch62
-rw-r--r--main/nfs-utils/0008-Only-work-around-glibc-bugs-on-glibc.patch26
-rw-r--r--main/nfs-utils/0009-include-libgen.h-for-basename.patch82
-rw-r--r--main/nfs-utils/0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch49
-rw-r--r--main/nfs-utils/APKBUILD55
-rw-r--r--main/nfs-utils/nfs-utils-1.3.1-rc3.patch1086
12 files changed, 6 insertions, 1749 deletions
diff --git a/main/nfs-utils/0001-conffile-use-standard-uint-_t-and-unsigned-char.patch b/main/nfs-utils/0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
deleted file mode 100644
index 2be3602ac7..0000000000
--- a/main/nfs-utils/0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1From 733f0786ee7fb6091e35827a7ba1c1c96a7b393d Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 13:40:36 +0000
4Subject: [PATCH] conffile: use standard uint*_t and unsigned char
5
6Use the standard integer types. This fixes compiling errors with musl
7libc.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10---
11 support/include/conffile.h | 2 +-
12 support/nfs/conffile.c | 14 +++++++-------
13 2 files changed, 8 insertions(+), 8 deletions(-)
14
15diff --git a/support/include/conffile.h b/support/include/conffile.h
16index 05ea5d2..94fb005 100644
17--- a/support/include/conffile.h
18+++ b/support/include/conffile.h
19@@ -49,7 +49,7 @@ struct conf_list {
20 extern char *conf_path;
21
22 extern int conf_begin(void);
23-extern int conf_decode_base64(u_int8_t *, u_int32_t *, u_char *);
24+extern int conf_decode_base64(uint8_t *, uint32_t *, unsigned char *);
25 extern int conf_end(int, int);
26 extern void conf_free_list(struct conf_list *);
27 extern struct sockaddr *conf_get_address(char *, char *);
28diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
29index c3434d5..6b94ec0 100644
30--- a/support/nfs/conffile.c
31+++ b/support/nfs/conffile.c
32@@ -72,10 +72,10 @@ TAILQ_HEAD (conf_trans_head, conf_trans) conf_trans_queue;
33 /*
34 * Radix-64 Encoding.
35 */
36-static const u_int8_t bin2asc[]
37+static const uint8_t bin2asc[]
38 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
39
40-static const u_int8_t asc2bin[] =
41+static const uint8_t asc2bin[] =
42 {
43 255, 255, 255, 255, 255, 255, 255, 255,
44 255, 255, 255, 255, 255, 255, 255, 255,
45@@ -109,10 +109,10 @@ LIST_HEAD (conf_bindings, conf_binding) conf_bindings[256];
46
47 static char *conf_addr;
48
49-static __inline__ u_int8_t
50+static __inline__ uint8_t
51 conf_hash(char *s)
52 {
53- u_int8_t hash = 0;
54+ uint8_t hash = 0;
55
56 while (*s) {
57 hash = ((hash << 1) | (hash >> 7)) ^ tolower (*s);
58@@ -603,10 +603,10 @@ cleanup:
59
60 /* Decode a PEM encoded buffer. */
61 int
62-conf_decode_base64 (u_int8_t *out, u_int32_t *len, u_char *buf)
63+conf_decode_base64 (uint8_t *out, uint32_t *len, unsigned char *buf)
64 {
65- u_int32_t c = 0;
66- u_int8_t c1, c2, c3, c4;
67+ uint32_t c = 0;
68+ uint8_t c1, c2, c3, c4;
69
70 while (*buf) {
71 if (*buf > 127 || (c1 = asc2bin[*buf]) == 255)
72--
732.0.4
74
diff --git a/main/nfs-utils/0002-Fix-header-include-for-definition-of-NULL.patch b/main/nfs-utils/0002-Fix-header-include-for-definition-of-NULL.patch
deleted file mode 100644
index ef359b9759..0000000000
--- a/main/nfs-utils/0002-Fix-header-include-for-definition-of-NULL.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From bf56f9f7a782a8b854f698bf2b452c790ebc2e93 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 13:43:34 +0000
4Subject: [PATCH] Fix header include for definition of NULL
5
6NULL is defined in stdlib.h so we need to include that.
7
8Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
9---
10 support/include/sockaddr.h | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/support/include/sockaddr.h b/support/include/sockaddr.h
14index a1c30f9..446b537 100644
15--- a/support/include/sockaddr.h
16+++ b/support/include/sockaddr.h
17@@ -27,6 +27,7 @@
18 #ifdef HAVE_LIBIO_H
19 #include <libio.h>
20 #endif
21+#include <stdlib.h>
22 #include <stdbool.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25--
262.0.4
27
diff --git a/main/nfs-utils/0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch b/main/nfs-utils/0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
deleted file mode 100644
index 40163bf8a7..0000000000
--- a/main/nfs-utils/0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 3c09cd3801d1200a11e03a387cd4844591b7850d Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Tue, 5 Aug 2014 17:02:25 +0200
4Subject: [PATCH] configure.ac: enable GNU_SOURCE for stat64/statfs64
5
6Use AC_USE_SYSTEM_EXTENSIONS to enable GNU_SOURCE, which is needed
7for:
8 - stat64 in utils/exportfs/exportfs.c
9 - statfs64 in utils/mountd/cache.c
10
11Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
12---
13 configure.ac | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/configure.ac b/configure.ac
17index 408f4c8..b9682ed 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -8,6 +8,7 @@ AM_INIT_AUTOMAKE
21 AC_PREREQ(2.59)
22 AC_PREFIX_DEFAULT(/usr)
23 AM_MAINTAINER_MODE
24+AC_USE_SYSTEM_EXTENSIONS
25
26 dnl *************************************************************
27 dnl * Define the set of applicable options
28--
292.0.4
30
diff --git a/main/nfs-utils/0004-replace-__attribute_malloc__-with-the-more-portable-.patch b/main/nfs-utils/0004-replace-__attribute_malloc__-with-the-more-portable-.patch
deleted file mode 100644
index f92e1df6d4..0000000000
--- a/main/nfs-utils/0004-replace-__attribute_malloc__-with-the-more-portable-.patch
+++ /dev/null
@@ -1,208 +0,0 @@
1From c09597e62a4fcd68fa4aab1183146d36c0326a35 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 13:46:51 +0000
4Subject: [PATCH] replace __attribute_malloc__ with the more portable
5 __attribute__((__malloc__))
6
7Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
8---
9 support/export/hostname.c | 14 +++++++-------
10 support/include/exportfs.h | 10 +++++-----
11 support/nfs/svc_create.c | 2 +-
12 utils/statd/hostname.c | 6 +++---
13 utils/statd/sm-notify.c | 8 ++++----
14 utils/statd/statd.h | 2 +-
15 6 files changed, 21 insertions(+), 21 deletions(-)
16
17diff --git a/support/export/hostname.c b/support/export/hostname.c
18index 3e949a1..ad595d1 100644
19--- a/support/export/hostname.c
20+++ b/support/export/hostname.c
21@@ -91,7 +91,7 @@ host_ntop(const struct sockaddr *sap, char *buf, const size_t buflen)
22 * Returns address info structure, or NULL if an error occurs. Caller
23 * must free the returned structure with freeaddrinfo(3).
24 */
25-__attribute_malloc__
26+__attribute__((__malloc__))
27 struct addrinfo *
28 host_pton(const char *paddr)
29 {
30@@ -153,7 +153,7 @@ host_pton(const char *paddr)
31 * if no information is available for @hostname. Caller must free the
32 * returned structure with freeaddrinfo(3).
33 */
34-__attribute_malloc__
35+__attribute__((__malloc__))
36 struct addrinfo *
37 host_addrinfo(const char *hostname)
38 {
39@@ -199,7 +199,7 @@ host_addrinfo(const char *hostname)
40 * the string.
41 */
42 #ifdef HAVE_GETNAMEINFO
43-__attribute_malloc__
44+__attribute__((__malloc__))
45 char *
46 host_canonname(const struct sockaddr *sap)
47 {
48@@ -234,7 +234,7 @@ host_canonname(const struct sockaddr *sap)
49 return strdup(buf);
50 }
51 #else /* !HAVE_GETNAMEINFO */
52-__attribute_malloc__
53+__attribute__((__malloc__))
54 char *
55 host_canonname(const struct sockaddr *sap)
56 {
57@@ -266,7 +266,7 @@ host_canonname(const struct sockaddr *sap)
58 *
59 * Caller must free the returned structure with freeaddrinfo(3).
60 */
61-__attribute_malloc__
62+__attribute__((__malloc__))
63 struct addrinfo *
64 host_reliable_addrinfo(const struct sockaddr *sap)
65 {
66@@ -313,7 +313,7 @@ out_free_hostname:
67 * Caller must free the returned structure with freeaddrinfo(3).
68 */
69 #ifdef HAVE_GETNAMEINFO
70-__attribute_malloc__
71+__attribute__((__malloc__))
72 struct addrinfo *
73 host_numeric_addrinfo(const struct sockaddr *sap)
74 {
75@@ -361,7 +361,7 @@ host_numeric_addrinfo(const struct sockaddr *sap)
76 return ai;
77 }
78 #else /* !HAVE_GETNAMEINFO */
79-__attribute_malloc__
80+__attribute__((__malloc__))
81 struct addrinfo *
82 host_numeric_addrinfo(const struct sockaddr *sap)
83 {
84diff --git a/support/include/exportfs.h b/support/include/exportfs.h
85index 97b2327..9021fae 100644
86--- a/support/include/exportfs.h
87+++ b/support/include/exportfs.h
88@@ -156,15 +156,15 @@ int secinfo_addflavor(struct flav_info *, struct exportent *);
89
90 char * host_ntop(const struct sockaddr *sap,
91 char *buf, const size_t buflen);
92-__attribute_malloc__
93+__attribute__((__malloc__))
94 struct addrinfo * host_pton(const char *paddr);
95-__attribute_malloc__
96+__attribute__((__malloc__))
97 struct addrinfo * host_addrinfo(const char *hostname);
98-__attribute_malloc__
99+__attribute__((__malloc__))
100 char * host_canonname(const struct sockaddr *sap);
101-__attribute_malloc__
102+__attribute__((__malloc__))
103 struct addrinfo * host_reliable_addrinfo(const struct sockaddr *sap);
104-__attribute_malloc__
105+__attribute__((__malloc__))
106 struct addrinfo * host_numeric_addrinfo(const struct sockaddr *sap);
107
108 int rmtab_read(void);
109diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c
110index 6b9e85b..a706f87 100644
111--- a/support/nfs/svc_create.c
112+++ b/support/nfs/svc_create.c
113@@ -113,7 +113,7 @@ svc_create_find_xprt(const struct sockaddr *bindaddr, const struct netconfig *nc
114 *
115 * Otherwise NULL is returned if an error occurs.
116 */
117-__attribute_malloc__
118+__attribute__((__malloc__))
119 static struct addrinfo *
120 svc_create_bindaddr(struct netconfig *nconf, const uint16_t port)
121 {
122diff --git a/utils/statd/hostname.c b/utils/statd/hostname.c
123index 746ecc7..c61087c 100644
124--- a/utils/statd/hostname.c
125+++ b/utils/statd/hostname.c
126@@ -105,7 +105,7 @@ statd_present_address(const struct sockaddr *sap, char *buf, const size_t buflen
127 * Look up the hostname; report exceptional errors. Caller must
128 * call freeaddrinfo(3) if a valid addrinfo is returned.
129 */
130-__attribute_malloc__
131+__attribute__((__malloc__))
132 static struct addrinfo *
133 get_addrinfo(const char *hostname, const struct addrinfo *hint)
134 {
135@@ -184,7 +184,7 @@ get_nameinfo(const struct sockaddr *sap,
136 * We won't monitor peers that don't have a reverse map. The canonical
137 * name gives us a key for our monitor list.
138 */
139-__attribute_malloc__
140+__attribute__((__malloc__))
141 char *
142 statd_canonical_name(const char *hostname)
143 {
144@@ -234,7 +234,7 @@ statd_canonical_name(const char *hostname)
145 * NULL if some error occurs. Caller must free the returned
146 * list with freeaddrinfo(3).
147 */
148-__attribute_malloc__
149+__attribute__((__malloc__))
150 static struct addrinfo *
151 statd_canonical_list(const char *hostname)
152 {
153diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
154index 9dbe5d9..5994b2f 100644
155--- a/utils/statd/sm-notify.c
156+++ b/utils/statd/sm-notify.c
157@@ -74,7 +74,7 @@ static int record_pid(void);
158
159 static struct nsm_host * hosts = NULL;
160
161-__attribute_malloc__
162+__attribute__((__malloc__))
163 static struct addrinfo *
164 smn_lookup(const char *name)
165 {
166@@ -149,7 +149,7 @@ smn_get_hostname(const struct sockaddr *sap,
167 * if the canonical name doesn't exist or cannot be determined.
168 * The caller must free the result with free(3).
169 */
170-__attribute_malloc__
171+__attribute__((__malloc__))
172 static char *
173 smn_verify_my_name(const char *name)
174 {
175@@ -189,7 +189,7 @@ smn_verify_my_name(const char *name)
176 return retval;
177 }
178
179-__attribute_malloc__
180+__attribute__((__malloc__))
181 static struct nsm_host *
182 smn_alloc_host(const char *hostname, const char *mon_name,
183 const char *my_name, const time_t timestamp)
184@@ -343,7 +343,7 @@ static int smn_socket(void)
185 * If admin specified a source address or srcport, then convert those
186 * to a sockaddr and return it. Otherwise, return an ANYADDR address.
187 */
188-__attribute_malloc__
189+__attribute__((__malloc__))
190 static struct addrinfo *
191 smn_bind_address(const char *srcaddr, const char *srcport)
192 {
193diff --git a/utils/statd/statd.h b/utils/statd/statd.h
194index e89e666..a1d8035 100644
195--- a/utils/statd/statd.h
196+++ b/utils/statd/statd.h
197@@ -25,7 +25,7 @@
198 extern _Bool statd_matchhostname(const char *hostname1, const char *hostname2);
199 extern _Bool statd_present_address(const struct sockaddr *sap, char *buf,
200 const size_t buflen);
201-__attribute_malloc__
202+__attribute__((__malloc__))
203 extern char * statd_canonical_name(const char *hostname);
204
205 extern void my_svc_run(void);
206--
2072.0.4
208
diff --git a/main/nfs-utils/0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch b/main/nfs-utils/0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
deleted file mode 100644
index e9c666954f..0000000000
--- a/main/nfs-utils/0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From f16907e3a179438ff93e712d5303d8041f918dbe Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 14:04:30 +0000
4Subject: [PATCH] mountd: use standard dev_t instead of glibc internals
5
6The __dev_t is a GNU libc internal. Use the standard dev_t instead,
7which is specified in POSIX.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10---
11 utils/mountd/cache.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
15index b0cc6a8..663a52a 100644
16--- a/utils/mountd/cache.c
17+++ b/utils/mountd/cache.c
18@@ -1419,7 +1419,7 @@ static int cache_export_ent(char *domain, struct exportent *exp, char *path)
19 */
20 struct stat stb;
21 size_t l = strlen(exp->e_path);
22- __dev_t dev;
23+ dev_t dev;
24
25 if (strlen(path) <= l || path[l] != '/' ||
26 strncmp(exp->e_path, path, l) != 0)
27--
282.0.4
29
diff --git a/main/nfs-utils/0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch b/main/nfs-utils/0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
deleted file mode 100644
index 82477985f3..0000000000
--- a/main/nfs-utils/0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From bcf08c3eba0c529077c16110e066750c5cce8292 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 14:07:16 +0000
4Subject: [PATCH] nfsstat: replace the legacy SA_ONESHOT with standard
5 SA_RESETHAND
6
7Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
8---
9 utils/nfsstat/nfsstat.c | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c
13index 70f8d10..3612bfe 100644
14--- a/utils/nfsstat/nfsstat.c
15+++ b/utils/nfsstat/nfsstat.c
16@@ -336,7 +336,7 @@ main(int argc, char **argv)
17
18 struct sigaction act = {
19 .sa_handler = unpause,
20- .sa_flags = SA_ONESHOT,
21+ .sa_flags = SA_RESETHAND,
22 };
23
24 if ((progname = strrchr(argv[0], '/')))
25--
262.0.4
27
diff --git a/main/nfs-utils/0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch b/main/nfs-utils/0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
deleted file mode 100644
index c39b01fe0a..0000000000
--- a/main/nfs-utils/0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1From 733d3316dd67aeb175016a098d6d0fd08cefdd33 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 12 Feb 2014 13:54:31 +0000
4Subject: [PATCH] Allow usage of getrpcbynumber() when getrpcbynumber_r() is
5 unavailable
6
7Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
8---
9 configure.ac | 6 +-----
10 support/nfs/svc_socket.c | 6 ++++++
11 2 files changed, 7 insertions(+), 5 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index b9682ed..bc48373 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -248,9 +248,6 @@ AC_CHECK_FUNC([connect], ,
18 AC_CHECK_FUNC([getaddrinfo], ,
19 [AC_MSG_ERROR([Function 'getaddrinfo' not found.])])
20
21-AC_CHECK_FUNC([getrpcbynumber], ,
22- [AC_MSG_ERROR([Function 'getrpcbynumber' not found.])])
23-
24 AC_CHECK_FUNC([getservbyname], ,
25 [AC_MSG_ERROR([Function 'getservbyname' not found.])])
26
27@@ -409,12 +406,11 @@ AC_FUNC_STAT
28 AC_FUNC_VPRINTF
29 AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
30 gethostbyaddr gethostbyname gethostname getmntent \
31- getnameinfo getrpcbyname getifaddrs \
32+ getnameinfo getrpcbyname getrpcbynumber getrpcbynumber_r getifaddrs \
33 gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
34 ppoll realpath rmdir select socket strcasecmp strchr strdup \
35 strerror strrchr strtol strtoul sigprocmask name_to_handle_at])
36
37-
38 dnl *************************************************************
39 dnl Check for data sizes
40 dnl *************************************************************
41diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c
42index f56f310..61ccf5b 100644
43--- a/support/nfs/svc_socket.c
44+++ b/support/nfs/svc_socket.c
45@@ -42,8 +42,14 @@ int getservport(u_long number, const char *proto)
46 struct servent servbuf, *servp = NULL;
47 int ret;
48
49+#if HAVE_GETRPCBYNUMBER_R
50 ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata,
51 &rpcp);
52+#else
53+ rpcp = getrpcbynumber(number);
54+ ret = 0;
55+#endif
56+
57 if (ret == 0 && rpcp != NULL) {
58 /* First try name. */
59 ret = getservbyname_r(rpcp->r_name, proto, &servbuf, servdata,
60--
612.0.4
62
diff --git a/main/nfs-utils/0008-Only-work-around-glibc-bugs-on-glibc.patch b/main/nfs-utils/0008-Only-work-around-glibc-bugs-on-glibc.patch
deleted file mode 100644
index 9f87eec597..0000000000
--- a/main/nfs-utils/0008-Only-work-around-glibc-bugs-on-glibc.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 21a0c6b3ace23acd0236339582366bb128065347 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 24 Apr 2014 14:25:23 +0200
4Subject: [PATCH] Only work around glibc bugs on glibc
5
6Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
7---
8 utils/mountd/svc_run.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/utils/mountd/svc_run.c b/utils/mountd/svc_run.c
12index 1938a67..a572441 100644
13--- a/utils/mountd/svc_run.c
14+++ b/utils/mountd/svc_run.c
15@@ -60,7 +60,7 @@
16 void cache_set_fds(fd_set *fdset);
17 int cache_process_req(fd_set *readfds);
18
19-#if LONG_MAX != INT_MAX
20+#if defined(__GLIBC__) && LONG_MAX != INT_MAX
21 /* bug in glibc 2.3.6 and earlier, we need
22 * our own svc_getreqset
23 */
24--
252.0.4
26
diff --git a/main/nfs-utils/0009-include-libgen.h-for-basename.patch b/main/nfs-utils/0009-include-libgen.h-for-basename.patch
deleted file mode 100644
index 0cca70e1c0..0000000000
--- a/main/nfs-utils/0009-include-libgen.h-for-basename.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From e828b9c9ac735a18850bd90c61b60064c236937b Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 24 Apr 2014 10:38:26 +0200
4Subject: [PATCH] include libgen.h for basename
5
6According POSIX basename(3) should have an #include <libgen.h>
7
8There are a different GNU implementation too, that can be used with
9_GNU_SOURCE, but the POSIX version is good enough and more portable.
10
11Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
12---
13 tools/rpcdebug/rpcdebug.c | 1 +
14 utils/mount/mount.c | 1 +
15 utils/mount/mount_libmount.c | 1 +
16 utils/nfsd/nfsd.c | 1 +
17 utils/nfsidmap/nfsidmap.c | 1 +
18 5 files changed, 5 insertions(+)
19
20diff --git a/tools/rpcdebug/rpcdebug.c b/tools/rpcdebug/rpcdebug.c
21index d6e10d3..18b1622 100644
22--- a/tools/rpcdebug/rpcdebug.c
23+++ b/tools/rpcdebug/rpcdebug.c
24@@ -26,6 +26,7 @@
25 #include <malloc.h>
26 #include <fcntl.h>
27 #include <ctype.h>
28+#include <libgen.h>
29 /* RPC debug flags
30 #include <sunrpc/debug.h> */
31 /* NFS debug flags
32diff --git a/utils/mount/mount.c b/utils/mount/mount.c
33index eea00af..91f1087 100644
34--- a/utils/mount/mount.c
35+++ b/utils/mount/mount.c
36@@ -33,6 +33,7 @@
37 #include <getopt.h>
38 #include <mntent.h>
39 #include <pwd.h>
40+#include <libgen.h>
41
42 #include "fstab.h"
43 #include "xcommon.h"
44diff --git a/utils/mount/mount_libmount.c b/utils/mount/mount_libmount.c
45index 701d41e..6f85dc9 100644
46--- a/utils/mount/mount_libmount.c
47+++ b/utils/mount/mount_libmount.c
48@@ -29,6 +29,7 @@
49 #include <string.h>
50 #include <errno.h>
51 #include <getopt.h>
52+#include <libgen.h>
53
54 #include <libmount/libmount.h>
55
56diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
57index 03e3c81..201bb13 100644
58--- a/utils/nfsd/nfsd.c
59+++ b/utils/nfsd/nfsd.c
60@@ -19,6 +19,7 @@
61 #include <errno.h>
62 #include <getopt.h>
63 #include <netdb.h>
64+#include <libgen.h>
65 #include <sys/socket.h>
66 #include <netinet/in.h>
67 #include <arpa/inet.h>
68diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
69index 3f51b4d..e0d31e7 100644
70--- a/utils/nfsidmap/nfsidmap.c
71+++ b/utils/nfsidmap/nfsidmap.c
72@@ -4,6 +4,7 @@
73 #include <stdlib.h>
74 #include <string.h>
75 #include <errno.h>
76+#include <libgen.h>
77
78 #include <pwd.h>
79 #include <grp.h>
80--
812.0.4
82
diff --git a/main/nfs-utils/0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch b/main/nfs-utils/0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
deleted file mode 100644
index 00ec08c787..0000000000
--- a/main/nfs-utils/0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 7fc596097b2a0545a8a21e90ecdabdc34073ab49 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Mon, 2 Jun 2014 14:20:59 +0200
4Subject: [PATCH] exportfs: fix test of NULL pointer in host_pton()
5
6should fix https://bugzilla.redhat.com/show_bug.cgi?id=1083018
7
8Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
9---
10 support/export/hostname.c | 12 +++++++-----
11 1 file changed, 7 insertions(+), 5 deletions(-)
12
13diff --git a/support/export/hostname.c b/support/export/hostname.c
14index ad595d1..d9153e1 100644
15--- a/support/export/hostname.c
16+++ b/support/export/hostname.c
17@@ -115,6 +115,11 @@ host_pton(const char *paddr)
18 * have a real AF_INET presentation address, before invoking
19 * getaddrinfo(3) to generate the full addrinfo list.
20 */
21+ if (paddr == NULL) {
22+ xlog(D_GENERAL, "%s: passed a NULL presentation address",
23+ __func__);
24+ return NULL;
25+ }
26 inet4 = 1;
27 if (inet_pton(AF_INET, paddr, &sin.sin_addr) == 0)
28 inet4 = 0;
29@@ -123,15 +128,12 @@ host_pton(const char *paddr)
30 switch (error) {
31 case 0:
32 if (!inet4 && ai->ai_addr->sa_family == AF_INET) {
33+ xlog(D_GENERAL, "%s: failed to convert %s",
34+ __func__, paddr);
35 freeaddrinfo(ai);
36 break;
37 }
38 return ai;
39- case EAI_NONAME:
40- if (paddr == NULL)
41- xlog(D_GENERAL, "%s: passed a NULL presentation address",
42- __func__);
43- break;
44 case EAI_SYSTEM:
45 xlog(D_GENERAL, "%s: failed to convert %s: (%d) %m",
46 __func__, paddr, errno);
47--
482.0.4
49
diff --git a/main/nfs-utils/APKBUILD b/main/nfs-utils/APKBUILD
index 9cccd6716f..76acd4219c 100644
--- a/main/nfs-utils/APKBUILD
+++ b/main/nfs-utils/APKBUILD
@@ -1,14 +1,15 @@
1# Contributor: Carlo Landmeter <clandmeter@gmail.com> 1# Contributor: Carlo Landmeter <clandmeter@gmail.com>
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=nfs-utils 3pkgname=nfs-utils
4pkgver=1.3.1_rc3 4pkgver=1.3.1
5_basever=1.3.0 5_basever=$pkgver
6pkgrel=0 6pkgrel=0
7pkgdesc="kernel-mode NFS" 7pkgdesc="kernel-mode NFS"
8url="http://nfs.sourceforge.net/" 8url="http://nfs.sourceforge.net/"
9arch="all" 9arch="all"
10license="GPL" 10license="GPL"
11depends="rpcbind" 11depends="rpcbind"
12options="suid"
12makedepends="util-linux-dev libtirpc-dev libcap-dev libevent-dev 13makedepends="util-linux-dev libtirpc-dev libcap-dev libevent-dev
13 libnfsidmap-dev keyutils-dev lvm2-dev krb5-dev sqlite-dev 14 libnfsidmap-dev keyutils-dev lvm2-dev krb5-dev sqlite-dev
14 autoconf automake libtool !rpcgen" 15 autoconf automake libtool !rpcgen"
@@ -16,17 +17,6 @@ subpackages="$pkgname-doc $pkgname-dbg"
16[ "$ALPINE_LIBC" != "eglibc" ] && subpackages="$subpackages rpcgen" 17[ "$ALPINE_LIBC" != "eglibc" ] && subpackages="$subpackages rpcgen"
17 18
18source="http://downloads.sourceforge.net/nfs/$pkgname-$_basever.tar.bz2 19source="http://downloads.sourceforge.net/nfs/$pkgname-$_basever.tar.bz2
19 nfs-utils-1.3.1-rc3.patch
20 0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
21 0002-Fix-header-include-for-definition-of-NULL.patch
22 0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
23 0004-replace-__attribute_malloc__-with-the-more-portable-.patch
24 0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
25 0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
26 0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
27 0008-Only-work-around-glibc-bugs-on-glibc.patch
28 0009-include-libgen.h-for-basename.patch
29 0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
30 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch 20 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch
31 0012-rework-access-to-proc-net-rpc.patch 21 0012-rework-access-to-proc-net-rpc.patch
32 22
@@ -110,18 +100,7 @@ rpcgen() {
110 install -m755 -D tools/rpcgen/rpcgen "$subpkgdir"/usr/bin/rpcgen 100 install -m755 -D tools/rpcgen/rpcgen "$subpkgdir"/usr/bin/rpcgen
111} 101}
112 102
113md5sums="3ac3726eda563946d1f44ac3e5b61d56 nfs-utils-1.3.0.tar.bz2 103md5sums="97f157f954edb6d4d4385a0c5986f36f nfs-utils-1.3.1.tar.bz2
1144f6b75806437b08742f95eeb8abc640e nfs-utils-1.3.1-rc3.patch
115714afe3a88d6a584d15e167c96c57925 0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
11642df50df2888a3384550d4f5667fb515 0002-Fix-header-include-for-definition-of-NULL.patch
1170ee94b77a48b6b364e6b14bb75b992a2 0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
1182e67ee958bbdcc11d1888c1b8c4329f0 0004-replace-__attribute_malloc__-with-the-more-portable-.patch
119d10a5b570dbbb20accfb4117f605914a 0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
1204b5e2ed10351eb8d6ab4aa99e65d72aa 0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
12193588b3c68825eadf758832a0045f9e2 0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
1223b733a0bb274ecdf80bbc09b2a11aa4f 0008-Only-work-around-glibc-bugs-on-glibc.patch
1236424e1113a838ab35eb8623ed82a2352 0009-include-libgen.h-for-basename.patch
124232a07d7d923435a12e51ee74e05cea2 0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
1255994a46367486129e2892c73dcdc82c2 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch 1045994a46367486129e2892c73dcdc82c2 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch
1261f6ba2d021b5fa7f7ea4e66b393bd268 0012-rework-access-to-proc-net-rpc.patch 1051f6ba2d021b5fa7f7ea4e66b393bd268 0012-rework-access-to-proc-net-rpc.patch
1272b2d228f9947581c924a691a84664fa1 nfs-utils-mtab-sym.patch 1062b2d228f9947581c924a691a84664fa1 nfs-utils-mtab-sym.patch
@@ -136,18 +115,7 @@ d514fb87ce5de9909f43d99012352f09 nfsmount.initd
13620e71ab412555b2dc9b50f346f68e5c8 rpc.svcgssd.initd 11520e71ab412555b2dc9b50f346f68e5c8 rpc.svcgssd.initd
13709135438d6df50b868bbe5a2260f973c nfs.confd 11609135438d6df50b868bbe5a2260f973c nfs.confd
1384f1bb7b2412ce5952ecb5ec22d8ed99d nfs.exports" 1174f1bb7b2412ce5952ecb5ec22d8ed99d nfs.exports"
139sha256sums="25f1c974018c944347d74eebe89643e1004c822a6145153136b192d1acfaf60d nfs-utils-1.3.0.tar.bz2 118sha256sums="748c4afbdfd3e92017fe579f1dd3280a10db1306c43228f83cd6b55f0d95aed3 nfs-utils-1.3.1.tar.bz2
140d138a10d4d97e185f1563574019919881a742f2908ef432055b64c4e1a249e2c nfs-utils-1.3.1-rc3.patch
1413ea08ea31560eef7315953d691862174bb1a814ef7d5a0c7d695e922d8723b67 0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
142562647aeb295c612889744a4ca7770409ac60ff5953210e5765cac6689d9b0c4 0002-Fix-header-include-for-definition-of-NULL.patch
143bf0af038c1f73a15abaca0242652b9f6666bdff9eae0ac6d4188291abe742769 0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
1445f95083f65eb4b8f7e2687a1070c0a7a8eee1ec2fb10a56a47e4d69ddd3b9188 0004-replace-__attribute_malloc__-with-the-more-portable-.patch
145993b944d25f03fe7282e1be1d1a294e72d2f879365f08d5c59ea377e51736204 0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
1465f9ef2978c6cf2c7883984d2ef6bbcb79d88e2155e0b183bfbb8748d1696ba81 0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
147cae35793e7548be84fdb4719d92156b7ff167304952fd15d9023e051ec176a82 0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
1481de98cbae3b03ea3fba14f1a125bf88b01581e7a9e155377b9d9d98963ced365 0008-Only-work-around-glibc-bugs-on-glibc.patch
149e0eca027b68c191dc96ca89ebe628df18e487b7cbdfb3629231526ef35953de6 0009-include-libgen.h-for-basename.patch
150280ab8bb989c555d880c0aa9b75a6fa83d3bf912ffde75588d914eb9d4cdf54d 0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
1510bd62ea53c980369990f04b620db725259fa919a351b8ed44e081a8b7a1c221e 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch 1190bd62ea53c980369990f04b620db725259fa919a351b8ed44e081a8b7a1c221e 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch
1522d5cc55a6047ef576d6795442b3926f7f686122be26be8566606e0a2d5695b56 0012-rework-access-to-proc-net-rpc.patch 1202d5cc55a6047ef576d6795442b3926f7f686122be26be8566606e0a2d5695b56 0012-rework-access-to-proc-net-rpc.patch
1535a1c6875f43ecc93d5db7bcf84b4ceda16c09b6109c28696eb55d05247511706 nfs-utils-mtab-sym.patch 1215a1c6875f43ecc93d5db7bcf84b4ceda16c09b6109c28696eb55d05247511706 nfs-utils-mtab-sym.patch
@@ -162,18 +130,7 @@ a727948ccf665b6bb1977ac3014b7086ff654173d1a2be1e2b38a43e97f84ca8 rpc.statd.init
162f1c460d8b0e91e54a551397d755135d05a3728d81de596535bf8bda074455677 rpc.svcgssd.initd 130f1c460d8b0e91e54a551397d755135d05a3728d81de596535bf8bda074455677 rpc.svcgssd.initd
1639ca3b7dfbac5bedd818a3637805380f4e873ef8e809c21c26f410c86ac16e03e nfs.confd 1319ca3b7dfbac5bedd818a3637805380f4e873ef8e809c21c26f410c86ac16e03e nfs.confd
164f2aaf1c92e07172adeb65f7f2bc0140c533ae453a3477e99be677ef2e05f2d4b nfs.exports" 132f2aaf1c92e07172adeb65f7f2bc0140c533ae453a3477e99be677ef2e05f2d4b nfs.exports"
165sha512sums="9cb9efa26d2b1bd6ae3e0c516ac50b17b4c7993366ae36c7786da734dc8ea4dd7a05f0d6fabb6fba6df36ead8642341a095f1972cb46b400840705356d410a6a nfs-utils-1.3.0.tar.bz2 133sha512sums="304e718aaee1df4decb0711c58c814ac773d55277baca01fd74d275969b9a1cee4bf0c0c20ba3ed72a112bd92b4744d45179f29a2a69a7fc2ca2590762a671c9 nfs-utils-1.3.1.tar.bz2
166a19bea1792e2034e713c49f407512ed6a5d0bfc9c99a8ef96b656b183f90d44554d2f007f28d2ba66e07c9756c9c50d6b5fab3a200fb6ce573e2d7755ec2cf0b nfs-utils-1.3.1-rc3.patch
1674f215d3824142dcf911e57e5772c8d8df4671703c46ba1a28afeca84c94c566034fbaa11214998ae8e636666b32afac6fcfd7b7ee7ba3f4ce469a5952e3aea18 0001-conffile-use-standard-uint-_t-and-unsigned-char.patch
1687e6367904135465a06561ab3053362992380eaaa012277697d6f3ae7bbdf022d20cb1e36099ecfb646f414892eb1c32142073561f48ab82f09589473115fb889 0002-Fix-header-include-for-definition-of-NULL.patch
16930161e256160ba258e588412e6dbe5a7b112c19963c489eb01b4b93af329c5f034a6466e44031c4b63f9df9577d30ba8b50102013abdde7bcb40b08d1d222a35 0003-configure.ac-enable-GNU_SOURCE-for-stat64-statfs64.patch
170fea39cdc904cf58c0ddf848c941e8bfda12f30e3a723b9be051042682876d7fbe3bf42b464e1f38993230cb63a7a55d93c08cb26dd6b79b482e10cf4f119515b 0004-replace-__attribute_malloc__-with-the-more-portable-.patch
1718372f6f5b71e9f5e262396c7d319188998e46e91ad763d0acc5e8931d1a12f2240f49dfcab20a71048ec2445e8dbb0d15d8f798978308fd492e146beda4a589e 0005-mountd-use-standard-dev_t-instead-of-glibc-internals.patch
1720d8030816a19ababbc2c3e59960240fe3ed84a058082f7f5bee28129cb9969d14be6d6ebb96d0992928ef76610c94dc5937510db05b4853ef93489ea7134af4b 0006-nfsstat-replace-the-legacy-SA_ONESHOT-with-standard-.patch
173c665989dfb7d050f87f998373d1b26e816beb87063df625596aca6bf372a65a919d6cf8c8b1664f9aa3422a95e276a0ad5b11b883a40a65c0769fd5f37ea08f9 0007-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
174fe8191a231cd53dd5e44abeb46dbe34bf33df8f8071375c7f80468c12a6de47d16e6eba1342dbd889b16a821491b80f191691fae29f5e4a46f262e3d8beca5ab 0008-Only-work-around-glibc-bugs-on-glibc.patch
175b5042e36f46701ef1163f54e3ef537a07590dec71e39f4fc64ba7a9d0e27a2d7c65af0e639a17867704f212774a375d47bf9bba74ec4c5afffe59c8cee74c588 0009-include-libgen.h-for-basename.patch
176703f1cd9f72faad84fbf60f631acb8e1927a1915addcc64840f6f690e6577837b7a3cefd493fc3b553e724c31352053558395a7a813c90c4186666cd5fd433e1 0010-exportfs-fix-test-of-NULL-pointer-in-host_pton.patch
1779561a979a2313f00c0bbb2ffb3193ca089e5de2f15cf5b6c142e65e04a9401bbc962e490e5b1de026750262a05e5258b286a79781444e7f2ac6bd581b426211a 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch 1349561a979a2313f00c0bbb2ffb3193ca089e5de2f15cf5b6c142e65e04a9401bbc962e490e5b1de026750262a05e5258b286a79781444e7f2ac6bd581b426211a 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch
178babaf804265cdd768a2dc8ec798e0a31e8cd8c65c6d8f57f4d254b9b56f336c1c3ec2e8a34ed7765a32720b5d75eb9490ad6269daba51aded8fe29136b3b715e 0012-rework-access-to-proc-net-rpc.patch 135babaf804265cdd768a2dc8ec798e0a31e8cd8c65c6d8f57f4d254b9b56f336c1c3ec2e8a34ed7765a32720b5d75eb9490ad6269daba51aded8fe29136b3b715e 0012-rework-access-to-proc-net-rpc.patch
1795fd9039a61a0cdaeb57b5332ea545034101e6f15be200b7cf8fc7d0a3d22836a6fc778e0560656c1825808a4dc09046d9923d81b4d1324a6e526b226c657d064 nfs-utils-mtab-sym.patch 1365fd9039a61a0cdaeb57b5332ea545034101e6f15be200b7cf8fc7d0a3d22836a6fc778e0560656c1825808a4dc09046d9923d81b4d1324a6e526b226c657d064 nfs-utils-mtab-sym.patch
diff --git a/main/nfs-utils/nfs-utils-1.3.1-rc3.patch b/main/nfs-utils/nfs-utils-1.3.1-rc3.patch
deleted file mode 100644
index 9e4048b59c..0000000000
--- a/main/nfs-utils/nfs-utils-1.3.1-rc3.patch
+++ /dev/null
@@ -1,1086 +0,0 @@
1diff --git a/Makefile.am b/Makefile.am
2index ae7cd16..5824adc 100644
3--- a/Makefile.am
4+++ b/Makefile.am
5@@ -54,13 +54,13 @@ install-data-hook:
6 touch $(DESTDIR)$(statedir)/xtab; chmod 644 $(DESTDIR)$(statedir)/xtab
7 touch $(DESTDIR)$(statedir)/etab; chmod 644 $(DESTDIR)$(statedir)/etab
8 touch $(DESTDIR)$(statedir)/rmtab; chmod 644 $(DESTDIR)$(statedir)/rmtab
9- mkdir -p $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak
10- touch $(DESTDIR)$(statedir)/state
11- chmod go-rwx $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak $(DESTDIR)$(statedir)/state
12- -chown $(statduser) $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak $(DESTDIR)$(statedir)/state
13+ mkdir -p $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak
14+ touch $(DESTDIR)$(statdpath)/state
15+ chmod go-rwx $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak $(DESTDIR)$(statdpath)/state
16+ -chown $(statduser) $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak $(DESTDIR)$(statdpath)/state
17
18 uninstall-hook:
19 rm $(DESTDIR)$(statedir)/xtab
20 rm $(DESTDIR)$(statedir)/etab
21 rm $(DESTDIR)$(statedir)/rmtab
22- rm $(DESTDIR)$(statedir)/state
23+ rm $(DESTDIR)$(statdpath)/state
24diff --git a/configure.ac b/configure.ac
25index 7b93de6..408f4c8 100644
26--- a/configure.ac
27+++ b/configure.ac
28@@ -411,7 +411,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
29 getnameinfo getrpcbyname getifaddrs \
30 gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
31 ppoll realpath rmdir select socket strcasecmp strchr strdup \
32- strerror strrchr strtol strtoul sigprocmask])
33+ strerror strrchr strtol strtoul sigprocmask name_to_handle_at])
34
35
36 dnl *************************************************************
37diff --git a/support/export/client.c b/support/export/client.c
38index dbf47b9..f85e11c 100644
39--- a/support/export/client.c
40+++ b/support/export/client.c
41@@ -482,8 +482,12 @@ add_name(char *old, const char *add)
42 else
43 cp = cp + strlen(cp);
44 }
45- strncpy(new, old, cp-old);
46- new[cp-old] = 0;
47+ if (old) {
48+ strncpy(new, old, cp-old);
49+ new[cp-old] = 0;
50+ } else {
51+ new[0] = 0;
52+ }
53 if (cp != old && !*cp)
54 strcat(new, ",");
55 strcat(new, add);
56diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
57index e46105d..1fb3e2f 100644
58--- a/tools/mountstats/mountstats.py
59+++ b/tools/mountstats/mountstats.py
60@@ -371,7 +371,7 @@ def parse_stats_file(filename):
61 ms_dict = dict()
62 key = ''
63
64- f = file(filename)
65+ f = open(filename)
66 for line in f.readlines():
67 words = line.split()
68 if len(words) == 0:
69diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
70index 341cdbf..61d15a5 100644
71--- a/tools/nfs-iostat/nfs-iostat.py
72+++ b/tools/nfs-iostat/nfs-iostat.py
73@@ -213,7 +213,8 @@ class DeviceData:
74 # the reference to them. so we build new lists here
75 # for the result object.
76 for op in result.__rpc_data['ops']:
77- result.__rpc_data[op] = map(difference, self.__rpc_data[op], old_stats.__rpc_data[op])
78+ result.__rpc_data[op] = list(map(
79+ difference, self.__rpc_data[op], old_stats.__rpc_data[op]))
80
81 # update the remaining keys we care about
82 result.__rpc_data['rpcsends'] -= old_stats.__rpc_data['rpcsends']
83@@ -243,27 +244,15 @@ class DeviceData:
84 """Print attribute cache efficiency stats
85 """
86 nfs_stats = self.__nfs_data
87- getattr_stats = self.__rpc_data['GETATTR']
88-
89- if nfs_stats['inoderevalidates'] != 0:
90- getattr_ops = float(getattr_stats[1])
91- opens = float(nfs_stats['vfsopen'])
92- revalidates = float(nfs_stats['inoderevalidates']) - opens
93- if revalidates != 0:
94- ratio = ((revalidates - getattr_ops) * 100) / revalidates
95- else:
96- ratio = 0.0
97-
98- data_invalidates = float(nfs_stats['datainvalidates'])
99- attr_invalidates = float(nfs_stats['attrinvalidates'])
100
101- print()
102- print('%d inode revalidations, hitting in cache %4.2f%% of the time' % \
103- (revalidates, ratio))
104- print('%d open operations (mandatory GETATTR requests)' % opens)
105- if getattr_ops != 0:
106- print('%4.2f%% of GETATTRs resulted in data cache invalidations' % \
107- ((data_invalidates * 100) / getattr_ops))
108+ print()
109+ print('%d VFS opens' % (nfs_stats['vfsopen']))
110+ print('%d inoderevalidates (forced GETATTRs)' % \
111+ (nfs_stats['inoderevalidates']))
112+ print('%d page cache invalidations' % \
113+ (nfs_stats['datainvalidates']))
114+ print('%d attribute cache invalidations' % \
115+ (nfs_stats['attrinvalidates']))
116
117 def __print_dir_cache_stats(self, sample_time):
118 """Print directory stats
119@@ -353,15 +342,21 @@ class DeviceData:
120 exe_per_op = 0.0
121
122 op += ':'
123- print('%s' % op.lower().ljust(15), end='')
124- print(' ops/s\t\t kB/s\t\t kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)')
125-
126- print('\t\t%7.3f' % (ops / sample_time), end='')
127- print('\t%7.3f' % (kilobytes / sample_time), end='')
128- print('\t%7.3f' % kb_per_op, end='')
129- print(' %7d (%3.1f%%)' % (retrans, retrans_percent), end='')
130- print('\t%7.3f' % rtt_per_op, end='')
131- print('\t%7.3f' % exe_per_op)
132+ print(format(op.lower(), '<16s'), end='')
133+ print(format('ops/s', '>8s'), end='')
134+ print(format('kB/s', '>16s'), end='')
135+ print(format('kB/op', '>16s'), end='')
136+ print(format('retrans', '>16s'), end='')
137+ print(format('avg RTT (ms)', '>16s'), end='')
138+ print(format('avg exe (ms)', '>16s'))
139+
140+ print(format((ops / sample_time), '>24.3f'), end='')
141+ print(format((kilobytes / sample_time), '>16.3f'), end='')
142+ print(format(kb_per_op, '>16.3f'), end='')
143+ retransmits = '{0:>10.0f} ({1:>3.1f}%)'.format(retrans, retrans_percent).strip()
144+ print(format(retransmits, '>16'), end='')
145+ print(format(rtt_per_op, '>16.3f'), end='')
146+ print(format(exe_per_op, '>16.3f'))
147
148 def ops(self, sample_time):
149 sends = float(self.__rpc_data['rpcsends'])
150@@ -391,9 +386,10 @@ class DeviceData:
151 (self.__nfs_data['export'], self.__nfs_data['mountpoint']))
152 print()
153
154- print(' op/s\t\trpc bklog')
155- print('%7.2f' % (sends / sample_time), end='')
156- print('\t%7.2f' % backlog)
157+ print(format('ops/s', '>16') + format('rpc bklog', '>16'))
158+ print(format((sends / sample_time), '>16.3f'), end='')
159+ print(format(backlog, '>16.3f'))
160+ print()
161
162 if which == 0:
163 self.__print_rpc_op_stats('READ', sample_time)
164diff --git a/tools/nfs-iostat/nfsiostat.man b/tools/nfs-iostat/nfsiostat.man
165index 3ec245d..b477a9a 100644
166--- a/tools/nfs-iostat/nfsiostat.man
167+++ b/tools/nfs-iostat/nfsiostat.man
168@@ -38,6 +38,61 @@ If one or more
169 .I <mount point>
170 names are specified, statistics for only these mount points will
171 be displayed. Otherwise, all NFS mount points on the client are listed.
172+.TP
173+The meaning of each column of \fBnfsiostat\fR's output is the following:
174+.RS 8
175+- \fBop/s\fR
176+.RS
177+This is the number of operations per second.
178+.RS
179+.RE
180+.RE
181+.RE
182+.RS 8
183+- \fBrpc bklog\fR
184+.RS
185+This is the length of the backlog queue.
186+.RE
187+.RE
188+.RE
189+.RS 8
190+- \fBkB/s\fR
191+.RS
192+This is the number of kB written/read per second.
193+.RE
194+.RE
195+.RE
196+.RS 8
197+- \fBkB/op\fR
198+.RS
199+This is the number of kB written/read per each operation.
200+.RE
201+.RE
202+.RE
203+.RS 8
204+- \fBretrans\fR
205+.RS
206+This is the number of retransmissions.
207+.RE
208+.RE
209+.RE
210+.RS 8
211+- \fBavg RTT (ms)\fR
212+.RS
213+This is the duration from the time that client's kernel sends the RPC request until the time it receives the reply.
214+.RE
215+.RE
216+.RE
217+.RS 8
218+- \fBavg exe (ms)\fR
219+.RS
220+This is the duration from the time that NFS client does the RPC request to its kernel until the RPC request is completed, this includes the RTT time above.
221+.RE
222+.RE
223+.RE
224+.TP
225+Note that if an interval is used as argument to \fBnfsiostat\fR, then the diffrence from previous interval will be displayed, otherwise the results will be from the time that the share was mounted.
226+
227 .SH OPTIONS
228 .TP
229 .B \-a " or " \-\-attr
230diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
231index a9a3e42..af59791 100644
232--- a/utils/gssd/Makefile.am
233+++ b/utils/gssd/Makefile.am
234@@ -18,11 +18,13 @@ COMMON_SRCS = \
235 context_lucid.c \
236 gss_util.c \
237 gss_oids.c \
238+ gss_names.c \
239 err_util.c \
240 \
241 context.h \
242 err_util.h \
243 gss_oids.h \
244+ gss_names.h \
245 gss_util.h
246
247 gssd_SOURCES = \
248diff --git a/utils/gssd/gss_names.c b/utils/gssd/gss_names.c
249new file mode 100644
250index 0000000..047069d
251--- /dev/null
252+++ b/utils/gssd/gss_names.c
253@@ -0,0 +1,138 @@
254+/*
255+ Copyright (c) 2000 The Regents of the University of Michigan.
256+ All rights reserved.
257+
258+ Copyright (c) 2002 Bruce Fields <bfields@UMICH.EDU>
259+
260+ Redistribution and use in source and binary forms, with or without
261+ modification, are permitted provided that the following conditions
262+ are met:
263+
264+ 1. Redistributions of source code must retain the above copyright
265+ notice, this list of conditions and the following disclaimer.
266+ 2. Redistributions in binary form must reproduce the above copyright
267+ notice, this list of conditions and the following disclaimer in the
268+ documentation and/or other materials provided with the distribution.
269+ 3. Neither the name of the University nor the names of its
270+ contributors may be used to endorse or promote products derived
271+ from this software without specific prior written permission.
272+
273+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
274+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
275+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
276+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
277+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
278+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
279+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
280+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
281+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
282+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
283+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284+*/
285+
286+#ifdef HAVE_CONFIG_H
287+#include <config.h>
288+#endif /* HAVE_CONFIG_H */
289+
290+#include <sys/param.h>
291+#include <sys/stat.h>
292+#include <rpc/rpc.h>
293+
294+#include <pwd.h>
295+#include <stdio.h>
296+#include <unistd.h>
297+#include <ctype.h>
298+#include <string.h>
299+#include <fcntl.h>
300+#include <errno.h>
301+#include <nfsidmap.h>
302+#include <nfslib.h>
303+#include <time.h>
304+
305+#include "svcgssd.h"
306+#include "gss_util.h"
307+#include "err_util.h"
308+#include "context.h"
309+#include "misc.h"
310+#include "gss_oids.h"
311+#include "svcgssd_krb5.h"
312+
313+static int
314+get_krb5_hostbased_name(gss_buffer_desc *name, char **hostbased_name)
315+{
316+ char *p, *sname = NULL;
317+ if (strchr(name->value, '@') && strchr(name->value, '/')) {
318+ if ((sname = calloc(name->length, 1)) == NULL) {
319+ printerr(0, "ERROR: get_krb5_hostbased_name failed "
320+ "to allocate %d bytes\n", name->length);
321+ return -1;
322+ }
323+ /* read in name and instance and replace '/' with '@' */
324+ sscanf(name->value, "%[^@]", sname);
325+ p = strrchr(sname, '/');
326+ if (p == NULL) { /* The '@' preceeded the '/' */
327+ free(sname);
328+ return -1;
329+ }
330+ *p = '@';
331+ }
332+ *hostbased_name = sname;
333+ return 0;
334+}
335+
336+int
337+get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
338+ char **hostbased_name)
339+{
340+ u_int32_t maj_stat, min_stat;
341+ gss_buffer_desc name;
342+ gss_OID name_type = GSS_C_NO_OID;
343+ char *cname;
344+ int res = -1;
345+
346+ *hostbased_name = NULL; /* preset in case we fail */
347+
348+ /* Get the client's gss authenticated name */
349+ maj_stat = gss_display_name(&min_stat, client_name, &name, &name_type);
350+ if (maj_stat != GSS_S_COMPLETE) {
351+ pgsserr("get_hostbased_client_name: gss_display_name",
352+ maj_stat, min_stat, mech);
353+ goto out_err;
354+ }
355+ if (name.length >= 0xffff) { /* don't overflow */
356+ printerr(0, "ERROR: get_hostbased_client_name: "
357+ "received gss_name is too long (%d bytes)\n",
358+ name.length);
359+ goto out_rel_buf;
360+ }
361+
362+ /* For Kerberos, transform the NT_KRB5_PRINCIPAL name to
363+ * an NT_HOSTBASED_SERVICE name */
364+ if (g_OID_equal(&krb5oid, mech)) {
365+ if (get_krb5_hostbased_name(&name, &cname) == 0)
366+ *hostbased_name = cname;
367+ } else {
368+ printerr(1, "WARNING: unknown/unsupport mech OID\n");
369+ }
370+
371+ res = 0;
372+out_rel_buf:
373+ gss_release_buffer(&min_stat, &name);
374+out_err:
375+ return res;
376+}
377+
378+void
379+get_hostbased_client_buffer(gss_name_t client_name, gss_OID mech,
380+ gss_buffer_t buf)
381+{
382+ char *hname;
383+
384+ if (!get_hostbased_client_name(client_name, mech, &hname)) {
385+ buf->length = strlen(hname) + 1;
386+ buf->value = hname;
387+ } else {
388+ buf->length = 0;
389+ buf->value = NULL;
390+ }
391+}
392diff --git a/utils/gssd/gss_names.h b/utils/gssd/gss_names.h
393new file mode 100644
394index 0000000..ce182f7
395--- /dev/null
396+++ b/utils/gssd/gss_names.h
397@@ -0,0 +1,36 @@
398+/*
399+ Copyright (c) 2000 The Regents of the University of Michigan.
400+ All rights reserved.
401+
402+ Copyright (c) 2002 Bruce Fields <bfields@UMICH.EDU>
403+
404+ Redistribution and use in source and binary forms, with or without
405+ modification, are permitted provided that the following conditions
406+ are met:
407+
408+ 1. Redistributions of source code must retain the above copyright
409+ notice, this list of conditions and the following disclaimer.
410+ 2. Redistributions in binary form must reproduce the above copyright
411+ notice, this list of conditions and the following disclaimer in the
412+ documentation and/or other materials provided with the distribution.
413+ 3. Neither the name of the University nor the names of its
414+ contributors may be used to endorse or promote products derived
415+ from this software without specific prior written permission.
416+
417+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
418+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
419+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
420+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
421+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
422+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
423+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
424+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
425+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
426+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
427+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
428+*/
429+
430+extern int get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
431+ char **hostbased_name);
432+extern void get_hostbased_client_buffer(gss_name_t client_name,
433+ gss_OID mech, gss_buffer_t buf);
434diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
435index 611ef1a..6b8b863 100644
436--- a/utils/gssd/gssd.c
437+++ b/utils/gssd/gssd.c
438@@ -64,6 +64,7 @@ char *ccachesearch[GSSD_MAX_CCACHE_SEARCH + 1];
439 int use_memcache = 0;
440 int root_uses_machine_creds = 1;
441 unsigned int context_timeout = 0;
442+unsigned int rpc_timeout = 5;
443 char *preferred_realm = NULL;
444 int pipefds[2] = { -1, -1 };
445
446@@ -105,7 +106,7 @@ main(int argc, char *argv[])
447 char *progname;
448
449 memset(ccachesearch, 0, sizeof(ccachesearch));
450- while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:R:")) != -1) {
451+ while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
452 switch (opt) {
453 case 'f':
454 fg = 1;
455@@ -143,6 +144,9 @@ main(int argc, char *argv[])
456 case 't':
457 context_timeout = atoi(optarg);
458 break;
459+ case 'T':
460+ rpc_timeout = atoi(optarg);
461+ break;
462 case 'R':
463 preferred_realm = strdup(optarg);
464 break;
465diff --git a/utils/gssd/gssd.h b/utils/gssd/gssd.h
466index 56a18d6..48f4ad8 100644
467--- a/utils/gssd/gssd.h
468+++ b/utils/gssd/gssd.h
469@@ -66,6 +66,7 @@ extern char *ccachesearch[];
470 extern int use_memcache;
471 extern int root_uses_machine_creds;
472 extern unsigned int context_timeout;
473+extern unsigned int rpc_timeout;
474 extern char *preferred_realm;
475 extern int pipefds[2];
476
477diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
478index ac13fd4..ea58fa0 100644
479--- a/utils/gssd/gssd.man
480+++ b/utils/gssd/gssd.man
481@@ -289,6 +289,14 @@ new kernel contexts to be negotiated after
482 seconds, which allows changing Kerberos tickets and identities frequently.
483 The default is no explicit timeout, which means the kernel context will live
484 the lifetime of the Kerberos service ticket used in its creation.
485+.TP
486+.B -T timeout
487+Timeout, in seconds, to create an RPC connection with a server while
488+establishing an authenticated gss context for a user.
489+The default timeout is set to 5 seconds.
490+If you get messages like "WARNING: can't create tcp rpc_clnt to server
491+%servername% for user with uid %uid%: RPC: Remote system error -
492+Connection timed out", you should consider an increase of this timeout.
493 .SH SEE ALSO
494 .BR rpc.svcgssd (8),
495 .BR kerberos (1),
496diff --git a/utils/gssd/gssd_main_loop.c b/utils/gssd/gssd_main_loop.c
497index 9970028..6946ab6 100644
498--- a/utils/gssd/gssd_main_loop.c
499+++ b/utils/gssd/gssd_main_loop.c
500@@ -173,6 +173,10 @@ topdirs_init_list(void)
501 if (ret)
502 goto out_err;
503 }
504+ if (TAILQ_EMPTY(&topdirs_list)) {
505+ printerr(0, "ERROR: rpc_pipefs directory '%s' is empty!\n", pipefs_dir);
506+ return -1;
507+ }
508 closedir(pipedir);
509 return 0;
510 out_err:
511@@ -233,9 +237,10 @@ gssd_run()
512 sigaddset(&set, DNOTIFY_SIGNAL);
513 sigprocmask(SIG_UNBLOCK, &set, NULL);
514
515- if (topdirs_init_list() != 0)
516- return;
517-
518+ if (topdirs_init_list() != 0) {
519+ /* Error msg is already printed */
520+ exit(1);
521+ }
522 init_client_list();
523
524 printerr(1, "beginning poll\n");
525diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
526index 33cfeb2..121feb1 100644
527--- a/utils/gssd/gssd_proc.c
528+++ b/utils/gssd/gssd_proc.c
529@@ -77,6 +77,7 @@
530 #include "context.h"
531 #include "nfsrpc.h"
532 #include "nfslib.h"
533+#include "gss_names.h"
534
535 /*
536 * pollarray:
537@@ -217,7 +218,7 @@ get_servername(const char *name, const struct sockaddr *sa, const char *addr)
538 NI_NAMEREQD);
539 if (err) {
540 printerr(0, "ERROR: unable to resolve %s to hostname: %s\n",
541- addr, err == EAI_SYSTEM ? strerror(err) :
542+ addr, err == EAI_SYSTEM ? strerror(errno) :
543 gai_strerror(err));
544 return NULL;
545 }
546@@ -681,19 +682,25 @@ parse_enctypes(char *enctypes)
547 return 0;
548 }
549
550-static int
551+static void
552 do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
553- gss_buffer_desc *context_token, OM_uint32 lifetime_rec)
554+ gss_buffer_desc *context_token, OM_uint32 lifetime_rec,
555+ gss_buffer_desc *acceptor)
556 {
557 char *buf = NULL, *p = NULL, *end = NULL;
558 unsigned int timeout = context_timeout;
559 unsigned int buf_size = 0;
560
561- printerr(1, "doing downcall lifetime_rec %u\n", lifetime_rec);
562+ printerr(1, "doing downcall: lifetime_rec=%u acceptor=%.*s\n",
563+ lifetime_rec, acceptor->length, acceptor->value);
564 buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
565 sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
566- sizeof(context_token->length) + context_token->length;
567+ sizeof(context_token->length) + context_token->length +
568+ sizeof(acceptor->length) + acceptor->length;
569 p = buf = malloc(buf_size);
570+ if (!buf)
571+ goto out_err;
572+
573 end = buf + buf_size;
574
575 /* context_timeout set by -t option overrides context lifetime */
576@@ -704,14 +711,15 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
577 if (WRITE_BYTES(&p, end, pd->pd_seq_win)) goto out_err;
578 if (write_buffer(&p, end, &pd->pd_ctx_hndl)) goto out_err;
579 if (write_buffer(&p, end, context_token)) goto out_err;
580+ if (write_buffer(&p, end, acceptor)) goto out_err;
581
582 if (write(k5_fd, buf, p - buf) < p - buf) goto out_err;
583- if (buf) free(buf);
584- return 0;
585+ free(buf);
586+ return;
587 out_err:
588- if (buf) free(buf);
589+ free(buf);
590 printerr(1, "Failed to write downcall!\n");
591- return -1;
592+ return;
593 }
594
595 static int
596@@ -842,7 +850,7 @@ create_auth_rpc_client(struct clnt_info *clp,
597 OM_uint32 min_stat;
598 char rpc_errmsg[1024];
599 int protocol;
600- struct timeval timeout = {5, 0};
601+ struct timeval timeout;
602 struct sockaddr *addr = (struct sockaddr *) &clp->addr;
603 socklen_t salen;
604
605@@ -910,6 +918,10 @@ create_auth_rpc_client(struct clnt_info *clp,
606 if (!populate_port(addr, salen, clp->prog, clp->vers, protocol))
607 goto out_fail;
608
609+ /* set the timeout according to the requested valued */
610+ timeout.tv_sec = (long) rpc_timeout;
611+ timeout.tv_usec = (long) 0;
612+
613 rpc_clnt = nfs_get_rpcclient(addr, salen, protocol, clp->prog,
614 clp->vers, &timeout);
615 if (!rpc_clnt) {
616@@ -1031,6 +1043,9 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
617 gss_cred_id_t gss_cred;
618 OM_uint32 maj_stat, min_stat, lifetime_rec;
619 pid_t pid;
620+ gss_name_t gacceptor = GSS_C_NO_NAME;
621+ gss_OID mech;
622+ gss_buffer_desc acceptor = {0};
623
624 pid = fork();
625 switch(pid) {
626@@ -1171,15 +1186,24 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
627 goto out_return_error;
628 }
629
630- /* Grab the context lifetime to pass to the kernel. lifetime_rec
631- * is set to zero on error */
632- maj_stat = gss_inquire_context(&min_stat, pd.pd_ctx, NULL, NULL,
633- &lifetime_rec, NULL, NULL, NULL, NULL);
634+ /* Grab the context lifetime and acceptor name out of the ctx. */
635+ maj_stat = gss_inquire_context(&min_stat, pd.pd_ctx, NULL, &gacceptor,
636+ &lifetime_rec, &mech, NULL, NULL, NULL);
637
638- if (maj_stat)
639- printerr(1, "WARNING: Failed to inquire context for lifetme "
640- "maj_stat %u\n", maj_stat);
641+ if (maj_stat != GSS_S_COMPLETE) {
642+ printerr(1, "WARNING: Failed to inquire context "
643+ "maj_stat (0x%x)\n", maj_stat);
644+ lifetime_rec = 0;
645+ } else {
646+ get_hostbased_client_buffer(gacceptor, mech, &acceptor);
647+ gss_release_name(&min_stat, &gacceptor);
648+ }
649
650+ /*
651+ * The serialization can mean turning pd.pd_ctx into a lucid context. If
652+ * that happens then the pd.pd_ctx will be unusable, so we must never
653+ * try to use it after this point.
654+ */
655 if (serialize_context_for_kernel(&pd.pd_ctx, &token, &krb5oid, NULL)) {
656 printerr(0, "WARNING: Failed to serialize krb5 context for "
657 "user with uid %d for server %s\n",
658@@ -1187,9 +1211,10 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
659 goto out_return_error;
660 }
661
662- do_downcall(fd, uid, &pd, &token, lifetime_rec);
663+ do_downcall(fd, uid, &pd, &token, lifetime_rec, &acceptor);
664
665 out:
666+ gss_release_buffer(&min_stat, &acceptor);
667 if (token.value)
668 free(token.value);
669 #ifdef HAVE_AUTHGSS_FREE_PRIVATE_DATA
670diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
671index 3757d51..5bdb438 100644
672--- a/utils/gssd/svcgssd_proc.c
673+++ b/utils/gssd/svcgssd_proc.c
674@@ -59,6 +59,7 @@
675 #include "misc.h"
676 #include "gss_oids.h"
677 #include "svcgssd_krb5.h"
678+#include "gss_names.h"
679
680 extern char * mech2file(gss_OID mech);
681 #define SVCGSSD_CONTEXT_CHANNEL "/proc/net/rpc/auth.rpcsec.context/channel"
682@@ -315,71 +316,6 @@ print_hexl(const char *description, unsigned char *cp, int length)
683 }
684 #endif
685
686-static int
687-get_krb5_hostbased_name (gss_buffer_desc *name, char **hostbased_name)
688-{
689- char *p, *sname = NULL;
690- if (strchr(name->value, '@') && strchr(name->value, '/')) {
691- if ((sname = calloc(name->length, 1)) == NULL) {
692- printerr(0, "ERROR: get_krb5_hostbased_name failed "
693- "to allocate %d bytes\n", name->length);
694- return -1;
695- }
696- /* read in name and instance and replace '/' with '@' */
697- sscanf(name->value, "%[^@]", sname);
698- p = strrchr(sname, '/');
699- if (p == NULL) { /* The '@' preceeded the '/' */
700- free(sname);
701- return -1;
702- }
703- *p = '@';
704- }
705- *hostbased_name = sname;
706- return 0;
707-}
708-
709-static int
710-get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
711- char **hostbased_name)
712-{
713- u_int32_t maj_stat, min_stat;
714- gss_buffer_desc name;
715- gss_OID name_type = GSS_C_NO_OID;
716- char *cname;
717- int res = -1;
718-
719- *hostbased_name = NULL; /* preset in case we fail */
720-
721- /* Get the client's gss authenticated name */
722- maj_stat = gss_display_name(&min_stat, client_name, &name, &name_type);
723- if (maj_stat != GSS_S_COMPLETE) {
724- pgsserr("get_hostbased_client_name: gss_display_name",
725- maj_stat, min_stat, mech);
726- goto out_err;
727- }
728- if (name.length >= 0xffff) { /* don't overflow */
729- printerr(0, "ERROR: get_hostbased_client_name: "
730- "received gss_name is too long (%d bytes)\n",
731- name.length);
732- goto out_rel_buf;
733- }
734-
735- /* For Kerberos, transform the NT_KRB5_PRINCIPAL name to
736- * an NT_HOSTBASED_SERVICE name */
737- if (g_OID_equal(&krb5oid, mech)) {
738- if (get_krb5_hostbased_name(&name, &cname) == 0)
739- *hostbased_name = cname;
740- } else {
741- printerr(1, "WARNING: unknown/unsupport mech OID\n");
742- }
743-
744- res = 0;
745-out_rel_buf:
746- gss_release_buffer(&min_stat, &name);
747-out_err:
748- return res;
749-}
750-
751 void
752 handle_nullreq(FILE *f) {
753 /* XXX initialize to a random integer to reduce chances of unnecessary
754diff --git a/utils/mount/error.c b/utils/mount/error.c
755index f8fc13f..e06f598 100644
756--- a/utils/mount/error.c
757+++ b/utils/mount/error.c
758@@ -215,8 +215,12 @@ void mount_error(const char *spec, const char *mount_point, int error)
759 progname);
760 break;
761 case ENOTDIR:
762- nfs_error(_("%s: mount point %s is not a directory"),
763- progname, mount_point);
764+ if (spec)
765+ nfs_error(_("%s: mount spec %s or point %s is not a "
766+ "directory"), progname, spec, mount_point);
767+ else
768+ nfs_error(_("%s: mount point %s is not a directory"),
769+ progname, mount_point);
770 break;
771 case EBUSY:
772 nfs_error(_("%s: %s is busy or already mounted"),
773diff --git a/utils/mount/nfsmount.conf b/utils/mount/nfsmount.conf
774index 9b8ff4a..aeb3023 100644
775--- a/utils/mount/nfsmount.conf
776+++ b/utils/mount/nfsmount.conf
777@@ -133,3 +133,12 @@
778 # RPCGSS security flavors
779 # [none, sys, krb5, krb5i, krb5p ]
780 # Sec=sys
781+#
782+# Allow Signals to interrupt file operations
783+# Intr=True
784+#
785+# Specifies how the kernel manages its cache of directory
786+# Lookupcache=all|none|pos|positive
787+#
788+# Turn of the caching of that access time
789+# noatime=True
790diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
791index 9a1bb27..b0cc6a8 100644
792--- a/utils/mountd/cache.c
793+++ b/utils/mountd/cache.c
794@@ -377,6 +377,86 @@ static char *next_mnt(void **v, char *p)
795 return me->mnt_dir;
796 }
797
798+/* same_path() check is two paths refer to the same directory.
799+ * We don't rely on 'strcmp()' as some filesystems support case-insensitive
800+ * names and we might have two different names for the one directory.
801+ * Theoretically the lengths of the names could be different, but the
802+ * number of components must be the same.
803+ * So if the paths have the same number of components (but aren't identical)
804+ * we ask the kernel if they are the same thing.
805+ * By preference we use name_to_handle_at(), as the mntid it returns
806+ * will distinguish between bind-mount points. If that isn't available
807+ * we fall back on lstat, which is usually good enough.
808+ */
809+static inline int count_slashes(char *p)
810+{
811+ int cnt = 0;
812+ while (*p)
813+ if (*p++ == '/')
814+ cnt++;
815+ return cnt;
816+}
817+
818+static int same_path(char *child, char *parent, int len)
819+{
820+ static char p[PATH_MAX];
821+ struct stat sc, sp;
822+
823+ if (len <= 0)
824+ len = strlen(child);
825+ strncpy(p, child, len);
826+ p[len] = 0;
827+ if (strcmp(p, parent) == 0)
828+ return 1;
829+
830+ /* If number of '/' are different, they must be different */
831+ if (count_slashes(p) != count_slashes(parent))
832+ return 0;
833+
834+#if HAVE_NAME_TO_HANDLE_AT
835+ struct {
836+ struct file_handle fh;
837+ unsigned char handle[128];
838+ } fchild, fparent;
839+ int mnt_child, mnt_parent;
840+
841+ fchild.fh.handle_bytes = 128;
842+ fparent.fh.handle_bytes = 128;
843+ if (name_to_handle_at(AT_FDCWD, p, &fchild.fh, &mnt_child, 0) != 0) {
844+ if (errno == ENOSYS)
845+ goto fallback;
846+ return 0;
847+ }
848+ if (name_to_handle_at(AT_FDCWD, parent, &fparent.fh, &mnt_parent, 0) != 0)
849+ return 0;
850+
851+ if (mnt_child != mnt_parent ||
852+ fchild.fh.handle_bytes != fparent.fh.handle_bytes ||
853+ fchild.fh.handle_type != fparent.fh.handle_type ||
854+ memcmp(fchild.handle, fparent.handle,
855+ fchild.fh.handle_bytes) != 0)
856+ return 0;
857+
858+ return 1;
859+fallback:
860+#endif
861+
862+ /* This is nearly good enough. However if a directory is
863+ * bind-mounted in two places and both are exported, it
864+ * could give a false positive
865+ */
866+ if (lstat(p, &sc) != 0)
867+ return 0;
868+ if (lstat(parent, &sp) != 0)
869+ return 0;
870+ if (sc.st_dev != sp.st_dev)
871+ return 0;
872+ if (sc.st_ino != sp.st_ino)
873+ return 0;
874+
875+ return 1;
876+}
877+
878 static int is_subdirectory(char *child, char *parent)
879 {
880 /* Check is child is strictly a subdirectory of
881@@ -387,7 +467,7 @@ static int is_subdirectory(char *child, char *parent)
882 if (strcmp(parent, "/") == 0 && child[1] != 0)
883 return 1;
884
885- return (strncmp(child, parent, l) == 0 && child[l] == '/');
886+ return (same_path(child, parent, l) && child[l] == '/');
887 }
888
889 static int path_matches(nfs_export *exp, char *path)
890@@ -396,7 +476,7 @@ static int path_matches(nfs_export *exp, char *path)
891 * exact match, or does the export have CROSSMOUNT, and path
892 * is a descendant?
893 */
894- return strcmp(path, exp->m_export.e_path) == 0
895+ return same_path(path, exp->m_export.e_path, 0)
896 || ((exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
897 && is_subdirectory(path, exp->m_export.e_path));
898 }
899diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man
900index e59a559..a8828ae 100644
901--- a/utils/mountd/mountd.man
902+++ b/utils/mountd/mountd.man
903@@ -86,7 +86,7 @@ Turn on debugging. Valid kinds are: all, auth, call, general and parse.
904 .B \-F " or " \-\-foreground
905 Run in foreground (do not daemonize)
906 .TP
907-.B \-f " or " \-\-exports-file
908+.B \-f export-file " or " \-\-exports-file export-file
909 This option specifies the exports file, listing the clients that this
910 server is prepared to serve and parameters to apply to each
911 such mount (see
912@@ -101,7 +101,7 @@ Display usage message.
913 Set the limit of the number of open file descriptors to num. The
914 default is to leave the limit unchanged.
915 .TP
916-.B \-N " or " \-\-no-nfs-version
917+.B \-N mountd-version " or " \-\-no-nfs-version mountd-version
918 This option can be used to request that
919 .B rpc.mountd
920 do not offer certain versions of NFS. The current version of
921@@ -118,7 +118,7 @@ Don't advertise TCP for mount.
922 .B \-P
923 Ignored (compatibility with unfsd??).
924 .TP
925-.B \-p " or " \-\-port num
926+.B \-p num " or " \-\-port num
927 Specifies the port number used for RPC listener sockets.
928 If this option is not specified,
929 .B rpc.mountd
930@@ -132,7 +132,7 @@ This option can be used to fix the port value of
931 listeners when NFS MOUNT requests must traverse a firewall
932 between clients and servers.
933 .TP
934-.B \-H " or " \-\-ha-callout prog
935+.B \-H " prog or " \-\-ha-callout prog
936 Specify a high availability callout program.
937 This program receives callouts for all MOUNT and UNMOUNT requests.
938 This allows
939@@ -174,7 +174,7 @@ to perform a reverse lookup on each IP address and return that hostname instead.
940 Enabling this can have a substantial negative effect on performance
941 in some situations.
942 .TP
943-.BR "\-t N" " or " "\-\-num\-threads=N"
944+.BR "\-t N" " or " "\-\-num\-threads=N" or " \-\-num\-threads N"
945 This option specifies the number of worker threads that rpc.mountd
946 spawns. The default is 1 thread, which is probably enough. More
947 threads are usually only needed for NFS servers which need to handle
948@@ -184,7 +184,7 @@ your DNS server is slow or unreliable.
949 .B \-u " or " \-\-no-udp
950 Don't advertise UDP for mounting
951 .TP
952-.B \-V " or " \-\-nfs-version
953+.B \-V version " or " \-\-nfs-version version
954 This option can be used to request that
955 .B rpc.mountd
956 offer certain versions of NFS. The current version of
957diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
958index 73d6a92..03e3c81 100644
959--- a/utils/nfsd/nfsd.c
960+++ b/utils/nfsd/nfsd.c
961@@ -101,7 +101,7 @@ main(int argc, char **argv)
962 int count = NFSD_NPROC, c, i, error = 0, portnum = 0, fd, found_one;
963 char *p, *progname, *port, *rdma_port = NULL;
964 char **haddr = NULL;
965- unsigned int hcounter = 0;
966+ int hcounter = 0;
967 int socket_up = 0;
968 unsigned int minorvers = 0;
969 unsigned int minorversset = 0;
970diff --git a/utils/nfsdcltrack/Makefile.am b/utils/nfsdcltrack/Makefile.am
971index a860ffb..7524295 100644
972--- a/utils/nfsdcltrack/Makefile.am
973+++ b/utils/nfsdcltrack/Makefile.am
974@@ -1,5 +1,9 @@
975 ## Process this file with automake to produce Makefile.in
976
977+# These binaries go in /sbin (not /usr/sbin), and that cannot be
978+# overridden at config time. The kernel "knows" the /sbin name.
979+sbindir = /sbin
980+
981 man8_MANS = nfsdcltrack.man
982 EXTRA_DIST = $(man8_MANS)
983
984diff --git a/utils/statd/callback.c b/utils/statd/callback.c
985index d1cc139..bb7c590 100644
986--- a/utils/statd/callback.c
987+++ b/utils/statd/callback.c
988@@ -10,11 +10,13 @@
989 #include <config.h>
990 #endif
991
992+#include <unistd.h>
993 #include <netdb.h>
994
995 #include "rpcmisc.h"
996 #include "statd.h"
997 #include "notlist.h"
998+#include "ha-callout.h"
999
1000 /* Callback notify list. */
1001 /* notify_list *cbnl = NULL; ... never used */
1002@@ -87,6 +89,13 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
1003 xlog(D_CALL, "Received SM_NOTIFY from %s, state: %d",
1004 argp->mon_name, argp->state);
1005
1006+ if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) {
1007+ xlog_warn("Unrecognized sender address");
1008+ return ((void *) &result);
1009+ }
1010+
1011+ ha_callout("sm-notify", argp->mon_name, ip_addr, argp->state);
1012+
1013 /* quick check - don't bother if we're not monitoring anyone */
1014 if (rtnl == NULL) {
1015 xlog_warn("SM_NOTIFY from %s while not monitoring any hosts",
1016@@ -94,11 +103,6 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
1017 return ((void *) &result);
1018 }
1019
1020- if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) {
1021- xlog_warn("Unrecognized sender address");
1022- return ((void *) &result);
1023- }
1024-
1025 /* okir change: statd doesn't remove the remote host from its
1026 * internal monitor list when receiving an SM_NOTIFY call from
1027 * it. Lockd will want to continue monitoring the remote host
1028diff --git a/utils/statd/start-statd b/utils/statd/start-statd
1029index cde3583..dcdaf77 100644
1030--- a/utils/statd/start-statd
1031+++ b/utils/statd/start-statd
1032@@ -4,8 +4,8 @@
1033 # /var/run/rpc.statd.pid).
1034 # It should run statd with whatever flags are apropriate for this
1035 # site.
1036-PATH=/sbin:/usr/sbin
1037-if systemctl start statd.service
1038+PATH="/sbin:/usr/sbin:/bin:/usr/bin"
1039+if systemctl start rpc-statd.service
1040 then :
1041 else
1042 exec rpc.statd --no-notify
1043diff --git a/utils/statd/statd.man b/utils/statd/statd.man
1044index 896c2f8..1e5520c 100644
1045--- a/utils/statd/statd.man
1046+++ b/utils/statd/statd.man
1047@@ -346,7 +346,8 @@ points due to inactivity.
1048 .SS High-availability callouts
1049 .B rpc.statd
1050 can exec a special callout program during processing of
1051-successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests.
1052+successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests,
1053+or when it receives SM_NOTIFY.
1054 Such a program may be used in High Availability NFS (HA-NFS)
1055 environments to track lock state that may need to be migrated after
1056 a system reboot.
1057@@ -357,15 +358,26 @@ option.
1058 The program is run with 3 arguments:
1059 The first is either
1060 .B add-client
1061-or
1062 .B del-client
1063+or
1064+.B sm-notify
1065 depending on the reason for the callout.
1066 The second is the
1067 .I mon_name
1068 of the monitored peer.
1069 The third is the
1070-.I caller_name
1071-of the requesting lock manager.
1072+.I caller_name
1073+of the requesting lock manager for
1074+.B add-client
1075+or
1076+.B del-client
1077+, otherwise it is
1078+.I IP_address
1079+of the caller sending SM_NOTIFY.
1080+The forth is the
1081+.I state_value
1082+in the SM_NOTIFY request.
1083+
1084 .SS IPv6 and TI-RPC support
1085 TI-RPC is a pre-requisite for supporting NFS on IPv6.
1086 If TI-RPC support is built into