summaryrefslogtreecommitdiffstats
path: root/x11vnc/inet.c
diff options
context:
space:
mode:
authorrunge <runge>2006-03-05 00:35:33 +0000
committerrunge <runge>2006-03-05 00:35:33 +0000
commita9a9c812f7feb5bfb1d017575762c6a6390227b9 (patch)
tree1f1e013d1c905b0e705ec245aa9fec1df6cb1c30 /x11vnc/inet.c
parentb03a920cb996bf61af2d9351d2fe497ea3c0c99e (diff)
downloadlibtdevnc-a9a9c812f7feb5bfb1d017575762c6a6390227b9.tar.gz
libtdevnc-a9a9c812f7feb5bfb1d017575762c6a6390227b9.zip
x11vnc: -unixpw on *bsd, hpux and tru64. -unixpw_nis mode. stunnel and gui tweaks.
Diffstat (limited to 'x11vnc/inet.c')
-rw-r--r--x11vnc/inet.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/x11vnc/inet.c b/x11vnc/inet.c
index c4433a9..852056c 100644
--- a/x11vnc/inet.c
+++ b/x11vnc/inet.c
@@ -288,6 +288,9 @@ char *ident_username(rfbClientPtr client) {
}
user = newuser;
}
+ if (!strcmp(user, "unknown-user") && cd && cd->unixname[0] != '\0') {
+ user = cd->unixname;
+ }
newhost = ip2host(client->host);
len = strlen(user) + 1 + strlen(newhost) + 1;
str = (char *) malloc(len);
@@ -318,7 +321,20 @@ int have_ssh_env(void) {
char *str, *p = getenv("SSH_CONNECTION");
char *rhost, *rport, *lhost, *lport;
- if (! p) return 0;
+ if (! p) {
+ char *q = getenv("SSH_CLIENT");
+ if (! q) {
+ return 0;
+ }
+ if (strstr(q, "127.0.0.1") != NULL) {
+ return 0;
+ }
+ return 1;
+ }
+
+ if (strstr(p, "127.0.0.1") != NULL) {
+ return 0;
+ }
str = strdup(p);
@@ -342,10 +358,10 @@ int have_ssh_env(void) {
if (0) fprintf(stderr, "%d/%d - '%s' '%s'\n", atoi(rport), atoi(lport), rhost, lhost);
- if (atoi(rport) < 0 || atoi(rport) > 65535) {
+ if (atoi(rport) <= 16 || atoi(rport) > 65535) {
goto fail;
}
- if (atoi(lport) < 0 || atoi(lport) > 65535) {
+ if (atoi(lport) <= 16 || atoi(lport) > 65535) {
goto fail;
}
@@ -358,7 +374,6 @@ if (0) fprintf(stderr, "%d/%d - '%s' '%s'\n", atoi(rport), atoi(lport), rhost, l
return 1;
fail:
-fprintf(stderr, "failed:\n");
free(str);