summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ndb/cs.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-06-14 19:20:06 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-06-14 19:20:06 +0200
commit2e0fac766c44301086d98910555ba351778cfb52 (patch)
tree13c20c8e9f2dd5f85b35b06c74b3ba6c6a71add5 /sys/src/cmd/ndb/cs.c
parent249915c3795858582dbf5b0f1e1533b50b90737d (diff)
ndb/cs, ndb/dns: ignore special commands from users different from the one we run the service owner
this prevents users like "none" from toggling special options in ndb/dns and ndb/cs.
Diffstat (limited to 'sys/src/cmd/ndb/cs.c')
-rw-r--r--sys/src/cmd/ndb/cs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/src/cmd/ndb/cs.c b/sys/src/cmd/ndb/cs.c
index 4e0ed17d6..f760c8f39 100644
--- a/sys/src/cmd/ndb/cs.c
+++ b/sys/src/cmd/ndb/cs.c
@@ -87,6 +87,7 @@ int *isslave; /* *isslave non-zero means this is a slave process */
long active; /* number of active slaves */
char *dbfile;
Ndb *db, *netdb;
+char *csuser;
void rversion(Job*);
void rflush(Job*);
@@ -266,6 +267,7 @@ main(int argc, char *argv[])
netinit(0);
if(!justsetname){
+ csuser = estrdup(getuser());
mountinit(servefile, mntpt);
io();
}
@@ -779,6 +781,9 @@ rwrite(Job *job, Mfile *mf)
}
job->request.data[cnt] = 0;
+ if(strcmp(mf->user, "none") == 0 || strcmp(mf->user, csuser) != 0)
+ goto query; /* skip special commands if not owner */
+
/*
* toggle debugging
*/
@@ -825,6 +830,7 @@ rwrite(Job *job, Mfile *mf)
goto send;
}
+query:
if(mf->ref){
err = "query already in progress";
goto send;