ref: 8c70c09bfdfb5857e60e2455642603a883847c14
parent: a2623fd82a1a49ee588b1ff14b0aa472d30a5ee2
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 3 19:30:57 EDT 2018
devaoe: fix dotdot walk in devlinkdir, make perms consistent
--- a/sys/src/9/port/devaoe.c
+++ b/sys/src/9/port/devaoe.c
@@ -828,7 +828,7 @@
Qid q;
d = unit2dev(UNIT(c->qid));
- perm = 0644;
+ perm = 0664;
size = 0;
vers = d->vers;
t = QTFILE;
@@ -841,7 +841,7 @@
break;
case Qdata:
p = "data";
- perm = 0640;
+ perm = 0660;
if(UP(d))
size = d->bsize;
break;
@@ -881,7 +881,7 @@
return -1;
case Qtopctl:
p = "ctl";
- perm = 0644;
+ perm = 0664;
break;
case Qtoplog:
p = "log";
@@ -949,24 +949,24 @@
return unitgen(c, TYPE(c->qid), dp);
case Qdevlinkdir:
i = UNIT(c->qid);
+ if(i >= Maxunits || i >= units.ref)
+ return -1;
+ d = unit2dev(i);
if(s == DEVDOTDOT){
mkqid(&q, QID(i, Qunitdir), 0, QTDIR);
- devdir(c, q, "devlink", 0, eve, 0555, dp);
+ devdir(c, q, unitname(d), 0, eve, 0555, dp);
return 1;
}
- if(i >= Maxunits || i >= units.ref)
- return -1;
- d = unit2dev(i);
if(s >= d->ndl)
return -1;
uprint("%d", s);
mkqid(&q, Q3(s, i, Qdevlink), 0, QTFILE);
- devdir(c, q, up->genbuf, 0, eve, 0755, dp);
+ devdir(c, q, up->genbuf, 0, eve, 0444, dp);
return 1;
case Qdevlink:
uprint("%d", s);
mkqid(&q, Q3(s, UNIT(c->qid), Qdevlink), 0, QTFILE);
- devdir(c, q, up->genbuf, 0, eve, 0755, dp);
+ devdir(c, q, up->genbuf, 0, eve, 0444, dp);
return 1;
}
}