summaryrefslogtreecommitdiffstats
path: root/nest/cli.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-02-21 09:57:26 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-02-21 09:57:26 +0100
commite0a45fb42163a6bfdeeee44bd0a6a7461552e10f (patch)
treed0c889a0b98ea7d269e44c1693d5a3fbb6322738 /nest/cli.h
parente304fd4bcf5813b581a39078a25a5cf6916b9f29 (diff)
downloadbird-e0a45fb42163a6bfdeeee44bd0a6a7461552e10f.tar
bird-e0a45fb42163a6bfdeeee44bd0a6a7461552e10f.zip
Restricted read-only CLI.
Also adds support for executing commands using birdc <cmd>.
Diffstat (limited to 'nest/cli.h')
-rw-r--r--nest/cli.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/nest/cli.h b/nest/cli.h
index f816ef1..57414a2 100644
--- a/nest/cli.h
+++ b/nest/cli.h
@@ -33,6 +33,7 @@ typedef struct cli {
void (*cleanup)(struct cli *c);
void *rover; /* Private to continuation routine */
int last_reply;
+ int restricted; /* CLI is restricted to read-only commands */
struct linpool *parser_pool; /* Pool used during parsing */
byte *ring_buf; /* Ring buffer for asynchronous messages */
byte *ring_end, *ring_read, *ring_write; /* Pointers to the ring buffer */
@@ -60,6 +61,14 @@ void cli_kick(cli *);
void cli_written(cli *);
void cli_echo(unsigned int class, byte *msg);
+static inline int cli_access_restricted(void)
+{
+ if (this_cli && this_cli->restricted)
+ return (cli_printf(this_cli, 8007, "Access denied"), 1);
+ else
+ return 0;
+}
+
/* Functions provided by sysdep layer */
void cli_write_trigger(cli *);