cluster-devel.redhat.com archive mirror
 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 ricci/commo ...
Date: 22 Mar 2007 03:42:39 -0000	[thread overview]
Message-ID: <20070322034239.19107.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-03-22 03:42:38

Modified files:
	luci/conga_ssl : SSLClient.cpp 
	ricci/common   : XML.cpp 
Added files:
	ricci/test_suite: SSLClient_send_to_ricci 

Log message:
	- Suppress warning and error messages that libxml2 can write to stderr
	- Add a new script for exercising the conga SSL python module

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/conga_ssl/SSLClient.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/XML.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/SSLClient_send_to_ricci.diff?cvsroot=cluster&r1=NONE&r2=1.1

--- conga/luci/conga_ssl/SSLClient.cpp	2006/12/21 21:32:00	1.2
+++ conga/luci/conga_ssl/SSLClient.cpp	2007/03/22 03:42:38	1.3
@@ -81,14 +81,14 @@
   if (!SSL_CTX_load_verify_locations(ctx, 
 				     _trust_CAs, 
 				     NULL))
-    cout << "failed to load trusted CAs" << endl;
+    ;//cout << "failed to load trusted CAs" << endl;
   
   STACK_OF(X509_NAME) *cert_names = 
     SSL_load_client_CA_file(_trust_CAs);
   if (cert_names)
     SSL_CTX_set_client_CA_list(ctx, cert_names);
-  else
-    cout << "failed to load trusted CAs" << endl;
+//  else
+//    cout << "failed to load trusted CAs" << endl;
   
   // load saved certs
   
--- conga/ricci/common/XML.cpp	2006/10/23 18:43:35	1.7
+++ conga/ricci/common/XML.cpp	2007/03/22 03:42:38	1.8
@@ -189,7 +189,7 @@
 			      xml.size(),
 			      "noname.xml",
 			      NULL,
-			      XML_PARSE_NONET);
+			      XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
   if (!doc)
     throw String("parseXML(): couldn't parse xml");
   
@@ -216,7 +216,7 @@
 			      xml.size(),
 			      "noname.xml",
 			      NULL,
-			      XML_PARSE_NONET);
+			      XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
   if (!doc) {
     //    cout << xml << endl;
     throw String("generateXML(): internal error");
/cvs/cluster/conga/ricci/test_suite/SSLClient_send_to_ricci,v  -->  standard output
revision 1.1
--- conga/ricci/test_suite/SSLClient_send_to_ricci
+++ -	2007-03-22 03:42:39.354601000 +0000
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+
+import socket
+import sys, os
+import xml.dom
+import xml
+from xml.dom import minidom
+
+import sys
+sys.path.append('/var/lib/luci/Extensions')
+from conga_ssl import SSLSocket
+
+
+WRITE_TIMEOUT = 600
+READ_TIMEOUT = 600
+CONNECT_TIMEOUT = 4
+
+RICCI_PORT = 11111
+
+
+def send_to_ricci(hostname, msg):
+    ss = SSLSocket(hostname, RICCI_PORT, CONNECT_TIMEOUT)
+    
+    res1 = ss.recv(READ_TIMEOUT)
+    ss.send(msg, WRITE_TIMEOUT)
+    res2 = ''
+    while True:
+        buff = ss.recv(READ_TIMEOUT)
+        if buff == '':
+            break
+        res2 += buff
+        try:
+            minidom.parseString(res2)
+            break
+        except:
+            pass
+    return res1, res2
+
+
+def main(argv):
+    certs_present = True
+    if os.access('cacert.pem', os.R_OK) == False:
+        print 'cannot find cacert.pem'
+        certs_present = False
+    if os.access('privkey.pem', os.R_OK) == False:
+        print 'cannot find privkey.pem'
+        certs_present = False
+    
+    if len(argv) != 3 or not certs_present:
+        print 'sends <command_file> to ricci on <hostname>, and writes its response to stdout'
+        print '\t' + argv[0] + ' <hostname> <command_file>'
+        print '\t\thostname - host to send command to'
+        print '\t\txml_file - file with valid ricci request to be sent'
+        print '\t./ has to contain privkey.pem and cacert.pem'
+        sys.exit(1)
+
+    hostname = argv[1]
+    filename = argv[2]
+    res = send_to_ricci(hostname, open(filename).read(100000))
+    print res[1]
+    if res[1].find('success="5"') > -1:
+        print "not authenticated, send ricci/authenticate.xml with root password in it"
+
+
+
+
+# If called from the command line
+if __name__ == '__main__':
+    main(sys.argv)
+



                 reply	other threads:[~2007-03-22  3:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070322034239.19107.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).