mirror of
git://git.proxmox.com/git/vncterm.git
synced 2024-12-22 21:33:49 +03:00
fix argument parser
rfbPurgeArguments() moves arguments, so we need to decrement i after purge, and use 'else if' (else we depend on argument order). Also delete PVE_VNC_TICKET from environment (child don't need that).
This commit is contained in:
parent
c6d5b0959b
commit
5a90889767
19
vncterm.c
19
vncterm.c
@ -2334,20 +2334,17 @@ main (int argc, char** argv)
|
||||
if (!strcmp (argv[i], "-timeout")) {
|
||||
CHECK_ARGC (argc, argv, i);
|
||||
idle_timeout = atoi(argv[i+1]);
|
||||
rfbPurgeArguments(&argc, &i, 2, argv);
|
||||
}
|
||||
if (!strcmp (argv[i], "-authpath")) {
|
||||
rfbPurgeArguments(&argc, &i, 2, argv); i--;
|
||||
} else if (!strcmp (argv[i], "-authpath")) {
|
||||
CHECK_ARGC (argc, argv, i);
|
||||
auth_path = argv[i+1];
|
||||
rfbPurgeArguments(&argc, &i, 2, argv);
|
||||
}
|
||||
if (!strcmp (argv[i], "-perm")) {
|
||||
rfbPurgeArguments(&argc, &i, 2, argv); i--;
|
||||
} else if (!strcmp (argv[i], "-perm")) {
|
||||
CHECK_ARGC (argc, argv, i);
|
||||
auth_perm = argv[i+1];
|
||||
rfbPurgeArguments(&argc, &i, 2, argv);
|
||||
}
|
||||
if (!strcmp (argv[i], "-notls")) {
|
||||
rfbPurgeArguments(&argc, &i, 1, argv);
|
||||
rfbPurgeArguments(&argc, &i, 2, argv); i--;
|
||||
} else if (!strcmp (argv[i], "-notls")) {
|
||||
rfbPurgeArguments(&argc, &i, 1, argv); i--;
|
||||
if ((vncticket = getenv("PVE_VNC_TICKET")) == NULL) {
|
||||
fprintf(stderr, "missing env PVE_VNC_TICKET (-notls)\n");
|
||||
exit(-1);
|
||||
@ -2355,6 +2352,8 @@ main (int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
unsetenv("PVE_VNC_TICKET"); // do not expose this to child
|
||||
|
||||
#ifdef DEBUG
|
||||
rfbLogEnable (1);
|
||||
gnutls_global_set_log_level(10);
|
||||
|
Loading…
Reference in New Issue
Block a user