From: Ben Hutchings Date: Wed, 14 Jul 2010 01:29:37 +0000 (+0100) Subject: Merge branch 'upstream' X-Git-Tag: debian/1%1.0.8-1~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=1408e610ac2db753543a546c4312b2eb6799f044;hp=-c Merge branch 'upstream' Conflicts: config.guess config.sub configure debian/changelog debian/control debian/etc.exports debian/nfs-common.default debian/nfs-common.dirs debian/nfs-common.init debian/nfs-common.install debian/nfs-common.postinst debian/nfs-common.postrm debian/nfs-common.prerm debian/nfs-kernel-server.default debian/nfs-kernel-server.dirs debian/nfs-kernel-server.init debian/nfs-kernel-server.postinst debian/nfs-kernel-server.postrm debian/nfs-kernel-server.prerm debian/rules utils/gssd/Makefile utils/svcgssd/Makefile --- 1408e610ac2db753543a546c4312b2eb6799f044 diff --combined support/export/export.c index edfe52f,27d4440..cfb6681 --- a/support/export/export.c +++ b/support/export/export.c @@@ -6,7 -6,9 +6,9 @@@ * Copyright (C) 1995, 1996 Olaf Kirch */ - #include "config.h" + #ifdef HAVE_CONFIG_H + #include + #endif #include #include @@@ -129,7 -131,7 +131,7 @@@ export_add(nfs_export *exp xlog(L_FATAL, "unknown client type in export_add"); epp = exportlist + type; - while (*epp && slen < strlen((*epp)->m_export.e_path)) + while (*epp && slen <= strlen((*epp)->m_export.e_path)) epp = &((*epp)->m_next); exp->m_next = *epp; *epp = exp; diff --combined support/nfs/exports.c index 7194c08,5d8cf5e..e6de71a --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@@ -14,7 -14,9 +14,9 @@@ * as is, with no warranty expressed or implied. */ - #include "config.h" + #ifdef HAVE_CONFIG_H + #include + #endif #include #include @@@ -67,7 -69,7 +69,7 @@@ struct exportent getexportent(int fromkernel, int fromexports) { static struct exportent ee; - char exp[512]; + char exp[512], *hostname; char rpath[MAXPATHLEN+1]; char *opt, *sp; int ok; @@@ -87,8 -89,8 +89,8 @@@ ee.e_flags &= ~NFSEXP_GATHERED_WRITES; } ee.e_maptype = CLE_MAP_IDENT; - ee.e_anonuid = -2; - ee.e_anongid = -2; + ee.e_anonuid = 65534; + ee.e_anongid = 65534; ee.e_squids = NULL; ee.e_sqgids = NULL; ee.e_mountpoint = NULL; @@@ -113,9 -115,13 +115,13 @@@ /* Check for default client */ if (ok == 0) exp[0] = '\0'; + + hostname = exp; if ((opt = strchr(exp, '(')) != NULL) { - if (opt == exp) + if (opt == exp) { xlog(L_WARNING, "No host name given with %s %s, suggest *%s to avoid warning", ee.e_path, exp, exp); + hostname = "*"; + } *opt++ = '\0'; if (!(sp = strchr(opt, ')')) || sp[1] != '\0') { syntaxerr("bad option list"); @@@ -126,12 -132,12 +132,12 @@@ } else { xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp); } - if (strlen(exp) >= sizeof(ee.e_hostname)) { + if (strlen(hostname) >= sizeof(ee.e_hostname)) { syntaxerr("client name too long"); export_errno = EINVAL; return NULL; } - strncpy(ee.e_hostname, exp, sizeof (ee.e_hostname) - 1); + strncpy(ee.e_hostname, hostname, sizeof (ee.e_hostname) - 1); ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0'; if (parseopts(opt, &ee, fromexports) < 0) @@@ -161,7 -167,7 +167,7 @@@ putexportent(struct exportent *ep fp = efp->x_fp; for (i=0; esc[i]; i++) - if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\'|| isspace(esc[i])) + if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\' || esc[i] == '#' || isspace(esc[i])) fprintf(fp, "\\%03o", esc[i]); else fprintf(fp, "%c", esc[i]); @@@ -265,8 -271,8 +271,8 @@@ mkexportent(char *hname, char *path, ch ee.e_flags = EXPORT_DEFAULT_FLAGS; ee.e_maptype = CLE_MAP_IDENT; - ee.e_anonuid = -2; - ee.e_anongid = -2; + ee.e_anonuid = 65534; + ee.e_anongid = 65534; ee.e_squids = NULL; ee.e_sqgids = NULL; ee.e_mountpoint = NULL; diff --combined utils/exportfs/exportfs.c index 6e09b21,c3ba997..cd49a3b --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@@ -8,7 -8,9 +8,9 @@@ * Extensive changes, 1999, Neil Brown */ - #include "config.h" + #ifdef HAVE_CONFIG_H + #include + #endif #include #include @@@ -410,9 -412,9 +412,9 @@@ dump(int verbose c = dumpopt(c, "mapping=ugidd"); else if (ep->e_maptype == CLE_MAP_FILE) c = dumpopt(c, "mapping=file"); - if (ep->e_anonuid != -2) + if (ep->e_anonuid != 65534) c = dumpopt(c, "anonuid=%d", ep->e_anonuid); - if (ep->e_anongid != -2) + if (ep->e_anongid != 65534) c = dumpopt(c, "anongid=%d", ep->e_anongid); printf("%c\n", (c != '(')? ')' : ' '); diff --combined utils/exportfs/exports.man index 65aeefb,f420a20..fd6d4be --- a/utils/exportfs/exports.man +++ b/utils/exportfs/exports.man @@@ -29,9 -29,6 +29,9 @@@ double quotes. You can also specify spa the export name using a backslash followed by the character code as three octal digits. .PP +To apply changes to this file, run exportfs -ra or (on Debian) +/etc/init.d/nfs-kernel-server reload. +.PP .SS Machine Name Formats NFS clients may be specified in a number of ways: .IP "single host @@@ -112,13 -109,6 +112,13 @@@ Using this option usually improves perf an unclean server restart (i.e. a crash) can cause data to be lost or corrupted. +.TP +.IR sync +Reply to requests only after the changes have been committed to stable +storage (see +.IR async +above). + In releases of nfs-utils upto and including 1.0.0, this option was the default. In this and future releases, .I sync @@@ -178,6 -168,14 +178,14 @@@ copes with the situation effectively The option can be explicitly disabled with .IR hide . .TP + .IR crossmnt + This option is similar to + .I nohide + but it makes it possible for clients to move from the filesystem marked + with crossmnt to exported filesystems mounted on it. Thus when a child + filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has + the same effect as setting "nohide" on B. + .TP .IR no_subtree_check This option disables subtree checking, which has mild security implications, but can improve reliability in some circumstances. @@@ -333,7 -331,7 +341,7 @@@ By default '''in the password file at startup time. If it isn't found, a uid and gid .I exportfs chooses a uid and gid -of -2 (i.e. 65534) for squashed access. These values can also be overridden by +of 65534 for squashed access. These values can also be overridden by the .IR anonuid " and " anongid options. diff --combined utils/mountd/mountd.c index a2ecb98,9cf2a1f..0d77e4a --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@@ -6,7 -6,9 +6,9 @@@ * Copyright (C) 1995, 1996 Olaf Kirch */ - #include "config.h" + #ifdef HAVE_CONFIG_H + #include + #endif #include #include @@@ -54,7 -56,6 +56,7 @@@ static struct option longopts[] { "port", 1, 0, 'p' }, { "no-tcp", 0, 0, 'n' }, { "ha-callout", 1, 0, 'H' }, + { "state-directory-path", 1, 0, 's' }, { NULL, 0, 0, 0 } }; @@@ -75,6 -76,14 +77,14 @@@ killer (int sig xlog (L_FATAL, "Caught signal %d, un-registering and exiting.", sig); } + static void + sig_hup (int sig) + { + /* don't exit on SIGHUP */ + xlog (L_NOTICE, "Received SIGHUP... Ignoring.\n", sig); + return; + } + bool_t mount_null_1_svc(struct svc_req *rqstp, void *argp, void *resp) { @@@ -97,10 -106,11 +107,11 @@@ mount_dump_1_svc(struct svc_req *rqstp { struct sockaddr_in *addr = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt); - xlog(L_NOTICE, "dump request from %s", - inet_ntoa(addr->sin_addr)); - *res = mountlist_list(); + if ((*res = mountlist_list()) == NULL) + xlog(L_WARNING, "dump request from %s failed.", + inet_ntoa(addr->sin_addr)); + return 1; } @@@ -150,9 -160,11 +161,11 @@@ mount_export_1_svc(struct svc_req *rqst { struct sockaddr_in *addr = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt); - xlog(L_NOTICE, "export request from %s", - inet_ntoa(addr->sin_addr)); - *resp = get_exportlist(); + + if ((*resp = get_exportlist()) == NULL) + xlog(L_WARNING, "export request from %s failed.", + inet_ntoa(addr->sin_addr)); + return 1; } @@@ -161,9 -173,10 +174,10 @@@ mount_exportall_1_svc(struct svc_req *r { struct sockaddr_in *addr = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt); - xlog(L_NOTICE, "exportall request from %s", - inet_ntoa(addr->sin_addr)); - *resp = get_exportlist(); + + if ((*resp = get_exportlist()) == NULL) + xlog(L_WARNING, "exportall request from %s failed.", + inet_ntoa(addr->sin_addr)); return 1; } @@@ -235,7 -248,10 +249,10 @@@ mount_pathconf_2_svc(struct svc_req *rq bool_t mount_mnt_3_svc(struct svc_req *rqstp, dirpath *path, mountres3 *res) { - static int flavors[] = { AUTH_NULL, AUTH_UNIX }; + #define AUTH_GSS_KRB5 390003 + #define AUTH_GSS_KRB5I 390004 + #define AUTH_GSS_KRB5P 390005 + static int flavors[] = { AUTH_NULL, AUTH_UNIX, AUTH_GSS_KRB5, AUTH_GSS_KRB5I, AUTH_GSS_KRB5P}; struct nfs_fh_len *fh; xlog(D_CALL, "MNT3(%s) called", *path); @@@ -244,7 -260,8 +261,8 @@@ ok->fhandle.fhandle3_len = fh->fh_size; ok->fhandle.fhandle3_val = fh->fh_handle; - ok->auth_flavors.auth_flavors_len = 2; + ok->auth_flavors.auth_flavors_len + = sizeof(flavors)/sizeof(flavors[0]); ok->auth_flavors.auth_flavors_val = flavors; } return 1; @@@ -410,11 -427,9 +428,9 @@@ get_exportlist(void xfree(c->gr_name); xfree(c); xfree (hp); - if ((c = *cp) == NULL) - break; + continue; } - else - xfree (hp); + xfree (hp); } cp = &(c->gr_next); } @@@ -442,7 -457,6 +458,7 @@@ in main(int argc, char **argv) { char *export_file = _PATH_EXPORTS; + char *state_dir = NFS_STATEDIR; int foreground = 0; int port = 0; int descriptors = 0; @@@ -492,13 -506,6 +508,13 @@@ case 'n': _rpcfdtype = SOCK_DGRAM; break; + case 's': + if ((state_dir = xstrdup(optarg)) == NULL) { + fprintf(stderr, "%s: xstrdup(%s) failed!\n", + argv[0], optarg); + exit(1); + } + break; case 'V': nfs_version |= 1 << (atoi (optarg) - 1); break; @@@ -516,9 -523,9 +532,9 @@@ if (optind != argc || !(nfs_version & 0x7)) usage(argv [0], 1); - if (chdir(NFS_STATEDIR)) { + if (chdir(state_dir)) { fprintf(stderr, "%s: chdir(%s) failed: %s\n", - argv [0], NFS_STATEDIR, strerror(errno)); + argv [0], state_dir, strerror(errno)); exit(1); } @@@ -554,11 -561,8 +570,8 @@@ sigaction(SIGCHLD, &sa, NULL); /* Daemons should close all extra filehandles ... *before* RPC init. */ - if (!foreground) { - int fd = sysconf (_SC_OPEN_MAX); - while (--fd > 2) - (void) close(fd); - } + if (!foreground) + closeall(3); new_cache = check_new_cache(); if (new_cache) @@@ -575,9 -579,10 +588,10 @@@ mount_dispatch, port); sa.sa_handler = killer; - sigaction(SIGHUP, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); + sa.sa_handler = sig_hup; + sigaction(SIGHUP, &sa, NULL); auth_init(export_file); @@@ -615,6 -620,6 +629,6 @@@ usage(const char *prog, int n " [-o num|--descriptors num] [-f exports-file|--exports-file=file]\n" " [-p|--port port] [-V version|--nfs-version version]\n" " [-N version|--no-nfs-version version] [-n|--no-tcp]\n" -" [-H ha-callout-prog]\n", prog); +" [-H ha-callout-prog] [-s|--state-directory-path path]\n", prog); exit(n); } diff --combined utils/nhfsstone/nhfsrun index a91c6af,a0ac0f8..ce77ace --- a/utils/nhfsstone/nhfsrun +++ b/utils/nhfsstone/nhfsrun @@@ -46,7 -46,7 +46,7 @@@ INCR=1 # SIGUSR1 is used by nhfsstone to synchronize child processes. # nothing() { echo -n ""; } -trap nothing 30 +trap nothing USR1 rm -f $OUTFILE @@@ -54,6 -54,6 +54,6 @@@ LOAD=$STAR while [ $LOAD -le $END ]; do echo nhfsstone -l $LOAD nhfsstone -l $LOAD >> $OUTFILE - tail -1 $OUTFILE + tail -n 1 $OUTFILE LOAD=`expr $LOAD + $INCR` done