Wikipost expects it can mount a wikifs from /srv. But consider the case where we are using https plus passwords to export a "private" wiki via httpd, and to modify pages with wikipost. Then it is not so desirable for a publicly readable /srv entry to show the private bits to everybody who can log in to the web server. This patch leverages private namespaces to fix the problem. Before trying to mount /srv/wiki.%s onto /mnt/wiki, wikipost will first see if a /mnt/wiki.%s exists in its (httpd's) namespace. If so, it will bind that /mnt/wiki.%s onto /mnt/wiki and use it. In other words, the wikifs can be "stored" in httpd's namespace instead of being "stored" in /srv. The code falls back to the pre-existing behavior if there is no /mnt/wiki.%s. Reference: /n/sources/patch/applied/wikipost-trybind Date: Thu Jun 5 00:36:28 CES 2008 Signed-off-by: davide+p9@cs.cmu.edu --- /sys/src/cmd/ip/httpd/wikipost.c Thu Jun 5 00:28:42 2008 +++ /sys/src/cmd/ip/httpd/wikipost.c Thu Jun 5 20:59:47 2008 @@ -120,6 +120,18 @@ char buf[64]; int fd; + /* already in (possibly private) namespace? */ + snprint(buf, sizeof buf, "/mnt/wiki.%s/new", service); + if (access(buf, AREAD) == 0){ + if (bind(buf, "/mnt/wiki", MREPL) < 0){ + syslog(0, LOG, "%s bind /mnt/wiki failed: %r", hp->remotesys); + hfail(c, HNotFound); + exits("bind /mnt/wiki failed"); + } + return; + } + + /* old way: public wikifs from /srv */ snprint(buf, sizeof buf, "/srv/wiki.%s", service); if((fd = open(buf, ORDWR)) < 0){ syslog(0, LOG, "%s open %s failed: %r", buf, hp->remotesys);