1. Add the "sys" alias for "unix", as well as "none", and "null"
authorzoulasc <christos@zoulas.com>
Mon, 7 Mar 2016 23:03:19 +0000 (18:03 -0500)
committerzoulasc <christos@zoulas.com>
Mon, 7 Mar 2016 23:03:19 +0000 (18:03 -0500)
2. Properly handle multiple flavors, although the linux kernel does not (yet?)
3. Don't add the "sec=" field, because it is already there.

libamu/mount_fs.c

index 87f64c369d1f0f3881938e7b885e80826c23ff43..366eb8b0cbd73799d295b16f13926e0d873d4f28 100644 (file)
@@ -1076,7 +1076,10 @@ struct {
   const char *name;
   int num;
 } flavours[] = {
+  { "none",     AUTH_NONE },
+  { "null",     AUTH_NULL },
   { "unix",    AUTH_UNIX },
+  { "sys",      AUTH_SYS },
   { "krb5",    RPC_AUTH_GSS_KRB5 },
   { "krb5i",   RPC_AUTH_GSS_KRB5I },
   { "krb5p",   RPC_AUTH_GSS_KRB5P },
@@ -1104,12 +1107,13 @@ set_nfs4_security(nfs4_args_t *nap, mntent_t *mntp)
   nap->auth_flavours = xmalloc(l * sizeof(*nap->auth_flavours));
 
   s = ss = xstrdup(o);
+  l = 0;
   for (;;) {
     q = strchr(s, ',');
     if (q)
        *q = '\0';
 
-    for (l = 0, i = 0; i < sizeof(flavours) / sizeof(flavours[0]); i++)
+    for (i = 0; i < sizeof(flavours) / sizeof(flavours[0]); i++)
       if (strcmp(flavours[i].name, s) == 0) {
        nap->auth_flavours[l++] = flavours[i].num;
        break;
@@ -1125,6 +1129,9 @@ set_nfs4_security(nfs4_args_t *nap, mntent_t *mntp)
     s = ++q;
   }
 
+  if (l == 0) {
+    nap->auth_flavours[l++] = AUTH_UNIX;
+  }
   nap->auth_flavourlen = l;
   return ss;
 }
@@ -1172,12 +1179,15 @@ add_nfs4_mntopts(const nfs4_args_t *nap, mntent_t *mntp, char *sec)
   opts = xrealloc(mntp->mnt_opts, len);
   xstrlcat(opts, buf, len);
 
+#ifdef notdef
+  /* Already in the options */
   if (sec) {
     xstrlcat(opts, ",", len);
     xstrlcat(opts, MNTTAB_OPT_SEC, len);
     xstrlcat(opts, "=", len);
     xstrlcat(opts, sec, len);
   }
+#endif
 
   mntp->mnt_opts = opts;
 }