about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--WWW/Library/Implementation/HTTP.c16
-rw-r--r--src/GridText.c10
-rw-r--r--src/HTForms.h4
-rw-r--r--src/LYMainLoop.c14
-rw-r--r--src/LYShowInfo.c8
-rw-r--r--src/LYStrings.c10
-rw-r--r--src/LYStrings.h10
8 files changed, 44 insertions, 34 deletions
diff --git a/CHANGES b/CHANGES
index 411539dc..8f8b75e3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,11 @@
--- $LynxId: CHANGES,v 1.972 2018/04/01 14:31:31 tom Exp $
+-- $LynxId: CHANGES,v 1.973 2018/05/04 22:33:56 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2018-04-01 (2.8.9dev.18)
+2018-05-03 (2.8.9dev.18)
+* add support for using client certificate with OpenSSL configuration (patch
+  by Elliot Thomas).
 * fix a few more memory leaks -TD
 * put Lynx.leaks file in home directory like Lynx.trace (report by GV) -TD
 * fix a memory leak in HTFTP.c -GV
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index c8d0bab4..41ab8499 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.174 2018/03/30 09:12:37 tom Exp $
+ * $LynxId: HTTP.c,v 1.175 2018/05/04 20:07:43 Elliot.Thomas Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -191,9 +191,9 @@ SSL *HTGetSSLHandle(void)
 {
 #ifdef USE_GNUTLS_INCL
     static char *certfile = NULL;
+#endif
     static char *client_keyfile = NULL;
     static char *client_certfile = NULL;
-#endif
 
     if (ssl_ctx == NULL) {
 	/*
@@ -262,7 +262,7 @@ SSL *HTGetSSLHandle(void)
 #endif
 	atexit(free_ssl_ctx);
     }
-#ifdef USE_GNUTLS_INCL
+
     if (non_empty(SSL_client_key_file)) {
 	client_keyfile = SSL_client_key_file;
 	CTRACE((tfp,
@@ -276,13 +276,21 @@ SSL *HTGetSSLHandle(void)
 		"HTGetSSLHandle: client cert file is set to %s by config SSL_CLIENT_CERT_FILE\n",
 		client_certfile));
     }
-
+#ifdef USE_GNUTLS_INCL
     ssl_ctx->certfile = certfile;
     ssl_ctx->certfile_type = GNUTLS_X509_FMT_PEM;
     ssl_ctx->client_keyfile = client_keyfile;
     ssl_ctx->client_keyfile_type = GNUTLS_X509_FMT_PEM;
     ssl_ctx->client_certfile = client_certfile;
     ssl_ctx->client_certfile_type = GNUTLS_X509_FMT_PEM;
+#elif SSLEAY_VERSION_NUMBER >= 0x0930
+    if (client_certfile != NULL) {
+	if (client_keyfile == NULL) {
+	    client_keyfile = client_certfile;
+	}
+	SSL_CTX_use_certificate_chain_file(ssl_ctx, client_certfile);
+	SSL_CTX_use_PrivateKey_file(ssl_ctx, client_keyfile, SSL_FILETYPE_PEM);
+    }
 #endif
     ssl_okay = 0;
     return (SSL_new(ssl_ctx));
diff --git a/src/GridText.c b/src/GridText.c
index 813f03dc..784574b2 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.311 2018/04/01 14:22:01 tom Exp $
+ * $LynxId: GridText.c,v 1.312 2018/05/04 22:53:37 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -10642,7 +10642,7 @@ static void load_a_file(const char *val_used,
 {
     FILE *fd;
     size_t bytes;
-    char buffer[BUFSIZ + 1];
+    char bfr[BUFSIZ + 1];
 
     CTRACE((tfp, "Ok, about to convert \"%s\" to mime/thingy\n", val_used));
 
@@ -10650,8 +10650,8 @@ static void load_a_file(const char *val_used,
 	if ((fd = fopen(val_used, BIN_R)) == 0) {
 	    HTAlert(gettext("Can't open file for uploading"));
 	} else {
-	    while ((bytes = fread(buffer, sizeof(char), BUFSIZ, fd)) != 0) {
-		HTSABCat(result, buffer, (int) bytes);
+	    while ((bytes = fread(bfr, sizeof(char), sizeof(bfr) - 1, fd)) != 0) {
+		HTSABCat(result, bfr, (int) bytes);
 	    }
 	    LYCloseInput(fd);
 	}
@@ -11861,7 +11861,7 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc,
 	 */
 	if (my_query != 0 &&
 	    my_query->len > 5 &&
-	    !strncmp(my_query->str, "file:", 5)) {
+	    !strncmp(my_query->str, "file:", (size_t) 5)) {
 	    strtok(my_query->str, "?");
 	}
 	if (submit_item->submit_method == URL_POST_METHOD || Boundary) {
diff --git a/src/HTForms.h b/src/HTForms.h
index 7f3555da..17f74912 100644
--- a/src/HTForms.h
+++ b/src/HTForms.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTForms.h,v 1.33 2012/02/12 22:30:53 tom Exp $
+ * $LynxId: HTForms.h,v 1.34 2018/05/04 22:50:54 tom Exp $
  */
 #ifndef HTFORMS_H
 #define HTFORMS_H
@@ -75,7 +75,7 @@ extern "C" {
 	char *value;		/* user entered string data */
 	char *orig_value;	/* the original value */
 	int size;		/* width on the screen */
-	size_t maxlength;	/* max width of data */
+	unsigned maxlength;	/* max width of data */
 	int group;		/* a group associated with the link
 				 *  this is used for select's
 				 */
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 05f5cbce..638765eb 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.239 2018/03/05 22:38:53 tom Exp $
+ * $LynxId: LYMainLoop.c,v 1.240 2018/05/04 22:49:06 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -1489,7 +1489,7 @@ static int handle_LYK_ACTIVATE(int *c,
 	 ? (F_SUBMITLIKE((form)->type)) \
 	 : ((form)->type == F_RESET_TYPE))
 
-static FormInfo *FindFormAction(FormInfo * given, BOOLEAN submit)
+static FormInfo *FindFormAction(FormInfo * given, int submit)
 {
     FormInfo *result = NULL;
     FormInfo *fi;
@@ -1512,7 +1512,7 @@ static FormInfo *FindFormAction(FormInfo * given, BOOLEAN submit)
     return result;
 }
 
-static FormInfo *MakeFormAction(FormInfo * given, BOOLEAN submit)
+static FormInfo *MakeFormAction(FormInfo * given, int submit)
 {
     FormInfo *result = 0;
 
@@ -1540,12 +1540,12 @@ static FormInfo *MakeFormAction(FormInfo * given, BOOLEAN submit)
 
 static void handle_LYK_SUBMIT(int cur, DocInfo *doc, BOOLEAN *refresh_screen)
 {
-    FormInfo *form = FindFormAction(links[cur].l_form, TRUE);
+    FormInfo *form = FindFormAction(links[cur].l_form, 1);
     FormInfo *make = NULL;
     char *save_submit_action = NULL;
 
     if (form == 0) {
-	make = MakeFormAction(links[cur].l_form, TRUE);
+	make = MakeFormAction(links[cur].l_form, 1);
 	form = make;
     }
 
@@ -1570,11 +1570,11 @@ static void handle_LYK_SUBMIT(int cur, DocInfo *doc, BOOLEAN *refresh_screen)
 
 static void handle_LYK_RESET(int cur, BOOLEAN *refresh_screen)
 {
-    FormInfo *form = FindFormAction(links[cur].l_form, FALSE);
+    FormInfo *form = FindFormAction(links[cur].l_form, 0);
     FormInfo *make = NULL;
 
     if (form == 0) {
-	make = MakeFormAction(links[cur].l_form, FALSE);
+	make = MakeFormAction(links[cur].l_form, 0);
 	form = make;
     }
 
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index e787f701..01aa5e06 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYShowInfo.c,v 1.79 2018/03/11 21:37:12 tom Exp $ */
+/* $LynxId: LYShowInfo.c,v 1.80 2018/05/04 22:28:57 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFile.h>
 #include <HTParse.h>
@@ -26,8 +26,8 @@
 #define BEGIN_DL(text) fprintf(fp0, "<h2>%s</h2>\n<dl compact>", LYEntifyTitle(&buffer, text))
 #define END_DL()       fprintf(fp0, "\n</dl>\n")
 
-#define ADD_SS(label,value)       dt_String(fp0, label, value, FALSE)
-#define ADD_WW(label,value)       dt_String(fp0, label, value, TRUE)
+#define ADD_SS(label,value)       dt_String(fp0, label, value, 0)
+#define ADD_WW(label,value)       dt_String(fp0, label, value, 1)
 #define ADD_NN(label,value,units) dt_Number(fp0, label, (long) value, units)
 
 static int label_columns;
@@ -67,7 +67,7 @@ const char *LYVersionDate(void)
 static void dt_String(FILE *fp,
 		      const char *label,
 		      const char *value,
-		      BOOL allow_wide)
+		      int allow_wide)
 {
     int have;
     int need;
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 676adddc..e1845bb1 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYStrings.c,v 1.271 2018/03/18 19:14:44 tom Exp $ */
+/* $LynxId: LYStrings.c,v 1.273 2018/05/04 23:29:29 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <UCAux.h>
@@ -2978,7 +2978,7 @@ void LYFinishEdit(FieldEditor * edit)
     FREE(Offs2Col);
 }
 
-void LYSetupEdit(FieldEditor * edit, char *old_value, size_t buffer_limit, int display_limit)
+void LYSetupEdit(FieldEditor * edit, char *old_value, unsigned buffer_limit, int display_limit)
 {
     CTRACE((tfp, "LYSetupEdit buffer %lu, display %d:%s\n",
 	    (unsigned long) buffer_limit,
@@ -2987,7 +2987,7 @@ void LYSetupEdit(FieldEditor * edit, char *old_value, size_t buffer_limit, int d
 
     BufLimit = buffer_limit;
     if (buffer_limit == 0)
-	buffer_limit = strlen(old_value) + 1;
+	buffer_limit = (unsigned) strlen(old_value) + 1;
 
     /*
      * Initialize edit record
@@ -5104,7 +5104,7 @@ int LYhandlePopupList(int cur_choice,
  */
 int LYgetBString(bstring **inputline,
 		 int hidden,
-		 size_t max_cols,
+		 unsigned max_cols,
 		 RecallType recall)
 {
     int x, y;
@@ -5389,7 +5389,7 @@ int LYgetBString(bstring **inputline,
  */
 int LYgetstr(char *inputline,	/* fixed-size buffer for input/output */
 	     int hidden,	/* true to suppress from command-history */
-	     size_t bufsize,	/* sizeof(inputline) */
+	     unsigned bufsize,	/* sizeof(inputline) */
 	     RecallType recall)	/* type of command-history */
 {
     int ch;
diff --git a/src/LYStrings.h b/src/LYStrings.h
index c75b3a85..a401379e 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYStrings.h,v 1.116 2015/10/07 23:20:48 tom Exp $
+ * $LynxId: LYStrings.h,v 1.117 2018/05/04 22:47:10 tom Exp $
  */
 #ifndef LYSTRINGS_H
 #define LYSTRINGS_H
@@ -54,13 +54,13 @@ extern "C" {
     extern int LYgetch_single(void);
     extern int LYgetstr(char *inputline,
 			int masked,
-			size_t bufsize,
+			unsigned bufsize,
 			RecallType recall);
 #define LYGetStr(input,masked,bufsize,recall) \
-	LYgetstr(input,masked,(size_t)(bufsize),recall)
+	LYgetstr(input,masked,(unsigned)(bufsize),recall)
     extern int LYgetBString(bstring **inputline,
 			    int masked,
-			    size_t max_cols,
+			    unsigned max_cols,
 			    RecallType recall);
     extern int LYscanFloat(const char *source, float *result);
     extern int LYscanFloat2(const char **source, float *result);
@@ -357,7 +357,7 @@ extern "C" {
     extern void LYLowerCase(char *buffer);
     extern void LYRefreshEdit(FieldEditor * edit);
     extern void LYSetupEdit(FieldEditor * edit, char *old,
-			    size_t buffer_limit,
+			    unsigned buffer_limit,
 			    int display_limit);
     extern void LYTrimAllStartfile(char *buffer);
     extern void LYTrimLeading(char *buffer);