All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/conga_ssl SSLClient.cpp SSLClient.h ...
Date: 22 Oct 2007 19:29:13 -0000	[thread overview]
Message-ID: <20071022192913.11387.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-10-22 19:29:13

Modified files:
	luci/conga_ssl : SSLClient.cpp SSLClient.h conga_ssl_lib.cpp 

Log message:
	Fix a bug that could cause requests to be truncated if their length is a multiple of 4096 and they end with '/>'

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/conga_ssl/SSLClient.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/conga_ssl/SSLClient.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/conga_ssl/conga_ssl_lib.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5

--- conga/luci/conga_ssl/SSLClient.cpp	2007/06/18 18:39:31	1.1.2.4
+++ conga/luci/conga_ssl/SSLClient.cpp	2007/10/22 19:29:13	1.1.2.5
@@ -279,19 +279,20 @@
 }
 
 String 
-SSLClient::recv(unsigned int timeout)
+SSLClient::recv(unsigned int timeout, size_t& buflen)
 {
   if (!_connected)
     throw String("cannot receive, yet: SSL connection not connected");
   
   char buff[4096];
   
+  buflen = sizeof(buff);
   unsigned int beg = time_mil();
   while (time_mil() < beg + timeout) {
     int ret = SSL_read(_ssl, buff, sizeof(buff));
     if (ret > 0) {
       String data(buff, ret);
-      shred(buff, sizeof(buff));
+      memset(buff, 0, sizeof(buff));
       return data;
     } else {
       bool want_read, want_write;
--- conga/luci/conga_ssl/SSLClient.h	2006/12/22 17:50:16	1.1.2.2
+++ conga/luci/conga_ssl/SSLClient.h	2007/10/22 19:29:13	1.1.2.3
@@ -48,7 +48,7 @@
   bool connect(unsigned int timeout);
   
   String send(const String& msg, unsigned int timeout);
-  String recv(unsigned int timeout);
+  String recv(unsigned int timeout, size_t& buflen);
   
   
   bool peer_has_cert();
--- conga/luci/conga_ssl/conga_ssl_lib.cpp	2007/06/18 18:39:31	1.1.2.4
+++ conga/luci/conga_ssl/conga_ssl_lib.cpp	2007/10/22 19:29:13	1.1.2.5
@@ -239,25 +239,29 @@
 			int beg = int(time_sec());
 			String xml_in;
 			while (true) {
+				size_t buflen;
 				String ret;
 				if (int(time_sec()) > beg + timeout)
 					throw String("timeout");
 				else {
-					ret = iter->second->recv(400);
+					ret = iter->second->recv(400, buflen);
 					if (ret == "")
 						continue;
 					xml_in += ret;
 				}
 
-				int start = xml_in.length() - 1;
-				while (start > 0 && xml_in[start] == '\n' || xml_in[start] == '\r')
-					start--;
-				start += 2;
-				if ((ret.substr(0, 6) == "<?xml " && xml_in.substr(start - sizeof("/>"), sizeof("/>") - 1) == "/>") ||
-					xml_in.substr(start - sizeof("</ricci>"), sizeof("</ricci>") - 1) == "</ricci>")
-				{
-					resp = xml_in;
-					break;
+				/*
+				** If less characters than the size of the read buffer
+				** were read, we may be done
+				*/
+				if (ret.size() < buflen) {
+					try {
+						resp = xml_in;
+						parseXML(xml_in);
+						break;
+					} catch (...) {
+						continue;
+					}
 				}
 			}
 		}



             reply	other threads:[~2007-10-22 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 19:29 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-13 14:48 [Cluster-devel] conga/luci/conga_ssl SSLClient.cpp SSLClient.h rmccabe
2007-09-12 19:37 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071022192913.11387.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.