diff options
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch | 39 | ||||
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch | 36 | ||||
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-nfsctl-x32-fix.patch | 30 | ||||
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch | 599 | ||||
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb (renamed from meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.3.bb) | 25 |
5 files changed, 671 insertions, 58 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch index 6d46d3a591..c3442380e1 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch | |||
| @@ -1,22 +1,27 @@ | |||
| 1 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 2 | |||
| 1 | Upstream-Status: Inappropriate [embedded specific] | 3 | Upstream-Status: Inappropriate [embedded specific] |
| 2 | 4 | ||
| 3 | Index: nfs-utils-1.2.3/support/nfs/svc_socket.c | 5 | Index: nfs-utils-1.2.6/support/nfs/svc_socket.c |
| 4 | =================================================================== | 6 | =================================================================== |
| 5 | --- nfs-utils-1.2.3.orig/support/nfs/svc_socket.c | 7 | --- nfs-utils-1.2.6.orig/support/nfs/svc_socket.c 2012-05-14 07:40:52.000000000 -0700 |
| 6 | +++ nfs-utils-1.2.3/support/nfs/svc_socket.c | 8 | +++ nfs-utils-1.2.6/support/nfs/svc_socket.c 2012-10-28 02:42:50.179222457 -0700 |
| 7 | @@ -67,6 +67,7 @@ svc_socket (u_long number, int type, int | 9 | @@ -40,8 +40,9 @@ |
| 8 | memset (&addr, 0, sizeof (addr)); | 10 | char rpcdata[1024], servdata[1024]; |
| 9 | addr.sin_family = AF_INET; | 11 | struct rpcent rpcbuf, *rpcp; |
| 12 | struct servent servbuf, *servp = NULL; | ||
| 13 | - int ret; | ||
| 14 | + int ret = 0; | ||
| 10 | 15 | ||
| 11 | +#ifndef __UCLIBC__ /* neither getrpcbynumber() nor getrpcbynumber_r() is SuSv3 */ | 16 | +#ifndef __UCLIBC__ /* neither getrpcbynumber() nor getrpcbynumber_r() is SuSv3 */ |
| 12 | ret = getrpcbynumber_r (number, &rpcbuf, rpcdata, sizeof rpcdata, | 17 | ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata, |
| 13 | &rpcp); | 18 | &rpcp); |
| 14 | if (ret == 0 && rpcp != NULL) | 19 | if (ret == 0 && rpcp != NULL) { |
| 15 | @@ -100,6 +101,7 @@ svc_socket (u_long number, int type, int | 20 | @@ -60,6 +61,7 @@ |
| 21 | } | ||
| 22 | } | ||
| 16 | } | 23 | } |
| 17 | } | 24 | +#endif /* __UCLIBC__ */ |
| 18 | else | 25 | |
| 19 | +#endif | 26 | if (ret == 0 && servp != NULL) |
| 20 | { | 27 | return ntohs(servp->s_port); |
| 21 | addr.sin_port = 0; | ||
| 22 | if (bind (sock, (struct sockaddr *) &addr, len) < 0) | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch new file mode 100644 index 0000000000..d8f8181670 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | Fixes errors like | ||
| 2 | sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later | ||
| 3 | This error will occur anytime sm-notify is run before the network if fully up, | ||
| 4 | which is happening more and more with parallel startup systems. | ||
| 5 | The res_init() call is simple, safe, quick, and a patch to use it should be | ||
| 6 | able to go upstream. Presumably the whole reason sm-notify tries several | ||
| 7 | times is to wait for possible changes to the network configuration, but without | ||
| 8 | calling res_init() it will never be aware of those changes | ||
| 9 | |||
| 10 | Backported drom Fedora | ||
| 11 | |||
| 12 | Upstream-Status: Pending | ||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | |||
| 15 | |||
| 16 | diff -up nfs-utils-1.2.3/utils/statd/sm-notify.c.orig nfs-utils-1.2.3/utils/statd/sm-notify.c | ||
| 17 | --- nfs-utils-1.2.3/utils/statd/sm-notify.c.orig 2010-09-28 08:24:16.000000000 -0400 | ||
| 18 | +++ nfs-utils-1.2.3/utils/statd/sm-notify.c 2010-10-15 16:44:43.487119601 -0400 | ||
| 19 | @@ -28,6 +28,9 @@ | ||
| 20 | #include <netdb.h> | ||
| 21 | #include <errno.h> | ||
| 22 | #include <grp.h> | ||
| 23 | +#include <netinet/in.h> | ||
| 24 | +#include <arpa/nameser.h> | ||
| 25 | +#include <resolv.h> | ||
| 26 | |||
| 27 | #include "sockaddr.h" | ||
| 28 | #include "xlog.h" | ||
| 29 | @@ -84,6 +87,7 @@ smn_lookup(const char *name) | ||
| 30 | }; | ||
| 31 | int error; | ||
| 32 | |||
| 33 | + res_init(); | ||
| 34 | error = getaddrinfo(name, NULL, &hint, &ai); | ||
| 35 | if (error != 0) { | ||
| 36 | xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error)); | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-nfsctl-x32-fix.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-nfsctl-x32-fix.patch deleted file mode 100644 index 26b463136a..0000000000 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-nfsctl-x32-fix.patch +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | |||
| 2 | Upstream-Status: Pending | ||
| 3 | |||
| 4 | Signed-off-by: H.J. Lu <hjl.tools@gmail.com> | ||
| 5 | |||
| 6 | --- nfs-utils-1.2.3/support/nfs/nfsctl.c.x32 2010-09-28 05:24:16.000000000 -0700 | ||
| 7 | +++ nfs-utils-1.2.3/support/nfs/nfsctl.c 2011-11-30 13:34:09.369917161 -0800 | ||
| 8 | @@ -12,15 +12,22 @@ | ||
| 9 | |||
| 10 | #include <unistd.h> | ||
| 11 | #include <asm/unistd.h> | ||
| 12 | +#include <errno.h> | ||
| 13 | #include "nfslib.h" | ||
| 14 | |||
| 15 | /* compatibility hack... */ | ||
| 16 | #ifndef __NR_nfsctl | ||
| 17 | +#ifdef __NR_nfsservctl | ||
| 18 | #define __NR_nfsctl __NR_nfsservctl | ||
| 19 | #endif | ||
| 20 | +#endif | ||
| 21 | |||
| 22 | int | ||
| 23 | nfsctl (int cmd, struct nfsctl_arg * argp, union nfsctl_res * resp) | ||
| 24 | { | ||
| 25 | +#ifdef __NR_nfsctl | ||
| 26 | return syscall (__NR_nfsctl, cmd, argp, resp); | ||
| 27 | +#else | ||
| 28 | + return -ENOSYS; | ||
| 29 | +#endif | ||
| 30 | } | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch new file mode 100644 index 0000000000..0411b47982 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch | |||
| @@ -0,0 +1,599 @@ | |||
| 1 | Backported from Fedora | ||
| 2 | |||
| 3 | This is a cumulative fixes patch between 1.2.7 and 1.2.8 latest rc | ||
| 4 | |||
| 5 | Upstream-Status: Backport | ||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | |||
| 8 | diff --git a/support/export/rmtab.c b/support/export/rmtab.c | ||
| 9 | index 31c0f50..d16b3b3 100644 | ||
| 10 | --- a/support/export/rmtab.c | ||
| 11 | +++ b/support/export/rmtab.c | ||
| 12 | @@ -1,7 +1,7 @@ | ||
| 13 | /* | ||
| 14 | - * support/export/rmntab.c | ||
| 15 | + * support/export/rmtab.c | ||
| 16 | * | ||
| 17 | - * Interface to the rmnt file. | ||
| 18 | + * Interface to the rmtab file. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | @@ -12,7 +12,7 @@ | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <string.h> | ||
| 25 | #include <errno.h> | ||
| 26 | -#include "xmalloc.h" | ||
| 27 | + | ||
| 28 | #include "misc.h" | ||
| 29 | #include "nfslib.h" | ||
| 30 | #include "exportfs.h" | ||
| 31 | diff --git a/support/export/xtab.c b/support/export/xtab.c | ||
| 32 | index 2a43193..e953071 100644 | ||
| 33 | --- a/support/export/xtab.c | ||
| 34 | +++ b/support/export/xtab.c | ||
| 35 | @@ -14,7 +14,7 @@ | ||
| 36 | #include <unistd.h> | ||
| 37 | #include <stdlib.h> | ||
| 38 | #include <string.h> | ||
| 39 | -#include "xmalloc.h" | ||
| 40 | + | ||
| 41 | #include "nfslib.h" | ||
| 42 | #include "exportfs.h" | ||
| 43 | #include "xio.h" | ||
| 44 | diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c | ||
| 45 | index e641c45..61e07a8 100644 | ||
| 46 | --- a/support/nfs/cacheio.c | ||
| 47 | +++ b/support/nfs/cacheio.c | ||
| 48 | @@ -162,11 +162,16 @@ int qword_eol(FILE *f) | ||
| 49 | { | ||
| 50 | int err; | ||
| 51 | |||
| 52 | - fprintf(f,"\n"); | ||
| 53 | - err = fflush(f); | ||
| 54 | - if (err) { | ||
| 55 | - xlog_warn("qword_eol: fflush failed: errno %d (%s)", | ||
| 56 | + err = fprintf(f,"\n"); | ||
| 57 | + if (err < 0) { | ||
| 58 | + xlog_warn("qword_eol: fprintf failed: errno %d (%s)", | ||
| 59 | errno, strerror(errno)); | ||
| 60 | + } else { | ||
| 61 | + err = fflush(f); | ||
| 62 | + if (err) { | ||
| 63 | + xlog_warn("qword_eol: fflush failed: errno %d (%s)", | ||
| 64 | + errno, strerror(errno)); | ||
| 65 | + } | ||
| 66 | } | ||
| 67 | /* | ||
| 68 | * We must send one line (and one line only) in a single write | ||
| 69 | diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c | ||
| 70 | index ec251fa..d01ba2f 100644 | ||
| 71 | --- a/utils/gssd/gssd_proc.c | ||
| 72 | +++ b/utils/gssd/gssd_proc.c | ||
| 73 | @@ -52,6 +52,7 @@ | ||
| 74 | #include <sys/socket.h> | ||
| 75 | #include <arpa/inet.h> | ||
| 76 | #include <sys/fsuid.h> | ||
| 77 | +#include <sys/resource.h> | ||
| 78 | |||
| 79 | #include <stdio.h> | ||
| 80 | #include <stdlib.h> | ||
| 81 | @@ -250,21 +251,10 @@ read_service_info(char *info_file_name, char **servicename, char **servername, | ||
| 82 | if ((p = strstr(buf, "port")) != NULL) | ||
| 83 | sscanf(p, "port: %127s\n", port); | ||
| 84 | |||
| 85 | - /* check service, program, and version */ | ||
| 86 | - if (memcmp(service, "nfs", 3) != 0) | ||
| 87 | - return -1; | ||
| 88 | + /* get program, and version numbers */ | ||
| 89 | *prog = atoi(program + 1); /* skip open paren */ | ||
| 90 | *vers = atoi(version); | ||
| 91 | |||
| 92 | - if (strlen(service) == 3 ) { | ||
| 93 | - if ((*prog != 100003) || ((*vers != 2) && (*vers != 3) && | ||
| 94 | - (*vers != 4))) | ||
| 95 | - goto fail; | ||
| 96 | - } else if (memcmp(service, "nfs4_cb", 7) == 0) { | ||
| 97 | - if (*vers != 1) | ||
| 98 | - goto fail; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | if (!addrstr_to_sockaddr(addr, address, port)) | ||
| 102 | goto fail; | ||
| 103 | |||
| 104 | @@ -398,10 +388,10 @@ process_clnt_dir_files(struct clnt_info * clp) | ||
| 105 | static int | ||
| 106 | get_poll_index(int *ind) | ||
| 107 | { | ||
| 108 | - int i; | ||
| 109 | + unsigned int i; | ||
| 110 | |||
| 111 | *ind = -1; | ||
| 112 | - for (i=0; i<FD_ALLOC_BLOCK; i++) { | ||
| 113 | + for (i=0; i<pollsize; i++) { | ||
| 114 | if (pollarray[i].events == 0) { | ||
| 115 | *ind = i; | ||
| 116 | break; | ||
| 117 | @@ -483,9 +473,13 @@ fail_keep_client: | ||
| 118 | void | ||
| 119 | init_client_list(void) | ||
| 120 | { | ||
| 121 | + struct rlimit rlim; | ||
| 122 | TAILQ_INIT(&clnt_list); | ||
| 123 | /* Eventually plan to grow/shrink poll array: */ | ||
| 124 | pollsize = FD_ALLOC_BLOCK; | ||
| 125 | + if (getrlimit(RLIMIT_NOFILE, &rlim) < 0 && | ||
| 126 | + rlim.rlim_cur != RLIM_INFINITY) | ||
| 127 | + pollsize = rlim.rlim_cur; | ||
| 128 | pollarray = calloc(pollsize, sizeof(struct pollfd)); | ||
| 129 | } | ||
| 130 | |||
| 131 | @@ -567,9 +561,8 @@ process_pipedir(char *pipe_name) | ||
| 132 | |||
| 133 | update_old_clients(namelist, j, pipe_name); | ||
| 134 | for (i=0; i < j; i++) { | ||
| 135 | - if (i < FD_ALLOC_BLOCK | ||
| 136 | - && !strncmp(namelist[i]->d_name, "clnt", 4) | ||
| 137 | - && !find_client(namelist[i]->d_name, pipe_name)) | ||
| 138 | + if (!strncmp(namelist[i]->d_name, "clnt", 4) | ||
| 139 | + && !find_client(namelist[i]->d_name, pipe_name)) | ||
| 140 | process_clnt_dir(namelist[i]->d_name, pipe_name); | ||
| 141 | free(namelist[i]); | ||
| 142 | } | ||
| 143 | @@ -962,12 +955,6 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname, | ||
| 144 | |||
| 145 | printerr(1, "handling krb5 upcall (%s)\n", clp->dirname); | ||
| 146 | |||
| 147 | - if (tgtname) { | ||
| 148 | - if (clp->servicename) { | ||
| 149 | - free(clp->servicename); | ||
| 150 | - clp->servicename = strdup(tgtname); | ||
| 151 | - } | ||
| 152 | - } | ||
| 153 | token.length = 0; | ||
| 154 | token.value = NULL; | ||
| 155 | memset(&pd, 0, sizeof(struct authgss_private_data)); | ||
| 156 | @@ -1016,7 +1003,8 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname, | ||
| 157 | int success = 0; | ||
| 158 | do { | ||
| 159 | gssd_refresh_krb5_machine_credential(clp->servername, | ||
| 160 | - NULL, service); | ||
| 161 | + NULL, service, | ||
| 162 | + tgtname); | ||
| 163 | /* | ||
| 164 | * Get a list of credential cache names and try each | ||
| 165 | * of them until one works or we've tried them all | ||
| 166 | diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c | ||
| 167 | index 60ba594..aeb8f70 100644 | ||
| 168 | --- a/utils/gssd/krb5_util.c | ||
| 169 | +++ b/utils/gssd/krb5_util.c | ||
| 170 | @@ -774,12 +774,16 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt, | ||
| 171 | } | ||
| 172 | |||
| 173 | /* | ||
| 174 | - * Find a keytab entry to use for a given target hostname. | ||
| 175 | + * Find a keytab entry to use for a given target realm. | ||
| 176 | * Tries to find the most appropriate keytab to use given the | ||
| 177 | * name of the host we are trying to connect with. | ||
| 178 | + * | ||
| 179 | + * Note: the tgtname contains a hostname in the realm that we | ||
| 180 | + * are authenticating to. It may, or may not be the same as | ||
| 181 | + * the server hostname. | ||
| 182 | */ | ||
| 183 | static int | ||
| 184 | -find_keytab_entry(krb5_context context, krb5_keytab kt, const char *hostname, | ||
| 185 | +find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname, | ||
| 186 | krb5_keytab_entry *kte, const char **svcnames) | ||
| 187 | { | ||
| 188 | krb5_error_code code; | ||
| 189 | @@ -795,7 +799,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *hostname, | ||
| 190 | |||
| 191 | |||
| 192 | /* Get full target hostname */ | ||
| 193 | - retval = get_full_hostname(hostname, targethostname, | ||
| 194 | + retval = get_full_hostname(tgtname, targethostname, | ||
| 195 | sizeof(targethostname)); | ||
| 196 | if (retval) | ||
| 197 | goto out; | ||
| 198 | @@ -1128,7 +1132,7 @@ gssd_get_krb5_machine_cred_list(char ***list) | ||
| 199 | if (ple->ccname) { | ||
| 200 | /* Make sure cred is up-to-date before returning it */ | ||
| 201 | retval = gssd_refresh_krb5_machine_credential(NULL, ple, | ||
| 202 | - NULL); | ||
| 203 | + NULL, NULL); | ||
| 204 | if (retval) | ||
| 205 | continue; | ||
| 206 | if (i + 1 > listsize) { | ||
| 207 | @@ -1219,7 +1223,8 @@ gssd_destroy_krb5_machine_creds(void) | ||
| 208 | int | ||
| 209 | gssd_refresh_krb5_machine_credential(char *hostname, | ||
| 210 | struct gssd_k5_kt_princ *ple, | ||
| 211 | - char *service) | ||
| 212 | + char *service, | ||
| 213 | + char *tgtname) | ||
| 214 | { | ||
| 215 | krb5_error_code code = 0; | ||
| 216 | krb5_context context; | ||
| 217 | @@ -1258,7 +1263,10 @@ gssd_refresh_krb5_machine_credential(char *hostname, | ||
| 218 | if (ple == NULL) { | ||
| 219 | krb5_keytab_entry kte; | ||
| 220 | |||
| 221 | - code = find_keytab_entry(context, kt, hostname, &kte, svcnames); | ||
| 222 | + if (tgtname == NULL) | ||
| 223 | + tgtname = hostname; | ||
| 224 | + | ||
| 225 | + code = find_keytab_entry(context, kt, tgtname, &kte, svcnames); | ||
| 226 | if (code) { | ||
| 227 | printerr(0, "ERROR: %s: no usable keytab entry found " | ||
| 228 | "in keytab %s for connection with host %s\n", | ||
| 229 | diff --git a/utils/gssd/krb5_util.h b/utils/gssd/krb5_util.h | ||
| 230 | index cd6e107..9f41625 100644 | ||
| 231 | --- a/utils/gssd/krb5_util.h | ||
| 232 | +++ b/utils/gssd/krb5_util.h | ||
| 233 | @@ -31,7 +31,8 @@ void gssd_setup_krb5_machine_gss_ccache(char *servername); | ||
| 234 | void gssd_destroy_krb5_machine_creds(void); | ||
| 235 | int gssd_refresh_krb5_machine_credential(char *hostname, | ||
| 236 | struct gssd_k5_kt_princ *ple, | ||
| 237 | - char *service); | ||
| 238 | + char *service, | ||
| 239 | + char *tgtname); | ||
| 240 | char *gssd_k5_err_msg(krb5_context context, krb5_error_code code); | ||
| 241 | void gssd_k5_get_default_realm(char **def_realm); | ||
| 242 | |||
| 243 | diff --git a/utils/gssd/svcgssd_krb5.c b/utils/gssd/svcgssd_krb5.c | ||
| 244 | index 6c34faf..1d44d34 100644 | ||
| 245 | --- a/utils/gssd/svcgssd_krb5.c | ||
| 246 | +++ b/utils/gssd/svcgssd_krb5.c | ||
| 247 | @@ -38,6 +38,7 @@ | ||
| 248 | |||
| 249 | #include <stdio.h> | ||
| 250 | #include <errno.h> | ||
| 251 | +#include <ctype.h> | ||
| 252 | #include <gssapi/gssapi.h> | ||
| 253 | #include <krb5.h> | ||
| 254 | |||
| 255 | @@ -98,6 +99,12 @@ parse_enctypes(char *enctypes) | ||
| 256 | if (n == 0) | ||
| 257 | return ENOENT; | ||
| 258 | |||
| 259 | + /* Skip pass any non digits */ | ||
| 260 | + while (*enctypes && isdigit(*enctypes) == 0) | ||
| 261 | + enctypes++; | ||
| 262 | + if (*enctypes == '\0') | ||
| 263 | + return EINVAL; | ||
| 264 | + | ||
| 265 | /* Allocate space for enctypes array */ | ||
| 266 | if ((parsed_enctypes = (int *) calloc(n, sizeof(int))) == NULL) { | ||
| 267 | return ENOMEM; | ||
| 268 | diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c | ||
| 269 | index e80efb4..beba9c4 100644 | ||
| 270 | --- a/utils/idmapd/idmapd.c | ||
| 271 | +++ b/utils/idmapd/idmapd.c | ||
| 272 | @@ -145,7 +145,6 @@ static void svrreopen(int, short, void *); | ||
| 273 | static int nfsopen(struct idmap_client *); | ||
| 274 | static void nfscb(int, short, void *); | ||
| 275 | static void nfsdcb(int, short, void *); | ||
| 276 | -static int validateascii(char *, u_int32_t); | ||
| 277 | static int addfield(char **, ssize_t *, char *); | ||
| 278 | static int getfield(char **, char *, size_t); | ||
| 279 | |||
| 280 | @@ -425,7 +424,8 @@ dirscancb(int UNUSED(fd), short UNUSED(which), void *data) | ||
| 281 | pipefsdir, ents[i]->d_name); | ||
| 282 | |||
| 283 | if ((ic->ic_dirfd = open(path, O_RDONLY, 0)) == -1) { | ||
| 284 | - xlog_warn("dirscancb: open(%s): %s", path, strerror(errno)); | ||
| 285 | + if (verbose > 0) | ||
| 286 | + xlog_warn("dirscancb: open(%s): %s", path, strerror(errno)); | ||
| 287 | free(ic); | ||
| 288 | goto out; | ||
| 289 | } | ||
| 290 | @@ -642,6 +642,8 @@ out: | ||
| 291 | static void | ||
| 292 | imconv(struct idmap_client *ic, struct idmap_msg *im) | ||
| 293 | { | ||
| 294 | + u_int32_t len; | ||
| 295 | + | ||
| 296 | switch (im->im_conv) { | ||
| 297 | case IDMAP_CONV_IDTONAME: | ||
| 298 | idtonameres(im); | ||
| 299 | @@ -652,10 +654,10 @@ imconv(struct idmap_client *ic, struct idmap_msg *im) | ||
| 300 | im->im_id, im->im_name); | ||
| 301 | break; | ||
| 302 | case IDMAP_CONV_NAMETOID: | ||
| 303 | - if (validateascii(im->im_name, sizeof(im->im_name)) == -1) { | ||
| 304 | - im->im_status |= IDMAP_STATUS_INVALIDMSG; | ||
| 305 | + len = strnlen(im->im_name, IDMAP_NAMESZ - 1); | ||
| 306 | + /* Check for NULL termination just to be careful */ | ||
| 307 | + if (im->im_name[len+1] != '\0') | ||
| 308 | return; | ||
| 309 | - } | ||
| 310 | nametoidres(im); | ||
| 311 | if (verbose > 1) | ||
| 312 | xlog_warn("%s %s: (%s) name \"%s\" -> id \"%d\"", | ||
| 313 | @@ -855,25 +857,6 @@ nametoidres(struct idmap_msg *im) | ||
| 314 | } | ||
| 315 | |||
| 316 | static int | ||
| 317 | -validateascii(char *string, u_int32_t len) | ||
| 318 | -{ | ||
| 319 | - u_int32_t i; | ||
| 320 | - | ||
| 321 | - for (i = 0; i < len; i++) { | ||
| 322 | - if (string[i] == '\0') | ||
| 323 | - break; | ||
| 324 | - | ||
| 325 | - if (string[i] & 0x80) | ||
| 326 | - return (-1); | ||
| 327 | - } | ||
| 328 | - | ||
| 329 | - if ((i >= len) || string[i] != '\0') | ||
| 330 | - return (-1); | ||
| 331 | - | ||
| 332 | - return (i + 1); | ||
| 333 | -} | ||
| 334 | - | ||
| 335 | -static int | ||
| 336 | addfield(char **bpp, ssize_t *bsizp, char *fld) | ||
| 337 | { | ||
| 338 | char ch, *bp = *bpp; | ||
| 339 | diff --git a/utils/mount/error.c b/utils/mount/error.c | ||
| 340 | index 83ad1d2..f8fc13f 100644 | ||
| 341 | --- a/utils/mount/error.c | ||
| 342 | +++ b/utils/mount/error.c | ||
| 343 | @@ -225,7 +225,7 @@ void mount_error(const char *spec, const char *mount_point, int error) | ||
| 344 | case ENOENT: | ||
| 345 | if (spec) | ||
| 346 | nfs_error(_("%s: mounting %s failed, " | ||
| 347 | - "reason given by server:\n %s"), | ||
| 348 | + "reason given by server: %s"), | ||
| 349 | progname, spec, strerror(error)); | ||
| 350 | else | ||
| 351 | nfs_error(_("%s: mount point %s does not exist"), | ||
| 352 | diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c | ||
| 353 | index 9b4197b..8ee3024 100644 | ||
| 354 | --- a/utils/mount/stropts.c | ||
| 355 | +++ b/utils/mount/stropts.c | ||
| 356 | @@ -666,6 +666,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi) | ||
| 357 | case EOPNOTSUPP: | ||
| 358 | case EHOSTUNREACH: | ||
| 359 | case ETIMEDOUT: | ||
| 360 | + case EACCES: | ||
| 361 | continue; | ||
| 362 | default: | ||
| 363 | goto out; | ||
| 364 | @@ -761,6 +762,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) | ||
| 365 | case ECONNREFUSED: | ||
| 366 | case EHOSTUNREACH: | ||
| 367 | case ETIMEDOUT: | ||
| 368 | + case EACCES: | ||
| 369 | continue; | ||
| 370 | default: | ||
| 371 | goto out; | ||
| 372 | diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c | ||
| 373 | index 508040a..330cab5 100644 | ||
| 374 | --- a/utils/mountd/auth.c | ||
| 375 | +++ b/utils/mountd/auth.c | ||
| 376 | @@ -10,10 +10,12 @@ | ||
| 377 | #include <config.h> | ||
| 378 | #endif | ||
| 379 | |||
| 380 | +#include <sys/types.h> | ||
| 381 | #include <sys/stat.h> | ||
| 382 | #include <netinet/in.h> | ||
| 383 | #include <arpa/inet.h> | ||
| 384 | #include <errno.h> | ||
| 385 | +#include <fcntl.h> | ||
| 386 | #include <unistd.h> | ||
| 387 | |||
| 388 | #include "sockaddr.h" | ||
| 389 | @@ -21,7 +23,6 @@ | ||
| 390 | #include "nfslib.h" | ||
| 391 | #include "exportfs.h" | ||
| 392 | #include "mountd.h" | ||
| 393 | -#include "xmalloc.h" | ||
| 394 | #include "v4root.h" | ||
| 395 | |||
| 396 | enum auth_error | ||
| 397 | diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c | ||
| 398 | index e950ec6..45012be 100644 | ||
| 399 | --- a/utils/mountd/cache.c | ||
| 400 | +++ b/utils/mountd/cache.c | ||
| 401 | @@ -29,7 +29,6 @@ | ||
| 402 | #include "nfslib.h" | ||
| 403 | #include "exportfs.h" | ||
| 404 | #include "mountd.h" | ||
| 405 | -#include "xmalloc.h" | ||
| 406 | #include "fsloc.h" | ||
| 407 | #include "pseudoflavors.h" | ||
| 408 | |||
| 409 | @@ -109,12 +108,10 @@ static void auth_unix_ip(FILE *f) | ||
| 410 | struct addrinfo *ai = NULL; | ||
| 411 | |||
| 412 | ai = client_resolve(tmp->ai_addr); | ||
| 413 | - if (ai == NULL) | ||
| 414 | - goto out; | ||
| 415 | - client = client_compose(ai); | ||
| 416 | - freeaddrinfo(ai); | ||
| 417 | - if (!client) | ||
| 418 | - goto out; | ||
| 419 | + if (ai) { | ||
| 420 | + client = client_compose(ai); | ||
| 421 | + freeaddrinfo(ai); | ||
| 422 | + } | ||
| 423 | } | ||
| 424 | qword_print(f, "nfsd"); | ||
| 425 | qword_print(f, ipaddr); | ||
| 426 | @@ -127,7 +124,6 @@ static void auth_unix_ip(FILE *f) | ||
| 427 | xlog(D_CALL, "auth_unix_ip: client %p '%s'", client, client?client: "DEFAULT"); | ||
| 428 | |||
| 429 | free(client); | ||
| 430 | -out: | ||
| 431 | freeaddrinfo(tmp); | ||
| 432 | |||
| 433 | } | ||
| 434 | @@ -347,6 +343,30 @@ static char *next_mnt(void **v, char *p) | ||
| 435 | return me->mnt_dir; | ||
| 436 | } | ||
| 437 | |||
| 438 | +static int is_subdirectory(char *child, char *parent) | ||
| 439 | +{ | ||
| 440 | + size_t l = strlen(parent); | ||
| 441 | + | ||
| 442 | + if (strcmp(parent, "/") == 0) | ||
| 443 | + return 1; | ||
| 444 | + | ||
| 445 | + return strcmp(child, parent) == 0 | ||
| 446 | + || (strncmp(child, parent, l) == 0 && child[l] == '/'); | ||
| 447 | +} | ||
| 448 | + | ||
| 449 | +static int path_matches(nfs_export *exp, char *path) | ||
| 450 | +{ | ||
| 451 | + if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT) | ||
| 452 | + return is_subdirectory(path, exp->m_export.e_path); | ||
| 453 | + return strcmp(path, exp->m_export.e_path) == 0; | ||
| 454 | +} | ||
| 455 | + | ||
| 456 | +static int | ||
| 457 | +export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai) | ||
| 458 | +{ | ||
| 459 | + return path_matches(exp, path) && client_matches(exp, dom, ai); | ||
| 460 | +} | ||
| 461 | + | ||
| 462 | /* True iff e1 is a child of e2 and e2 has crossmnt set: */ | ||
| 463 | static bool subexport(struct exportent *e1, struct exportent *e2) | ||
| 464 | { | ||
| 465 | @@ -354,8 +374,7 @@ static bool subexport(struct exportent *e1, struct exportent *e2) | ||
| 466 | size_t l2 = strlen(p2); | ||
| 467 | |||
| 468 | return e2->e_flags & NFSEXP_CROSSMOUNT | ||
| 469 | - && strncmp(p1, p2, l2) == 0 | ||
| 470 | - && p1[l2] == '/'; | ||
| 471 | + && is_subdirectory(p1, p2); | ||
| 472 | } | ||
| 473 | |||
| 474 | struct parsed_fsid { | ||
| 475 | @@ -756,27 +775,6 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex | ||
| 476 | return qword_eol(f); | ||
| 477 | } | ||
| 478 | |||
| 479 | -static int is_subdirectory(char *child, char *parent) | ||
| 480 | -{ | ||
| 481 | - size_t l = strlen(parent); | ||
| 482 | - | ||
| 483 | - return strcmp(child, parent) == 0 | ||
| 484 | - || (strncmp(child, parent, l) == 0 && child[l] == '/'); | ||
| 485 | -} | ||
| 486 | - | ||
| 487 | -static int path_matches(nfs_export *exp, char *path) | ||
| 488 | -{ | ||
| 489 | - if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT) | ||
| 490 | - return is_subdirectory(path, exp->m_export.e_path); | ||
| 491 | - return strcmp(path, exp->m_export.e_path) == 0; | ||
| 492 | -} | ||
| 493 | - | ||
| 494 | -static int | ||
| 495 | -export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai) | ||
| 496 | -{ | ||
| 497 | - return path_matches(exp, path) && client_matches(exp, dom, ai); | ||
| 498 | -} | ||
| 499 | - | ||
| 500 | static nfs_export * | ||
| 501 | lookup_export(char *dom, char *path, struct addrinfo *ai) | ||
| 502 | { | ||
| 503 | @@ -830,6 +828,7 @@ lookup_export(char *dom, char *path, struct addrinfo *ai) | ||
| 504 | |||
| 505 | #ifdef HAVE_NFS_PLUGIN_H | ||
| 506 | #include <dlfcn.h> | ||
| 507 | +#include <link.h> | ||
| 508 | #include <nfs-plugin.h> | ||
| 509 | |||
| 510 | /* | ||
| 511 | @@ -1094,6 +1093,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname, | ||
| 512 | struct addrinfo *ai) | ||
| 513 | { | ||
| 514 | struct exportent *exp; | ||
| 515 | + struct link_map *map; | ||
| 516 | void *handle; | ||
| 517 | |||
| 518 | handle = dlopen("libnfsjunct.so", RTLD_NOW); | ||
| 519 | @@ -1101,6 +1101,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname, | ||
| 520 | xlog(D_GENERAL, "%s: dlopen: %s", __func__, dlerror()); | ||
| 521 | return NULL; | ||
| 522 | } | ||
| 523 | + | ||
| 524 | + if (dlinfo(handle, RTLD_DI_LINKMAP, &map) == 0) | ||
| 525 | + xlog(D_GENERAL, "%s: loaded plug-in %s", | ||
| 526 | + __func__, map->l_name); | ||
| 527 | + | ||
| 528 | (void)dlerror(); /* Clear any error */ | ||
| 529 | |||
| 530 | exp = invoke_junction_ops(handle, dom, pathname, ai); | ||
| 531 | diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c | ||
| 532 | index 9801b9c..4334340 100644 | ||
| 533 | --- a/utils/nfsdcltrack/nfsdcltrack.c | ||
| 534 | +++ b/utils/nfsdcltrack/nfsdcltrack.c | ||
| 535 | @@ -379,6 +379,17 @@ cltrack_legacy_gracedone(void) | ||
| 536 | while ((entry = readdir(v4recovery))) { | ||
| 537 | int len; | ||
| 538 | |||
| 539 | + /* skip "." and ".." */ | ||
| 540 | + if (entry->d_name[0] == '.') { | ||
| 541 | + switch (entry->d_name[1]) { | ||
| 542 | + case '\0': | ||
| 543 | + continue; | ||
| 544 | + case '.': | ||
| 545 | + if (entry->d_name[2] == '\0') | ||
| 546 | + continue; | ||
| 547 | + } | ||
| 548 | + } | ||
| 549 | + | ||
| 550 | /* borrow the clientid blob for this */ | ||
| 551 | len = snprintf((char *)blob, sizeof(blob), "%s/%s", dirname, | ||
| 552 | entry->d_name); | ||
| 553 | diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c | ||
| 554 | index 4ecb03c..fd576d9 100644 | ||
| 555 | --- a/utils/statd/rmtcall.c | ||
| 556 | +++ b/utils/statd/rmtcall.c | ||
| 557 | @@ -68,21 +68,19 @@ statd_get_socket(void) | ||
| 558 | { | ||
| 559 | struct sockaddr_in sin; | ||
| 560 | struct servent *se; | ||
| 561 | - int loopcnt = 100; | ||
| 562 | + const int loopcnt = 100; | ||
| 563 | + int i, tmp_sockets[loopcnt]; | ||
| 564 | |||
| 565 | if (sockfd >= 0) | ||
| 566 | return sockfd; | ||
| 567 | |||
| 568 | - while (loopcnt-- > 0) { | ||
| 569 | - | ||
| 570 | - if (sockfd >= 0) close(sockfd); | ||
| 571 | + for (i = 0; i < loopcnt; ++i) { | ||
| 572 | |||
| 573 | if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { | ||
| 574 | xlog(L_ERROR, "%s: Can't create socket: %m", __func__); | ||
| 575 | - return -1; | ||
| 576 | + break; | ||
| 577 | } | ||
| 578 | |||
| 579 | - | ||
| 580 | memset(&sin, 0, sizeof(sin)); | ||
| 581 | sin.sin_family = AF_INET; | ||
| 582 | sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | ||
| 583 | @@ -96,7 +94,16 @@ statd_get_socket(void) | ||
| 584 | if (se == NULL) | ||
| 585 | break; | ||
| 586 | /* rather not use that port, try again */ | ||
| 587 | + | ||
| 588 | + tmp_sockets[i] = sockfd; | ||
| 589 | } | ||
| 590 | + | ||
| 591 | + while (--i >= 0) | ||
| 592 | + close(tmp_sockets[i]); | ||
| 593 | + | ||
| 594 | + if (sockfd < 0) | ||
| 595 | + return -1; | ||
| 596 | + | ||
| 597 | FD_SET(sockfd, &SVC_FDSET); | ||
| 598 | return sockfd; | ||
| 599 | } | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb index 84b8e76315..5bad6f17ad 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.3.bb +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb | |||
| @@ -4,24 +4,23 @@ NFS server and related tools." | |||
| 4 | HOMEPAGE = "http://nfs.sourceforge.net/" | 4 | HOMEPAGE = "http://nfs.sourceforge.net/" |
| 5 | SECTION = "console/network" | 5 | SECTION = "console/network" |
| 6 | 6 | ||
| 7 | LICENSE = "GPLv2+" | 7 | LICENSE = "MIT & GPLv2+ & BSD" |
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" | 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=95f3a93a5c3c7888de623b46ea085a84" |
| 9 | 9 | ||
| 10 | # util-linux for libblkid | 10 | # util-linux for libblkid |
| 11 | DEPENDS = "libcap libnfsidmap libevent util-linux tcp-wrappers" | 11 | DEPENDS = "libcap libnfsidmap libevent util-linux tcp-wrappers sqlite3" |
| 12 | RDEPENDS_${PN} = "rpcbind" | 12 | RDEPENDS_${PN} = "rpcbind" |
| 13 | RRECOMMENDS_${PN} = "kernel-module-nfsd" | 13 | RRECOMMENDS_${PN} = "kernel-module-nfsd" |
| 14 | 14 | ||
| 15 | PR = "r5" | 15 | SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \ |
| 16 | 16 | file://nfs-utils.1.2.8.rc3.patch \ | |
| 17 | SRC_URI = "${SOURCEFORGE_MIRROR}/nfs/nfs-utils-${PV}.tar.bz2 \ | ||
| 18 | file://nfs-utils-1.0.6-uclibc.patch \ | 17 | file://nfs-utils-1.0.6-uclibc.patch \ |
| 19 | file://nfs-utils-1.2.3-uclibc-libio.h.patch \ | 18 | file://nfs-utils-1.2.3-uclibc-libio.h.patch \ |
| 20 | file://nfs-utils-nfsctl-x32-fix.patch \ | 19 | file://nfs-utils-1.2.3-sm-notify-res_init.patch \ |
| 21 | file://nfsserver" | 20 | file://nfsserver" |
| 22 | 21 | ||
| 23 | SRC_URI[md5sum] = "1131dc5f27c4f3905a6e7ee0d594fd4d" | 22 | SRC_URI[md5sum] = "3b5ca797197765dc0c3a4122720c7716" |
| 24 | SRC_URI[sha256sum] = "5575ece941097cbfa67fbe0d220dfa11b73f5e6d991e7939c9339bd72259ff19" | 23 | SRC_URI[sha256sum] = "7ef8e0a8b22cd7ff33f3afd28e770d45643fae303468a180640c2967833fe75e" |
| 25 | 24 | ||
| 26 | PARALLEL_MAKE = "" | 25 | PARALLEL_MAKE = "" |
| 27 | 26 | ||
| @@ -38,11 +37,15 @@ inherit autotools update-rc.d | |||
| 38 | 37 | ||
| 39 | # --enable-uuid is need for cross-compiling | 38 | # --enable-uuid is need for cross-compiling |
| 40 | EXTRA_OECONF = "--with-statduser=nobody \ | 39 | EXTRA_OECONF = "--with-statduser=nobody \ |
| 41 | --enable-nfsv41 \ | 40 | --enable-mountconfig \ |
| 41 | --enable-libmount-mount \ | ||
| 42 | --disable-nfsv41 \ | ||
| 42 | --enable-uuid \ | 43 | --enable-uuid \ |
| 43 | --disable-gss \ | 44 | --disable-gss \ |
| 44 | --disable-tirpc \ | 45 | --disable-tirpc \ |
| 45 | --with-statedir=/var/lib/nfs" | 46 | --disable-nfsdcltrack \ |
| 47 | --with-statdpath=/var/lib/nfs/statd \ | ||
| 48 | " | ||
| 46 | 49 | ||
| 47 | INHIBIT_AUTO_STAGE = "1" | 50 | INHIBIT_AUTO_STAGE = "1" |
| 48 | 51 | ||
