diff --git a/lib3270.cbp b/lib3270.cbp
index 82463d3..a2a962a 100644
--- a/lib3270.cbp
+++ b/lib3270.cbp
@@ -50,6 +50,9 @@
+
+
+
@@ -225,6 +228,7 @@
+
diff --git a/src/core/array.c b/src/core/array.c
new file mode 100644
index 0000000..2c0c11e
--- /dev/null
+++ b/src/core/array.c
@@ -0,0 +1,79 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como array.c e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ */
+
+
+/**
+ * @brief Handle text arrays.
+ */
+
+ #include
+ #include
+ #include
+ #include
+
+/*---[ Implement ]------------------------------------------------------------------------------------------------------------*/
+
+LIB3270_STRING_ARRAY * lib3270_string_array_new(void)
+{
+ LIB3270_STRING_ARRAY * array = lib3270_malloc(sizeof(LIB3270_STRING_ARRAY));
+ memset(array,0,sizeof(LIB3270_STRING_ARRAY));
+
+ return array;
+}
+
+void lib3270_string_array_free(LIB3270_STRING_ARRAY *array)
+{
+ size_t ix;
+
+ if(array)
+ {
+ for(ix = 0; ix < array->length; ix++)
+ lib3270_free((char *) array->str[ix]);
+
+ lib3270_free(array->str);
+ lib3270_free(array);
+ }
+}
+
+LIB3270_INTERNAL void lib3270_string_array_append(LIB3270_STRING_ARRAY *array, const char *str)
+{
+ if(array->str)
+ {
+ array->str = lib3270_realloc(array->str,(array->length + 1) * sizeof(char *));
+ }
+ else
+ {
+ array->str = lib3270_malloc(sizeof(char *));
+ array->length = 0; // Just in case.
+ }
+
+ array->str[array->length++] = strdup(str);
+
+}
+
diff --git a/src/include/array.h b/src/include/array.h
new file mode 100644
index 0000000..8473c33
--- /dev/null
+++ b/src/include/array.h
@@ -0,0 +1,56 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Este programa está nomeado como - e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ */
+
+/**
+ * @file array.h
+ * @brief Global declarations for array.c.
+ */
+
+#ifndef LIB3270_ARRAY_H_INCLUDED
+
+ #define LIB3270_ARRAY_H_INCLUDED
+
+ #include
+
+ typedef struct _lib3270_string_array
+ {
+ size_t length; ///< @brief Number of elements.
+ const char **str;
+ } LIB3270_STRING_ARRAY;
+
+ LIB3270_INTERNAL LIB3270_STRING_ARRAY * lib3270_string_array_new(void);
+ LIB3270_INTERNAL void lib3270_string_array_free(LIB3270_STRING_ARRAY *object);
+ LIB3270_INTERNAL void lib3270_string_array_append(LIB3270_STRING_ARRAY *object, const char *str);
+
+ inline void lib3270_autoptr_cleanup_LIB3270_STRING_ARRAY(LIB3270_STRING_ARRAY **ptr)
+ {
+ lib3270_string_array_free(*ptr);
+ }
+
+#endif // LIB3270_ARRAY_H_INCLUDED
diff --git a/src/ssl/negotiate.c b/src/ssl/negotiate.c
index 78d8455..c31b359 100644
--- a/src/ssl/negotiate.c
+++ b/src/ssl/negotiate.c
@@ -41,6 +41,7 @@
#include
#include
#include
+ #include
#ifndef SSL_ST_OK
#define SSL_ST_OK 3
@@ -134,16 +135,60 @@ static int background_ssl_init(H3270 *hSession, void *message)
#if !defined(SSL_DEFAULT_CRL_URL) && defined(SSL_ENABLE_CRL_CHECK)
-static int getCRLFromDistPoints(CRL_DIST_POINTS * dist_points, SSL_ERROR_MESSAGE *message)
+static int getCRLFromDistPoints(H3270 *hSession, CRL_DIST_POINTS * dist_points, SSL_ERROR_MESSAGE *message)
{
- int ix;
+ int ix, i, gtype;
+ lib3270_autoptr(LIB3270_STRING_ARRAY) uris = lib3270_string_array_new();
+
+ // https://nougat.cablelabs.com/DLNA-RUI/openssl/commit/57912ed329f870b237f2fd9f2de8dec3477d1729
for(ix = 0; ix < sk_DIST_POINT_num(dist_points); ix++) {
- debug("CRL(%d):", ix);
+ DIST_POINT *dp = sk_DIST_POINT_value(dist_points, ix);
+
+ if(!dp->distpoint || dp->distpoint->type != 0)
+ continue;
+
+ GENERAL_NAMES *gens = dp->distpoint->name.fullname;
+
+ for (i = 0; i < sk_GENERAL_NAME_num(gens); i++)
+ {
+ GENERAL_NAME *gen = sk_GENERAL_NAME_value(gens, i);
+ ASN1_STRING *uri = GENERAL_NAME_get0_value(gen, >ype);
+ if(uri)
+ {
+ const unsigned char * data = ASN1_STRING_get0_data(uri);
+ if(data)
+ {
+ lib3270_string_array_append(uris,(char *) data);
+ }
+ }
+
+ }
+
+ }
+
+#ifdef DEBUG
+ {
+ for(ix = 0; ix < uris->length; ix++)
+ {
+ debug("%u: %s", (unsigned int) ix, uris->str[ix]);
+ }
+ }
+#endif // DEBUG
+ /*
+ if(hSession->ssl.crl.url)
+ {
+ // Check if we already have the URL.
+
+ // The URL is invalid or not to this cert, remove it!
+ lib3270_free(hSession->ssl.crl.url);
+ hSession->ssl.crl.url = NULL;
}
+ */
+
return 0;
}
@@ -247,7 +292,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
return EACCES;
}
- if(getCRLFromDistPoints(dist_points, (SSL_ERROR_MESSAGE *) message))
+ if(getCRLFromDistPoints(hSession, dist_points, (SSL_ERROR_MESSAGE *) message))
return EACCES;
#endif // !SSL_DEFAULT_CRL_URL && SSL_ENABLE_CRL_CHECK
--
libgit2 0.21.2