projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix node name check for "connect" and "disconnect" commands.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
a515259
..
00d8eb9
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-928,7
+928,7
@@
static int cmd_connect(int argc, char *argv[]) {
return 1;
}
return 1;
}
- if(!check_id(argv[
2
])) {
+ if(!check_id(argv[
1
])) {
fprintf(stderr, "Invalid name for node.\n");
return 1;
}
fprintf(stderr, "Invalid name for node.\n");
return 1;
}
@@
-951,7
+951,7
@@
static int cmd_disconnect(int argc, char *argv[]) {
return 1;
}
return 1;
}
- if(!check_id(argv[
2
])) {
+ if(!check_id(argv[
1
])) {
fprintf(stderr, "Invalid name for node.\n");
return 1;
}
fprintf(stderr, "Invalid name for node.\n");
return 1;
}
@@
-1916,7
+1916,7
@@
static int cmd_shell(int argc, char *argv[]) {
}
#else
if(tty)
}
#else
if(tty)
- fputs(
stdout, promp
t);
+ fputs(
prompt, stdou
t);
line = fgets(buf, sizeof buf, stdin);
#endif
line = fgets(buf, sizeof buf, stdin);
#endif
@@
-1951,6
+1951,9
@@
static int cmd_shell(int argc, char *argv[]) {
if(nargc == argc)
continue;
if(nargc == argc)
continue;
+ if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit"))
+ return result;
+
bool found = false;
for(int i = 0; commands[i].command; i++) {
bool found = false;
for(int i = 0; commands[i].command; i++) {
@@
-1962,7
+1965,7
@@
static int cmd_shell(int argc, char *argv[]) {
}
#ifdef HAVE_READLINE
}
#ifdef HAVE_READLINE
- if(found)
+ if(
tty &&
found)
add_history(copy);
#endif
add_history(copy);
#endif