28c28
< __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214649 2010-11-01 21:37:28Z jamie $");
---
> __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214783 2010-11-04 17:01:21Z jamie $");
30a31
> #include <sys/errno.h>
87a89
> [IP__MOUNT_FROM_FSTAB] = {"mount.fstab", PF_INTERNAL | PF_CONV},
432a435
> FILE *f;
434,435c437,438
< char *cs, *ep;
< size_t size;
---
> char *cs, *ep, *ln;
> size_t size, lnlen;
603a607,640
>
> /*
> * Read mount.fstab file(s), and treat each line as its own mount
> * parameter.
> */
> if (j->intparams[IP_MOUNT_FSTAB] != NULL) {
> STAILQ_FOREACH(s, &j->intparams[IP_MOUNT_FSTAB]->val, tq) {
> if (s->len == 0)
> continue;
> f = fopen(s->s, "r");
> if (f == NULL) {
> jail_warnx(j, "mount.fstab: %s: %s",
> s->s, strerror(errno));
> error = -1;
> continue;
> }
> while ((ln = fgetln(f, &lnlen))) {
> if ((cs = memchr(ln, '#', lnlen - 1)))
> lnlen = cs - ln + 1;
> if (ln[lnlen - 1] == '\n' ||
> ln[lnlen - 1] == '#')
> ln[lnlen - 1] = '\0';
> else {
> cs = alloca(lnlen + 1);
> strlcpy(cs, ln, lnlen + 1);
> ln = cs;
> }
> add_param(j, NULL, IP__MOUNT_FROM_FSTAB, ln);
> }
> fclose(f);
> }
> }
> if (error)
> failed(j);
< __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214649 2010-11-01 21:37:28Z jamie $");
---
> __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214783 2010-11-04 17:01:21Z jamie $");
30a31
> #include <sys/errno.h>
87a89
> [IP__MOUNT_FROM_FSTAB] = {"mount.fstab", PF_INTERNAL | PF_CONV},
432a435
> FILE *f;
434,435c437,438
< char *cs, *ep;
< size_t size;
---
> char *cs, *ep, *ln;
> size_t size, lnlen;
603a607,640
>
> /*
> * Read mount.fstab file(s), and treat each line as its own mount
> * parameter.
> */
> if (j->intparams[IP_MOUNT_FSTAB] != NULL) {
> STAILQ_FOREACH(s, &j->intparams[IP_MOUNT_FSTAB]->val, tq) {
> if (s->len == 0)
> continue;
> f = fopen(s->s, "r");
> if (f == NULL) {
> jail_warnx(j, "mount.fstab: %s: %s",
> s->s, strerror(errno));
> error = -1;
> continue;
> }
> while ((ln = fgetln(f, &lnlen))) {
> if ((cs = memchr(ln, '#', lnlen - 1)))
> lnlen = cs - ln + 1;
> if (ln[lnlen - 1] == '\n' ||
> ln[lnlen - 1] == '#')
> ln[lnlen - 1] = '\0';
> else {
> cs = alloca(lnlen + 1);
> strlcpy(cs, ln, lnlen + 1);
> ln = cs;
> }
> add_param(j, NULL, IP__MOUNT_FROM_FSTAB, ln);
> }
> fclose(f);
> }
> }
> if (error)
> failed(j);