echo "Usage: $progname [OPTIONS] hostname"
        echo "Options:"
        echo " -h | --help            Show this help message."
+       echo " -P | --no-proxy        Do not copy existing user proxy."
        echo " hostname               L&B server to use for testing."
 }
 
 fi
 source ${COMMON}
 
+COPYPROXY=1
+
 #logfile=$$.tmp
 #flag=0
 while test -n "$1"
 do
        case "$1" in
                "-h" | "--help") showHelp && exit 2 ;;
+               "-P" | "--no-proxy") COPYPROXY=0 ;;
                *) remotehost=$1 
                        shift
                        outformat=$1
        test_done
 fi
 
-printf "Testing credentials"
-
-timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"`
-
-if [ "$timeleft" = "" ]; then
-        test_failed
-        print_error "No credentials"
-else
-        if [ "$timeleft" = "0:00:00" ]; then
-                test_failed
-                print_error "Credentials expired"
-        else
-                test_done
-
-               # Get path to the proxy cert
-               printf "Getting proxy cert path... "
-
-               PROXYCERT=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^path" | ${SYS_SED} "s/path\s*:\s//"`
-
-               if [ "$PROXYCERT" = "" ]; then
-                       test_failed
-                       print_error "Unable to identify the path to your proxy certificate"
-               else
-                       printf "$PROXYCERT"
-                       test_done
-
-                       printf "L&B server: '$remotehost'"
+printf "L&B server: '$remotehost'\n"
+if [ "$remotehost" == "" ]; then
+       printf "L&B server not specified, exittig...\n\n"
+       exit 1
+fi
 
-                       if [ "$remotehost" = "" ]; then
-                               test_failed
-                       else
-                               test_done
+if [ $COPYPROXY -eq 1 ]; then
+       printf "Testing credentials... "
+       timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//" 2> /dev/null`
+
+       if [ "$timeleft" = "" ]; then
+               printf "No credentials"
+               COPYPROXY=0
+               test_skipped
+       else
+               if [ "$timeleft" = "0:00:00" ]; then
+                       printf "Credentials expired"
+                       COPYPROXY=0
+                       test_skipped
+               else
+                       test_done
+
+                       # Get path to the proxy cert
+                       printf "Getting proxy cert path... "
+
+                       PROXYCERT=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^path" | ${SYS_SED} "s/path\s*:\s//"`
+
+                       if [ "$PROXYCERT" = "" ]; then
+                               printf "Unable to identify the path to your proxy certificate"
+                               COPYPROXY=0
+                               test_skipped
+                       else
+                               printf "$PROXYCERT"
+                               test_done
 
                                scp $PROXYCERT root@$remotehost:/tmp/
+                       fi
+               fi
+       fi
+fi
+
+if [ "$PROXYCERT" == "" ]; then
+       PROXYCERT="none"
+fi
 
 cat << EndArrangeScript > arrange_lb_test_root.sh 
 CERTFILE=\$1
 LBTSTCOLS=\$3
 OUTPUT_OPT=\$4
 
-
 export LBTSTCOLS
 
 yum install -q -y globus-proxy-utils 
 #Standard setup now uses production brokers. No need to install our own.
 #yum install -q -y activemq java-1.6.0-openjdk
 yum install -q -y emi-lb-nagios-plugins
+yum install -q -y voms-clients
 
 /etc/init.d/postgresql start
 mv /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.orig
 #      activemq start
 #fi
 
-
 cd /tmp
 
 glite_id=\`id -u \$GLITE_USER\`
 
 echo \$GLITE_USER user ID is \$glite_id
 
-mv \$CERTFILE x509up_u\$glite_id
-chown \$GLITE_USER:\$GLITE_USER x509up_u\${glite_id}
+if [ $COPYPROXY -eq 1 ]; then
+       mv \$CERTFILE x509up_u\$glite_id
+       chown \$GLITE_USER:\$GLITE_USER x509up_u\${glite_id}
+else
+       rm -rf /tmp/test-certs/grid-security
+       cvs -d :pserver:anonymous@glite.cvs.cern.ch:/cvs/jra1mw co org.glite.testsuites.ctb/LB
+       ./org.glite.testsuites.ctb/LB/tests/lb-generate-fake-proxy.sh
+       scp -rv /tmp/test-certs/grid-security/certificates/* /etc/grid-security/certificates/
+fi
 
 CVSPATH=\`which cvs\`
 
 echo "</verbatim>"
 
 EndArrangeScript
-                               TERMCOLS=`stty size | awk '{print $2}'`
 
-                               chmod +x arrange_lb_test_root.sh
+TERMCOLS=`stty size | awk '{print $2}'`
+
+chmod +x arrange_lb_test_root.sh
 
-                               scp arrange_lb_test_root.sh root@$remotehost:/tmp/
+scp arrange_lb_test_root.sh root@$remotehost:/tmp/
 
-                               ssh -l root $remotehost "sh /tmp/arrange_lb_test_root.sh $PROXYCERT glite $TERMCOLS $outformat"
+ssh -l root $remotehost "sh /tmp/arrange_lb_test_root.sh "$PROXYCERT" glite $TERMCOLS $outformat"
 
                
-                       fi
-               fi
-       fi
-fi
 
 
 {
 cat << EndHelpHeader
 Script for testing correct reporting of LB server properties over BDII/LDAP.
-This should also be thought of as a regression test for bug #55482,
-and ggus ticket #62737.
+This should also be thought of as a regression test for ggus ticket #62737.
 
 Prerequisities:
    - LB server
        test_done
 fi
 
-printf "Checking ServiceStatus... "
+printf "Checking ServiceStatus (Regression into bug #76174)... "
 health=`$SYS_GREP GlueServiceStatus: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
 if [ "$health" == "" ]; then
        print_error "GlueServiceStatus not specified"
 fi
 
 printf "Checking Glue 2.0 entry with 'o=glue'... "
-$SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=glue' 'GLUE2EndpointInterfaceName=org.glite.lb.Server' > ldap.$$.out
+$SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=glue' -S GLUE2EntityCreationTime 'GLUE2EndpointInterfaceName=org.glite.lb.Server' > ldap.$$.out
 if [ $? -gt 0 ]; then  
        test_failed
        print_error "No reply"
        test_done
 fi
 
-printf "Checking GLUE2 HealthStatus... "
-health=`$SYS_GREP GLUE2EndpointHealthState: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'`
+printf "Checking GLUE2 HealthStatus (Regression into bug #76173)... "
+health=`$SYS_GREP GLUE2EndpointHealthState: ldap.$$.out | $SYS_TAIL -n 1 | $SYS_SED 's/^[^:]*: *//'`
 if [ "$health" == "" ]; then
        print_error "GLUE2EndpointHealthState not specified"
        test_failed
        fi
 fi
 
-printf "Checking GlueServiceVersion... "
-glservver=`$SYS_GREP GLUE2EndpointImplementationVersion ldap.$$.out | $SYS_SED 's/^.*GLUE2EndpointImplementationVersion:\s*//'`
+printf "Checking GlueServiceVersion (Regression into bug #55482)... "
+glservver=`$SYS_GREP GLUE2EndpointImplementationVersion ldap.$$.out | $SYS_TAIL -n 1 | $SYS_SED 's/^.*GLUE2EndpointImplementationVersion:\s*//'`
 if [ "$glservver" == "" ]; then        
        print_error "GLUE2EndpointImplementationVersion not specified"
        test_failed