summaryrefslogtreecommitdiffstats
path: root/x11vnc/sslhelper.c
diff options
context:
space:
mode:
authorrunge <runge>2006-09-17 18:08:23 +0000
committerrunge <runge>2006-09-17 18:08:23 +0000
commitdba5e098767b71bb017fa191cc3f07dc68437655 (patch)
tree2cc3de51656fb733b93baaa0b7a02a058801cd3c /x11vnc/sslhelper.c
parent31d3a9fa8d081c573822fd8b66b9cdf70092c9d2 (diff)
downloadlibtdevnc-dba5e098767b71bb017fa191cc3f07dc68437655.tar.gz
libtdevnc-dba5e098767b71bb017fa191cc3f07dc68437655.zip
x11vnc: -verbose, -connect_or_exit, -rfbport 0, print out SSL cert.
Diffstat (limited to 'x11vnc/sslhelper.c')
-rw-r--r--x11vnc/sslhelper.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c
index 26c36b1..abd0a77 100644
--- a/x11vnc/sslhelper.c
+++ b/x11vnc/sslhelper.c
@@ -146,9 +146,35 @@ char *get_saved_pem(char *save, int create) {
}
}
return new;
- } else {
- return strdup(path);
}
+
+ if (! quiet) {
+ char line[1024];
+ int on = 0;
+ FILE *in = fopen(path, "r");
+ if (in != NULL) {
+ rfbLog("\n");
+ rfbLog("Using SSL Certificate:\n");
+ fprintf(stderr, "\n");
+ while (fgets(line, 1024, in) != NULL) {
+ if (strstr(line, "BEGIN CERTIFICATE")) {
+ on = 1;
+ }
+ if (on) {
+ fprintf(stderr, "%s", line);
+ }
+ if (strstr(line, "END CERTIFICATE")) {
+ on = 0;
+ }
+ if (strstr(line, "PRIVATE KEY")) {
+ on = 0;
+ }
+ }
+ fprintf(stderr, "\n");
+ fclose(in);
+ }
+ }
+ return strdup(path);
}
static char *get_input(char *tag, char **in) {
@@ -441,14 +467,17 @@ static char *create_tmp_pem(char *pathin, int prompt) {
return NULL;
}
while (fgets(line, 1024, in) != NULL) {
- if (strstr(line, "-----BEGIN CERTIFICATE-----")) {
+ if (strstr(line, "BEGIN CERTIFICATE")) {
on = 1;
}
fprintf(out, "%s", line);
if (on) {
fprintf(crt, "%s", line);
}
- if (strstr(line, "-----END CERTIFICATE-----")) {
+ if (strstr(line, "END CERTIFICATE")) {
+ on = 0;
+ }
+ if (strstr(line, "PRIVATE KEY")) {
on = 0;
}
}