X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmountd%2Fv4root.c;h=726b50dc61093a2fa926d131131ed59860b1ae8c;hp=81f813bde067777d4b357c86a2ea30a7d1bf0eee;hb=eae2fa997223ce0edb4218faf2ff67165535d21d;hpb=cd4f4d13848bd64f98290ef67ef8572d998d3041 diff --git a/utils/mountd/v4root.c b/utils/mountd/v4root.c index 81f813b..726b50d 100644 --- a/utils/mountd/v4root.c +++ b/utils/mountd/v4root.c @@ -46,6 +46,7 @@ static nfs_export pseudo_root = { .e_nsqgids = 0, .e_fsid = 0, .e_mountpoint = NULL, + .e_ttl = DEFAULT_TTL, }, .m_exported = 0, .m_xtabent = 1, @@ -61,6 +62,8 @@ void set_pseudofs_security(struct exportent *pseudo, struct exportent *source) if (source->e_flags & NFSEXP_INSECURE_PORT) pseudo->e_flags |= NFSEXP_INSECURE_PORT; + if ((source->e_flags & NFSEXP_ROOTSQUASH) == 0) + pseudo->e_flags &= ~NFSEXP_ROOTSQUASH; for (se = source->e_secinfo; se->flav; se++) { struct sec_entry *new; @@ -91,7 +94,8 @@ v4root_create(char *path, nfs_export *export) exp = export_create(&eep, 0); if (exp == NULL) return NULL; - xlog(D_CALL, "v4root_create: path '%s'", exp->m_export.e_path); + xlog(D_CALL, "v4root_create: path '%s' flags 0x%x", + exp->m_export.e_path, exp->m_export.e_flags); return &exp->m_export; } @@ -149,13 +153,13 @@ static int v4root_add_parents(nfs_export *exp) "pseudo export for '%s'", exp->m_export.e_path); return -ENOMEM; } - for (ptr = path + 1; ptr; ptr = strchr(ptr, '/')) { + for (ptr = path; ptr; ptr = strchr(ptr, '/')) { int ret; char saved; saved = *ptr; *ptr = '\0'; - ret = pseudofs_update(hostname, path, exp); + ret = pseudofs_update(hostname, *path ? path : "/", exp); if (ret) return ret; *ptr = saved; @@ -192,6 +196,13 @@ v4root_set() */ continue; + if (strcmp(exp->m_export.e_path, "/") == 0 && + !(exp->m_export.e_flags & NFSEXP_FSID)) { + /* Force '/' to be exported as fsid == 0*/ + exp->m_export.e_flags |= NFSEXP_FSID; + exp->m_export.e_fsid = 0; + } + v4root_add_parents(exp); /* XXX: error handling! */ }