[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga luci/conga_ssl/SSLClient.cpp ricci/commo ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe 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)
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]