From 91c6116d7fc0d138eccb979f1135ee686fe38bbb Mon Sep 17 00:00:00 2001
From: Evan Doiron <edoiron@cbnco.com>
Date: Wed, 26 Aug 2009 05:25:06 +0000
Subject: add sscep: v0.0.2008.1211

http://patchwork.openembedded.org/patch/998/

Signed-off-by: Evan Doiron <edoiron@cbnco.com>
Signed-off-by: Michael Smith <msmith@cbnco.com>
---
 recipes/sscep/files/ca_segfault.patch | 10 ++++++
 recipes/sscep/files/httphost.patch    | 66 +++++++++++++++++++++++++++++++++++
 recipes/sscep/files/memleak.patch     | 25 +++++++++++++
 recipes/sscep/sscep_0.0.20081211.bb   | 21 +++++++++++
 4 files changed, 122 insertions(+)
 create mode 100644 recipes/sscep/files/ca_segfault.patch
 create mode 100644 recipes/sscep/files/httphost.patch
 create mode 100644 recipes/sscep/files/memleak.patch
 create mode 100644 recipes/sscep/sscep_0.0.20081211.bb

(limited to 'recipes/sscep')

diff --git a/recipes/sscep/files/ca_segfault.patch b/recipes/sscep/files/ca_segfault.patch
new file mode 100644
index 0000000000..1a438b9be1
--- /dev/null
+++ b/recipes/sscep/files/ca_segfault.patch
@@ -0,0 +1,10 @@
+--- a/sscep.c	2009-07-10 11:43:14.000000000 -0400
++++ b/sscep.c	2009-07-10 10:53:37.000000000 -0400
+@@ -469,6 +469,7 @@
+ 				pname, c_char);
+ 			(void)fclose(fp);
+ 			pkistatus = SCEP_PKISTATUS_SUCCESS;
++			scep_t.pki_status = SCEP_PKISTATUS_SUCCESS;
+ 			break;
+ 
+ 		case SCEP_OPERATION_GETCERT:
diff --git a/recipes/sscep/files/httphost.patch b/recipes/sscep/files/httphost.patch
new file mode 100644
index 0000000000..313df16309
--- /dev/null
+++ b/recipes/sscep/files/httphost.patch
@@ -0,0 +1,66 @@
+commit cb3827e31b14e4830bdfd309c12f5510e0402d8d
+Author: michael <michael@ea9f5d8b-f83d-0410-bf23-ec2180cbb196>
+Date:   Mon Jun 25 21:52:51 2007 +0000
+
+    20040325.1: add HTTP Host: header to work behind Hughes satellite autoproxy
+    
+    
+    git-svn-id: file:///usr/local/httpd/SourceForge/home/users/michael/svn/svnrepos/os/packages/sscep/trunk@37 ea9f5d8b-f83d-0410-bf23-ec2180cbb196
+
+diff --git a/sscep.c b/sscep.c
+index 6ec2a4d..6eefdc9 100644
+--- a/sscep.c
++++ b/sscep.c
+@@ -16,6 +16,7 @@ main(int argc, char **argv) {
+ 	int			c, host_port = 80, count = 1;
+ 	char			*host_name, *p, *dir_name = NULL;
+ 	char			http_string[16384];
++	char			http_host[256];
+ 	struct http_reply	reply;
+ 	unsigned int		n;
+ 	unsigned char		md[EVP_MAX_MD_SIZE];
+@@ -250,6 +251,9 @@ main(int argc, char **argv) {
+ 	if (p_flag) {
+ 		host_name = strdup(p_char);
+ 		dir_name = url_char;
++
++		/* I won't bother with the Host: header for proxy mode. */
++		http_host[0] = '\0';
+ 	}
+ 
+ 	/* Break down the URL */
+@@ -289,6 +293,12 @@ main(int argc, char **argv) {
+ 				host_port);
+ 		exit (SCEP_PKISTATUS_ERROR);
+ 	}
++	if (!p_flag) {
++		if (snprintf(http_host, sizeof(http_host), "Host: %s:%d\r\n",
++			     host_name, host_port) >= sizeof(http_host)) {
++			http_host[0] = '\0';
++		}
++	}
+ 	if (v_flag) {
+ 		fprintf(stdout, "%s: hostname: %s\n", pname, host_name);
+ 		fprintf(stdout, "%s: directory: %s\n", pname, dir_name);
+@@ -349,8 +359,8 @@ main(int argc, char **argv) {
+ 			/* Forge the HTTP message */
+ 			snprintf(http_string, sizeof(http_string),
+ 			 "GET %s%s?operation=GetCACert&message=%s "
+-			 "HTTP/1.0\r\n\r\n", p_flag ? "" : "/", dir_name,
+-					i_char); 
++			 "HTTP/1.0\r\n%s\r\n", p_flag ? "" : "/",
++					dir_name, i_char, http_host);
+ 			printf("%s: requesting CA certificate\n", pname);
+ 			if (d_flag)
+ 				fprintf(stdout, "%s: scep msg: %s", pname,
+@@ -549,8 +559,8 @@ not_enroll:
+ 			snprintf(http_string, sizeof(http_string),
+ 				"GET %s%s?operation="
+ 				"PKIOperation&message="
+-				"%s HTTP/1.0\r\n\r\n",
+-				p_flag ? "" : "/", dir_name, p);
++				"%s HTTP/1.0\r\n%s\r\n",
++				p_flag ? "" : "/", dir_name, p, http_host);
+ 
+ 			free(p);
+ 			p = NULL;
diff --git a/recipes/sscep/files/memleak.patch b/recipes/sscep/files/memleak.patch
new file mode 100644
index 0000000000..59256a49c8
--- /dev/null
+++ b/recipes/sscep/files/memleak.patch
@@ -0,0 +1,25 @@
+commit ec9b27537400def0bee1ebbbdd69f2cf5486a99a
+Author: michael <michael@ea9f5d8b-f83d-0410-bf23-ec2180cbb196>
+Date:   Mon May 9 16:10:54 2005 +0000
+
+    Maybe fix a memory leak
+    
+    
+    git-svn-id: file:///usr/local/httpd/SourceForge/home/users/michael/svn/svnrepos/os/packages/sscep/trunk@15 ea9f5d8b-f83d-0410-bf23-ec2180cbb196
+
+diff --git a/sscep.c b/sscep.c
+index 637f1f0..b8f3289 100644
+--- a/sscep.c
++++ b/sscep.c
+@@ -539,7 +539,10 @@ not_enroll:
+ 				"GET %s%s?operation="
+ 				"PKIOperation&message="
+ 				"%s HTTP/1.0\r\n\r\n",
+-				p_flag ? "" : "/", dir_name, p); 
++				p_flag ? "" : "/", dir_name, p);
++
++			free(p);
++			p = NULL;
+ 
+ 			if (d_flag)
+ 				fprintf(stdout, "%s: scep msg: %s",
diff --git a/recipes/sscep/sscep_0.0.20081211.bb b/recipes/sscep/sscep_0.0.20081211.bb
new file mode 100644
index 0000000000..7791e23546
--- /dev/null
+++ b/recipes/sscep/sscep_0.0.20081211.bb
@@ -0,0 +1,21 @@
+DESCRIPTION = "Simple SCEP Client for Unix"
+SECTION = "console/utils"
+LICENSE = "BSD"
+
+SRC_URI = " \
+	http://www.klake.org/~jt/sscep/sscep.tgz \
+	file://memleak.patch;patch=1 \
+	file://httphost.patch;patch=1 \
+	file://ca_segfault.patch;patch=1 \
+"
+
+S = "${WORKDIR}/${PN}"
+
+do_compile() {
+	oe_runmake
+}
+
+do_install() {
+	install -d ${D}${bindir}
+	install -m 0755 sscep ${D}${bindir}/sscep
+}
-- 
cgit v1.2.3