FIX "mountd" BUG IF SUBDIR OF LOCAL MOUNT POINT EXPORTED
authorRick "gopher I <>
Tue, 8 Sep 1992 00:00:00 +0000 (00:00 +0000)
committerRick "gopher I <>
Tue, 8 Sep 1992 00:00:00 +0000 (00:00 +0000)
/sbin/mountd went into an infinite loop when subdirs of local mount
points were exported.

AUTHOR: Rick "gopher I" (root@snowhite.cis.uoguelph.ca)
386BSD-Patchkit: patch00054

usr/src/sbin/mountd/mountd.c

index 2dfba0b..cce57d0 100644 (file)
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+ * --------------------         -----   ----------------------
+ * CURRENT PATCH LEVEL:         1       00054
+ * --------------------         -----   ----------------------
+ *
+ * 08 Sep 92    Rick "gopher I"         Fix infinite loop when subdirs
+ *                                             of local mount exported
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -584,14 +592,20 @@ get_exportlist()
                        while (statfs(ep->ex_dirp, &stfsbuf) < 0 ||
                               mount(MOUNT_UFS, ep->ex_dirp,
                                     stfsbuf.f_flags|MNT_UPDATE, &args) < 0) {
                        while (statfs(ep->ex_dirp, &stfsbuf) < 0 ||
                               mount(MOUNT_UFS, ep->ex_dirp,
                                     stfsbuf.f_flags|MNT_UPDATE, &args) < 0) {
+/* 08 Sep 92*/                 if (cp)
+                                       *cp-- = savedc;
+                               else
+                                       cp = ep->ex_dirp + dirplen - 1;
+#ifdef OMIT
                                if (cp == NULL)
                                        cp = ep->ex_dirp + dirplen - 1;
                                else
                                        *cp = savedc;
                                if (cp == NULL)
                                        cp = ep->ex_dirp + dirplen - 1;
                                else
                                        *cp = savedc;
+#endif /* OMIT*/
                                /* back up over the last component */
                                while (*cp == '/' && cp > ep->ex_dirp)
                                        cp--;
                                /* back up over the last component */
                                while (*cp == '/' && cp > ep->ex_dirp)
                                        cp--;
-                               while (*(cp - 1) != '/' && cp > ep->ex_dirp)
+/* 08 Sep 92*/                 while (cp > ep->ex_dirp && *(cp - 1) != '/')
                                        cp--;
                                if (cp == ep->ex_dirp) {
                                        syslog(LOG_WARNING,
                                        cp--;
                                if (cp == ep->ex_dirp) {
                                        syslog(LOG_WARNING,