[Fedora-directory-commits] adminserver/tests setup.sh,1.1,1.2

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Wed Jul 4 01:31:36 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/adminserver/tests
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30934/adminserver/tests

Modified Files:
	setup.sh 
Log Message:
Resolves: bug 246683
Bug Description: Reimplement ds_create without setuputil code
Reviewed by: nhosoi (Thanks!)
Fix Description: ds_create was a CGI program that would create a new instance, set it up to be managed by console, and register it with the config ds.  The new ds_create CGI perl script does just that.  One tricky part was that, rather than enabling the pass through auth plugin and having to restart the server, the new server is created without being started, then the modification is done to the new server dse.ldif file directly, using the new FileConn.pm module, which simulates a Mozilla::LDAP::Conn on an LDIF file.  This also allows us to create a new instance with a pre-hashed rootdn password, rather than having to send the cleartext password.
I had to move around some code in AdminServer and AdminUtil so that I could use it from ds_create.  I also implemented support for the admin server PASSWORD_PIPE in perl so we could use it in other CGI perl scripts.
Finally, the error handling was not consistent in our code, so I made explicit the passing of error messages up and down the stack.  Oh how I wish we could just do this in python and use exception handling . . .
I added a test for ds_create.
Platforms tested: RHEL4
Flag Day: Yes - autotool changes
Doc impact: No.  Should work the same way as the old ds_create.



Index: setup.sh
===================================================================
RCS file: /cvs/dirsec/adminserver/tests/setup.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- setup.sh	9 May 2007 00:26:39 -0000	1.1
+++ setup.sh	4 Jul 2007 01:31:33 -0000	1.2
@@ -10,9 +10,9 @@
 #adminpw=boguspassword
 adminpw=admin
 #needinstance=1
-needdata=1
-usessl=1
-PATH=/usr/lib64/mozldap:$PATH
+#needdata=1
+#usessl=1
+PATH=/usr/lib64/mozldap:/usr/lib/mozldap:$PATH
 export PATH
 
 if [ "$needinstance" ] ; then
@@ -77,10 +77,11 @@
 dir=`pwd`
 
 # CGI env. vars
-ADMSERV_CONF_DIR=$dir/testtmp
-export ADMSERV_CONF_DIR
-ADMSERV_LOG_DIR=$dir/testtmp
-export ADMSERV_LOG_DIR
+#ADMSERV_CONF_DIR=$dir/testtmp
+#ADMSERV_CONF_DIR=$sroot/etc/fedora-ds/admin-serv
+#export ADMSERV_CONF_DIR
+#ADMSERV_LOG_DIR=$dir/testtmp
+#export ADMSERV_LOG_DIR
 HTTP_ACCEPT_LANGUAGE=en
 export HTTP_ACCEPT_LANGUAGE
 SERVER_URL=http://localhost
@@ -95,15 +96,16 @@
 SIEPWD: $adminpw
 EOF
 
-VALGRIND="valgrind --log-file=/var/tmp/vg.out --tool=memcheck --leak-check=yes --suppressions=/home/rmeggins/valgrind.supp --num-callers=40 "
+VALGRIND="valgrind --log-file=/var/tmp/vg.out --tool=memcheck --leak-check=yes --suppressions=$HOME/valgrind.supp --num-callers=40 "
 GDB="gdb -x .gdbinit "
-DEBUGCMD="$VALGRIND"
+#DEBUGCMD="$VALGRIND"
 #DEBUGCMD="$GDB"
 
 PROGS="mergeConfig admpw security ugdsconfig ReadLog start_config_ds \
 	config statpingserv viewdata dsconfig monreplication restartsrv \
 	statusping viewlog htmladmin sec-activate stopsrv download help"
-PROGS=restartsrv
+
+SCRIPTS=ds_create
 
 # each prog has a subdir containing the GET/POST args and any other test data
 for prog in $PROGS ; do
@@ -151,4 +153,26 @@
     rm -f $postlist
 done
 
+for prog in $SCRIPTS ; do
+    getlist=/tmp/gettests.$$
+    find $testdir/$prog -name testget.\* -print 2> /dev/null | sort -n > $getlist
+    for test in `cat $getlist` ; do
+        if [ ! -d results/$prog ] ; then mkdir -p results/$prog ; fi
+        basetest=`basename $test`
+        echo "Running test $test"
+        REQUEST_METHOD=GET ; export REQUEST_METHOD
+        QUERY_STRING="`cat $test`" ; export QUERY_STRING
+        SCRIPT_NAME=slapd/Tasks/Operation/$prog ; export SCRIPT_NAME
+        # open pwpfile for reading as file desc 4 - CGIs have to use stdin (0) for POST
+        exec 4<$pwpfile
+        PASSWORD_PIPE=4 ; export PASSWORD_PIPE
+        if [ -n "$DEBUGCMD" -a "$DEBUGCMD" = "$GDB" ] ; then
+            perl -d admserv/cgi-src40/$prog
+        else
+            perl -w admserv/cgi-src40/$prog
+        fi
+    done
+    rm -f $getlist
+done
+
 rm -rf $pwpfile .gdbinit




More information about the Fedora-directory-commits mailing list