713 void
714 srv_secinfo_treeclimb(nfs_export_t *ne, exportinfo_t *exip, secinfo_t *sec,
715 int seccnt, bool_t isadd)
716 {
717 treenode_t *tnode = exip->exi_tree;
718
719 ASSERT(RW_WRITE_HELD(&ne->exported_lock));
720 ASSERT(tnode != NULL);
721
722 if (seccnt == 0)
723 return;
724
725 /*
726 * If flavors are being added and the new export root isn't
727 * also VROOT, its implicitly allowed flavors are inherited from
728 * its pseudonode.
729 * Note - for VROOT exports the implicitly allowed flavors were
730 * transferred from the PSEUDO export in exportfs()
731 */
732 if (isadd && !(exip->exi_vp->v_flag & VROOT) &&
733 tnode->tree_vis->vis_seccnt > 0) {
734 srv_secinfo_add(&exip->exi_export.ex_secinfo,
735 &exip->exi_export.ex_seccnt, tnode->tree_vis->vis_secinfo,
736 tnode->tree_vis->vis_seccnt, FALSE);
737 }
738
739 /*
740 * Move to parent node and propagate sec flavor
741 * to exportinfo and to visible structures.
742 */
743 tnode = tnode->tree_parent;
744
745 while (tnode != NULL) {
746
747 /* If there is exportinfo, update it */
748 if (tnode->tree_exi != NULL) {
749 secinfo_t **pxsec =
750 &tnode->tree_exi->exi_export.ex_secinfo;
751 int *pxcnt = &tnode->tree_exi->exi_export.ex_seccnt;
752 int is_pseudo = PSEUDO(tnode->tree_exi);
2059 break;
2060 }
2061
2062 if (v4srv)
2063 exi = checkexport4(&vp->v_vfsp->vfs_fsid, &fid, vp);
2064 else
2065 exi = checkexport(&vp->v_vfsp->vfs_fsid, &fid);
2066
2067 if (exi != NULL) {
2068 /*
2069 * Found the export info
2070 */
2071 break;
2072 }
2073
2074 /*
2075 * We have just failed finding a matching export.
2076 * If we're at the root of this filesystem, then
2077 * it's time to stop (with failure).
2078 */
2079 if (vp->v_flag & VROOT) {
2080 error = EINVAL;
2081 break;
2082 }
2083
2084 if (walk != NULL)
2085 (*walk)++;
2086
2087 /*
2088 * Now, do a ".." up vp. If dvp is supplied, use it,
2089 * otherwise, look it up.
2090 */
2091 if (dvp == NULL) {
2092 error = VOP_LOOKUP(vp, "..", &dvp, NULL, 0, NULL, cr,
2093 NULL, NULL, NULL);
2094 if (error)
2095 break;
2096 }
2097 VN_RELE(vp);
2098 vp = dvp;
2099 dvp = NULL;
|
713 void
714 srv_secinfo_treeclimb(nfs_export_t *ne, exportinfo_t *exip, secinfo_t *sec,
715 int seccnt, bool_t isadd)
716 {
717 treenode_t *tnode = exip->exi_tree;
718
719 ASSERT(RW_WRITE_HELD(&ne->exported_lock));
720 ASSERT(tnode != NULL);
721
722 if (seccnt == 0)
723 return;
724
725 /*
726 * If flavors are being added and the new export root isn't
727 * also VROOT, its implicitly allowed flavors are inherited from
728 * its pseudonode.
729 * Note - for VROOT exports the implicitly allowed flavors were
730 * transferred from the PSEUDO export in exportfs()
731 */
732 if (isadd && !(exip->exi_vp->v_flag & VROOT) &&
733 !VN_IS_CURZONEROOT(exip->exi_vp) &&
734 tnode->tree_vis->vis_seccnt > 0) {
735 srv_secinfo_add(&exip->exi_export.ex_secinfo,
736 &exip->exi_export.ex_seccnt, tnode->tree_vis->vis_secinfo,
737 tnode->tree_vis->vis_seccnt, FALSE);
738 }
739
740 /*
741 * Move to parent node and propagate sec flavor
742 * to exportinfo and to visible structures.
743 */
744 tnode = tnode->tree_parent;
745
746 while (tnode != NULL) {
747
748 /* If there is exportinfo, update it */
749 if (tnode->tree_exi != NULL) {
750 secinfo_t **pxsec =
751 &tnode->tree_exi->exi_export.ex_secinfo;
752 int *pxcnt = &tnode->tree_exi->exi_export.ex_seccnt;
753 int is_pseudo = PSEUDO(tnode->tree_exi);
2060 break;
2061 }
2062
2063 if (v4srv)
2064 exi = checkexport4(&vp->v_vfsp->vfs_fsid, &fid, vp);
2065 else
2066 exi = checkexport(&vp->v_vfsp->vfs_fsid, &fid);
2067
2068 if (exi != NULL) {
2069 /*
2070 * Found the export info
2071 */
2072 break;
2073 }
2074
2075 /*
2076 * We have just failed finding a matching export.
2077 * If we're at the root of this filesystem, then
2078 * it's time to stop (with failure).
2079 */
2080 if ((vp->v_flag & VROOT) || VN_IS_CURZONEROOT(vp)) {
2081 error = EINVAL;
2082 break;
2083 }
2084
2085 if (walk != NULL)
2086 (*walk)++;
2087
2088 /*
2089 * Now, do a ".." up vp. If dvp is supplied, use it,
2090 * otherwise, look it up.
2091 */
2092 if (dvp == NULL) {
2093 error = VOP_LOOKUP(vp, "..", &dvp, NULL, 0, NULL, cr,
2094 NULL, NULL, NULL);
2095 if (error)
2096 break;
2097 }
2098 VN_RELE(vp);
2099 vp = dvp;
2100 dvp = NULL;
|