summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-21 14:58:35 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-21 14:58:35 -0700
commitd9b91758e044a70242dee1697345cd2ee4a096d4 (patch)
treeb3e0ba0a848e70efd6be26c23a91270d72037161 /node
parent4e26ade2df364b7149b1cd720f9e225542684e06 (diff)
downloadinfinitytier-d9b91758e044a70242dee1697345cd2ee4a096d4.tar.gz
infinitytier-d9b91758e044a70242dee1697345cd2ee4a096d4.zip
Fix command line interface.
Diffstat (limited to 'node')
-rw-r--r--node/Node.cpp6
-rw-r--r--node/NodeConfig.cpp6
2 files changed, 7 insertions, 5 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 1ffc0e79..20a049bc 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -90,8 +90,10 @@ struct _NodeControlClientImpl
static void _CBipcResultHandler(void *arg,IpcConnection *ipcc,IpcConnection::EventType event,const char *result)
{
- if ((event == IpcConnection::IPC_EVENT_COMMAND)&&(result))
- ((_NodeControlClientImpl *)arg)->resultHandler(((_NodeControlClientImpl *)arg)->arg,result);
+ if ((event == IpcConnection::IPC_EVENT_COMMAND)&&(result)) {
+ if (strcmp(result,"200 auth OK"))
+ ((_NodeControlClientImpl *)arg)->resultHandler(((_NodeControlClientImpl *)arg)->arg,result);
+ }
}
Node::NodeControlClient::NodeControlClient(const char *hp,void (*resultHandler)(void *,const char *),void *arg,const char *authToken)
diff --git a/node/NodeConfig.cpp b/node/NodeConfig.cpp
index 6f122498..30438fc6 100644
--- a/node/NodeConfig.cpp
+++ b/node/NodeConfig.cpp
@@ -195,12 +195,12 @@ void NodeConfig::_doCommand(IpcConnection *ipcc,const char *commandLine)
Mutex::Lock _l(_connections_m);
_connections[ipcc] = true;
ipcc->printf("200 auth OK"ZT_EOL_S);
- } else ipcc->printf("403 auth FAILED"ZT_EOL_S);
+ } else ipcc->printf("403 auth failed"ZT_EOL_S);
} else {
{
Mutex::Lock _l(_connections_m);
if (!_connections[ipcc]) {
- ipcc->printf("403 not authorized"ZT_EOL_S""ZT_EOL_S);
+ ipcc->printf("403 %s unauthorized"ZT_EOL_S"."ZT_EOL_S,cmd[0].c_str());
return;
}
}
@@ -307,7 +307,7 @@ void NodeConfig::_doCommand(IpcConnection *ipcc,const char *commandLine)
}
}
- ipcc->printf(ZT_EOL_S); // blank line ends response
+ ipcc->printf("."ZT_EOL_S); // blank line ends response
}
void NodeConfig::_readLocalConfig()