]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Merge branch 'upstream'
authorBen Hutchings <ben@decadent.org.uk>
Wed, 14 Jul 2010 01:29:37 +0000 (02:29 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 14 Jul 2010 01:29:37 +0000 (02:29 +0100)
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

1  2 
support/export/export.c
support/nfs/exports.c
utils/exportfs/exportfs.c
utils/exportfs/exports.man
utils/mountd/mountd.c
utils/nhfsstone/nhfsrun

diff --combined support/export/export.c
index edfe52faf3b54c06c998f06b99776cf50aaff4a0,27d4440c72bb287f32955704d6beda9ad19f17d3..cfb6681093fe8e629eb38ff1289794115191b10b
@@@ -6,7 -6,9 +6,9 @@@
   * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
   */
  
- #include "config.h"
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
  
  #include <string.h>
  #include <sys/types.h>
@@@ -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 7194c08e20b20652196565fbefc859470b8ac510,5d8cf5e30e871ea99e484bf289d8eb3ad9036c3e..e6de71aebfbce484e4c5aae3bf99b87c979408ea
@@@ -14,7 -14,9 +14,9 @@@
   *            as is, with no warranty expressed or implied.
   */
  
- #include "config.h"
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
  
  #include <sys/param.h>
  #include <stdlib.h>
@@@ -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;
        /* 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");
        } 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;
index 6e09b215c5d9c4ca34f13edd8a9d6c3630628f24,c3ba9970dd29bf7001eb5a4cb22bece67e1623e0..cd49a3b21f7f614c677440316586625e37b072d0
@@@ -8,7 -8,9 +8,9 @@@
   * Extensive changes, 1999, Neil Brown <neilb@cse.unsw.edu.au>
   */
  
- #include "config.h"
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
  
  #include <stdlib.h>
  #include <string.h>
@@@ -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 != '(')? ')' : ' ');
index 65aeefbac5d4bce932f5d3df00391460b42820fb,f420a20d60c48a8a54f2284e460c6c22b35f9604..fd6d4be4a74bfe53a44799eef5fcabc7399e2fa1
@@@ -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 a2ecb98c55b320642ecec42f2cf865608d124203,9cf2a1f039853a8c78c1faa29f39cb42439efad7..0d77e4a564d8e377e3a5b319c6874c056f4bada2
@@@ -6,7 -6,9 +6,9 @@@
   * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
   */
  
- #include "config.h"
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
  
  #include <signal.h>
  #include <sys/stat.h>
@@@ -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);
  
                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;
                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;
        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);
        }
  
        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)
                         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 a91c6af1b2153c30116fdb25b973178c6b83ef9b,a0ac0f8a86f38e78e012adfffc8ac034cf4df632..ce77acec2d44d8abf89b609bfb976fce84d83d41
@@@ -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 -1 $OUTFILE
        LOAD=`expr $LOAD + $INCR`
  done