summaryrefslogtreecommitdiff
path: root/one.cpp
diff options
context:
space:
mode:
authorMichael Adams <[email protected]>2020-09-10 12:42:11 -0700
committerMichael Adams <[email protected]>2020-09-10 12:42:11 -0700
commit0545e70bd58051a048730543684d3ac06cedfd09 (patch)
tree48a573967375c478663f01993dd6d7b3cf6550a2 /one.cpp
parent43c108f077cb01f48e043e2fef52a0b67a3548b3 (diff)
Added error messages to use admin/sudo/root
Diffstat (limited to 'one.cpp')
-rw-r--r--one.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/one.cpp b/one.cpp
index 20cdebfe..8b5ed4cf 100644
--- a/one.cpp
+++ b/one.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c)2019 ZeroTier, Inc.
+ * Copyright (c)2020 ZeroTier, Inc.
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file in the project's root directory.
@@ -85,7 +85,7 @@ using namespace ZeroTier;
static OneService *volatile zt1Service = (OneService *)0;
#define PROGRAM_NAME "ZeroTier One"
-#define COPYRIGHT_NOTICE "Copyright (c) 2019 ZeroTier, Inc."
+#define COPYRIGHT_NOTICE "Copyright (c) 2020 ZeroTier, Inc."
#define LICENSE_GRANT "Licensed under the ZeroTier BSL 1.1 (see LICENSE.txt)"
/****************************************************************************/
@@ -232,9 +232,12 @@ static int cli(int argc,char **argv)
if (!homeDir.length())
homeDir = OneService::platformDefaultHomePath();
+ // TODO: cleanup this logic
+ // A lot of generic CLI errors land here; missing admin rights cause a bit of this.
if ((!port)||(!authToken.length())) {
if (!homeDir.length()) {
fprintf(stderr,"%s: missing port or authentication token and no home directory specified to auto-detect" ZT_EOL_S,argv[0]);
+ fprintf(stderr, "If you did not, please run this command as an Administrator / sudo / Root user. Thanks!");
return 2;
}
@@ -244,6 +247,7 @@ static int cli(int argc,char **argv)
port = Utils::strToUInt(portStr.c_str());
if ((port == 0)||(port > 0xffff)) {
fprintf(stderr,"%s: missing port and zerotier-one.port not found in %s" ZT_EOL_S,argv[0],homeDir.c_str());
+ fprintf(stderr, "If you did not, please run this command as an Administrator / sudo / Root user. Thanks!");
return 2;
}
}
@@ -266,6 +270,7 @@ static int cli(int argc,char **argv)
#endif
if (!authToken.length()) {
fprintf(stderr,"%s: missing authentication token and authtoken.secret not found (or readable) in %s" ZT_EOL_S,argv[0],homeDir.c_str());
+ fprintf(stderr, "If you did not, please run this command as an Administrator / sudo / Root user. Thanks!");
return 2;
}
}
@@ -1316,6 +1321,7 @@ static BOOL WINAPI _winConsoleCtrlHandler(DWORD dwCtrlType)
return FALSE;
}
+// TODO: revisit this with https://support.microsoft.com/en-us/help/947709/how-to-use-the-netsh-advfirewall-firewall-context-instead-of-the-netsh
static void _winPokeAHole()
{
char myPath[MAX_PATH];
@@ -1690,7 +1696,7 @@ int main(int argc,char **argv)
ptmp.append(*pi);
if ((*pi != ".")&&(*pi != "..")) {
if (!OSUtils::mkdir(ptmp))
- throw std::runtime_error("home path does not exist, and could not create");
+ throw std::runtime_error("home path does not exist, and could not create. Please verify local system permissions.");
}
}
}