summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-05-06 09:22:09 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-05-06 09:22:09 +0000
commitb692b00052383b6be4c1f7a72505a59103253db5 (patch)
tree8f88804c4102c555bc675d2d9238754e2e02beaa /src
parente33f23bb4e95f9fbc9768f65900c6bebd122e16b (diff)
downloads6-rc-b692b00052383b6be4c1f7a72505a59103253db5.tar.xz
Some more boilerplate
Diffstat (limited to 'src')
-rw-r--r--src/server/command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/command.c b/src/server/command.c
index 9127714..59fd970 100644
--- a/src/server/command.c
+++ b/src/server/command.c
@@ -18,6 +18,8 @@ static inline int answer (client_t *c, char e)
static int do_query (client_t *c, char const *s, size_t len)
{
if (!len--) return (errno = EPROTO, 0) ;
+ if (!(c->flags & 2)) return answer(c, EPERM) ;
+ /* TODO */
return 1 ;
}
@@ -71,16 +73,25 @@ static int do_monitor (client_t *c, char const *s, size_t len)
static int do_change (client_t *c, char const *s, size_t len)
{
+ if (!len--) return (errno = EPROTO, 0) ;
+ if (!(c->flags & 4)) return answer(c, EPERM) ;
+ /* TODO */
return 1 ;
}
static int do_event (client_t *c, char const *s, size_t len)
{
+ if (!len--) return (errno = EPROTO, 0) ;
+ if (!(c->flags & 8)) return answer(c, EPERM) ;
+ /* TODO */
return 1 ;
}
static int do_admin (client_t *c, char const *s, size_t len)
{
+ if (!len--) return (errno = EPROTO, 0) ;
+ if (!(c->flags & 16)) return answer(c, EPERM) ;
+ /* TODO */
return 1 ;
}