Lots of errors spotted by Alex fixed, added mutexes to accept & I/O, added

"remote" commands to set ACL, start mirror etc.
This commit is contained in:
mbloch
2012-05-29 00:59:12 +01:00
parent c54d4a68ba
commit dcb1633b8b
10 changed files with 120 additions and 28 deletions

View File

@@ -94,6 +94,7 @@ void params_readwrite(
SERVER_ERROR("Couldn't parse connection address '%s'",
s_ip_address);
/* FIXME: duplicated from above */
out->connect_to.v4.sin_port = atoi(s_port);
if (out->connect_to.v4.sin_port < 0 || out->connect_to.v4.sin_port > 65535)
SERVER_ERROR("Port number must be >= 0 and <= 65535");
@@ -129,6 +130,7 @@ void params_readwrite(
void do_serve(struct mode_serve_params* params);
void do_read(struct mode_readwrite_params* params);
void do_write(struct mode_readwrite_params* params);
void do_remote_command(char* command, char* mode, int argc, char** argv);
union mode_params {
struct mode_serve_params serve;
@@ -167,6 +169,14 @@ void mode(char* mode, int argc, char **argv)
syntax();
}
}
else if (strcmp(mode, "acl") == 0 || strcmp(mode, "mirror") == 0 || strcmp(mode, "status") == 0) {
if (argc >= 1) {
do_remote_command(mode, argv[0], argc-1, argv+1);
}
else {
syntax();
}
}
else {
syntax();
}