summaryrefslogtreecommitdiffstats
path: root/x11vnc/user.c
diff options
context:
space:
mode:
authorrunge <runge>2006-06-09 22:36:41 +0000
committerrunge <runge>2006-06-09 22:36:41 +0000
commit7a3e236390501c14b9d75d80ea88f8a3e69a337a (patch)
tree02c71ad3e894e49d6c0a591ae785bb96f4e39593 /x11vnc/user.c
parent1776a3a55f59052bd69509c889e4370973305f0d (diff)
downloadlibtdevnc-7a3e236390501c14b9d75d80ea88f8a3e69a337a.tar.gz
libtdevnc-7a3e236390501c14b9d75d80ea88f8a3e69a337a.zip
x11vnc: make -display WAIT + -unixpw work on Solaris.
Diffstat (limited to 'x11vnc/user.c')
-rw-r--r--x11vnc/user.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/x11vnc/user.c b/x11vnc/user.c
index 90e791b..aa6432e 100644
--- a/x11vnc/user.c
+++ b/x11vnc/user.c
@@ -1082,15 +1082,15 @@ int wait_for_client(int *argc, char** argv, int http) {
memset(line2, 0, 16384);
if (unixpw) {
- int res = 0, k, j;
+ int res = 0, k, j, i;
char line[18000];
memset(line, 0, 18000);
if (keep_unixpw_user && keep_unixpw_pass) {
n = 18000;
- res = su_verify(keep_unixpw_user, keep_unixpw_pass,
- cmd, line, &n);
+ res = su_verify(keep_unixpw_user,
+ keep_unixpw_pass, cmd, line, &n);
strzero(keep_unixpw_user);
strzero(keep_unixpw_pass);
}
@@ -1100,17 +1100,35 @@ int wait_for_client(int *argc, char** argv, int http) {
rfbLog("wait_for_client: cmd failed: %s\n", cmd);
clean_up_exit(1);
}
+
+ /*
+ * we need to hunt for DISPLAY= since there may be
+ * a login banner or something at the beginning.
+ */
+ q = strstr(line, "DISPLAY=");
+ if (! q) {
+ q = line;
+ }
+ n -= (q - line);
+
for (k = 0; k < 1024; k++) {
- line1[k] = line[k];
- if (line[k] == '\n') {
+ line1[k] = q[k];
+ if (q[k] == '\n') {
k++;
break;
}
}
n -= k;
- while (j < 16384) {
- line2[j] = line[k+j];
- j++;
+ i = 0;
+ for (j = 0; j < 16384; j++) {
+ if (j < 16384 - 1) {
+ /* xauth data, assume pty added CR */
+ if (q[k+j] == '\r' && q[k+j+1] == '\n') {
+ continue;
+ }
+ }
+ line2[i] = q[k+j];
+ i++;
}
} else {
FILE *p = popen(cmd, "r");