summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2013-02-12 13:15:01 +0100
committerOndrej Filip <feela@network.cz>2013-02-12 13:15:01 +0100
commit4c2abee74e64f64fba61aad6e2b66e3895820003 (patch)
tree66daea65e4b1191bfbeb63f2a87ac8e152e73f1e
parent8c4da7e01ded3f06cbf873e67c5ae1cf70cf280b (diff)
Allow submitting BIRD commands from UNIX shell even in restricted mode.
-rw-r--r--client/client.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/client/client.c b/client/client.c
index 8711cf0a..d8f0060c 100644
--- a/client/client.c
+++ b/client/client.c
@@ -29,6 +29,7 @@ static char *opt_list = "s:vr";
static int verbose;
static char *init_cmd;
static int once;
+static int restricted;
static char *server_path = PATH_CONTROL_SOCKET;
static int server_fd;
@@ -70,7 +71,7 @@ parse_args(int argc, char **argv)
verbose++;
break;
case 'r':
- init_cmd = "restrict";
+ restricted = 1;
break;
default:
usage();
@@ -83,9 +84,6 @@ parse_args(int argc, char **argv)
int i;
int len = 0;
- if (init_cmd)
- usage();
-
for (i = optind; i < argc; i++)
len += strlen(argv[i]) + 1;
@@ -303,6 +301,13 @@ update_state(void)
if (nstate == cstate)
return;
+ if (restricted)
+ {
+ submit_server_command("restrict");
+ restricted = 0;
+ return;
+ }
+
if (init_cmd)
{
/* First transition - client received hello from BIRD