devproc: fix noteid permission checks for none
make sure noteid is valid (>0). prohibit changing note group of kernel processes. this is also checked for in pgrpnote(). prevent "none" user from changing its note group to another "none" sessions. this would allow him to send notes other none processes other than its own.
This commit is contained in:
parent
00ff4beaa7
commit
0feb6e06af
1 changed files with 6 additions and 1 deletions
|
@ -1136,16 +1136,21 @@ procwrite(Chan *c, void *va, long n, vlong off)
|
|||
error("note not posted");
|
||||
break;
|
||||
case Qnoteid:
|
||||
if(p->kp)
|
||||
error(Eperm);
|
||||
id = atoi(a);
|
||||
if(id <= 0)
|
||||
error(Ebadarg);
|
||||
if(id == p->pid) {
|
||||
p->noteid = id;
|
||||
break;
|
||||
}
|
||||
t = proctab(0);
|
||||
for(et = t+conf.nproc; t < et; t++) {
|
||||
if(t->state == Dead)
|
||||
if(t->state == Dead || t->kp)
|
||||
continue;
|
||||
if(id == t->noteid) {
|
||||
nonone(t);
|
||||
if(strcmp(p->user, t->user) != 0)
|
||||
error(Eperm);
|
||||
p->noteid = id;
|
||||
|
|
Loading…
Reference in a new issue