diff options
author | runge <runge> | 2006-09-17 18:08:23 +0000 |
---|---|---|
committer | runge <runge> | 2006-09-17 18:08:23 +0000 |
commit | dba5e098767b71bb017fa191cc3f07dc68437655 (patch) | |
tree | 2cc3de51656fb733b93baaa0b7a02a058801cd3c /x11vnc/sslcmds.c | |
parent | 31d3a9fa8d081c573822fd8b66b9cdf70092c9d2 (diff) | |
download | libvncserver-dba5e098767b71bb017fa191cc3f07dc68437655.zip libvncserver-dba5e098767b71bb017fa191cc3f07dc68437655.tar.gz |
x11vnc: -verbose, -connect_or_exit, -rfbport 0, print out SSL cert.
Diffstat (limited to 'x11vnc/sslcmds.c')
-rw-r--r-- | x11vnc/sslcmds.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/x11vnc/sslcmds.c b/x11vnc/sslcmds.c index cf69910..d1ed95c 100644 --- a/x11vnc/sslcmds.c +++ b/x11vnc/sslcmds.c @@ -314,6 +314,7 @@ void setup_stunnel(int rport, int *argc, char **argv) { argv[i+1] = strdup(tmp); *argc += 2; got_rfbport = 1; + got_rfbport_val = atoi(tmp); } } stunnel_port = rport; @@ -710,14 +711,34 @@ void sslEncKey(char *path, int mode) { unlink(tmp); if (! mode && cert && cert[0] != '\0') { - file = fopen(path, "a"); + int got_cert = 0; + file = fopen(path, "r"); if (file == NULL) { rfbLog("sslEncKey: %s\n", path); rfbLogPerror("fopen"); exit(1); } - fprintf(file, "%s", cert); + while (fgets(line, 1024, file) != NULL) { + if (strstr(line, "-----BEGIN CERTIFICATE-----") + == line) { + got_cert++; + } + if (strstr(line, "-----END CERTIFICATE-----") + == line) { + got_cert++; + } + } fclose(file); + if (got_cert < 2) { + file = fopen(path, "a"); + if (file == NULL) { + rfbLog("sslEncKey: %s\n", path); + rfbLogPerror("fopen"); + exit(1); + } + fprintf(file, "%s", cert); + fclose(file); + } free(cert); } |