summaryrefslogtreecommitdiff
path: root/one.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <[email protected]>2021-05-25 14:40:40 -0400
committerAdam Ierymenko <[email protected]>2021-05-25 14:40:40 -0400
commit6b3a7ec82713006b1b8fad9b09e9b8fe0124b3b3 (patch)
treea54b9447d071b2351140c8f6150c5b6f82c34395 /one.cpp
parented2360d9f7ab5a8ef8f55097c5a5a64b0c498b58 (diff)
Fix a few things...
Diffstat (limited to 'one.cpp')
-rw-r--r--one.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/one.cpp b/one.cpp
index d83ef5be..eb3198e7 100644
--- a/one.cpp
+++ b/one.cpp
@@ -786,20 +786,21 @@ static int cli(int argc,char **argv)
}
}
if (aa.length() == 0) aa = "-";
+ const std::string status = OSUtils::jsonString(n["status"],"-");
printf("200 listnetworks %s %s %s %s %s %s %s" ZT_EOL_S,
OSUtils::jsonString(n["nwid"],"-").c_str(),
OSUtils::jsonString(n["name"],"-").c_str(),
OSUtils::jsonString(n["mac"],"-").c_str(),
- OSUtils::jsonString(n["status"],"-").c_str(),
+ status.c_str(),
OSUtils::jsonString(n["type"],"-").c_str(),
OSUtils::jsonString(n["portDeviceName"],"-").c_str(),
aa.c_str());
int64_t authenticationExpiryTime = n["authenticationExpiryTime"];
if (authenticationExpiryTime >= 0) {
- if (n["status"] == "AUTHENTICATION_REQUIRED") {
- printf(" SSO authentication required, URL: %s" ZT_EOL_S, OSUtils::jsonString(n["authenticationURL"], "(null)").c_str());
- } else {
- printf(" SSO authentication expires in %lld" ZT_EOL_S, (authenticationExpiryTime - OSUtils::now()) / 1000LL);
+ if (status == "AUTHENTICATION_REQUIRED") {
+ printf(" AUTH EXPIRED, URL: %s" ZT_EOL_S, OSUtils::jsonString(n["authenticationURL"], "(null)").c_str());
+ } else if (status == "OK") {
+ printf(" AUTH OK, expires in: %lld seconds" ZT_EOL_S, (authenticationExpiryTime - OSUtils::now()) / 1000LL);
}
}
}