[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts template-bak2db, NONE, 1.1 template-db2bak, NONE, 1.1 template-db2index, NONE, 1.1 template-db2ldif, NONE, 1.1 template-ldif2db, NONE, 1.1 template-ldif2ldap, NONE, 1.1 template-monitor, NONE, 1.1 template-restoreconfig, NONE, 1.1 template-saveconfig, NONE, 1.1 template-start-slapd, NONE, 1.1 template-stop-slapd, NONE, 1.1 template-suffix2instance, NONE, 1.1 template-vlvindex, NONE, 1.1
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4149
Added Files:
template-bak2db template-db2bak template-db2index
template-db2ldif template-ldif2db template-ldif2ldap
template-monitor template-restoreconfig template-saveconfig
template-start-slapd template-stop-slapd
template-suffix2instance template-vlvindex
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Comment #10, #11, #14
Note: This is a generated file by autoconf. Checking this file in to support
the old style build. When migrating to the autotoolized build is completed,
this file is supposed to be removed from CVS.
--- NEW FILE template-bak2db ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
if [ $# -lt 1 ] || [ $# -gt 3 ]
then
echo "Usage: bak2db archivedir [-n backendname]"
exit 1
else
archivedir=$1
shift
fi
while getopts "n:" flag
do
case $flag in
n) bename=$OPTARG;;
*) echo "Usage: bak2db archivedir [-n backendname]"; exit 2;;
esac
done
if [ 1 = `expr $archivedir : "\/"` ]
then
archivedir=$archivedir
else
# relative
archivedir=`pwd`/$archivedir
fi
cd {{SERVER-DIR}}
if [ "$#" -eq 2 ]
then
./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir -n $bename
else
./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir
fi
--- NEW FILE template-db2bak ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ "$#" -eq 1 ]
then
bak_dir=$1
else
bak_dir={{BAK-DIR}}/`date +%Y_%m_%d_%H_%M_%S`
fi
./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir
--- NEW FILE template-db2index ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -eq 0 ]
then
bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S`
./ns-slapd upgradedb -D {{CONFIG-DIR}} -f -a "$bak_dir"
elif [ $# -lt 4 ]
then
echo "Usage: db2index [-n backend_instance | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvattribute]"
exit 1
else
./ns-slapd db2index -D {{CONFIG-DIR}} "$@"
fi
--- NEW FILE template-db2ldif ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ "$#" -lt 2 ];
then
echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*"
echo " [{-x excludesuffix}*] [-a outputfile]"
echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]"
echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required."
exit 1
fi
set_ldif=0
ldif_file="mydummy"
for arg in "$@"
do
if [ "$arg" = '-a' ];
then
set_ldif=1
elif [ $set_ldif -eq 1 ];
then
ldif_file=$arg
set_ldif=2
fi
done
if [ $ldif_file = "mydummy" ]
then
ldif_file={{LDIF-DIR}}/laputa-`date +%Y_%m_%d_%H%M%S`.ldif
fi
if [ $set_ldif -eq 2 ]
then
./ns-slapd db2ldif -D {{CONFIG-DIR}} "$@"
else
./ns-slapd db2ldif -D {{CONFIG-DIR}} -a $ldif_file "$@"
fi
--- NEW FILE template-ldif2db ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 4 ]
then
echo "Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]"
echo " {-i ldiffile}* [-O]"
echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" and \"-i ldiffile\" are required."
exit 1
fi
echo importing data ...
./ns-slapd ldif2db -D {{CONFIG-DIR}} "$@" 2>&1
exit $?
--- NEW FILE template-ldif2ldap ---
#!/bin/sh
prefix="{{DS-ROOT}}"
PATH=$prefix/usr/lib/mozldap6:/usr/lib/mozldap6
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
ldapmodify -a -p {{SERVER-PORT}} -D "$1" -w "$2" -f $3
--- NEW FILE template-monitor ---
#!/bin/sh
PATH=$prefix/usr/lib/mozldap6:/usr/lib/mozldap6
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:/usr/lib/dirsec:$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
if [ "x$1" != "x" ];
then MDN="$1";
else MDN="cn=monitor";
fi
ldapsearch -p {{SERVER-PORT}} -b "$MDN" -s base "objectClass=*"
--- NEW FILE template-restoreconfig ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
conf_ldif=`ls -1t {{BAK-DIR}}/{{SERV-ID}}-*.ldif | head -1`
if [ -z "$conf_ldif" ]
then
echo No configuration to restore in {{BAK-DIR}} ; exit 1
fi
echo Restoring $conf_ldif
./ns-slapd ldif2db -D {{CONFIG-DIR}} -i $conf_ldif -n NetscapeRoot 2>&1
exit $?
--- NEW FILE template-saveconfig ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
echo saving configuration ...
conf_ldif={{BAK-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif
./ns-slapd db2ldif -N -D {{CONFIG-DIR}} -s "o=NetscapeRoot" -a $conf_ldif -n NetscapeRoot 2>&1
if [ "$?" -ge 1 ]
then
echo Error occurred while saving configuration
exit 1
fi
exit 0
--- NEW FILE template-start-slapd ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
# Script that starts the ns-slapd server.
# Exit status can be:
# 0: Server started successfully
# 1: Server could not be started
# 2: Server already running
NETSITE_ROOT={{SERVER-DIR}}
export NETSITE_ROOT
DS_CONFIG_DIR={{CONFIG-DIR}}
export DS_CONFIG_DIR
PIDFILE={{RUN-DIR}}/pid
STARTPIDFILE={{RUN-DIR}}/startpid
if test -f $STARTPIDFILE ; then
PID=`cat $STARTPIDFILE`
if kill -0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd process already running: $PID
exit 2;
else
rm -f $STARTPIDFILE
fi
fi
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
if kill -0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd running: $PID
exit 2;
else
rm -f $PIDFILE
fi
fi
cd {{SERVER-DIR}}; ./ns-slapd -D {{CONFIG-DIR}} -i $PIDFILE -w $STARTPIDFILE "$@"
if [ $? -ne 0 ]; then
exit 1
fi
loop_counter=1
# wait for 10 seconds for the start pid file to appear
max_count=10
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $STARTPIDFILE ; then
sleep 1;
else
PID=`cat $STARTPIDFILE`
fi
done
if test ! -f $STARTPIDFILE ; then
echo Server failed to start !!! Please check errors log for problems
exit 1
fi
loop_counter=1
# wait for 10 minutes (600 times 1 seconds)
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $PIDFILE ; then
if kill -0 $PID > /dev/null 2>&1 ; then
sleep 1
else
echo Server failed to start !!! Please check errors log for problems
exit 1
fi
else
PID=`cat $PIDFILE`
exit 0;
fi
done
echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems.
exit 1
--- NEW FILE template-stop-slapd ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
# Script that stops the ns-slapd server.
# Exit status can be:
# 0: Server stopped successfully
# 1: Server could not be stopped
# 2: Server was not running
PIDFILE={{RUN-DIR}}/pid
if test ! -f $PIDFILE ; then
echo No ns-slapd PID file found. Server is probably not running
exit 2
fi
PID=`cat $PIDFILE`
# see if the server is already stopped
kill -0 $PID > /dev/null 2>&1 || {
echo Server not running
if test -f $PIDFILE ; then
rm -f $PIDFILE
fi
exit 2
}
# server is running - kill it
kill $PID
loop_counter=1
# wait for 10 minutes (600 times 1 second)
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if kill -0 $PID > /dev/null 2>&1 ; then
sleep 1;
else
if test -f $PIDFILE ; then
rm -f $PIDFILE
fi
exit 0
fi
done
if test -f $PIDFILE ; then
echo Server still running!! Failed to stop the ns-slapd process: $PID. Please check the errors log for problems.
fi
exit 1
--- NEW FILE template-suffix2instance ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 2 ]
then
echo Usage: suffix2instance {-s includesuffix}*
exit 1
fi
./ns-slapd suffix2instance -D {{CONFIG-DIR}} "$@" 2>&1
--- NEW FILE template-vlvindex ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 4 ]
then
echo "Usage: vlvindex -n backend_instance | {-s includesuffix}* -T attribute"
echo Note: either \"-n backend_instance\" or \"-s includesuffix\" are required.
exit 1
fi
./ns-slapd db2index -D {{CONFIG-DIR}} "$@"
16 years, 11 months
[Fedora-directory-commits] ldapserver autogen.sh, NONE, 1.1 Makefile.in, 1.8, 1.9 aclocal.m4, 1.1, 1.2 configure, 1.5, 1.6 configure.ac, 1.5, 1.6 ltmain.sh, 1.1, 1.2
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29248
Modified Files:
Makefile.in aclocal.m4 configure configure.ac ltmain.sh
Added Files:
autogen.sh
Log Message:
Resolves: 212483
Summary: Added autogen script to enforce versions of build tools used to generate build files.
--- NEW FILE autogen.sh ---
#!/bin/sh
# Check autoconf version
AC_VERSION=`autoconf --version | grep '^autoconf' | sed 's/.*) *//'`
case $AC_VERSION in
'' | 0.* | 1.* | 2.[0-4]* | 2.[0-9] | 2.5[0-8]* )
echo "You must have autoconf version 2.59 or later installed (found version $AC_VERSION)."
exit 1
;;
* )
echo "Found autoconf version $AC_VERSION"
;;
esac
# Check automake version
AM_VERSION=`automake --version | grep '^automake' | sed 's/.*) *//'`
case $AM_VERSION in
'' | 0.* | 1.[0-8]* | 1.9.[0-1]* )
echo "You must have automake version 1.9.2 or later installed (found version $AM_VERSION)."
exit 1
;;
* )
echo "Found automake version $AM_VERSION"
;;
esac
# Check libtool version
LT_VERSION=`libtool --version | grep ' libtool)' | sed 's/.*) \([0-9][0-9.]*\)[^ ]* .*/\1/'`
case $LT_VERSION in
'' | 0.* | 1.[0-4]* | 1.5.[0-9] | 1.5.[0-1]* | 1.5.2[0-1]* )
echo "You must have libtool version 1.5.22 or later installed (found version $LT_VERSION)."
exit 1
;;
* )
echo "Found libtool version $LT_VERSION"
;;
esac
# Run autoreconf
echo "Running autoreconf -fvi"
autoreconf -fvi
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.in 26 Oct 2006 17:45:27 -0000 1.8
+++ Makefile.in 26 Oct 2006 22:23:03 -0000 1.9
@@ -860,6 +860,9 @@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
NETSNMP_CONFIG = @NETSNMP_CONFIG@
OBJEXT = @OBJEXT@
@@ -1801,7 +1804,7 @@
.SUFFIXES: .c .cpp .lo .o .obj
am--refresh:
@:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -1828,9 +1831,9 @@
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
wrappers/dbscan: $(top_builddir)/config.status $(top_srcdir)/wrappers/dbscan.in
cd $(top_builddir) && $(SHELL) ./config.status $@
Index: aclocal.m4
===================================================================
RCS file: /cvs/dirsec/ldapserver/aclocal.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- aclocal.m4 17 Oct 2006 17:07:13 -0000 1.1
+++ aclocal.m4 26 Oct 2006 22:23:03 -0000 1.2
@@ -6505,6 +6505,46 @@
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- configure 26 Oct 2006 17:45:27 -0000 1.5
+++ configure 26 Oct 2006 22:23:03 -0000 1.6
@@ -465,7 +465,7 @@
#endif"
ac_default_prefix=/opt/fedora-ds
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS platfor!
m_defs SOLARIS_TRUE SOLARIS_FALSE debug_defs PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link configdir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CX!
XCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS platform_defs SOLARIS_TRUE SOLARIS_FALSE debug_defs PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link configdir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1027,6 +1027,8 @@
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-shared[=PKGS]
@@ -1970,6 +1972,30 @@
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
@@ -4251,7 +4277,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4254 "configure"' > conftest.$ac_ext
+ echo '#line 4280 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5359,7 +5385,7 @@
# Provide some information about the compiler.
-echo "$as_me:5362:" \
+echo "$as_me:5388:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6393,11 +6419,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6396: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6422: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6400: \$? = $ac_status" >&5
+ echo "$as_me:6426: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6626,11 +6652,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6629: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6655: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6633: \$? = $ac_status" >&5
+ echo "$as_me:6659: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6686,11 +6712,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6689: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6715: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6693: \$? = $ac_status" >&5
+ echo "$as_me:6719: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8020,7 +8046,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 8023 "configure"' > conftest.$ac_ext
+ echo '#line 8049 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8891,7 +8917,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8894 "configure"
+#line 8920 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8989,7 +9015,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8992 "configure"
+#line 9018 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11168,11 +11194,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11171: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11197: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11175: \$? = $ac_status" >&5
+ echo "$as_me:11201: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -11228,11 +11254,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11231: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11257: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11235: \$? = $ac_status" >&5
+ echo "$as_me:11261: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11739,7 +11765,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 11742 "configure"' > conftest.$ac_ext
+ echo '#line 11768 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -12610,7 +12636,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12613 "configure"
+#line 12639 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12708,7 +12734,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12711 "configure"
+#line 12737 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13535,11 +13561,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13538: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13564: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13542: \$? = $ac_status" >&5
+ echo "$as_me:13568: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -13595,11 +13621,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13598: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13624: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13602: \$? = $ac_status" >&5
+ echo "$as_me:13628: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14909,7 +14935,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 14912 "configure"' > conftest.$ac_ext
+ echo '#line 14938 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -15650,11 +15676,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15653: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15679: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15657: \$? = $ac_status" >&5
+ echo "$as_me:15683: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15883,11 +15909,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15886: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15912: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15890: \$? = $ac_status" >&5
+ echo "$as_me:15916: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15943,11 +15969,11 @@
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15946: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15972: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15950: \$? = $ac_status" >&5
+ echo "$as_me:15976: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17277,7 +17303,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 17280 "configure"' > conftest.$ac_ext
+ echo '#line 17306 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -18148,7 +18174,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18151 "configure"
+#line 18177 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18246,7 +18272,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18249 "configure"
+#line 18275 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -25183,6 +25209,13 @@
LTLIBOBJS=$ac_ltlibobjs
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -25802,6 +25835,9 @@
s,@AMTAR@,$AMTAR,;t t
s,@am__tar@,$am__tar,;t t
s,@am__untar@,$am__untar,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- configure.ac 26 Oct 2006 17:45:27 -0000 1.5
+++ configure.ac 26 Oct 2006 22:23:03 -0000 1.6
@@ -3,6 +3,7 @@
AC_PREREQ(2.59)
AC_INIT([fedora-ds], [1.1], [http://bugzilla.redhat.com/])
AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])
+AM_MAINTAINER_MODE
AC_CANONICAL_HOST
# Checks for programs.
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.1 -r 1.2 ltmain.sh
Index: ltmain.sh
===================================================================
RCS file: /cvs/dirsec/ldapserver/ltmain.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ltmain.sh 17 Oct 2006 17:07:13 -0000 1.1
+++ ltmain.sh 26 Oct 2006 22:23:03 -0000 1.2
@@ -1,7 +1,7 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord(a)gnu.ai.mit.edu>, 1996
#
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -33,9 +33,6 @@
# function.
progpath="$0"
-# RH: define SED for historic ltconfig's generated by Libtool 1.3
-[ -z "$SED" ] && SED=sed
-
# The name of this program:
progname=`echo "$progpath" | $SED $basename`
modename="$progname"
@@ -46,9 +43,14 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@@ -86,14 +88,15 @@
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
- SP2NL="tr '\100' '\n'"
- NL2SP="tr '\r\n' '\100\100'"
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
;;
- *) # Assume ASCII based system
- SP2NL="tr '\040' '\012'"
- NL2SP="tr '\015\012' '\040\040'"
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
;;
esac
@@ -110,8 +113,9 @@
fi
# Make sure IFS has a sensible default
-: ${IFS="
-"}
+lt_nl='
+'
+IFS=" $lt_nl"
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
$echo "$modename: not configured to build any kind of library" 1>&2
@@ -128,6 +132,8 @@
show="$echo"
show_help=
execute_dlfiles=
+duplicate_deps=no
+preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
@@ -135,13 +141,51 @@
# Shell function definitions:
# This seems to be the best place for them
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-func_win32_libid () {
+func_win32_libid ()
+{
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
@@ -152,12 +196,11 @@
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \
- sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
- if test "X$win32_nmres" = "Ximport" ; then
- win32_libid_type="x86 archive import"
- else
- win32_libid_type="x86 archive static"
- fi
+ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
fi
;;
*DLL*)
@@ -181,7 +224,8 @@
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
-func_infer_tag () {
+func_infer_tag ()
+{
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
@@ -238,12 +282,116 @@
esac
fi
}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
[...1833 lines suppressed...]
- dest="$arg"
+ dest=$arg
continue
fi
;;
@@ -5358,7 +5791,7 @@
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
@@ -5527,11 +5960,14 @@
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
for linkname
do
if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
fi
done
fi
@@ -5544,7 +5980,16 @@
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || exit $?
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
done
IFS="$save_ifs"
fi
@@ -5638,17 +6083,15 @@
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
# Check the variables that should have been set.
@@ -5676,34 +6119,21 @@
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
if test "$finalize" = yes && test -z "$run"; then
- tmpdir="/tmp"
- test -n "$TMPDIR" && tmpdir="$TMPDIR"
- tmpdir="$tmpdir/libtool-$$"
- save_umask=`umask`
- umask 0077
- if $mkdir "$tmpdir"; then
- umask $save_umask
- else
- umask $save_umask
- $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
- continue
- fi
+ tmpdir=`func_mktempdir`
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
outputname="$tmpdir/$file"
# Replace the output file specification.
@@ -5727,7 +6157,7 @@
fi
# remove .exe since cygwin /usr/bin/install will append another
- # one anyways
+ # one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
@@ -5827,7 +6257,7 @@
# Exit here if they wanted silent mode.
test "$show" = : && exit $EXIT_SUCCESS
- $echo "----------------------------------------------------------------------"
+ $echo "X----------------------------------------------------------------------" | $Xsed
$echo "Libraries have been installed in:"
for libdir in $libdirs; do
$echo " $libdir"
@@ -5860,7 +6290,7 @@
$echo
$echo "See any operating system documentation about shared libraries for"
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo "----------------------------------------------------------------------"
+ $echo "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS
;;
@@ -6077,9 +6507,17 @@
rmfiles="$rmfiles $objdir/$n"
done
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- if test "$mode" = uninstall; then
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
cmds=$postuninstall_cmds
@@ -6112,7 +6550,8 @@
IFS="$save_ifs"
fi
# FIXME: should reinstall the best remaining shared library.
- fi
+ ;;
+ esac
fi
;;
@@ -6397,7 +6836,7 @@
$echo
$echo "Try \`$modename --help' for more information about other modes."
-exit $EXIT_SUCCESS
+exit $?
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
@@ -6411,12 +6850,11 @@
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
+disable_libs=shared
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+disable_libs=static
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
16 years, 11 months
[Fedora-directory-commits] mod_nss nss_engine_init.c,1.25,1.26
by Doctor Conrad
Author: rcritten
Update of /cvs/dirsec/mod_nss
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14785
Modified Files:
nss_engine_init.c
Log Message:
212426
Don't fire up the NSS engine if SSL isn't enabled.
Index: nss_engine_init.c
===================================================================
RCS file: /cvs/dirsec/mod_nss/nss_engine_init.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- nss_engine_init.c 20 Oct 2006 15:23:39 -0000 1.25
+++ nss_engine_init.c 26 Oct 2006 18:59:24 -0000 1.26
@@ -134,10 +134,8 @@
/*
* Initialize SSL library
*
- * If sslenabled is not set then there is no need to prompt for the token
- * passwords.
*/
-static void nss_init_SSLLibrary(server_rec *s, int sslenabled, int fipsenabled,
+static void nss_init_SSLLibrary(server_rec *s, int fipsenabled,
int ocspenabled, int ocspdefault,
const char * ocspurl, const char *ocspname)
{
@@ -153,7 +151,7 @@
"Init: %snitializing NSS library", mc->nInitCount == 1 ? "I" : "Re-i");
/* Do we need to fire up our password helper? */
- if (mc->nInitCount == 1 && sslenabled) {
+ if (mc->nInitCount == 1) {
const char * child_argv[4];
apr_status_t rv;
@@ -237,7 +235,7 @@
}
/* Assuming everything is ok so far, check the cert database password(s). */
- if (sslenabled && (rv != SECSuccess)) {
+ if (rv != SECSuccess) {
NSS_Shutdown();
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"NSS initialization failed. Certificate database: %s.", mc->pCertificateDatabase != NULL ? mc->pCertificateDatabase : "not set in configuration");
@@ -262,7 +260,7 @@
} /* FIPS is already enabled, nothing to do */
}
- if (sslenabled && (nss_Init_Tokens(s) != SECSuccess)) {
+ if (nss_Init_Tokens(s) != SECSuccess) {
NSS_Shutdown();
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"NSS initialization failed. Certificate database: %s.", mc->pCertificateDatabase != NULL ? mc->pCertificateDatabase : "not set in configuration");
@@ -396,6 +394,10 @@
sc->enabled = FALSE;
}
+ if (sc->proxy_enabled == UNSET) {
+ sc->proxy_enabled = FALSE;
+ }
+
if (sc->fips == TRUE) {
fipsenabled = TRUE;
}
@@ -404,14 +406,10 @@
ocspenabled = TRUE;
}
- if (sc->enabled == TRUE) {
+ if ((sc->enabled == TRUE) || (sc->proxy_enabled == TRUE)) {
sslenabled = TRUE;
}
- if (sc->proxy_enabled == UNSET) {
- sc->proxy_enabled = FALSE;
- }
-
if (sc->ocsp_default == TRUE) {
ocspdefault = TRUE;
ocspurl = sc->ocsp_url;
@@ -424,7 +422,10 @@
}
}
- nss_init_SSLLibrary(base_server, sslenabled, fipsenabled, ocspenabled,
+ if (sslenabled == FALSE)
+ return OK;
+
+ nss_init_SSLLibrary(base_server, fipsenabled, ocspenabled,
ocspdefault, ocspurl, ocspname);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
"done Init: Initializing NSS library");
@@ -1083,7 +1084,8 @@
/* Closing this implicitly cleans up the copy of the certificates
* and keys associated with any SSL socket */
- PR_Close(sc->server->model);
+ if (sc->server->model)
+ PR_Close(sc->server->model);
shutdown = 1;
}
@@ -1095,7 +1097,8 @@
/* Closing this implicitly cleans up the copy of the certificates
* and keys associated with any SSL socket */
- PR_Close(sc->proxy->model);
+ if (sc->proxy->model)
+ PR_Close(sc->proxy->model);
shutdown = 1;
}
16 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts template-bak2db.in, NONE, 1.1 template-db2bak.in, NONE, 1.1 template-db2index.in, NONE, 1.1 template-db2ldif.in, NONE, 1.1 template-ldif2db.in, NONE, 1.1 template-ldif2ldap.in, NONE, 1.1 template-monitor.in, NONE, 1.1 template-restoreconfig.in, NONE, 1.1 template-saveconfig.in, NONE, 1.1 template-start-slapd.in, NONE, 1.1 template-stop-slapd.in, NONE, 1.1 template-suffix2instance.in, NONE, 1.1 template-upgradedb.in, NONE, 1.1 template-vlvindex.in,
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11321/ldap/admin/src/scripts
Modified Files:
template-verify-db.pl.in
Added Files:
template-bak2db.in template-db2bak.in template-db2index.in
template-db2ldif.in template-ldif2db.in template-ldif2ldap.in
template-monitor.in template-restoreconfig.in
template-saveconfig.in template-start-slapd.in
template-stop-slapd.in template-suffix2instance.in
template-upgradedb.in template-vlvindex.in
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Comment #10, #11, #14
--- NEW FILE template-bak2db.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
if [ $# -lt 1 ] || [ $# -gt 3 ]
then
echo "Usage: bak2db archivedir [-n backendname]"
exit 1
else
archivedir=$1
shift
fi
while getopts "n:" flag
do
case $flag in
n) bename=$OPTARG;;
*) echo "Usage: bak2db archivedir [-n backendname]"; exit 2;;
esac
done
if [ 1 = `expr $archivedir : "\/"` ]
then
archivedir=$archivedir
else
# relative
archivedir=`pwd`/$archivedir
fi
cd {{SERVER-DIR}}
if [ "$#" -eq 2 ]
then
./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir -n $bename
else
./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir
fi
--- NEW FILE template-db2bak.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ "$#" -eq 1 ]
then
bak_dir=$1
else
bak_dir={{BAK-DIR}}/`date +%Y_%m_%d_%H_%M_%S`
fi
./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir
--- NEW FILE template-db2index.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -eq 0 ]
then
bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S`
./ns-slapd upgradedb -D {{CONFIG-DIR}} -f -a "$bak_dir"
elif [ $# -lt 4 ]
then
echo "Usage: db2index [-n backend_instance | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvattribute]"
exit 1
else
./ns-slapd db2index -D {{CONFIG-DIR}} "$@"
fi
--- NEW FILE template-db2ldif.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ "$#" -lt 2 ];
then
echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*"
echo " [{-x excludesuffix}*] [-a outputfile]"
echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]"
echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required."
exit 1
fi
set_ldif=0
ldif_file="mydummy"
for arg in "$@"
do
if [ "$arg" = '-a' ];
then
set_ldif=1
elif [ $set_ldif -eq 1 ];
then
ldif_file=$arg
set_ldif=2
fi
done
if [ $ldif_file = "mydummy" ]
then
ldif_file={{LDIF-DIR}}/laputa-`date +%Y_%m_%d_%H%M%S`.ldif
fi
if [ $set_ldif -eq 2 ]
then
./ns-slapd db2ldif -D {{CONFIG-DIR}} "$@"
else
./ns-slapd db2ldif -D {{CONFIG-DIR}} -a $ldif_file "$@"
fi
--- NEW FILE template-ldif2db.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 4 ]
then
echo "Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]"
echo " {-i ldiffile}* [-O]"
echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" and \"-i ldiffile\" are required."
exit 1
fi
echo importing data ...
./ns-slapd ldif2db -D {{CONFIG-DIR}} "$@" 2>&1
exit $?
--- NEW FILE template-ldif2ldap.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
PATH=$prefix@ldapsdk_bindir@:@ldapsdk_bindir@
LD_LIBRARY_PATH=$prefix@ldapsdk_libdir@:@ldapsdk_libdir@:$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@ldapsdk_libdir@:@ldapsdk_libdir@:$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
ldapmodify -a -p {{SERVER-PORT}} -D "$1" -w "$2" -f $3
--- NEW FILE template-monitor.in ---
#!/bin/sh
PATH=$prefix@ldapsdk_bindir@:@ldapsdk_bindir@
LD_LIBRARY_PATH=$prefix@ldapsdk_libdir@:@ldapsdk_libdir@:$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@ldapsdk_libdir@:@ldapsdk_libdir@:$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
if [ "x$1" != "x" ];
then MDN="$1";
else MDN="cn=monitor";
fi
ldapsearch -p {{SERVER-PORT}} -b "$MDN" -s base "objectClass=*"
--- NEW FILE template-restoreconfig.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
conf_ldif=`ls -1t {{BAK-DIR}}/{{SERV-ID}}-*.ldif | head -1`
if [ -z "$conf_ldif" ]
then
echo No configuration to restore in {{BAK-DIR}} ; exit 1
fi
echo Restoring $conf_ldif
./ns-slapd ldif2db -D {{CONFIG-DIR}} -i $conf_ldif -n NetscapeRoot 2>&1
exit $?
--- NEW FILE template-saveconfig.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
echo saving configuration ...
conf_ldif={{BAK-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif
./ns-slapd db2ldif -N -D {{CONFIG-DIR}} -s "o=NetscapeRoot" -a $conf_ldif -n NetscapeRoot 2>&1
if [ "$?" -ge 1 ]
then
echo Error occurred while saving configuration
exit 1
fi
exit 0
--- NEW FILE template-start-slapd.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
# Script that starts the ns-slapd server.
# Exit status can be:
# 0: Server started successfully
# 1: Server could not be started
# 2: Server already running
NETSITE_ROOT={{SERVER-DIR}}
export NETSITE_ROOT
DS_CONFIG_DIR={{CONFIG-DIR}}
export DS_CONFIG_DIR
PIDFILE={{RUN-DIR}}/pid
STARTPIDFILE={{RUN-DIR}}/startpid
if test -f $STARTPIDFILE ; then
PID=`cat $STARTPIDFILE`
if kill -0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd process already running: $PID
exit 2;
else
rm -f $STARTPIDFILE
fi
fi
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
if kill -0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd running: $PID
exit 2;
else
rm -f $PIDFILE
fi
fi
cd {{SERVER-DIR}}; ./ns-slapd -D {{CONFIG-DIR}} -i $PIDFILE -w $STARTPIDFILE "$@"
if [ $? -ne 0 ]; then
exit 1
fi
loop_counter=1
# wait for 10 seconds for the start pid file to appear
max_count=10
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $STARTPIDFILE ; then
sleep 1;
else
PID=`cat $STARTPIDFILE`
fi
done
if test ! -f $STARTPIDFILE ; then
echo Server failed to start !!! Please check errors log for problems
exit 1
fi
loop_counter=1
# wait for 10 minutes (600 times 1 seconds)
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $PIDFILE ; then
if kill -0 $PID > /dev/null 2>&1 ; then
sleep 1
else
echo Server failed to start !!! Please check errors log for problems
exit 1
fi
else
PID=`cat $PIDFILE`
exit 0;
fi
done
echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems.
exit 1
--- NEW FILE template-stop-slapd.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
# Script that stops the ns-slapd server.
# Exit status can be:
# 0: Server stopped successfully
# 1: Server could not be stopped
# 2: Server was not running
PIDFILE={{RUN-DIR}}/pid
if test ! -f $PIDFILE ; then
echo No ns-slapd PID file found. Server is probably not running
exit 2
fi
PID=`cat $PIDFILE`
# see if the server is already stopped
kill -0 $PID > /dev/null 2>&1 || {
echo Server not running
if test -f $PIDFILE ; then
rm -f $PIDFILE
fi
exit 2
}
# server is running - kill it
kill $PID
loop_counter=1
# wait for 10 minutes (600 times 1 second)
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if kill -0 $PID > /dev/null 2>&1 ; then
sleep 1;
else
if test -f $PIDFILE ; then
rm -f $PIDFILE
fi
exit 0
fi
done
if test -f $PIDFILE ; then
echo Server still running!! Failed to stop the ns-slapd process: $PID. Please check the errors log for problems.
fi
exit 1
--- NEW FILE template-suffix2instance.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 2 ]
then
echo Usage: suffix2instance {-s includesuffix}*
exit 1
fi
./ns-slapd suffix2instance -D {{CONFIG-DIR}} "$@" 2>&1
--- NEW FILE template-upgradedb.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ "$#" -eq 1 ]
then
bak_dir=$1
else
bak_dir={{BAK-DIR}}/upgradedb_`date +%Y_%m_%d_%H_%M_%S`
fi
echo upgrade index files ...
./ns-slapd upgradedb -D {{CONFIG-DIR}} -a $bak_dir
--- NEW FILE template-vlvindex.in ---
#!/bin/sh
prefix="{{DS-ROOT}}"
LD_LIBRARY_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export LD_LIBRARY_PATH
SHLIB_PATH=$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@
export SHLIB_PATH
cd {{SERVER-DIR}}
if [ $# -lt 4 ]
then
echo "Usage: vlvindex -n backend_instance | {-s includesuffix}* -T attribute"
echo Note: either \"-n backend_instance\" or \"-s includesuffix\" are required.
exit 1
fi
./ns-slapd db2index -D {{CONFIG-DIR}} "$@"
Index: template-verify-db.pl.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-verify-db.pl.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- template-verify-db.pl.in 25 Oct 2006 20:36:46 -0000 1.1
+++ template-verify-db.pl.in 26 Oct 2006 17:45:28 -0000 1.2
@@ -111,7 +111,6 @@
# get dirs having DBVERSION
my $dbdirs = getDbDir(".");
-my $brand_ds = {{DS-BRAND}};
my $prefix = "{{DS-ROOT}}";
$ENV{'PATH'} = '$prefix@db_bindir@:$prefix/usr/lib:@db_bindir@:/usr/lib';
16 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.31, 1.32
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11321/ldap/admin/src
Modified Files:
create_instance.c
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Comment #10, #11, #14
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- create_instance.c 25 Oct 2006 00:04:41 -0000 1.31
+++ create_instance.c 26 Oct 2006 17:45:27 -0000 1.32
@@ -688,12 +688,12 @@
return NULL;
}
-char *gen_perl_script_auto(char *s_root, char *cs_path, char *name,
- server_config_s *cf)
+char *gen_script_auto(char *s_root, char *cs_path,
+ char *name, server_config_s *cf)
{
char myperl[PATH_SIZE];
char fn[PATH_SIZE], ofn[PATH_SIZE];
- const char *table[12][2];
+ const char *table[16][2];
if (PR_FAILURE == PR_Access(cs_path, PR_ACCESS_EXISTS)) {
printf("Notice: %s does not exist, skipping %s . . .\n", cs_path, name);
@@ -738,9 +738,16 @@
table[8][1] = cf->ldif_dir;
table[9][0] = "SERV-ID";
table[9][1] = cf->servid;
+
table[10][0] = "BAK-DIR";
table[10][1] = cf->bak_dir;
- table[11][0] = table[11][1] = NULL;
+ table[11][0] = "SERVER-DIR";
+ table[11][1] = cf->sroot;
+ table[12][0] = "CONFIG-DIR";
+ table[12][1] = cf->config_dir;
+ table[13][0] = "RUN-DIR";
+ table[13][1] = cf->run_dir;
+ table[14][0] = table[14][1] = NULL;
if (generate_script(ofn, fn, NEWSCRIPT_MODE, table) != 0) {
return make_error("Could not write %s to %s (%s).", ofn, fn,
@@ -755,7 +762,7 @@
{
char myperl[PATH_SIZE];
char fn[PATH_SIZE], ofn[PATH_SIZE];
- const char *table[12][2];
+ const char *table[16][2];
char *fnp = NULL;
int fnlen = 0;
@@ -802,9 +809,16 @@
table[8][1] = cf->ldif_dir;
table[9][0] = "SERV-ID";
table[9][1] = cf->servid;
+
table[10][0] = "BAK-DIR";
table[10][1] = cf->bak_dir;
- table[11][0] = table[11][1] = NULL;
+ table[11][0] = "SERVER-DIR";
+ table[11][1] = cf->sroot;
+ table[12][0] = "CONFIG-DIR";
+ table[12][1] = cf->config_dir;
+ table[13][0] = "RUN-DIR";
+ table[13][1] = cf->run_dir;
+ table[14][0] = table[14][1] = NULL;
if (generate_script(ofn, fn, NEWSCRIPT_MODE, table) != 0) {
return make_error("Could not write %s to %s (%s).", ofn, fn,
@@ -1026,243 +1040,6 @@
PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s",
sroot, FILE_PATHSEP, cf->servid);
#ifdef XP_UNIX
- /* Start/stop/rotate/restart scripts */
- if (getenv("USE_DEBUGGER"))
- {
- char *debugger = getenv("DSINST_DEBUGGER");
- char *debugger_command = getenv("DSINST_DEBUGGER_CMD");
- if (! debugger) {
- debugger = "gdb";
- }
- if (! debugger_command) {
- debugger_command = "echo"; /* e.g. do nothing */
- }
-#ifdef OSF1
- printf("-D %s -i %s/pid -d %s -z\n", cf->config_dir, cf->run_dir,
- cf->loglevel ? cf->loglevel : "0");
- t = gen_script(cf->inst_dir, START_SCRIPT,
- "\n"
- "# Script that starts the %s.\n"
- "# Exit status can be:\n"
- "# 0: Server started successfully\n"
- "# 1: Server could not be started\n"
- "# 2: Server already running\n"
- "\n"
- "NETSITE_ROOT=%s\n"
- "export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
- "if test -f $PIDFILE ; then\n"
- " PID=`cat $PIDFILE`\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s process already running: $PID\n"
- " exit 2;\n"
- " else\n"
- " rm -f $PIDFILE\n"
- " fi\n"
- "fi\n"
- "cd %s; ./%s -D %s -i %s/pid -d %s -z \"$@\" &\n"
- "loop_counter=1\n"
- "max_count=120\n"
- "while test $loop_counter -le $max_count; do\n"
- " loop_counter=`expr $loop_counter + 1`\n"
- " if test ! -f $PIDFILE ; then\n"
- " sleep 1;\n"
- " else\n"
- " PID=`cat $PIDFILE`\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been started. ns-slapd process started: $PID\n"*/
- " exit 0;\n"
- " fi\n"
- "done\n"
- "echo Server not running!! Failed to start ns-slapd process.\n"
- "exit 1\n",
- PRODUCT_BIN,
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- PRODUCT_BIN,
- sroot, PRODUCT_BIN, cf->config_dir, cf->run_dir,
- cf->loglevel ? cf->loglevel : "0"
- );
-#else
- t = gen_script(cf->inst_dir, START_SCRIPT,
- "\n"
- "# Script that starts the ns-slapd server.\n"
- "# Exit status can be:\n"
- "# 0: Server started successfully\n"
- "# 1: Server could not be started\n"
- "# 2: Server already running\n"
- "\n"
- "NETSITE_ROOT=%s\n"
- "export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
- "if test -f $PIDFILE ; then\n"
- " PID=`cat $PIDFILE`\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an ns-slapd process already running: $PID\n"
- " exit 2;\n"
- " else\n"
- " rm -f $PIDFILE\n"
- " fi\n"
- "fi\n"
- "if [ -x /usr/bin/xterm ]; then\n"
- " xterm=/usr/bin/xterm\n"
- "else\n"
- " xterm=/usr/openwin/bin/xterm\n"
- "fi\n"
- "cd %s; $xterm -title debugger -e %s -c \"dbxenv follow_fork_mode child ; break main ; %s ; run -D %s -i %s/pid -d %s -z $*\" %s &\n"
- "loop_counter=1\n"
- "max_count=120\n"
- "while test $loop_counter -le $max_count; do\n"
- " loop_counter=`expr $loop_counter + 1`\n"
- " if test ! -f $PIDFILE ; then\n"
- " sleep 1;\n"
- " else\n"
- " PID=`cat $PIDFILE`\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been started. ns-slapd process started: $PID\n"*/
- " exit 0;\n"
- " fi\n"
- "done\n"
- "echo Server not running!! Failed to start ns-slapd process.\n"
- "exit 1\n",
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- sroot, debugger, debugger_command, cf->config_dir, cf->run_dir,
- cf->loglevel ? cf->loglevel : "0", PRODUCT_BIN
- );
-#endif
- }
- else
- {
- t = gen_script(cf->inst_dir, START_SCRIPT,
- "\n"
- "# Script that starts the ns-slapd server.\n"
- "# Exit status can be:\n"
- "# 0: Server started successfully\n"
- "# 1: Server could not be started\n"
- "# 2: Server already running\n"
- "\n"
- "NETSITE_ROOT=%s\n"
- "export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
- "STARTPIDFILE=%s/startpid\n"
- "if test -f $STARTPIDFILE ; then\n"
- " PID=`cat $STARTPIDFILE`\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s process already running: $PID\n"
- " exit 2;\n"
- " else\n"
- " rm -f $STARTPIDFILE\n"
- " fi\n"
- "fi\n"
- "if test -f $PIDFILE ; then\n"
- " PID=`cat $PIDFILE`\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s running: $PID\n"
- " exit 2;\n"
- " else\n"
- " rm -f $PIDFILE\n"
- " fi\n"
- "fi\n"
- "cd %s; ./%s -D %s -i %s/pid -w $STARTPIDFILE \"$@\"\n"
- "if [ $? -ne 0 ]; then\n"
- " exit 1\n"
- "fi\n"
- "\n"
- "loop_counter=1\n"
- "# wait for 10 seconds for the start pid file to appear\n"
- "max_count=10\n"
- "while test $loop_counter -le $max_count; do\n"
- " loop_counter=`expr $loop_counter + 1`\n"
- " if test ! -f $STARTPIDFILE ; then\n"
- " sleep 1;\n"
- " else\n"
- " PID=`cat $STARTPIDFILE`\n"
- " fi\n"
- "done\n"
- "if test ! -f $STARTPIDFILE ; then\n"
- " echo Server failed to start !!! Please check errors log for problems\n"
- " exit 1\n"
- "fi\n"
- "loop_counter=1\n"
- "# wait for 10 minutes (600 times 1 seconds)\n"
- "max_count=600\n" /* 10 minutes */
- "while test $loop_counter -le $max_count; do\n"
- " loop_counter=`expr $loop_counter + 1`\n"
- " if test ! -f $PIDFILE ; then\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " sleep 1\n"
- " else\n"
- " echo Server failed to start !!! Please check errors log for problems\n"
- " exit 1\n"
- " fi\n"
- " else\n"
- " PID=`cat $PIDFILE`\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been started. ns-slapd process started: $PID\n"*/
- " exit 0;\n"
- " fi\n"
- "done\n"
- "echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems.\n"
- "exit 1\n",
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- cf->run_dir, PRODUCT_BIN, PRODUCT_BIN,
- cf->sroot, PRODUCT_BIN, cf->config_dir, cf->run_dir
- );
- }
- if(t) return t;
-
- t = gen_script(cf->inst_dir, STOP_SCRIPT,
- "\n"
- "# Script that stops the ns-slapd server.\n"
- "# Exit status can be:\n"
- "# 0: Server stopped successfully\n"
- "# 1: Server could not be stopped\n"
- "# 2: Server was not running\n"
- "\n"
- "PIDFILE=%s/pid\n"
- "if test ! -f $PIDFILE ; then\n"
- " echo No ns-slapd PID file found. Server is probably not running\n"
- " exit 2\n"
- "fi\n"
- "PID=`cat $PIDFILE`\n"
- "# see if the server is already stopped\n"
- "kill -0 $PID > /dev/null 2>&1 || {\n"
- " echo Server not running\n"
- " if test -f $PIDFILE ; then\n"
- " rm -f $PIDFILE\n"
- " fi\n"
- " exit 2\n"
- "}\n"
- "# server is running - kill it\n"
- "kill $PID\n"
- "loop_counter=1\n"
- "# wait for 10 minutes (600 times 1 second)\n"
- "max_count=600\n" /* 10 minutes */
- "while test $loop_counter -le $max_count; do\n"
- " loop_counter=`expr $loop_counter + 1`\n"
- " if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " sleep 1;\n"
- " else\n"
- " if test -f $PIDFILE ; then\n"
- " rm -f $PIDFILE\n"
- " fi\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been stopped. ns-slapd process stopped: $PID\n"*/
- " exit 0\n"
- " fi\n"
- "done\n"
- "if test -f $PIDFILE ; then\n"
- " echo Server still running!! Failed to stop the ns-slapd process: $PID. Please check the errors log for problems.\n"
- "fi\n"
- "exit 1\n",
- cf->run_dir);
- if(t) return t;
-
t = gen_script(cf->inst_dir, RESTART_SCRIPT,
"\n"
"# Script that restarts the ns-slapd server.\n"
@@ -1991,50 +1768,29 @@
}
#define CREATE_LDIF2DB() \
- gen_perl_script_auto(mysroot, mycs_path, "ldif2db.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "ldif2db.pl", cf)
#define CREATE_DB2INDEX() \
- gen_perl_script_auto(mysroot, mycs_path, "db2index.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "db2index.pl", cf)
#define CREATE_DB2LDIF() \
- gen_perl_script_auto(mysroot, mycs_path, "db2ldif.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "db2ldif.pl", cf)
#define CREATE_DB2BAK() \
- gen_perl_script_auto(mysroot, mycs_path, "db2bak.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "db2bak.pl", cf)
#define CREATE_BAK2DB() \
- gen_perl_script_auto(mysroot, mycs_path, "bak2db.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "bak2db.pl", cf)
#define CREATE_VERIFYDB() \
- gen_perl_script_auto(mysroot, mycs_path, "verify-db.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "verify-db.pl", cf)
/* tentatively moved to mycs_path */
#define CREATE_REPL_MONITOR_CGI() \
- gen_perl_script_auto(mysroot, mycs_path, "repl-monitor-cgi.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "repl-monitor-cgi.pl", cf)
#define CREATE_ACCOUNT_INACT(_commandName) \
- gen_perl_script_auto(mysroot, cs_path, _commandName, cf)
-
-#define CREATE_DSML() \
- gen_perl_script_auto(mysroot, mycs_path, "dsml-activate.pl", cf)
-
-#define CREATE_MIGRATETO5() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrateTo5", cf)
-
-#define CREATE_MIGRATE50TO51() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrate50to51", cf)
-
-#define CREATE_MIGRATEINSTANCE5() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrateInstance5", cf)
-
-#define CREATE_MIGRATE5TO6() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrate5to6", cf)
-
-#define CREATE_MIGRATEINSTANCE6() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrateInstance6", cf)
-
-#define CREATE_MIGRATETO6() \
- gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrateTo6", cf)
+ gen_script_auto(mysroot, cs_path, _commandName, cf)
#define CREATE_MIGRATE5TO7() \
gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrate5to7", cf)
@@ -2049,7 +1805,46 @@
gen_perl_script_auto_for_migration(mysroot, mycs_path, "migrateTo7", cf)
#define CREATE_NEWPWPOLICY() \
- gen_perl_script_auto(mysroot, mycs_path, "ns-newpwpolicy.pl", cf)
+ gen_script_auto(mysroot, mycs_path, "ns-newpwpolicy.pl", cf)
+
+#define CREATE_BAK2DB_SH() \
+ gen_script_auto(mysroot, mycs_path, "bak2db", cf)
+
+#define CREATE_DB2BAK_SH() \
+ gen_script_auto(mysroot, mycs_path, "db2bak", cf)
+
+#define CREATE_DB2INDEX_SH() \
+ gen_script_auto(mysroot, mycs_path, "db2index", cf)
+
+#define CREATE_DB2LDIF_SH() \
+ gen_script_auto(mysroot, mycs_path, "db2ldif", cf)
+
+#define CREATE_LDIF2DB_SH() \
+ gen_script_auto(mysroot, mycs_path, "ldif2db", cf)
+
+#define CREATE_LDIF2LDAP_SH() \
+ gen_script_auto(mysroot, mycs_path, "ldif2ldap", cf)
+
+#define CREATE_MONITOR_SH() \
+ gen_script_auto(mysroot, mycs_path, "monitor", cf)
+
+#define CREATE_RESTORECONFIG_SH() \
+ gen_script_auto(mysroot, mycs_path, "restoreconfig", cf)
+
+#define CREATE_SAVECONFIG_SH() \
+ gen_script_auto(mysroot, mycs_path, "saveconfig", cf)
+
+#define CREATE_START_SLAPD_SH() \
+ gen_script_auto(mysroot, mycs_path, "start-slapd", cf)
+
+#define CREATE_STOP_SLAPD_SH() \
+ gen_script_auto(mysroot, mycs_path, "stop-slapd", cf)
+
+#define CREATE_SUFFIX2INSTANCE_SH() \
+ gen_script_auto(mysroot, mycs_path, "suffix2instance", cf)
+
+#define CREATE_VLVINDEX_SH() \
+ gen_script_auto(mysroot, mycs_path, "vlvindex", cf)
#ifdef XP_UNIX
char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
@@ -2073,164 +1868,61 @@
mysroot = sroot;
mycs_path = cs_path;
- t = gen_script(cs_path, "monitor",
- "if [ \"x$1\" != \"x\" ];\nthen MDN=\"$1\";\nelse MDN=\"cn=monitor\";\n fi\n"
-
- "cd %s\nPATH=%s:$PATH;export PATH\n"
- "ldapsearch -p %s -b \"$MDN\" -s base \"objectClass=*\"\n",
- tools, tools, cf->servport);
+ t = CREATE_LDIF2DB();
if(t) return t;
-
- t = gen_script(cs_path, "saveconfig",
- "cd %s\n"
- "echo saving configuration ...\n"
- "conf_ldif=%s/confbak/%s-`date +%%Y_%%m_%%d_%%H%%M%%S`.ldif\n"
- "./%s db2ldif -N -D %s "
- "-s \"%s\" -a $conf_ldif -n NetscapeRoot 2>&1\n"
- "if [ \"$?\" -ge 1 ] \nthen\n"
- " echo Error occurred while saving configuration\n"
- " exit 1\n"
- "fi\n"
- "exit 0\n",
- server,
- cf->config_dir, cf->servid,
- PRODUCT_BIN, cf->config_dir,
- cf->netscaperoot);
+
+ t = CREATE_DB2INDEX();
if(t) return t;
-
- t = gen_script(cs_path, "restoreconfig",
- "cd %s\n"
- "conf_ldif=`ls -1t %s/confbak/%s-*.ldif | head -1`\n"
- "if [ -z \"$conf_ldif\" ]\n"
- "then\n"
- " echo No configuration to restore in %s/confbak ; exit 1\n"
- "fi\n"
- "echo Restoring $conf_ldif\n"
- "./%s ldif2db -D %s"
- " -i $conf_ldif -n NetscapeRoot 2>&1\n"
- "exit $?\n",
- server,
- cf->config_dir, cf->servid,
- cf->config_dir,
- PRODUCT_BIN, cf->config_dir);
+
+ t = CREATE_MIGRATE5TO7();
if(t) return t;
-
- t = gen_script(cs_path, "ldif2db",
- "cd %s\n"
- "if [ $# -lt 4 ]\nthen\n"
- "\techo \"Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]\"\n"
- "\techo \" {-i ldiffile}* [-O]\"\n"
- "\techo \"Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" and \\\"-i ldiffile\\\" are required.\"\n"
- "\texit 1\n"
- "fi\n\n"
- "echo importing data ...\n"
- "./%s ldif2db -D %s \"$@\" 2>&1\n"
- "exit $?\n",
- server, PRODUCT_BIN, cf->config_dir);
+
+ t = CREATE_MIGRATE6TO7();
if(t) return t;
-#if defined(UPGRADEDB)
- t = gen_script(cs_path, "upgradedb",
- "cd %s\n"
- "if [ \"$#\" -eq 1 ]\nthen\n"
- "\tbak_dir=$1\nelse\n"
- "\tbak_dir=%s/upgradedb_`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
- "echo upgrade index files ...\n"
- "./%s upgradedb -D %s -a $bak_dir\n",
- server, cf->bak_dir, PRODUCT_BIN, cf->config_dir);
+ t = CREATE_MIGRATEINSTANCE7();
if(t) return t;
-#endif
- /* new code for dsml import */
- /* OBSOLETE??? */
- t = gen_script(cs_path, "dsml2db",
- "cd %s\n"
- "if [ $# -lt 4 ]\nthen\n"
- "\techo \"Usage: dsml2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]\"\n"
- "\techo \" {-i dsmlfile}\"\n"
- "\techo \"Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" and \\\"-i dsmlfile\\\" are required.\"\n"
- "\texit 1\n"
- "fi\n\n"
- "set_dsml=0\n"
- "dsml_file=\"mydummy\"\n"
- "space=\" \"\n"
- "i=0\n"
- "for arg in \"$@\"\ndo\n"
- "\tif [ \"$arg\" = '-i' ];\n\tthen\n"
- "\t\tset_dsml=1\n"
- "\telif [ $set_dsml -eq 1 ];\n\tthen\n"
- "\t\tdsml_file=$arg\n"
- "\t\tset_dsml=2\n"
- "\telse\n"
- "\t\teval a$i=\\\"$arg\\\"\n"
- "\t\ti=`expr $i + 1`\n"
- "\tfi\n"
- "done\n"
- "max=$i; i=0;\n"
- "shift $#\n"
- "while [ $i -lt $max ]; do\n"
- "\teval arg=\\$a$i\n"
- "\tset -- \"$@\" \"$arg\"\n"
- "\ti=`expr $i + 1`\n"
- "done\n"
- "\tif [ $dsml_file = \"mydummy\" ]\n\tthen\n\t"
- "echo \"Need a DSML file as input\""
- "\n\t\t exit 1"
- "\n\tfi\n"
- "\tif [ -f $dsml_file ] && [ -r $dsml_file ]\n\tthen\n"
- "\t\t%s/bin/base/jre/bin/java -Dverify=true -classpath %s/java/jars/crimson.jar:%s/java/ldapjdk.jar:%s/java/jars/xmltools.jar com.netscape.xmltools.DSML2LDIF $dsml_file\n"
- "\t\tif [ $? = 0 ]; then\n"
- "\t\techo importing data ...\n"
- "\t\t%s/bin/base/jre/bin/java -classpath %s/java/jars/crimson.jar:%s/java/ldapjdk.jar:%s/java/jars/xmltools.jar com.netscape.xmltools.DSML2LDIF $dsml_file | ./ns-slapd ldif2db -D %s \"$@\" -i -\n"
- "\t\texit $?\n"
- "\t\tfi\n"
- "\telse\n"
- "\t\techo \"File $dsml_file invalid. Absolute path is required.\"\n\t\texit 1\n"
- "\tfi\n",
- server,sroot,sroot,sroot,sroot,sroot,sroot,sroot,sroot,cs_path);
+ t = CREATE_MIGRATETO7();
if(t) return t;
-
- t = gen_script(cs_path, "ldif2ldap",
- "cd %s\n"
- "./ldapmodify -a -p %s -D \"$1\" -w \"$2\" -f $3\n",
- tools, cf->servport);
+
+ t = CREATE_BAK2DB_SH();
if(t) return t;
-
- t = CREATE_LDIF2DB();
+
+ t = CREATE_DB2BAK_SH();
if(t) return t;
- t = CREATE_DB2INDEX();
+ t = CREATE_DB2INDEX_SH();
if(t) return t;
-/*
- t = CREATE_MIGRATETO5();
+
+ t = CREATE_DB2LDIF_SH();
if(t) return t;
-
- t = CREATE_MIGRATE50TO51();
+
+ t = CREATE_LDIF2DB_SH();
if(t) return t;
- t = CREATE_MIGRATEINSTANCE5();
+ t = CREATE_LDIF2LDAP_SH();
if(t) return t;
- t = CREATE_MIGRATE5TO6();
+ t = CREATE_MONITOR_SH();
if(t) return t;
- t = CREATE_MIGRATEINSTANCE6();
+ t = CREATE_RESTORECONFIG_SH();
if(t) return t;
- t = CREATE_MIGRATETO6();
+ t = CREATE_SAVECONFIG_SH();
if(t) return t;
-*/
- t = CREATE_MIGRATE5TO7();
+ t = CREATE_START_SLAPD_SH();
if(t) return t;
- t = CREATE_MIGRATE6TO7();
+ t = CREATE_STOP_SLAPD_SH();
if(t) return t;
- t = CREATE_MIGRATEINSTANCE7();
+ t = CREATE_SUFFIX2INSTANCE_SH();
if(t) return t;
- t = CREATE_MIGRATETO7();
+ t = CREATE_VLVINDEX_SH();
if(t) return t;
t = gen_script(cs_path, "getpwenc",
@@ -2245,146 +1937,9 @@
server, cf->config_dir, cs_path);
if(t) return t;
- t = gen_script(cs_path, "db2ldif",
- "cd %s\n"
- "if [ \"$#\" -lt 2 ];\nthen\n"
- "\techo \"Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*\"\n"
- "\techo \" [{-x excludesuffix}*] [-a outputfile]\"\n"
- "\techo \" [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]\"\n"
- "\techo \"Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" is required.\"\n"
- "\texit 1\n"
- "fi\n\n"
- "set_ldif=0\n"
- "ldif_file=\"mydummy\"\n"
- "for arg in \"$@\"\ndo\n"
- "\tif [ \"$arg\" = '-a' ];\n\tthen\n"
- "\t\tset_ldif=1\n"
- "\telif [ $set_ldif -eq 1 ];\n\tthen\n"
- "\t\tldif_file=$arg\n"
- "\t\tset_ldif=2\n"
- "\tfi\n"
- "done\n"
- "if [ $ldif_file = \"mydummy\" ]\nthen\n"
- "\tldif_file=%s/%s-`date +%%Y_%%m_%%d_%%H%%M%%S`.ldif\nfi\n"
- "if [ $set_ldif -eq 2 ]\nthen\n"
- "./%s db2ldif -D %s \"$@\"\nelse\n"
- "./%s db2ldif -D %s -a $ldif_file \"$@\"\nfi\n",
- server,
- cf->ldif_dir, cf->servid,
- PRODUCT_BIN, cf->config_dir,
- PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-
- /* new code for dsml export */
- t = gen_script(cs_path, "db2dsml",
- "cd %s\n"
- "if [ \"$#\" -lt 2 ];\nthen\n"
- "\techo \"Usage: db2dsml {-n backend_instance} | {-s includesuffix}*\"\n"
- "\techo \" [{-x excludesuffix}*] [-a outputfile]\"\n"
- "\techo \" [-u]\"\n"
- "\techo \"Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" is required.\"\n"
- "\texit 1\n"
- "fi\n\n"
- "set_dsml=0\n"
- "dsml_file=\"mydummy\"\n"
- "arg_list=\"\"\n"
- "space=\" \"\n"
- "for arg in \"$@\"\ndo\n"
- "\tif [ \"$arg\" = '-a' ];\n\tthen\n"
- "\t\tset_dsml=1\n"
- "\telif [ $set_dsml -eq 1 ];\n\tthen\n"
- "\t\tdsml_file=$arg\n"
- "\t\tset_dsml=2\n"
- "\telse\n"
- "\t\targ_list=$arg_list$space$arg\n"
- "\tfi\n"
- "done\n"
- "if [ $dsml_file = \"mydummy\" ]\nthen\n"
- "\tdsml_file=%s/dsml/`date +%%Y_%%m_%%d_%%H%%M%%S`.dsml\n"
- "\techo dsmlfile: $dsml_file\n"
- "fi\n"
- "%s/bin/base/jre/bin/java -Dverify=true -classpath %s/java/ldapjdk.jar:%s/java/jars/xmltools.jar com.netscape.xmltools.LDIF2DSML -s -o $dsml_file \n"
- "if [ $? = 0 ]; then\n"
- "\t./ns-slapd db2ldif -D %s \"$@\" -a - | %s/bin/base/jre/bin/java -classpath %s/java/ldapjdk.jar:%s/java/jars/xmltools.jar com.netscape.xmltools.LDIF2DSML -s -o $dsml_file \n"
- "fi\n",
- server, cs_path, sroot, sroot, sroot, cs_path, sroot, sroot, sroot);
- if(t) return t;
-
t = CREATE_DB2LDIF();
if(t) return t;
-#if defined(UPGRADEDB)
- t = gen_script(cs_path, "db2index",
- "cd %s\n"
- "if [ $# -eq 0 ]\n"
- "then\n"
- "\tbak_dir=%s/bak/reindex_`date +%%Y_%%m_%%d_%%H_%%M_%%S`\n"
- "\t./%s upgradedb -D %s -f -a \"$bak_dir\"\n"
- "elif [ $# -lt 4 ]\n"
- "then\n"
- "\techo \"Usage: db2index [-n backend_instance | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvattribute]\"\n"
- "\texit 1\n"
- "else\n"
- "\t./%s db2index -D %s \"$@\"\n"
- "fi\n\n",
- server, cf->ldif_dir,
- PRODUCT_BIN, cf->config_dir,
- PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-#endif
-
- t = gen_script(cs_path, "vlvindex",
- "cd %s\n"
- "if [ $# -lt 4 ]\n"
- "then\n"
- "\techo \"Usage: vlvindex -n backend_instance | {-s includesuffix}* -T attribute\"\n"
- "\techo Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" are required.\n"
- "\texit 1\n"
- "fi\n\n"
- "./%s db2index -D %s \"$@\"\n",
- server, PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-
- t = gen_script(cs_path, "db2bak",
- "cd %s\n"
- "if [ \"$#\" -eq 1 ]\nthen\n"
- "\tbak_dir=$1\nelse\n"
- "\tbak_dir=%s/`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
- "./%s db2archive -D %s -a $bak_dir\n",
- server, cf->bak_dir, PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-
- t = CREATE_DB2BAK();
- if(t) return t;
-
- t = gen_script(cs_path, "bak2db",
- "if [ $# -lt 1 ] || [ $# -gt 3 ]\nthen\n"
- " echo \"Usage: bak2db archivedir [-n backendname]\"\n"
- " exit 1\n"
- "else\n"
- " archivedir=$1\n"
- " shift\n"
- "fi\n"
- "while getopts \"n:\" flag\ndo\n"
- " case $flag in\n"
- " n) bename=$OPTARG;;\n"
- " *) echo \"Usage: bak2db archivedir [-n backendname]\"; exit 2;;\n"
- " esac\n"
- "done\n\n"
- "if [ 1 = `expr $archivedir : \"\\/\"` ]\nthen\n"
- " archivedir=$archivedir\n"
- "else\n"
- " # relative\n"
- " archivedir=`pwd`/$archivedir\nfi\n\n"
- "cd %s\n"
- "if [ \"$#\" -eq 2 ]\nthen\n"
- " ./%s archive2db -D %s -a $archivedir -n $bename\n"
- "else\n"
- " ./%s archive2db -D %s -a $archivedir\n"
- "fi\n",
- server, PRODUCT_BIN, cf->config_dir, PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-
t = CREATE_BAK2DB();
if(t) return t;
@@ -2403,50 +1958,9 @@
t = CREATE_ACCOUNT_INACT("ns-accountstatus.pl");
if(t) return t;
- t = CREATE_DSML();
- if(t) return t;
-
t = CREATE_NEWPWPOLICY();
if(t) return t;
- t = gen_script(cs_path, "suffix2instance",
- "cd %s\n"
- "if [ $# -lt 2 ]\n"
- "then\n"
- "\techo Usage: suffix2instance {-s includesuffix}*\n"
- "\texit 1\n"
- "fi\n\n"
- "./%s suffix2instance -D %s \"$@\" 2>&1\n",
- server, PRODUCT_BIN, cf->config_dir);
- if(t) return t;
-
- /*Generate the java commandline tools in bin/slapd/server*/
- for (cls = 0; cls < 7; cls++) {
- t = gen_script(server, cl_scripts[cls],
- "cd %s\n\n"
- "lang=${LANG:=en}\n"
- "while [ $# -ge 1 ]\n"
- "do\n"
- " if [ $1 = '-l' ]\n"
- " then\n"
- " shift\n"
- " lang=$1\n"
- " else\n"
- " arg=\"$arg $1\"\n"
- " fi\n"
- " shift\n"
- "done\n"
- "./bin/base/jre/bin/jre -classpath ./bin/base/jre/lib:"
- "./bin/base/jre/lib/rt.jar:./bin/base/jre/lib/i18n.jar:"
- "./java/base.jar:./java/jars/ds40.jar:./java/jars/ds40_${lang}.jar:"
- "./java/swingall.jar:./java/ssl.zip:"
- "./java/ldapjdk.jar:./java/mcc40.jar:./java/mcc40_${lang}.jar:"
- "./java/nmclf40.jar:./java/nmclf40_${lang}.jar"
- " com.netscape.admin.dirserv.cmdln.%s $arg\n",
- sroot, cl_javafiles[cls]);
- if(t) return t;
- }
-
return (t);
}
#else
@@ -2655,25 +2169,6 @@
t = CREATE_DB2INDEX();
if(t) return t;
-/*
- t = CREATE_MIGRATETO5();
- if(t) return t;
-
- t = CREATE_MIGRATE50TO51();
- if(t) return t;
-
- t = CREATE_MIGRATEINSTANCE5();
- if(t) return t;
-
- t = CREATE_MIGRATETO6();
- if(t) return t;
-
- t = CREATE_MIGRATE5TO6();
- if(t) return t;
-
- t = CREATE_MIGRATEINSTANCE6();
- if(t) return t;
-*/
t = CREATE_MIGRATE5TO7();
if(t) return t;
@@ -3010,9 +2505,6 @@
t = CREATE_ACCOUNT_INACT("ns-accountstatus.pl");
if(t) return t;
- t = CREATE_DSML();
- if(t) return t;
-
t = gen_script(cs_path, "dsml-activate.bat",
"@echo off\n"
"setlocal\n"
16 years, 11 months
[Fedora-directory-commits] ldapserver Makefile.am, 1.7, 1.8 configure.ac, 1.4, 1.5 Makefile.in, 1.7, 1.8 configure, 1.4, 1.5
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11321
Modified Files:
Makefile.am configure.ac Makefile.in configure
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Comment #10, #11, #14
Index: Makefile.am
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.am 24 Oct 2006 21:11:01 -0000 1.7
+++ Makefile.am 26 Oct 2006 17:45:27 -0000 1.8
@@ -51,6 +51,7 @@
schemadir = @sysconfdir@@schemadir@
serverdir = @prefix@@serverdir@
serverplugindir = @prefix@@serverplugindir@
+taskdir = @sysconfdir@@scripttemplatedir@
#------------------------
# Build Products
@@ -125,8 +126,39 @@
wrappers/ldif \
wrappers/migratecred \
wrappers/mmldif \
- wrappers/pwdhash
+ wrappers/pwdhash \
+ $(srcdir)/ldap/admin/src/ds_newinst.pl
+task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
+ ldap/admin/src/scripts/template-db2bak \
+ ldap/admin/src/scripts/template-db2index \
+ ldap/admin/src/scripts/template-db2ldif \
+ ldap/admin/src/scripts/template-ldif2db \
+ ldap/admin/src/scripts/template-ldif2ldap \
+ ldap/admin/src/scripts/template-monitor \
+ ldap/admin/src/scripts/template-restoreconfig \
+ ldap/admin/src/scripts/template-saveconfig \
+ ldap/admin/src/scripts/template-start-slapd \
+ ldap/admin/src/scripts/template-stop-slapd \
+ ldap/admin/src/scripts/template-suffix2instance \
+ ldap/admin/src/scripts/template-vlvindex \
+ ldap/admin/src/scripts/template-bak2db.pl \
+ ldap/admin/src/scripts/template-cl-dump.pl \
+ ldap/admin/src/scripts/template-db2bak.pl \
+ ldap/admin/src/scripts/template-db2index.pl \
+ ldap/admin/src/scripts/template-db2ldif.pl \
+ ldap/admin/src/scripts/template-ldif2db.pl \
+ ldap/admin/src/scripts/template-ns-accountstatus.pl \
+ ldap/admin/src/scripts/template-ns-activate.pl \
+ ldap/admin/src/scripts/template-ns-inactivate.pl \
+ ldap/admin/src/scripts/template-ns-newpwpolicy.pl \
+ ldap/admin/src/scripts/template-repl-monitor-cgi.pl \
+ ldap/admin/src/scripts/template-repl-monitor.pl \
+ ldap/admin/src/scripts/template-verify-db.pl \
+ $(srcdir)/ldap/admin/src/scripts/template-migrate5to7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrate6to7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrateInstance7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrateTo7
#////////////////////////////////////////////////////////////////
#
@@ -584,7 +616,7 @@
#------------------------
# libreplication-plugin
#------------------------
-libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.o \
+libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.c \
ldap/servers/plugins/replication/cl5_clcache.c \
ldap/servers/plugins/replication/cl5_config.c \
ldap/servers/plugins/replication/cl5_init.c \
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configure.ac 25 Oct 2006 20:36:45 -0000 1.4
+++ configure.ac 26 Oct 2006 17:45:27 -0000 1.5
@@ -131,6 +131,7 @@
schemadir=/fedora-ds/schema
serverdir=/usr/lib/fedora-ds
serverplugindir=/usr/lib/fedora-ds/plugins
+scripttemplatedir=/fedora-ds/script-templates
AC_SUBST(bindir)
AC_SUBST(configdir)
AC_SUBST(datadir)
@@ -138,6 +139,7 @@
AC_SUBST(schemadir)
AC_SUBST(serverdir)
AC_SUBST(serverplugindir)
+AC_SUBST(scripttemplatedir)
# WINNT should be true if building on Windows system not using
# cygnus, mingw, or the like and using cmd.exe as the shell
@@ -156,6 +158,20 @@
AC_CONFIG_FILES([wrappers/pwdhash])
AC_CONFIG_FILES([wrappers/rsearch])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-bak2db])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2bak])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2index])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2ldif])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ldif2db])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ldif2ldap])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-monitor])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-restoreconfig])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-saveconfig])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-start-slapd])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-stop-slapd])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-suffix2instance])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-vlvindex])
+
AC_CONFIG_FILES([ldap/admin/src/scripts/template-bak2db.pl])
AC_CONFIG_FILES([ldap/admin/src/scripts/template-cl-dump.pl])
AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2bak.pl])
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.in 24 Oct 2006 21:11:01 -0000 1.7
+++ Makefile.in 26 Oct 2006 17:45:27 -0000 1.8
@@ -52,6 +52,32 @@
@SOLARIS_TRUE@am__append_1 = ldap/servers/slapd/tools/ldclt/opCheck.c
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure \
+ $(top_srcdir)/ldap/admin/src/scripts/template-bak2db.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-bak2db.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-cl-dump.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2bak.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2bak.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2index.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2index.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2ldif.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-db2ldif.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ldif2db.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ldif2db.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ldif2ldap.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-monitor.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ns-accountstatus.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ns-activate.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ns-inactivate.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-repl-monitor-cgi.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-repl-monitor.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-restoreconfig.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-saveconfig.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-start-slapd.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-stop-slapd.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-suffix2instance.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-verify-db.pl.in \
+ $(top_srcdir)/ldap/admin/src/scripts/template-vlvindex.in \
$(top_srcdir)/wrappers/dbscan.in \
$(top_srcdir)/wrappers/ds_newinst.in \
$(top_srcdir)/wrappers/dsktune.in \
@@ -78,7 +104,33 @@
CONFIG_CLEAN_FILES = wrappers/dbscan wrappers/dsktune \
wrappers/ds_newinst wrappers/infadd wrappers/ldap-agent \
wrappers/ldclt wrappers/ldif wrappers/migratecred \
- wrappers/mmldif wrappers/pwdhash wrappers/rsearch
+ wrappers/mmldif wrappers/pwdhash wrappers/rsearch \
+ ldap/admin/src/scripts/template-bak2db \
+ ldap/admin/src/scripts/template-db2bak \
+ ldap/admin/src/scripts/template-db2index \
+ ldap/admin/src/scripts/template-db2ldif \
+ ldap/admin/src/scripts/template-ldif2db \
+ ldap/admin/src/scripts/template-ldif2ldap \
+ ldap/admin/src/scripts/template-monitor \
+ ldap/admin/src/scripts/template-restoreconfig \
+ ldap/admin/src/scripts/template-saveconfig \
+ ldap/admin/src/scripts/template-start-slapd \
+ ldap/admin/src/scripts/template-stop-slapd \
+ ldap/admin/src/scripts/template-suffix2instance \
+ ldap/admin/src/scripts/template-vlvindex \
+ ldap/admin/src/scripts/template-bak2db.pl \
+ ldap/admin/src/scripts/template-cl-dump.pl \
+ ldap/admin/src/scripts/template-db2bak.pl \
+ ldap/admin/src/scripts/template-db2index.pl \
+ ldap/admin/src/scripts/template-db2ldif.pl \
+ ldap/admin/src/scripts/template-ldif2db.pl \
+ ldap/admin/src/scripts/template-ns-accountstatus.pl \
+ ldap/admin/src/scripts/template-ns-activate.pl \
+ ldap/admin/src/scripts/template-ns-inactivate.pl \
+ ldap/admin/src/scripts/template-ns-newpwpolicy.pl \
+ ldap/admin/src/scripts/template-repl-monitor-cgi.pl \
+ ldap/admin/src/scripts/template-repl-monitor.pl \
+ ldap/admin/src/scripts/template-verify-db.pl
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libavl_a_AR = $(AR) $(ARFLAGS)
@@ -107,9 +159,9 @@
am__installdirs = "$(DESTDIR)$(serverdir)" \
"$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(serverdir)" "$(DESTDIR)$(bindir)" \
- "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(configdir)" \
- "$(DESTDIR)$(datadir)" "$(DESTDIR)$(propertydir)" \
- "$(DESTDIR)$(schemadir)"
+ "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(taskdir)" \
+ "$(DESTDIR)$(configdir)" "$(DESTDIR)$(datadir)" \
+ "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(schemadir)"
serverLTLIBRARIES_INSTALL = $(INSTALL)
serverpluginLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(server_LTLIBRARIES) $(serverplugin_LTLIBRARIES)
@@ -364,7 +416,8 @@
am_libreferint_plugin_la_OBJECTS = ldap/servers/plugins/referint/libreferint_plugin_la-referint.lo
libreferint_plugin_la_OBJECTS = $(am_libreferint_plugin_la_OBJECTS)
libreplication_plugin_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am_libreplication_plugin_la_OBJECTS = ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo \
+am_libreplication_plugin_la_OBJECTS = ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo \
+ ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo \
ldap/servers/plugins/replication/libreplication_plugin_la-cl5_config.lo \
ldap/servers/plugins/replication/libreplication_plugin_la-cl5_init.lo \
ldap/servers/plugins/replication/libreplication_plugin_la-csnpl.lo \
@@ -679,7 +732,8 @@
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
serverSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-SCRIPTS = $(bin_SCRIPTS) $(server_SCRIPTS)
+taskSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(bin_SCRIPTS) $(server_SCRIPTS) $(task_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -853,6 +907,7 @@
build_vendor = @build_vendor@
configdir = @sysconfdir@@configdir@
datadir = @prefix@@datadir@
+db_bindir = @db_bindir@
db_inc = @db_inc@
db_incdir = @db_incdir@
db_lib = @db_lib@
@@ -870,6 +925,7 @@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+ldapsdk_bindir = @ldapsdk_bindir@
ldapsdk_inc = @ldapsdk_inc@
ldapsdk_lib = @ldapsdk_lib@
ldapsdk_libdir = @ldapsdk_libdir@
@@ -898,6 +954,7 @@
sasl_libdir = @sasl_libdir@
sbindir = @sbindir@
schemadir = @sysconfdir@@schemadir@
+scripttemplatedir = @scripttemplatedir@
serverdir = @prefix@@serverdir@
serverplugindir = @prefix@@serverplugindir@
sharedstatedir = @sharedstatedir@
@@ -942,6 +999,7 @@
#------------------------
BUILT_SOURCES = dirver.h dberrstrs.h
CLEANFILES = dirver.h dberrstrs.h ns-slapd.properties
+taskdir = @sysconfdir@@scripttemplatedir@
server_LTLIBRARIES = libslapd.la libback-ldbm.la libds_admin.la libns-dshttpd.la
serverplugin_LTLIBRARIES = libacl-plugin.la libattr-unique-plugin.la libchainingdb-plugin.la \
libcos-plugin.la libdes-plugin.la libdistrib-plugin.la \
@@ -1003,7 +1061,39 @@
wrappers/ldif \
wrappers/migratecred \
wrappers/mmldif \
- wrappers/pwdhash
+ wrappers/pwdhash \
+ $(srcdir)/ldap/admin/src/ds_newinst.pl
+
+task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
+ ldap/admin/src/scripts/template-db2bak \
+ ldap/admin/src/scripts/template-db2index \
+ ldap/admin/src/scripts/template-db2ldif \
+ ldap/admin/src/scripts/template-ldif2db \
+ ldap/admin/src/scripts/template-ldif2ldap \
+ ldap/admin/src/scripts/template-monitor \
+ ldap/admin/src/scripts/template-restoreconfig \
+ ldap/admin/src/scripts/template-saveconfig \
+ ldap/admin/src/scripts/template-start-slapd \
+ ldap/admin/src/scripts/template-stop-slapd \
+ ldap/admin/src/scripts/template-suffix2instance \
+ ldap/admin/src/scripts/template-vlvindex \
+ ldap/admin/src/scripts/template-bak2db.pl \
+ ldap/admin/src/scripts/template-cl-dump.pl \
+ ldap/admin/src/scripts/template-db2bak.pl \
+ ldap/admin/src/scripts/template-db2index.pl \
+ ldap/admin/src/scripts/template-db2ldif.pl \
+ ldap/admin/src/scripts/template-ldif2db.pl \
+ ldap/admin/src/scripts/template-ns-accountstatus.pl \
+ ldap/admin/src/scripts/template-ns-activate.pl \
+ ldap/admin/src/scripts/template-ns-inactivate.pl \
+ ldap/admin/src/scripts/template-ns-newpwpolicy.pl \
+ ldap/admin/src/scripts/template-repl-monitor-cgi.pl \
+ ldap/admin/src/scripts/template-repl-monitor.pl \
+ ldap/admin/src/scripts/template-verify-db.pl \
+ $(srcdir)/ldap/admin/src/scripts/template-migrate5to7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrate6to7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrateInstance7 \
+ $(srcdir)/ldap/admin/src/scripts/template-migrateTo7
#////////////////////////////////////////////////////////////////
@@ -1448,7 +1538,7 @@
#------------------------
# libreplication-plugin
#------------------------
-libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.o \
+libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.c \
ldap/servers/plugins/replication/cl5_clcache.c \
ldap/servers/plugins/replication/cl5_config.c \
ldap/servers/plugins/replication/cl5_init.c \
@@ -1764,6 +1854,58 @@
cd $(top_builddir) && $(SHELL) ./config.status $@
wrappers/rsearch: $(top_builddir)/config.status $(top_srcdir)/wrappers/rsearch.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-bak2db: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-bak2db.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2bak: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2bak.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2index: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2index.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2ldif: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2ldif.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ldif2db: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ldif2db.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ldif2ldap: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ldif2ldap.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-monitor: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-monitor.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-restoreconfig: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-restoreconfig.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-saveconfig: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-saveconfig.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-start-slapd: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-start-slapd.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-stop-slapd: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-stop-slapd.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-suffix2instance: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-suffix2instance.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-vlvindex: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-vlvindex.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-bak2db.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-bak2db.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-cl-dump.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-cl-dump.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2bak.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2bak.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2index.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2index.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-db2ldif.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-db2ldif.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ldif2db.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ldif2db.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ns-accountstatus.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ns-activate.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ns-activate.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ns-inactivate.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ns-inactivate.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-ns-newpwpolicy.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-repl-monitor-cgi.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-repl-monitor-cgi.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-repl-monitor.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-repl-monitor.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+ldap/admin/src/scripts/template-verify-db.pl: $(top_builddir)/config.status $(top_srcdir)/ldap/admin/src/scripts/template-verify-db.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -2608,6 +2750,9 @@
ldap/servers/plugins/replication/$(DEPDIR)/$(am__dirstamp):
@$(mkdir_p) ldap/servers/plugins/replication/$(DEPDIR)
@: > ldap/servers/plugins/replication/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo: \
+ ldap/servers/plugins/replication/$(am__dirstamp) \
+ ldap/servers/plugins/replication/$(DEPDIR)/$(am__dirstamp)
ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo: \
ldap/servers/plugins/replication/$(am__dirstamp) \
ldap/servers/plugins/replication/$(DEPDIR)/$(am__dirstamp)
@@ -3519,6 +3664,25 @@
echo " rm -f '$(DESTDIR)$(serverdir)/$$f'"; \
rm -f "$(DESTDIR)$(serverdir)/$$f"; \
done
+install-taskSCRIPTS: $(task_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(taskdir)" || $(mkdir_p) "$(DESTDIR)$(taskdir)"
+ @list='$(task_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(taskSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(taskdir)/$$f'"; \
+ $(taskSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(taskdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-taskSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(task_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(taskdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(taskdir)/$$f"; \
+ done
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -3685,6 +3849,8 @@
-rm -f ldap/servers/plugins/pwdstorage/libpwdstorage_plugin_la-ssha_pwd.lo
-rm -f ldap/servers/plugins/referint/libreferint_plugin_la-referint.$(OBJEXT)
-rm -f ldap/servers/plugins/referint/libreferint_plugin_la-referint.lo
+ -rm -f ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.$(OBJEXT)
+ -rm -f ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo
-rm -f ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.$(OBJEXT)
-rm -f ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo
-rm -f ldap/servers/plugins/replication/libreplication_plugin_la-cl5_config.$(OBJEXT)
@@ -4415,6 +4581,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/pwdstorage/$(DEPDIR)/libpwdstorage_plugin_la-sha_pwd.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/pwdstorage/$(DEPDIR)/libpwdstorage_plugin_la-ssha_pwd.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/referint/$(DEPDIR)/libreferint_plugin_la-referint.Plo(a)am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_api.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_clcache.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_config.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_init.Plo(a)am__quote@
@@ -6057,6 +6224,13 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libreferint_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/referint/libreferint_plugin_la-referint.lo `test -f 'ldap/servers/plugins/referint/referint.c' || echo '$(srcdir)/'`ldap/servers/plugins/referint/referint.c
+ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo: ldap/servers/plugins/replication/cl5_api.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libreplication_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo -MD -MP -MF "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_api.Tpo" -c -o ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo `test -f 'ldap/servers/plugins/replication/cl5_api.c' || echo '$(srcdir)/'`ldap/servers/plugins/replication/cl5_api.c; \
+@am__fastdepCC_TRUE@ then mv -f "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_api.Tpo" "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_api.Plo"; else rm -f "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_api.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/replication/cl5_api.c' object='ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libreplication_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/replication/libreplication_plugin_la-cl5_api.lo `test -f 'ldap/servers/plugins/replication/cl5_api.c' || echo '$(srcdir)/'`ldap/servers/plugins/replication/cl5_api.c
+
ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo: ldap/servers/plugins/replication/cl5_clcache.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libreplication_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo -MD -MP -MF "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_clcache.Tpo" -c -o ldap/servers/plugins/replication/libreplication_plugin_la-cl5_clcache.lo `test -f 'ldap/servers/plugins/replication/cl5_clcache.c' || echo '$(srcdir)/'`ldap/servers/plugins/replication/cl5_clcache.c; \
@am__fastdepCC_TRUE@ then mv -f "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_clcache.Tpo" "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_clcache.Plo"; else rm -f "ldap/servers/plugins/replication/$(DEPDIR)/libreplication_plugin_la-cl5_clcache.Tpo"; exit 1; fi
@@ -8563,7 +8737,7 @@
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/m4 $(distdir)/wrappers
+ $(mkdir_p) $(distdir)/ldap/admin/src/scripts $(distdir)/m4 $(distdir)/wrappers
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@@ -8693,7 +8867,7 @@
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) \
$(DATA)
installdirs:
- for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(schemadir)"; do \
+ for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(schemadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -8820,7 +8994,8 @@
install-data-am: install-configDATA install-dataDATA \
install-nodist_propertyDATA install-schemaDATA \
install-serverLTLIBRARIES install-serverPROGRAMS \
- install-serverSCRIPTS install-serverpluginLTLIBRARIES
+ install-serverSCRIPTS install-serverpluginLTLIBRARIES \
+ install-taskSCRIPTS
install-exec-am: install-binPROGRAMS install-binSCRIPTS
@@ -8854,7 +9029,8 @@
uninstall-configDATA uninstall-dataDATA uninstall-info-am \
uninstall-nodist_propertyDATA uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverPROGRAMS \
- uninstall-serverSCRIPTS uninstall-serverpluginLTLIBRARIES
+ uninstall-serverSCRIPTS uninstall-serverpluginLTLIBRARIES \
+ uninstall-taskSCRIPTS
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool \
@@ -8871,15 +9047,16 @@
install-nodist_propertyDATA install-schemaDATA \
install-serverLTLIBRARIES install-serverPROGRAMS \
install-serverSCRIPTS install-serverpluginLTLIBRARIES \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-binSCRIPTS \
+ install-strip install-taskSCRIPTS installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-configDATA uninstall-dataDATA uninstall-info-am \
uninstall-nodist_propertyDATA uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverPROGRAMS \
- uninstall-serverSCRIPTS uninstall-serverpluginLTLIBRARIES
+ uninstall-serverSCRIPTS uninstall-serverpluginLTLIBRARIES \
+ uninstall-taskSCRIPTS
dirver.h: Makefile
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configure 24 Oct 2006 21:11:01 -0000 1.4
+++ configure 26 Oct 2006 17:45:27 -0000 1.5
@@ -465,7 +465,7 @@
#endif"
ac_default_prefix=/opt/fedora-ds
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS platfor!
m_defs SOLARIS_TRUE SOLARIS_FALSE debug_defs PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir db_inc db_incdir db_lib db_libdir sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link configdir propertydir schemadir serverdir serverplugindir WINNT_TRUE WINNT_FALSE LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS platfor!
m_defs SOLARIS_TRUE SOLARIS_FALSE debug_defs PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link configdir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -23904,6 +23904,8 @@
echo "$as_me: error: LDAPSDK not found, specify with --with-ldapsdk-inc|-lib." >&2;}
{ (exit 1); exit 1; }; }
fi
+ldapsdk_bindir=/usr/lib/mozldap6
+
save_cppflags="$CPPFLAGS"
CPPFLAGS="$ldapsdk_inc $nss_inc $nspr_inc"
echo "$as_me:$LINENO: checking for ldap.h" >&5
@@ -24038,6 +24040,7 @@
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi;
+db_bindir=/usr/bin
if test -z "$db_inc"; then
echo "$as_me:$LINENO: checking for db.h" >&5
@@ -24946,6 +24949,8 @@
+
+
# installation paths
bindir=/usr/bin
configdir=/fedora-ds/config
@@ -24954,6 +24959,8 @@
schemadir=/fedora-ds/schema
serverdir=/usr/lib/fedora-ds
serverplugindir=/usr/lib/fedora-ds/plugins
+scripttemplatedir=/fedora-ds/script-templates
+
@@ -24999,6 +25006,61 @@
ac_config_files="$ac_config_files wrappers/rsearch"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-bak2db"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2bak"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2index"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2ldif"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ldif2db"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ldif2ldap"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-monitor"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-restoreconfig"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-saveconfig"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-start-slapd"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-stop-slapd"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-suffix2instance"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-vlvindex"
+
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-bak2db.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-cl-dump.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2bak.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2index.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-db2ldif.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ldif2db.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ns-accountstatus.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ns-activate.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ns-inactivate.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-ns-newpwpolicy.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-repl-monitor-cgi.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-repl-monitor.pl"
+
+ ac_config_files="$ac_config_files ldap/admin/src/scripts/template-verify-db.pl"
+
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -25607,6 +25669,32 @@
"wrappers/mmldif" ) CONFIG_FILES="$CONFIG_FILES wrappers/mmldif" ;;
"wrappers/pwdhash" ) CONFIG_FILES="$CONFIG_FILES wrappers/pwdhash" ;;
"wrappers/rsearch" ) CONFIG_FILES="$CONFIG_FILES wrappers/rsearch" ;;
+ "ldap/admin/src/scripts/template-bak2db" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-bak2db" ;;
+ "ldap/admin/src/scripts/template-db2bak" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2bak" ;;
+ "ldap/admin/src/scripts/template-db2index" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2index" ;;
+ "ldap/admin/src/scripts/template-db2ldif" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2ldif" ;;
+ "ldap/admin/src/scripts/template-ldif2db" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ldif2db" ;;
+ "ldap/admin/src/scripts/template-ldif2ldap" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ldif2ldap" ;;
+ "ldap/admin/src/scripts/template-monitor" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-monitor" ;;
+ "ldap/admin/src/scripts/template-restoreconfig" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-restoreconfig" ;;
+ "ldap/admin/src/scripts/template-saveconfig" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-saveconfig" ;;
+ "ldap/admin/src/scripts/template-start-slapd" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-start-slapd" ;;
+ "ldap/admin/src/scripts/template-stop-slapd" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-stop-slapd" ;;
+ "ldap/admin/src/scripts/template-suffix2instance" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-suffix2instance" ;;
+ "ldap/admin/src/scripts/template-vlvindex" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-vlvindex" ;;
+ "ldap/admin/src/scripts/template-bak2db.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-bak2db.pl" ;;
+ "ldap/admin/src/scripts/template-cl-dump.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-cl-dump.pl" ;;
+ "ldap/admin/src/scripts/template-db2bak.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2bak.pl" ;;
+ "ldap/admin/src/scripts/template-db2index.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2index.pl" ;;
+ "ldap/admin/src/scripts/template-db2ldif.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-db2ldif.pl" ;;
+ "ldap/admin/src/scripts/template-ldif2db.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ldif2db.pl" ;;
+ "ldap/admin/src/scripts/template-ns-accountstatus.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ns-accountstatus.pl" ;;
+ "ldap/admin/src/scripts/template-ns-activate.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ns-activate.pl" ;;
+ "ldap/admin/src/scripts/template-ns-inactivate.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ns-inactivate.pl" ;;
+ "ldap/admin/src/scripts/template-ns-newpwpolicy.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-ns-newpwpolicy.pl" ;;
+ "ldap/admin/src/scripts/template-repl-monitor-cgi.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-repl-monitor-cgi.pl" ;;
+ "ldap/admin/src/scripts/template-repl-monitor.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-repl-monitor.pl" ;;
+ "ldap/admin/src/scripts/template-verify-db.pl" ) CONFIG_FILES="$CONFIG_FILES ldap/admin/src/scripts/template-verify-db.pl" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -25774,10 +25862,12 @@
s,@ldapsdk_inc@,$ldapsdk_inc,;t t
s,@ldapsdk_lib@,$ldapsdk_lib,;t t
s,@ldapsdk_libdir@,$ldapsdk_libdir,;t t
+s,@ldapsdk_bindir@,$ldapsdk_bindir,;t t
s,@db_inc@,$db_inc,;t t
s,@db_incdir@,$db_incdir,;t t
s,@db_lib@,$db_lib,;t t
s,@db_libdir@,$db_libdir,;t t
+s,@db_bindir@,$db_bindir,;t t
s,@sasl_inc@,$sasl_inc,;t t
s,@sasl_lib@,$sasl_lib,;t t
s,@sasl_libdir@,$sasl_libdir,;t t
@@ -25795,6 +25885,7 @@
s,@schemadir@,$schemadir,;t t
s,@serverdir@,$serverdir,;t t
s,@serverplugindir@,$serverplugindir,;t t
+s,@scripttemplatedir@,$scripttemplatedir,;t t
s,@WINNT_TRUE@,$WINNT_TRUE,;t t
s,@WINNT_FALSE@,$WINNT_FALSE,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
16 years, 11 months
[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts template-bak2db.pl.in, NONE, 1.1 template-cl-dump.pl.in, NONE, 1.1 template-db2bak.pl.in, NONE, 1.1 template-db2index.pl.in, NONE, 1.1 template-db2ldif.pl.in, NONE, 1.1 template-ldif2db.pl.in, NONE, 1.1 template-ns-accountstatus.pl.in, NONE, 1.1 template-ns-activate.pl.in, NONE, 1.1 template-ns-inactivate.pl.in, NONE, 1.1 template-ns-newpwpolicy.pl.in, NONE, 1.1 template-repl-monitor-cgi.pl.in, NONE, 1.1 template-repl-monitor.pl.in, NONE, 1.1 temp
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5158/ldap/admin/src/scripts
Modified Files:
template-cl-dump.pl template-ns-newpwpolicy.pl
template-repl-monitor-cgi.pl template-verify-db.pl
Added Files:
template-bak2db.pl.in template-cl-dump.pl.in
template-db2bak.pl.in template-db2index.pl.in
template-db2ldif.pl.in template-ldif2db.pl.in
template-ns-accountstatus.pl.in template-ns-activate.pl.in
template-ns-inactivate.pl.in template-ns-newpwpolicy.pl.in
template-repl-monitor-cgi.pl.in template-repl-monitor.pl.in
template-verify-db.pl.in
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Changes:
1) added template files to AC_CONFIG_FILES list
2) added db_bindir and ldapsdk_bindir to pass their tools path to the template
files. The paths are hardcoded for now.
--- NEW FILE template-bak2db.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " : -a dirname [-t dbtype]\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
print(STDERR " : -w password - Directory Manager's password\n");
print(STDERR " : -w - - Prompt for Directory Manager's password\n");
print(STDERR " : -j filename - Read Directory Manager's password from file\n");
print(STDERR " : -a dirname - backup directory\n");
print(STDERR " : -t dbtype - database type (default: ldbm database)\n");
print(STDERR " : -n backend - name of backend instance to restore\n");
print(STDERR " : -v - verbose\n");
}
$taskname = "";
$archivedir = "";
$dbtype = "ldbm database";
$instance = "";
$prefix = "{{DS-ROOT}}";
$verbose = 0;
$rootdn = "";
$passwd = "";
$passwdfile = "";
$i = 0;
while ($i <= $#ARGV) {
if ("$ARGV[$i]" eq "-a") { # backup directory
$i++; $archivedir = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-D") { # Directory Manager
$i++; $rootdn = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-w") { # Directory Manager's password
$i++; $passwd = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-j") { # Read Directory Manager's password from a file
$i++; $passwdfile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-t") { # database type
$i++; $dbtype = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-n") { # backend instance name
$i++; $instance = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-v") { # verbose
$verbose = 1;
} else {
&usage; exit(1);
}
$i++;
}
if ($passwdfile ne ""){
# Open file and get the password
unless (open (RPASS, $passwdfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$passwd = <RPASS>;
chomp($passwd);
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $passwd = ReadLine(0);
# chomp($passwd);
# ReadMode('normal');
}
if ( $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "restore_${yr}_${mn}_${dy}_${h}_${m}_${s}";
if ($archivedir eq "") {
&usage; exit(1);
}
use File::Spec;
$isabs = File::Spec->file_name_is_absolute( $archivedir );
if (!$isabs) {
$archivedir = File::Spec->rel2abs( $archivedir );
}
$dn = "dn: cn=$taskname, cn=restore, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
if ($instance ne "") {
$nsinstance = "nsInstance: ${instance}\n";
}
$nsarchivedir = "nsArchiveDir: $archivedir\n";
$nsdbtype = "nsDatabaseType: $dbtype\n";
$entry = "${dn}${misc}${cn}${nsinstance}${nsarchivedir}${nsdbtype}";
$vstr = "";
if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
--- NEW FILE template-cl-dump.pl.in ---
#{{PERL-EXEC}}
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
###################################################################################
#
# FILE: cl-dump.pl
#
# SYNOPSIS:
#
# cl-dump.pl [-h host] [-p port] [-D bind-dn] -w bind-password | -P bind-cert\
# [-r replica-roots] [-o output-file] [-c] [-v]\n";
#
# cl-dump.pl -i changelog-ldif-file-with-base64encoding [-o output-file] [-c]\n";
#
# DESCRIPTION:
# Dump and decode Directory Server replication change log
#
# OPTIONS:
#
# -c Dump and interpret CSN only. This option can be used with or
# without -i option.
#
# -D bind-dn
# Directory server's bind DN. Default to "cn=Directory Manager" if
# the option is omitted.
#
# -h host
# Directory server's host. Default to the server where the script
# is running.
#
# -i changelog-ldif-file-with-base64encoding
# If you already have a ldif-like changelog, but the changes
# in that file are encoded, you may use this option to
# decode that ldif-like changelog.
#
# -o output-file
# Path name for the final result. Default to STDOUT if omitted.
#
# -p port
# Directory server's port. Default to 389.
#
# -P bind-cert
# Pathname of binding certificate DB
#
# -r replica-roots
# Specify replica roots whose changelog you want to dump. The replica
# roots may be seperated by comma. All the replica roots would be
# dumped if the option is omitted.
#
# -v Print the version of this script.
#
# -w bind-password
# Password for the bind DN
#
# RESTRICTION:
# If you are not using -i option, the script should be run when the server
# is running, and from where the server's changelog directory is accessible.
#
# DIAGNOSIS:
# For environment variable issues, see script template-repl-monitor.pl under
# DSHOME/bin/slapd/admin/scripts
#
################################################################################
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
# installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
$prefix = "{{DS-ROOT}}";
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$usage="Usage: $0 [-h host] [-p port] [-D bind-dn] [-w bind-password | -P bind-cert] [-r replica-roots] [-o output-file] [-c] [-v]\n\n $0 -i changelog-ldif-file-with-base64encoding [-o output-file] [-c]";
use Getopt::Std; # Parse command line arguments
use Mozilla::LDAP::Conn; # LDAP module for Perl
use Mozilla::LDAP::Utils; # LULU, utilities.
use Mozilla::LDAP::API; # Used to parse LDAP URL
use MIME::Base64; # Decode
# Global variables
$version = "Directory Server Changelog Dump - Version 1.0";
#main
{
# Turn off buffered I/O
$| = 1;
# Check for legal options
if (!getopts('h:p:D:w:P:r:o:cvi:')) {
print $usage;
exit -1;
}
exit -1 if &validateArgs;
if ($opt_v) {
print OUTPUT "$version\n";
exit;
}
if (!$opt_i) {
&cl_dump_and_decode;
}
elsif ($opt_c) {
&grep_csn ($opt_i);
}
else {
&cl_decode ($opt_i);
}
close (OUTPUT);
}
# Validate the parameters
sub validateArgs
{
my ($rc) = 0;
%ld = Mozilla::LDAP::Utils::ldapArgs();
chop ($ld{host} = `hostname`) if !$opt_h;
$ld{bind} = "cn=Directory Manager" if !$opt_D;
@allreplicas = ($opt_r) if ($opt_r);
if ($opt_o && ! open (OUTPUT, ">$opt_o")) {
print "Can't create output file $opt_o\n";
$rc = -1;
}
# Open STDOUT if option -o is missing
open (OUTPUT, ">-") if !$opt_o;
return $rc;
}
# Dump and decode changelog
# OUTPUT should have been opened before this call
sub cl_dump_and_decode
{
# Open the connection
my ($conn) = new Mozilla::LDAP::Conn (\%ld);
if (!$conn) {
print OUTPUT qq/Can't connect to $ld{host}:$ld{port} as "$ld{bind}"\n/;
return -1;
}
# Get the changelog dir
my ($changelogdir);
my ($entry) = $conn->search ("cn=changelog5,cn=config", "sub", "(objectClass=*)");
while ($entry) {
$changelogdir = $entry->{"nsslapd-changelogdir"}[0];
last if $changelogdir;
$entry = $conn->nextEntry ();
}
# Get all the replicas on the server if -r option is not specified
if (!$opt_r) {
$entry = $conn->search ("cn=mapping tree,cn=config", "sub",
"(objectClass=nsDS5Replica)");
while ($entry) {
push (@allreplicas, "$entry->{nsDS5ReplicaRoot}[0]");
$entry = $conn->nextEntry ();
}
}
# Dump the changelog for the replica
my (@ldifs);
my ($replica);
my ($gotldif);
my ($ldif);
foreach (@allreplicas) {
# Reset the script's start time
$^T = time;
$replica = $_;
$gotldif = 0;
# Can't move this line before entering the loop:
# no ldif file generated other than for the first
# replica.
$entry = $conn->newEntry();
$entry->setDN ("cn=replica,cn=\"$_\",cn=mapping tree,cn=config");
$entry->setValues('nsDS5Task', 'CL2LDIF');
$conn->update ($entry);
#Decode the dumped changelog
@ldifs = <$changelogdir/*.ldif>;
foreach (@ldifs) {
# Skip older ldif files
next if ($#ldifs > 0 && (-M $_ > 0));
$ldif = $_;
$gotldif = 1;
&print_header ($replica, 0);
if ($opt_c) {
&grep_csn ($_);
}
else {
&cl_decode ($_);
}
# Test op -M doesn't work well so we use rename
# here to avoid reading the same ldif file more
# than once.
rename ($ldif, "$ldif.done");
}
&print_header ($replica, "Not Found") if !$gotldif;
}
$conn->close;
}
sub print_header
{
my ($replica, $ldif) = @_;
print OUTPUT "\n# Replica Root: $replica" if $replica;
print OUTPUT "\n# LDIF File : $ldif\n" if $ldif;
}
# Grep and interpret CSNs
# OUTPUT should have been opened before this call
sub grep_csn
{
open (INPUT, "@_") || return;
&print_header (0, @_);
my ($csn, $maxcsn, $modts);
while (<INPUT>) {
next if ($_ !~ /(csn:)|(ruv:)/i);
if (/ruv:\s*{.+}\s+(\w+)\s+(\w+)\s+(\w*)/i) {
#
# RUV with two CSNs and an optional lastModifiedTime
#
$csn = &csn_to_string($1);
$maxcsn = &csn_to_string($2);
$modts = $3;
if ( $modts =~ /^0+$/ ) {
$modts = "";
}
else {
$modts = &csn_to_string($modts);
}
}
elsif (/csn:\s*(\w+)\s+/i || /ruv:\s*{.+}\s+(\w+)\s+/i) {
#
# Single CSN
#
$csn = &csn_to_string($1);
$maxcsn = "";
$modts = "";
}
else {
printf OUTPUT;
next;
}
chop;
printf OUTPUT "$_ ($csn";
printf OUTPUT "; $maxcsn" if $maxcsn;
printf OUTPUT "; $modts" if $modts;
printf OUTPUT ")\n";
}
}
sub csn_to_string
{
my ($csn, $tm, $seq, $masterid, $subseq);
my ($sec, $min, $hour, $mday, $mon, $year);
$csn = "@_";
return $csn if !$csn;
($tm, $seq, $masterid, $subseq) = unpack("a8 a4 a4 a4", $csn);
$tm = hex($tm);
$seq = hex($seq);
$masterid = hex($masterid);
$subseq = hex($subseq);
($sec, $min, $hour, $mday, $mon, $year) = localtime ($tm);
$mon++;
$year += 1900;
foreach ($sec, $min, $hour, $mday, $mon) {
$_ = "0".$_ if ($_ < 10);
}
$csn = "$mon/$mday/$year $hour:$min:$sec";
$csn .= " $seq $subseq" if ( $seq != 0 || $subseq != 0 );
return $csn;
}
# Decode the changelog
# OUTPUT should have been opened before this call
sub cl_decode
{
open (INPUT, "@_") || return;
&print_header (0, @_);
my ($encoded);
undef $encoded;
while (<INPUT>) {
# Try to accomodate "changes" in 4.X and "change" in 6.X
if (/^changes?::\s*(\S*)/i) {
print OUTPUT "change::\n";
$encoded = $1;
next;
}
if (!defined ($encoded)) {
print OUTPUT;
next;
}
if ($_ eq "\n") {
print OUTPUT MIME::Base64::decode($encoded);
print OUTPUT "\n";
undef $encoded;
next;
}
/^\s*(\S+)\s*\n/;
$encoded .= $1;
}
}
--- NEW FILE template-db2bak.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " [-a dirname] [-t dbtype]\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
print(STDERR " : -w password - Directory Manager's password\n");
print(STDERR " : -w - - Prompt for Directory Manager's password\n");
print(STDERR " : -j filename - Read Directory Manager's password from file\n");
print(STDERR " : -a dirname - backup directory\n");
print(STDERR " : -t dbtype - database type (default: ldbm database)\n");
print(STDERR " : -v - verbose\n");
}
$taskname = "";
$archivedir = "";
$dbtype = "ldbm database";
$prefix = "{{DS-ROOT}}";
$mybakdir = "{{BAK-DIR}}";
$verbose = 0;
$rootdn = "";
$passwd = "";
$passwdfile = "";
$i = 0;
while ($i <= $#ARGV) {
if ("$ARGV[$i]" eq "-a") { # backup directory
$i++; $archivedir = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-D") { # Directory Manager
$i++; $rootdn = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-w") { # Directory Manager's password
$i++; $passwd = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-j") { # Read Directory Manager's password from a file
$i++; $passwdfile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-t") { # database type
$i++; $dbtype = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-v") { # verbose
$verbose = 1;
} else {
&usage; exit(1);
}
$i++;
}
if ($passwdfile ne ""){
# Open file and get the password
unless (open (RPASS, $passwdfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$passwd = <RPASS>;
chomp($passwd);
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $passwd = ReadLine(0);
# chomp($passwd);
# ReadMode('normal');
}
if ( $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "backup_${yr}_${mn}_${dy}_${h}_${m}_${s}";
if ($archivedir eq "") {
$archivedir = "${bakdir}{{SEP}}bak{{SEP}}${yr}_${mn}_${dy}_${h}_${m}_${s}";
}
$dn = "dn: cn=$taskname, cn=backup, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
$nsarchivedir = "nsArchiveDir: $archivedir\n";
$nsdbtype = "nsDatabaseType: $dbtype\n";
$entry = "${dn}${misc}${cn}${nsarchivedir}${nsdbtype}";
$vstr = "";
if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
--- NEW FILE template-db2index.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -n instance [-t attributeName[:indextypes[:matchingrules]]]\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
print(STDERR " : -w password - Directory Manager's password\n");
print(STDERR " : -w - - Prompt for Directory Manager's password\n");
print(STDERR " : -j filename - Read Directory Manager's password from file\n");
print(STDERR " : -n instance - instance to be indexed\n");
print(STDERR " : -t attributeName[:indextypes[:matchingrules]]\n");
print(STDERR " - attribute: name of the attribute to be indexed\n");
print(STDERR " If omitted, all the indexes defined \n");
print(STDERR " for that instance are generated.\n");
print(STDERR " - indextypes: comma separated index types\n");
print(STDERR " - matchingrules: comma separated matrules\n");
print(STDERR " Example: -t foo:eq,pres\n");
print(STDERR " : -v - verbose\n");
}
$instance = "";
$rootdn = "";
$passwd = "";
$passwdfile = "";
$attribute_arg = "";
$vlvattribute_arg = "";
$verbose = 0;
$prefix = "{{DS-ROOT}}";
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$i = 0;
while ($i <= $#ARGV)
{
if ("$ARGV[$i]" eq "-n")
{
# instance
$i++; $instance = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-D")
{
# Directory Manager
$i++; $rootdn = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-w")
{
# Directory Manager's password
$i++; $passwd = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-j")
{
# Read Directory Manager's password from a file
$i++; $passwdfile = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-t")
{
# Attribute to index
$i++; $attribute_arg = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-T")
{
# Vlvattribute to index
$i++; $vlvattribute_arg = $ARGV[$i];
}
elsif ("$ARGV[$i]" eq "-v")
{
# verbose
$verbose = 1;
}
else
{
&usage; exit(1);
}
$i++;
}
if ($passwdfile ne ""){
# Open file and get the password
unless (open (RPASS, $passwdfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$passwd = <RPASS>;
chomp($passwd);
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $passwd = ReadLine(0);
# chomp($passwd);
# ReadMode('normal');
}
if ( $rootdn eq "" || $passwd eq "" )
{
&usage;
exit(1);
}
$vstr = "";
if ($verbose != 0)
{
$vstr = "-v";
}
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "db2index_${yr}_${mn}_${dy}_${h}_${m}_${s}";
if ( $instance eq "" )
{
&usage;
exit(1);
}
# No attribute name has been specified: let's get them from the configuration
$attribute="";
$indexes_list="";
$vlvattribute="";
$vlvindexes_list="";
chdir("$prefix{{SEP}}usr{{SEP}}bin");
if ( $attribute_arg eq "" && $vlvattribute_arg eq "" )
{
# Get the list of indexes from the entry
$indexes_list="ldapsearch $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -s one " .
"-b \"cn=index,cn=\"$instance\", cn=ldbm database,cn=plugins,cn=config\" \"(&(objectclass=*)(nsSystemIndex=false))\" cn";
# build the values of the attribute nsIndexAttribute
open(LDAP1, "$indexes_list |");
while (<LDAP1>) {
s/\n //g;
if (/^cn: (.*)\n/) {
$IndexAttribute="nsIndexAttribute";
$attribute="$attribute$IndexAttribute: $1\n";
}
}
close(LDAP1);
if ( $attribute eq "" )
{
# No attribute to index, just exit
exit(0);
}
# Get the list of indexes from the entry
$vlvindexes_list="ldapsearch $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -s sub -b \"cn=\"$instance\", cn=ldbm database,cn=plugins,cn=config\" \"objectclass=vlvIndex\" cn";
# build the values of the attribute nsIndexVlvAttribute
open(LDAP1, "$vlvindexes_list |");
while (<LDAP1>) {
s/\n //g;
if (/^cn: (.*)\n/) {
$vlvIndexAttribute="nsIndexVlvAttribute";
$vlvattribute="$vlvattribute$vlvIndexAttribute: $1\n";
}
}
close(LDAP1);
}
else
{
if ( $attribute_arg ne "" )
{
$attribute="nsIndexAttribute: $attribute_arg\n";
}
if ( $vlvattribute_arg ne "" )
{
$vlvattribute="nsIndexVlvAttribute: $vlvattribute_arg\n";
}
}
# Build the task entry to add
$dn = "dn: cn=$taskname, cn=index, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
$nsinstance = "nsInstance: ${instance}\n";
$entry = "${dn}${misc}${cn}${nsinstance}${attribute}${vlvattribute}";
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
--- NEW FILE template-db2ldif.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " {-n instance}* | {-s include}* [{-x exclude}*] \n");
print(STDERR " [-m] [-M] [-u] [-C] [-N] [-U] [-a filename]\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
print(STDERR " : -w password - Directory Manager's password\n");
print(STDERR " : -w - - Prompt for Directory Manager's password\n");
print(STDERR " : -j filename - Read Directory Manager's password from file\n");
print(STDERR " : -n instance - instance to be exported\n");
print(STDERR " : -a filename - output ldif file\n");
print(STDERR " : -s include - included suffix(es)\n");
print(STDERR " : -x exclude - excluded suffix(es)\n");
print(STDERR " : -m - minimal base64 encoding\n");
print(STDERR " : -M - output ldif is stored in multiple files\n");
print(STDERR " these files are named : <instance>_<filename>\n");
print(STDERR " by default, all instances are stored in <filename>\n");
print(STDERR " : -r - export replica\n");
print(STDERR " : -u - do not export unique id\n");
print(STDERR " : -C - use main db file only\n");
print(STDERR " : -N - suppress printing sequential number\n");
print(STDERR " : -U - output ldif is not folded\n");
print(STDERR " : -E - Decrypt encrypted data when exporting\n");
print(STDERR " : -1 - do not print version line\n");
print(STDERR " : -v - verbose\n");
}
@instances = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
@included = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
@excluded = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
$maxidx = 50;
$nowrap = 0;
$nobase64 = 0;
$noversion = 0;
$nouniqueid = 0;
$useid2entry = 0;
$onefile = 1;
$printkey = 1;
$taskname = "";
$ldiffile = "";
$doreplica = 0;
$prefix = "{{DS-ROOT}}";
$ldifdir = "{{LDIF-DIR}}";
$servid = "{{SERV-ID}}";
$verbose = 0;
$rootdn = "";
$passwd = "";
$passwdfile = "";
$i = 0;
$insti = 0;
$incli = 0;
$excli = 0;
$decrypt_on_export = 0;
while ($i <= $#ARGV) {
if ( "$ARGV[$i]" eq "-n" ) { # instances
$i++;
if ($insti < $maxidx) {
$instances[$insti] = $ARGV[$i]; $insti++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-s") { # included suffix
$i++;
if ($incli < $maxidx) {
$included[$incli] = $ARGV[$i]; $incli++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-x") { # excluded suffix
$i++;
if ($excli < $maxidx) {
$excluded[$excli] = $ARGV[$i]; $excli++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-a") { # ldif file
$i++; $ldiffile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-D") { # Directory Manager
$i++; $rootdn = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-w") { # Directory Manager's password
$i++; $passwd = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-j") { # Read Directory Manager's password from a file
$i++; $passwdfile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-M") { # multiple ldif file
$onefile = 0;
} elsif ("$ARGV[$i]" eq "-o") { # one ldif file
$onefile = 1;
} elsif ("$ARGV[$i]" eq "-u") { # no dump unique id
$nouniqueid = 1;
} elsif ("$ARGV[$i]" eq "-C") { # use id2entry
$useid2entry = 1;
} elsif ("$ARGV[$i]" eq "-N") { # does not print key
$printkey = 0;
} elsif ("$ARGV[$i]" eq "-r") { # export replica
$doreplica = 1;
} elsif ("$ARGV[$i]" eq "-m") { # no base64
$nobase64 = 1;
} elsif ("$ARGV[$i]" eq "-U") { # no wrap
$nowrap = 1;
} elsif ("$ARGV[$i]" eq "-1") { # no version line
$noversion = 1;
} elsif ("$ARGV[$i]" eq "-E") { # decrypt
$decrypt_on_export = 1;
} elsif ("$ARGV[$i]" eq "-v") { # verbose
$verbose = 1;
} else {
&usage; exit(1);
}
$i++;
}
if ($passwdfile ne ""){
# Open file and get the password
unless (open (RPASS, $passwdfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$passwd = <RPASS>;
chomp($passwd);
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $passwd = ReadLine(0);
# chomp($passwd);
# ReadMode('normal');
}
if (($instances[0] eq "" && $included[0] eq "") || $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "export_${yr}_${mn}_${dy}_${h}_${m}_${s}";
if ($ldiffile eq "") {
$ldiffile = "${ldifdir}{{SEP}}${servid}-${yr}_${mn}_${dy}_${h}_${m}_${s}.ldif";
}
$dn = "dn: cn=$taskname, cn=export, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
$i = 0;
$nsinstance = "";
while ("" ne "$instances[$i]") {
$nsinstance = "${nsinstance}nsInstance: $instances[$i]\n";
$i++;
}
$i = 0;
$nsincluded = "";
while ("" ne "$included[$i]") {
$nsincluded = "${nsincluded}nsIncludeSuffix: $included[$i]\n";
$i++;
}
$i = 0;
$nsexcluded = "";
while ("" ne "$excluded[$i]") {
$nsexcluded = "${nsexcluded}nsExcludeSuffix: $excluded[$i]\n";
$i++;
}
$nsreplica = "";
if ($doreplica != 0) { $nsreplica = "nsExportReplica: true\n"; }
$nsnobase64 = "";
if ($nobase64 != 0) { $nsnobase64 = "nsMinimalEncoding: true\n"; }
$nsnowrap = "";
if ($nowrap != 0) { $nsnowrap = "nsNoWrap: true\n"; }
$nsnoversion = "";
if ($noversion != 0) { $nsnoversion = "nsNoVersionLine: true\n"; }
$nsnouniqueid = "";
if ($nouniqueid != 0) { $nsnouniqueid = "nsDumpUniqId: false\n"; }
$nsuseid2entry = "";
if ($useid2entry != 0) { $nsuseid2entry = "nsUseId2Entry: true\n"; }
$nsonefile = "";
if ($onefile != 0) { $nsonefile = "nsUseOneFile: true\n"; }
if ($onefile == 0) { $nsonefile = "nsUseOneFile: false\n"; }
$nsexportdecrypt = "";
if ($decrypt_on_export != 0) { $nsexportdecrypt = "nsExportDecrypt: true\n"; }
$nsprintkey = "";
if ($printkey == 0) { $nsprintkey = "nsPrintKey: false\n"; }
$nsldiffile = "nsFilename: ${ldiffile}\n";
$entry = "${dn}${misc}${cn}${nsinstance}${nsincluded}${nsexcluded}${nsreplica}${nsnobase64}${nsnowrap}${nsnoversion}${nsnouniqueid}${nsuseid2entry}${nsonefile}${nsexportdecrypt}${nsprintkey}${nsldiffile}";
$vstr = "";
if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
--- NEW FILE template-ldif2db.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub usage {
print(STDERR "Usage: $0 [-v] -D rootdn { -w password | -w - | -j filename } \n");
print(STDERR " -n instance | {-s include}* [{-x exclude}*] [-O] [-c]\n");
print(STDERR " [-g [string]] [-G namespace_id] {-i filename}*\n");
print(STDERR " Opts: -D rootdn - Directory Manager\n");
print(STDERR " : -w password - Directory Manager's password\n");
print(STDERR " : -w - - Prompt for Directory Manager's password\n");
print(STDERR " : -j filename - Read Directory Manager's password from file\n");
print(STDERR " : -n instance - instance to be imported to\n");
print(STDERR " : -i filename - input ldif file(s)\n");
print(STDERR " : -s include - included suffix\n");
print(STDERR " : -x exclude - excluded suffix(es)\n");
print(STDERR " : -O - only create core db, no attr indexes\n");
print(STDERR " : -c size - merge chunk size\n");
print(STDERR " : -g [string] - string is \"none\" or \"deterministic\"\n");
print(STDERR " : none - unique id is not generated\n");
print(STDERR " : deterministic - generate name based unique id (-G name)\n");
print(STDERR " : by default - generate time based unique id\n");
print(STDERR " : -G name - namespace id for name based uniqueid (-g deterministic)\n");
print(STDERR " : -E - Encrypt data when importing\n");
print(STDERR " : -v - verbose\n");
}
@ldiffiles = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
@included = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
@excluded = (
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
""
);
$maxidx = 50;
$instance = "";
$noattrindexes = 0;
$mergechunksiz = 0;
$genuniqid = "time";
$uniqidname = "";
$taskname = "";
$prefix = "{{DS-ROOT}}";
$verbose = 0;
$rootdn = "";
$passwd = "";
$passwdfile = "";
$i = 0;
$ldifi = 0;
$incli = 0;
$excli = 0;
$encrypt_on_import = 0;
while ($i <= $#ARGV) {
if ( "$ARGV[$i]" eq "-i" ) { # ldiffiles
$i++;
if ($ldifi < $maxidx) {
$ldiffiles[$ldifi] = $ARGV[$i]; $ldifi++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-s") { # included suffix
$i++;
if ($incli < $maxidx) {
$included[$incli] = $ARGV[$i]; $incli++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-x") { # excluded suffix
$i++;
if ($excli < $maxidx) {
$excluded[$excli] = $ARGV[$i]; $excli++;
} else {
&usage; exit(1);
}
} elsif ("$ARGV[$i]" eq "-n") { # instance
$i++; $instance = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-D") { # Directory Manager
$i++; $rootdn = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-w") { # Directory Manager's password
$i++; $passwd = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-j") { # Read Directory Manager's password from a file
$i++; $passwdfile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-O") { # no attr indexes
$noattrindexes = 1;
} elsif ("$ARGV[$i]" eq "-c") { # merge chunk size
$i++; $mergechunksiz = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-g") { # generate uniqueid
if (("$ARGV[$i+1]" ne "") && !("$ARGV[$i+1]" =~ /^-/)) {
$i++;
if ("$ARGV[$i]" eq "none") {
$genuniqid = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "deterministic") {
$genuniqid = $ARGV[$i];
}
}
} elsif ("$ARGV[$i]" eq "-G") { # namespace id
$i++; $uniqidname = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-v") { # verbose
$verbose = 1;
} elsif ("$ARGV[$i]" eq "-E") { # encrypt on import
$encrypt_on_import = 1;
} else {
&usage; exit(1);
}
$i++;
}
if ($passwdfile ne ""){
# Open file and get the password
unless (open (RPASS, $passwdfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$passwd = <RPASS>;
chomp($passwd);
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $passwd = ReadLine(0);
# chomp($passwd);
# ReadMode('normal');
}
if (($instance eq "" && $included[0] eq "") || $ldiffiles[0] eq "" || $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
$mn++; $yr += 1900;
$taskname = "import_${yr}_${mn}_${dy}_${h}_${m}_${s}";
$dn = "dn: cn=$taskname, cn=import, cn=tasks, cn=config\n";
$misc = "changetype: add\nobjectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
if ($instance ne "") {
$nsinstance = "nsInstance: ${instance}\n";
}
$i = 0;
$nsldiffiles = "";
while ("" ne "$ldiffiles[$i]") {
$nsldiffiles = "${nsldiffiles}nsFilename: $ldiffiles[$i]\n";
$i++;
}
$i = 0;
$nsincluded = "";
while ("" ne "$included[$i]") {
$nsincluded = "${nsincluded}nsIncludeSuffix: $included[$i]\n";
$i++;
}
$i = 0;
$nsexcluded = "";
while ("" ne "$excluded[$i]") {
$nsexcluded = "${nsexcluded}nsExcludeSuffix: $excluded[$i]\n";
$i++;
}
$nsnoattrindexes = "";
if ($noattrindexes != 0) { $nsnoattrindexes = "nsImportIndexAttrs: false\n"; }
$nsimportencrypt = "";
if ($encrypt_on_import != 0) { $nsimportencrypt = "nsImportEncrypt: true\n"; }
$nsmergechunksiz = "nsImportChunkSize: ${mergechunksiz}\n";
$nsgenuniqid = "nsUniqueIdGenerator: ${genuniqid}\n";
$nsuniqidname = "";
if ($uniqidname ne "") { $nsuniqidname = "nsUniqueIdGeneratorNamespace: ${uniqidname}\n"; }
$entry = "${dn}${misc}${cn}${nsinstance}${nsincluded}${nsexcluded}${nsldiffiles}${nsnoattrindexes}${nsimportencrypt}${nsmergechunksiz}${nsgenuniqid}${nsuniqidname}";
$vstr = "";
if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
--- NEW FILE template-ns-accountstatus.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
###############################
# SUB-ROUTINES
###############################
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
print (STDERR " [-p port] [-h host] -I DN-to-$operation\n\n");
print (STDERR "May be used to $operation a user or a domain of users\n\n");
print (STDERR "Arguments:\n");
print (STDERR " -? - help\n");
print (STDERR " -D rootdn - Provide a Directory Manager DN. Default= '$defrootdn'\n");
print (STDERR " -w password - Provide a password for the Directory Manager DN\n");
print (STDERR " -w - - Prompt for the Directory Manager's password\n");
print (STDERR " -j filename - Read the Directory Manager's password from file\n");
print (STDERR " -p port - Provide a port. Default= '$defport'\n");
print (STDERR " -h host - Provide a host name. Default= '$defhost'\n");
print (STDERR " -I DN-to-$operation - Single entry DN or role DN to $operation\n");
exit 100;
}
sub debug
{
# print " ==> @_";
}
sub out
{
print "@_";
}
# --------------------------
# Check if the entry is part of a locked role:
# i.e.: for each role member (nsroledn) of nsdisabledrole, check if
# * it is the same as the entry
# * the entry is member of role (==has nsroledn attributes), compare each of
# them with the nsroledn of nsdisabledrole
# * if nsroledn of nsdisabledrole are complex, go through each of them
# argv[0] is the local file handler
# argv[1] is the entry (may be a single entry DN or a role DN)
# argv[2] is the base for the search
# --------------------------
$throughRole="";
sub indirectLock
{
# For recursivity, file handler must be local
my $L_filehandle=$_[0];
$L_filehandle++;
my $L_entry=$_[1];
# Remove useless space
my @L_intern=split /([,])/,$L_entry;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_entry=$L_result;
my $L_base=$_[2];
my $L_search;
my $L_currentrole;
my $L_retCode;
my $L_local;
`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
return 1;
}
# Check if the role is a nested role
@L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
unless (open ($L_filehandle, "$L_search |"))
{
out("Can't open file $L_filehandle\n");
exit;
}
while (<$L_filehandle>) {
s/\n //g;
if (/^nsroledn: (.*)\n/) {
$L_currentrole = $1;
# Remove useless space
my @L_intern=split /([,])/,$L_currentrole;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_currentrole=$L_result;
debug("\t-- indirectLock loop: current nsroledn $L_currentrole of base $L_base\n");
if ( $L_isNested == 1 )
{
if ( checkScope($L_currentrole, $L_base) == 0 )
{
# Scope problem probably a bad conf, skip the currentrole
next;
}
}
if ( $L_currentrole eq $L_entry )
{
# the entry is a role that is directly locked
# i.e, nsroledn of nsdisabledrole contains the entry
$throughRole=$L_base;
$throughRole=~ tr/A-Z/a-z/;
# skipDisabled means that we've just found that the entry (which is a role)
# is locked directly (==its DN is part of nsroledn attributes)
# we just want to know now, if it is locked through another role
# at least, one
if ( $skipDisabled == 1 )
{
# direct inactivation
$directLocked=1;
# just go through that test once
$skipDisabled=0;
next;
}
debug("\t-- 1 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
$L_retCode=memberOf($L_currentrole, $L_entry);
if ( $L_retCode == 0 && $single == 1 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
if ( $skipManaged == 1 )
{
if ( $L_currentrole eq $nsManagedDisabledRole)
{
# Try next nsroledn
$directLocked=1;
$skipManaged=0;
next;
}
}
debug("\t-- 2 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
# Only for the first iteration
# the first iteration is with nsdisabledrole as base, other
# loops are deeper
$L_local=$skipDisabled;
$skipDisabled=0;
# the current nsroledn may be a complex role, just go through
# its won nsroledn
$L_retCode=indirectLock($L_filehandle,$L_entry, $L_currentrole);
# Because of recursivity, to keep the initial value for the first level
$skipDisabled=$L_local;
if ( $L_retCode == 0 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
debug("\t-- 3 indirectLock: $L_entry locked throughRole == $throughRole\n");
return 0;
}
}
}
close($L_filehandle);
debug("\t<--indirectLock: no more nsroledn to process\n");
return 1;
}
# --------------------------
# Check if nsroledn is part of the entry attributes
# argv[0] is a role DN (nsroledn attribute)
# argv[1] is the entry
# --------------------------
sub memberOf
{
my $L_nsroledn=$_[0];
$L_nsroledn=~ tr/A-Z/a-z/;
my $L_entry=$_[1];
my $L_search;
my $L_currentrole;
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
open (LDAP2, "$L_search |");
while (<LDAP2>) {
s/\n //g;
if (/^nsrole: (.*)\n/) {
$L_currentrole = $1;
$L_currentrole=~ tr/A-Z/a-z/;
if ( $L_currentrole eq $L_nsroledn )
{
# the parm is part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry locked through $L_nsroledn\n");
return 0;
}
}
}
close(LDAP2);
# the parm is not part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry not locked through $L_nsroledn\n");
return 1;
}
# --------------------------
# Remove the rdn of a DN
# argv[0] is a DN
# --------------------------
sub removeRdn
{
$L_entry=$_[0];
@L_entryToTest=split /([,])/,$L_entry;
debug("removeRdn: entry to split: $L_entry**@L_entryToTest\n");
$newDN="";
$removeRDN=1;
foreach $part (@L_entryToTest)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
if ( $removeRDN <= 2 )
{
$removeRDN=$removeRDN+1;
}
else
{
$newDN="$newDN$part";
}
}
debug("removeRdn: new DN **$newDN**\n");
}
# --------------------------
# Check if L_current is below the scope of
# L_nestedRole
# argv[0] is a role
# argv[1] is the nested role
# --------------------------
sub checkScope
{
$L_current=$_[0];
$L_nestedRole=$_[1];
debug("checkScope: check if $L_current is below $L_nestedRole\n");
removeRdn($L_nestedRole);
$L_nestedRoleSuffix=$newDN;
debug("checkScope: nested role based: $L_nestedRoleSuffix\n");
$cont=1;
while ( ($cont == 1) && ($L_current ne "") )
{
removeRdn($L_current);
$currentDn=$newDN;
debug("checkScope: current DN to check: $currentDn\n");
if ( $currentDn eq $L_nestedRoleSuffix )
{
debug("checkScope: DN match!!!\n");
$cont = 0;
}
else
{
$L_current=$currentDn;
}
}
if ( $cont == 1 )
{
debug("checkScope: $_[0] and $_[1] are not compatible\n");
return 0;
}
else
{
debug("checkScope: $_[0] and $_[1] are compatible\n");
return 1;
}
}
###############################
# MAIN ROUTINE
###############################
# Generated variable
$prefix="{{DS-ROOT}}";
# Determine which command we are running
if ( $0 =~ /ns-inactivate(.pl)?$/ )
{
$cmd="ns-inactivate.pl";
$operation="inactivate";
$state="inactivated";
$modrole="add";
$already="already";
}
elsif ( $0 =~ /ns-activate(.pl)?$/ )
{
$cmd="ns-activate.pl";
$operation="activate";
$state="activated";
$modrole="delete";
$already="already";
}
elsif ( $0 =~ /ns-accountstatus(.pl)?$/ )
{
$cmd="ns-accountstatus.pl";
$operation="get status of";
$state="activated";
# no need for $modrole as no operation is performed
$already="";
}
else
{
out("$0: unknown command\n");
exit 100;
}
debug("Running ** $cmd ** $operation\n");
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ldapsearch="ldapsearch -1";
$ldapmodify="ldapmodify";
# Default values
$defrootdn= "{{ROOT-DN}}";
$defhost= "{{SERVER-NAME}}";
$defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
$entry= "";
$single=0;
$role=0;
# Process the command line arguments
while( $arg = shift)
{
if($arg eq "-?")
{
usage_and_exit();
}
elsif($arg eq "-D")
{
$rootdn= shift @ARGV;
}
elsif($arg eq "-w")
{
$rootpw= shift @ARGV;
}
elsif($arg eq "-j")
{
$pwfile= shift @ARGV;
}
elsif($arg eq "-p")
{
$port= shift @ARGV;
}
elsif($arg eq "-h")
{
$host= shift @ARGV;
}
elsif($arg eq "-I")
{
$entry= shift @ARGV;
}
else
{
print "$arg: Unknown command line argument.\n";
usage_and_exit();
}
}
if ($pwfile ne ""){
# Open file and get the password
unless (open (RPASS, $pwfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$rootpw = <RPASS>;
chomp($rootpw);
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $rootpw = ReadLine(0);
# chomp($rootpw);
# ReadMode('normal');
}
if( $rootpw eq "" )
{
usage_and_exit();
}
if( $entry eq "" )
{
usage_and_exit();
}
#
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
$retCode1=$?>>8;
exit $retCode1;
}
@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
{
$retCode2=$?>>8;
exit $retCode2;
}
if ( $nbLineRole == 1 )
{
debug("Groups of users\n");
$role=1;
}
else
{
debug("Single user\n");
$single=1;
}
#
# First of all, check the existence of the nsaccountlock attribute in the entry
#
$isLocked=0;
if ( $single == 1 )
{
$searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
if (/^nsaccountlock: (.*)\n/) {
$L_currentvalue = $1;
$L_currentvalue=~ tr/A-Z/a-z/;
if ( $L_currentvalue eq "true")
{
$isLocked=1;
}
elsif ( $L_currentvalue eq "false" )
{
$isLocked=0;
}
}
}
close(LDAP1);
}
debug("Is the entry already locked? ==> $isLocked\n");
#
# Get the suffix name of that entry
#
# Remove the space at the beginning (just in case...)
# -I "uid=jvedder , ou=People , o=sun.com"
@suffix=split /([,])/,$entry;
$result="";
foreach $part (@suffix)
{
$part=~s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("Entry to $operation: #@suffix#\n");
debug("Entry to $operation: #@suffixN#\n");
# Get the suffix
$cont=0;
while ($cont == 0)
{
# Look if suffix is the suffix of the entry
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
@mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
exit $retCode;
}
# If we get a result, remove the dn:
# dn: cn="o=sun.com",cn=mapping tree,cn=config
# cn: "o=sun.com"
#
shift @mapping;
foreach $res (@mapping)
{
# Break the string cn: "o=sun.com" into pieces
@cn= split(/ /,$res);
# And remove the cn: part
shift @cn;
# Now compare the suffix we extract from the mapping tree
# with the suffix derived from the entry
debug("\tSuffix from mapping tree: #@cn#\n");
if ( @cn eq @suffixN ) {
debug("Found matching suffix\n");
$cont=1;
}
}
if ( $cont == 0 )
{
# Remove the current rdn to try another suffix
shift @suffix;
$result="";
foreach $part (@suffix)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("\t\tNothing found => go up one level in rdn #@suffix#\n");
$len=@suffix;
if ( $len == 0 )
{
debug("Can not find suffix. Problem\n");
$cont=2;
}
}
}
if ( $cont == 2)
{
out("Can not find suffix for entry $entry\n");
exit 100;
}
if ( $operation eq "inactivate" )
{
#
# Now that we have the suffix and we know if we deal with a single entry or
# a role, just try to create the COS and roles associated.
#
@base=(
"cn=nsManagedDisabledRole,@suffixN",
"cn=nsDisabledRole,@suffixN",
"cn=nsAccountInactivationTmp,@suffixN",
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
$addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsSimpleRoleDefinition\n",
"objectclass: nsManagedRoleDefinition\n",
"cn: nsManagedDisabledRole\n\n" );
@role2=(
"dn: cn=nsDisabledRole,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsComplexRoleDefinition\n",
"objectclass: nsNestedRoleDefinition\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n",
"cn: nsDisabledRole\n\n" );
@cos1=(
"dn: cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: nsContainer\n\n" );
@cos2=(
"dn: cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: extensibleObject\n",
"objectclass: costemplate\n",
"objectclass: ldapsubentry\n",
"cosPriority: 1\n",
"nsAccountLock: true\n\n" );
@cos3=(
"dn: cn=nsAccountInactivation_cos,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: cosSuperDefinition\n",
"objectclass: cosClassicDefinition\n",
"cosTemplateDn: cn=nsAccountInactivationTmp,@suffixN\n",
"cosSpecifier: nsRole\n",
"cosAttribute: nsAccountLock operational\n\n" );
@all=(\@role1, \@role2, \@cos1, \@cos2, \@cos3);
$i=0;
foreach $current (@base)
{
debug("Creating $current ??\n");
open(FD,"| $addrolescos ");
print FD @{$all[$i]};
close(FD);
if ( $? != 0 )
{
$retCode=$?>>8;
if ( $retCode == 68 )
{
debug("Entry $current already exists, ignore error\n");
}
else
{
# Probably a more serious problem.
# Exit with LDAP error
exit $retCode;
}
}
else
{
debug("Entry $current created\n");
}
$i=$i+1;
}
}
$skipManaged=0;
$skipDisabled=0;
$directLocked=0;
$nsDisabledRole="cn=nsDisabledRole,@suffixN";
$nsDisabledRole=~ tr/A-Z/a-z/;
$nsManagedDisabledRole="cn=nsManagedDisabledRole,@suffixN";
$nsManagedDisabledRole=~ tr/A-Z/a-z/;
if ( $operation eq "inactivate" )
{
# Go through all the roles part of nsdisabledrole to check if the entry
# is a member of one of those roles
$ret=indirectLock("LDAP00", $entry, $nsDisabledRole);
if ( $ret == 0 )
{
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
# indirect lock
out("$entry already $state through $throughRole.\n");
}
else
{
# direct lock
out("$entry already $state.\n");
}
exit 100;
}
elsif ( $isLocked == 1 )
{
# the entry is not locked through a role, may be nsaccountlock is "hardcoded" ?
out("$entry already $state (probably directly).\n");
exit 103;
}
}
elsif ( $operation eq "activate" || $operation eq "get status of" )
{
$skipManaged=$single;
$skipDisabled=$role;
$ret=indirectLock("LDAP00",$entry, $nsDisabledRole);
if ( $ret == 0 )
{
# undirectly locked
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
if ( $operation eq "activate" )
{
out("$entry inactivated through $throughRole. Can not activate it individually.\n");
exit 100;
}
else
{
out("$entry inactivated through $throughRole.\n");
exit 104;
}
}
debug("$entry locked individually\n");
if ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
}
elsif ( $directLocked == 0 )
{
if ( $operation eq "activate" && $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 100;
}
elsif ( $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 102;
}
else
{
# not locked using our schema, but nsaccountlock is probably present
out("$entry inactivated (probably directly).\n");
exit 103;
}
}
elsif ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
# else Locked directly, juste unlock it!
debug("$entry locked individually\n");
}
#
# Inactivate/activate the entry
#
$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
"dn: $entry\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n\n" );
}
else
{
@record=(
"dn: cn=nsDisabledRole,@suffixN\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: $entry\n\n" );
}
open(FD,"| $action ");
print FD @record;
close(FD);
if ( $? != 0 )
{
debug("$modrole, $entry\n");
$retCode=$?>>8;
exit $retCode;
}
out("$entry $state.\n");
exit 0;
--- NEW FILE template-ns-activate.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
###############################
# SUB-ROUTINES
###############################
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
print (STDERR " [-p port] [-h host] -I DN-to-$operation\n\n");
print (STDERR "May be used to $operation a user or a domain of users\n\n");
print (STDERR "Arguments:\n");
print (STDERR " -? - help\n");
print (STDERR " -D rootdn - Provide a Directory Manager DN. Default= '$defrootdn'\n");
print (STDERR " -w password - Provide a password for the Directory Manager DN\n");
print (STDERR " -w - - Prompt for the Directory Manager's password\n");
print (STDERR " -j filename - Read the Directory Manager's password from file\n");
print (STDERR " -p port - Provide a port. Default= '$defport'\n");
print (STDERR " -h host - Provide a host name. Default= '$defhost'\n");
print (STDERR " -I DN-to-$operation - Single entry DN or role DN to $operation\n");
exit 100;
}
sub debug
{
# print " ==> @_";
}
sub out
{
print "@_";
}
# --------------------------
# Check if the entry is part of a locked role:
# i.e.: for each role member (nsroledn) of nsdisabledrole, check if
# * it is the same as the entry
# * the entry is member of role (==has nsroledn attributes), compare each of
# them with the nsroledn of nsdisabledrole
# * if nsroledn of nsdisabledrole are complex, go through each of them
# argv[0] is the local file handler
# argv[1] is the entry (may be a single entry DN or a role DN)
# argv[2] is the base for the search
# --------------------------
$throughRole="";
sub indirectLock
{
# For recursivity, file handler must be local
my $L_filehandle=$_[0];
$L_filehandle++;
my $L_entry=$_[1];
# Remove useless space
my @L_intern=split /([,])/,$L_entry;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_entry=$L_result;
my $L_base=$_[2];
my $L_search;
my $L_currentrole;
my $L_retCode;
my $L_local;
`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
return 1;
}
# Check if the role is a nested role
@L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
unless (open ($L_filehandle, "$L_search |"))
{
out("Can't open file $L_filehandle\n");
exit;
}
while (<$L_filehandle>) {
s/\n //g;
if (/^nsroledn: (.*)\n/) {
$L_currentrole = $1;
# Remove useless space
my @L_intern=split /([,])/,$L_currentrole;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_currentrole=$L_result;
debug("\t-- indirectLock loop: current nsroledn $L_currentrole of base $L_base\n");
if ( $L_isNested == 1 )
{
if ( checkScope($L_currentrole, $L_base) == 0 )
{
# Scope problem probably a bad conf, skip the currentrole
next;
}
}
if ( $L_currentrole eq $L_entry )
{
# the entry is a role that is directly locked
# i.e, nsroledn of nsdisabledrole contains the entry
$throughRole=$L_base;
$throughRole=~ tr/A-Z/a-z/;
# skipDisabled means that we've just found that the entry (which is a role)
# is locked directly (==its DN is part of nsroledn attributes)
# we just want to know now, if it is locked through another role
# at least, one
if ( $skipDisabled == 1 )
{
# direct inactivation
$directLocked=1;
# just go through that test once
$skipDisabled=0;
next;
}
debug("\t-- 1 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
$L_retCode=memberOf($L_currentrole, $L_entry);
if ( $L_retCode == 0 && $single == 1 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
if ( $skipManaged == 1 )
{
if ( $L_currentrole eq $nsManagedDisabledRole)
{
# Try next nsroledn
$directLocked=1;
$skipManaged=0;
next;
}
}
debug("\t-- 2 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
# Only for the first iteration
# the first iteration is with nsdisabledrole as base, other
# loops are deeper
$L_local=$skipDisabled;
$skipDisabled=0;
# the current nsroledn may be a complex role, just go through
# its won nsroledn
$L_retCode=indirectLock($L_filehandle,$L_entry, $L_currentrole);
# Because of recursivity, to keep the initial value for the first level
$skipDisabled=$L_local;
if ( $L_retCode == 0 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
debug("\t-- 3 indirectLock: $L_entry locked throughRole == $throughRole\n");
return 0;
}
}
}
close($L_filehandle);
debug("\t<--indirectLock: no more nsroledn to process\n");
return 1;
}
# --------------------------
# Check if nsroledn is part of the entry attributes
# argv[0] is a role DN (nsroledn attribute)
# argv[1] is the entry
# --------------------------
sub memberOf
{
my $L_nsroledn=$_[0];
$L_nsroledn=~ tr/A-Z/a-z/;
my $L_entry=$_[1];
my $L_search;
my $L_currentrole;
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
open (LDAP2, "$L_search |");
while (<LDAP2>) {
s/\n //g;
if (/^nsrole: (.*)\n/) {
$L_currentrole = $1;
$L_currentrole=~ tr/A-Z/a-z/;
if ( $L_currentrole eq $L_nsroledn )
{
# the parm is part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry locked through $L_nsroledn\n");
return 0;
}
}
}
close(LDAP2);
# the parm is not part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry not locked through $L_nsroledn\n");
return 1;
}
# --------------------------
# Remove the rdn of a DN
# argv[0] is a DN
# --------------------------
sub removeRdn
{
$L_entry=$_[0];
@L_entryToTest=split /([,])/,$L_entry;
debug("removeRdn: entry to split: $L_entry**@L_entryToTest\n");
$newDN="";
$removeRDN=1;
foreach $part (@L_entryToTest)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
if ( $removeRDN <= 2 )
{
$removeRDN=$removeRDN+1;
}
else
{
$newDN="$newDN$part";
}
}
debug("removeRdn: new DN **$newDN**\n");
}
# --------------------------
# Check if L_current is below the scope of
# L_nestedRole
# argv[0] is a role
# argv[1] is the nested role
# --------------------------
sub checkScope
{
$L_current=$_[0];
$L_nestedRole=$_[1];
debug("checkScope: check if $L_current is below $L_nestedRole\n");
removeRdn($L_nestedRole);
$L_nestedRoleSuffix=$newDN;
debug("checkScope: nested role based: $L_nestedRoleSuffix\n");
$cont=1;
while ( ($cont == 1) && ($L_current ne "") )
{
removeRdn($L_current);
$currentDn=$newDN;
debug("checkScope: current DN to check: $currentDn\n");
if ( $currentDn eq $L_nestedRoleSuffix )
{
debug("checkScope: DN match!!!\n");
$cont = 0;
}
else
{
$L_current=$currentDn;
}
}
if ( $cont == 1 )
{
debug("checkScope: $_[0] and $_[1] are not compatible\n");
return 0;
}
else
{
debug("checkScope: $_[0] and $_[1] are compatible\n");
return 1;
}
}
###############################
# MAIN ROUTINE
###############################
# Generated variable
$prefix="{{DS-ROOT}}";
# Determine which command we are running
if ( $0 =~ /ns-inactivate(.pl)?$/ )
{
$cmd="ns-inactivate.pl";
$operation="inactivate";
$state="inactivated";
$modrole="add";
$already="already";
}
elsif ( $0 =~ /ns-activate(.pl)?$/ )
{
$cmd="ns-activate.pl";
$operation="activate";
$state="activated";
$modrole="delete";
$already="already";
}
elsif ( $0 =~ /ns-accountstatus(.pl)?$/ )
{
$cmd="ns-accountstatus.pl";
$operation="get status of";
$state="activated";
# no need for $modrole as no operation is performed
$already="";
}
else
{
out("$0: unknown command\n");
exit 100;
}
debug("Running ** $cmd ** $operation\n");
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ldapsearch="ldapsearch -1";
$ldapmodify="ldapmodify";
# Default values
$defrootdn= "{{ROOT-DN}}";
$defhost= "{{SERVER-NAME}}";
$defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
$entry= "";
$single=0;
$role=0;
# Process the command line arguments
while( $arg = shift)
{
if($arg eq "-?")
{
usage_and_exit();
}
elsif($arg eq "-D")
{
$rootdn= shift @ARGV;
}
elsif($arg eq "-w")
{
$rootpw= shift @ARGV;
}
elsif($arg eq "-j")
{
$pwfile= shift @ARGV;
}
elsif($arg eq "-p")
{
$port= shift @ARGV;
}
elsif($arg eq "-h")
{
$host= shift @ARGV;
}
elsif($arg eq "-I")
{
$entry= shift @ARGV;
}
else
{
print "$arg: Unknown command line argument.\n";
usage_and_exit();
}
}
if ($pwfile ne ""){
# Open file and get the password
unless (open (RPASS, $pwfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$rootpw = <RPASS>;
chomp($rootpw);
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $rootpw = ReadLine(0);
# chomp($rootpw);
# ReadMode('normal');
}
if( $rootpw eq "" )
{
usage_and_exit();
}
if( $entry eq "" )
{
usage_and_exit();
}
#
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
$retCode1=$?>>8;
exit $retCode1;
}
@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
{
$retCode2=$?>>8;
exit $retCode2;
}
if ( $nbLineRole == 1 )
{
debug("Groups of users\n");
$role=1;
}
else
{
debug("Single user\n");
$single=1;
}
#
# First of all, check the existence of the nsaccountlock attribute in the entry
#
$isLocked=0;
if ( $single == 1 )
{
$searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
if (/^nsaccountlock: (.*)\n/) {
$L_currentvalue = $1;
$L_currentvalue=~ tr/A-Z/a-z/;
if ( $L_currentvalue eq "true")
{
$isLocked=1;
}
elsif ( $L_currentvalue eq "false" )
{
$isLocked=0;
}
}
}
close(LDAP1);
}
debug("Is the entry already locked? ==> $isLocked\n");
#
# Get the suffix name of that entry
#
# Remove the space at the beginning (just in case...)
# -I "uid=jvedder , ou=People , o=sun.com"
@suffix=split /([,])/,$entry;
$result="";
foreach $part (@suffix)
{
$part=~s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("Entry to $operation: #@suffix#\n");
debug("Entry to $operation: #@suffixN#\n");
# Get the suffix
$cont=0;
while ($cont == 0)
{
# Look if suffix is the suffix of the entry
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
@mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
exit $retCode;
}
# If we get a result, remove the dn:
# dn: cn="o=sun.com",cn=mapping tree,cn=config
# cn: "o=sun.com"
#
shift @mapping;
foreach $res (@mapping)
{
# Break the string cn: "o=sun.com" into pieces
@cn= split(/ /,$res);
# And remove the cn: part
shift @cn;
# Now compare the suffix we extract from the mapping tree
# with the suffix derived from the entry
debug("\tSuffix from mapping tree: #@cn#\n");
if ( @cn eq @suffixN ) {
debug("Found matching suffix\n");
$cont=1;
}
}
if ( $cont == 0 )
{
# Remove the current rdn to try another suffix
shift @suffix;
$result="";
foreach $part (@suffix)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("\t\tNothing found => go up one level in rdn #@suffix#\n");
$len=@suffix;
if ( $len == 0 )
{
debug("Can not find suffix. Problem\n");
$cont=2;
}
}
}
if ( $cont == 2)
{
out("Can not find suffix for entry $entry\n");
exit 100;
}
if ( $operation eq "inactivate" )
{
#
# Now that we have the suffix and we know if we deal with a single entry or
# a role, just try to create the COS and roles associated.
#
@base=(
"cn=nsManagedDisabledRole,@suffixN",
"cn=nsDisabledRole,@suffixN",
"cn=nsAccountInactivationTmp,@suffixN",
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
$addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsSimpleRoleDefinition\n",
"objectclass: nsManagedRoleDefinition\n",
"cn: nsManagedDisabledRole\n\n" );
@role2=(
"dn: cn=nsDisabledRole,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsComplexRoleDefinition\n",
"objectclass: nsNestedRoleDefinition\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n",
"cn: nsDisabledRole\n\n" );
@cos1=(
"dn: cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: nsContainer\n\n" );
@cos2=(
"dn: cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: extensibleObject\n",
"objectclass: costemplate\n",
"objectclass: ldapsubentry\n",
"cosPriority: 1\n",
"nsAccountLock: true\n\n" );
@cos3=(
"dn: cn=nsAccountInactivation_cos,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: cosSuperDefinition\n",
"objectclass: cosClassicDefinition\n",
"cosTemplateDn: cn=nsAccountInactivationTmp,@suffixN\n",
"cosSpecifier: nsRole\n",
"cosAttribute: nsAccountLock operational\n\n" );
@all=(\@role1, \@role2, \@cos1, \@cos2, \@cos3);
$i=0;
foreach $current (@base)
{
debug("Creating $current ??\n");
open(FD,"| $addrolescos ");
print FD @{$all[$i]};
close(FD);
if ( $? != 0 )
{
$retCode=$?>>8;
if ( $retCode == 68 )
{
debug("Entry $current already exists, ignore error\n");
}
else
{
# Probably a more serious problem.
# Exit with LDAP error
exit $retCode;
}
}
else
{
debug("Entry $current created\n");
}
$i=$i+1;
}
}
$skipManaged=0;
$skipDisabled=0;
$directLocked=0;
$nsDisabledRole="cn=nsDisabledRole,@suffixN";
$nsDisabledRole=~ tr/A-Z/a-z/;
$nsManagedDisabledRole="cn=nsManagedDisabledRole,@suffixN";
$nsManagedDisabledRole=~ tr/A-Z/a-z/;
if ( $operation eq "inactivate" )
{
# Go through all the roles part of nsdisabledrole to check if the entry
# is a member of one of those roles
$ret=indirectLock("LDAP00", $entry, $nsDisabledRole);
if ( $ret == 0 )
{
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
# indirect lock
out("$entry already $state through $throughRole.\n");
}
else
{
# direct lock
out("$entry already $state.\n");
}
exit 100;
}
elsif ( $isLocked == 1 )
{
# the entry is not locked through a role, may be nsaccountlock is "hardcoded" ?
out("$entry already $state (probably directly).\n");
exit 103;
}
}
elsif ( $operation eq "activate" || $operation eq "get status of" )
{
$skipManaged=$single;
$skipDisabled=$role;
$ret=indirectLock("LDAP00",$entry, $nsDisabledRole);
if ( $ret == 0 )
{
# undirectly locked
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
if ( $operation eq "activate" )
{
out("$entry inactivated through $throughRole. Can not activate it individually.\n");
exit 100;
}
else
{
out("$entry inactivated through $throughRole.\n");
exit 104;
}
}
debug("$entry locked individually\n");
if ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
}
elsif ( $directLocked == 0 )
{
if ( $operation eq "activate" && $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 100;
}
elsif ( $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 102;
}
else
{
# not locked using our schema, but nsaccountlock is probably present
out("$entry inactivated (probably directly).\n");
exit 103;
}
}
elsif ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
# else Locked directly, juste unlock it!
debug("$entry locked individually\n");
}
#
# Inactivate/activate the entry
#
$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
"dn: $entry\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n\n" );
}
else
{
@record=(
"dn: cn=nsDisabledRole,@suffixN\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: $entry\n\n" );
}
open(FD,"| $action ");
print FD @record;
close(FD);
if ( $? != 0 )
{
debug("$modrole, $entry\n");
$retCode=$?>>8;
exit $retCode;
}
out("$entry $state.\n");
exit 0;
--- NEW FILE template-ns-inactivate.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
###############################
# SUB-ROUTINES
###############################
sub usage_and_exit
{
print (STDERR "$cmd [-D rootdn] { -w password | -w - | -j filename } \n");
print (STDERR " [-p port] [-h host] -I DN-to-$operation\n\n");
print (STDERR "May be used to $operation a user or a domain of users\n\n");
print (STDERR "Arguments:\n");
print (STDERR " -? - help\n");
print (STDERR " -D rootdn - Provide a Directory Manager DN. Default= '$defrootdn'\n");
print (STDERR " -w password - Provide a password for the Directory Manager DN\n");
print (STDERR " -w - - Prompt for the Directory Manager's password\n");
print (STDERR " -j filename - Read the Directory Manager's password from file\n");
print (STDERR " -p port - Provide a port. Default= '$defport'\n");
print (STDERR " -h host - Provide a host name. Default= '$defhost'\n");
print (STDERR " -I DN-to-$operation - Single entry DN or role DN to $operation\n");
exit 100;
}
sub debug
{
# print " ==> @_";
}
sub out
{
print "@_";
}
# --------------------------
# Check if the entry is part of a locked role:
# i.e.: for each role member (nsroledn) of nsdisabledrole, check if
# * it is the same as the entry
# * the entry is member of role (==has nsroledn attributes), compare each of
# them with the nsroledn of nsdisabledrole
# * if nsroledn of nsdisabledrole are complex, go through each of them
# argv[0] is the local file handler
# argv[1] is the entry (may be a single entry DN or a role DN)
# argv[2] is the base for the search
# --------------------------
$throughRole="";
sub indirectLock
{
# For recursivity, file handler must be local
my $L_filehandle=$_[0];
$L_filehandle++;
my $L_entry=$_[1];
# Remove useless space
my @L_intern=split /([,])/,$L_entry;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_entry=$L_result;
my $L_base=$_[2];
my $L_search;
my $L_currentrole;
my $L_retCode;
my $L_local;
`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn >> {{DEV-NULL}} 2>&1 `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
return 1;
}
# Check if the role is a nested role
@L_Nested="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=nsNestedRoleDefinition)(objectclass=ldapsubentry))\" ";
# L_isNested == 1 means that we are going through a nested role, so for each member of that
# nested role, check that the member is below the scope of the nested
$L_isNested=@L_Nested;
# Not Direct Lock, Go through roles if any
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_base\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsroledn ";
debug("\t-->indirectLock: check if $L_entry is part of a locked role from base $L_base\n\n");
unless (open ($L_filehandle, "$L_search |"))
{
out("Can't open file $L_filehandle\n");
exit;
}
while (<$L_filehandle>) {
s/\n //g;
if (/^nsroledn: (.*)\n/) {
$L_currentrole = $1;
# Remove useless space
my @L_intern=split /([,])/,$L_currentrole;
my $L_result="";
foreach $L_part (@L_intern)
{
$L_part=~s/^ +//;
$L_part=~ tr/A-Z/a-z/;
$L_result="$L_result$L_part";
}
$L_currentrole=$L_result;
debug("\t-- indirectLock loop: current nsroledn $L_currentrole of base $L_base\n");
if ( $L_isNested == 1 )
{
if ( checkScope($L_currentrole, $L_base) == 0 )
{
# Scope problem probably a bad conf, skip the currentrole
next;
}
}
if ( $L_currentrole eq $L_entry )
{
# the entry is a role that is directly locked
# i.e, nsroledn of nsdisabledrole contains the entry
$throughRole=$L_base;
$throughRole=~ tr/A-Z/a-z/;
# skipDisabled means that we've just found that the entry (which is a role)
# is locked directly (==its DN is part of nsroledn attributes)
# we just want to know now, if it is locked through another role
# at least, one
if ( $skipDisabled == 1 )
{
# direct inactivation
$directLocked=1;
# just go through that test once
$skipDisabled=0;
next;
}
debug("\t-- 1 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
$L_retCode=memberOf($L_currentrole, $L_entry);
if ( $L_retCode == 0 && $single == 1 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
if ( $skipManaged == 1 )
{
if ( $L_currentrole eq $nsManagedDisabledRole)
{
# Try next nsroledn
$directLocked=1;
$skipManaged=0;
next;
}
}
debug("\t-- 2 indirectLock: $L_currentrole locked throughRole == $throughRole\n");
return 0;
}
# Only for the first iteration
# the first iteration is with nsdisabledrole as base, other
# loops are deeper
$L_local=$skipDisabled;
$skipDisabled=0;
# the current nsroledn may be a complex role, just go through
# its won nsroledn
$L_retCode=indirectLock($L_filehandle,$L_entry, $L_currentrole);
# Because of recursivity, to keep the initial value for the first level
$skipDisabled=$L_local;
if ( $L_retCode == 0 )
{
$throughRole=$L_currentrole;
$throughRole=~ tr/A-Z/a-z/;
debug("\t-- 3 indirectLock: $L_entry locked throughRole == $throughRole\n");
return 0;
}
}
}
close($L_filehandle);
debug("\t<--indirectLock: no more nsroledn to process\n");
return 1;
}
# --------------------------
# Check if nsroledn is part of the entry attributes
# argv[0] is a role DN (nsroledn attribute)
# argv[1] is the entry
# --------------------------
sub memberOf
{
my $L_nsroledn=$_[0];
$L_nsroledn=~ tr/A-Z/a-z/;
my $L_entry=$_[1];
my $L_search;
my $L_currentrole;
$L_search="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$L_entry\" \"(|(objectclass=*)(objectclass=ldapsubentry))\" nsrole";
debug("\t\t-->memberOf: $L_search: check if $L_entry has $L_nsroledn as nsroledn attribute\n");
open (LDAP2, "$L_search |");
while (<LDAP2>) {
s/\n //g;
if (/^nsrole: (.*)\n/) {
$L_currentrole = $1;
$L_currentrole=~ tr/A-Z/a-z/;
if ( $L_currentrole eq $L_nsroledn )
{
# the parm is part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry locked through $L_nsroledn\n");
return 0;
}
}
}
close(LDAP2);
# the parm is not part of the $L_entry nsroledn
debug("\t\t<--memberOf: $L_entry not locked through $L_nsroledn\n");
return 1;
}
# --------------------------
# Remove the rdn of a DN
# argv[0] is a DN
# --------------------------
sub removeRdn
{
$L_entry=$_[0];
@L_entryToTest=split /([,])/,$L_entry;
debug("removeRdn: entry to split: $L_entry**@L_entryToTest\n");
$newDN="";
$removeRDN=1;
foreach $part (@L_entryToTest)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
if ( $removeRDN <= 2 )
{
$removeRDN=$removeRDN+1;
}
else
{
$newDN="$newDN$part";
}
}
debug("removeRdn: new DN **$newDN**\n");
}
# --------------------------
# Check if L_current is below the scope of
# L_nestedRole
# argv[0] is a role
# argv[1] is the nested role
# --------------------------
sub checkScope
{
$L_current=$_[0];
$L_nestedRole=$_[1];
debug("checkScope: check if $L_current is below $L_nestedRole\n");
removeRdn($L_nestedRole);
$L_nestedRoleSuffix=$newDN;
debug("checkScope: nested role based: $L_nestedRoleSuffix\n");
$cont=1;
while ( ($cont == 1) && ($L_current ne "") )
{
removeRdn($L_current);
$currentDn=$newDN;
debug("checkScope: current DN to check: $currentDn\n");
if ( $currentDn eq $L_nestedRoleSuffix )
{
debug("checkScope: DN match!!!\n");
$cont = 0;
}
else
{
$L_current=$currentDn;
}
}
if ( $cont == 1 )
{
debug("checkScope: $_[0] and $_[1] are not compatible\n");
return 0;
}
else
{
debug("checkScope: $_[0] and $_[1] are compatible\n");
return 1;
}
}
###############################
# MAIN ROUTINE
###############################
# Generated variable
$prefix="{{DS-ROOT}}";
# Determine which command we are running
if ( $0 =~ /ns-inactivate(.pl)?$/ )
{
$cmd="ns-inactivate.pl";
$operation="inactivate";
$state="inactivated";
$modrole="add";
$already="already";
}
elsif ( $0 =~ /ns-activate(.pl)?$/ )
{
$cmd="ns-activate.pl";
$operation="activate";
$state="activated";
$modrole="delete";
$already="already";
}
elsif ( $0 =~ /ns-accountstatus(.pl)?$/ )
{
$cmd="ns-accountstatus.pl";
$operation="get status of";
$state="activated";
# no need for $modrole as no operation is performed
$already="";
}
else
{
out("$0: unknown command\n");
exit 100;
}
debug("Running ** $cmd ** $operation\n");
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ldapsearch="ldapsearch -1";
$ldapmodify="ldapmodify";
# Default values
$defrootdn= "{{ROOT-DN}}";
$defhost= "{{SERVER-NAME}}";
$defport= "{{SERVER-PORT}}";
# User values
$rootdn= "{{ROOT-DN}}";
$rootpw= "";
$pwfile= "";
$host= "{{SERVER-NAME}}";
$port= "{{SERVER-PORT}}";
$entry= "";
$single=0;
$role=0;
# Process the command line arguments
while( $arg = shift)
{
if($arg eq "-?")
{
usage_and_exit();
}
elsif($arg eq "-D")
{
$rootdn= shift @ARGV;
}
elsif($arg eq "-w")
{
$rootpw= shift @ARGV;
}
elsif($arg eq "-j")
{
$pwfile= shift @ARGV;
}
elsif($arg eq "-p")
{
$port= shift @ARGV;
}
elsif($arg eq "-h")
{
$host= shift @ARGV;
}
elsif($arg eq "-I")
{
$entry= shift @ARGV;
}
else
{
print "$arg: Unknown command line argument.\n";
usage_and_exit();
}
}
if ($pwfile ne ""){
# Open file and get the password
unless (open (RPASS, $pwfile)) {
die "Error, cannot open password file $passwdfile\n";
}
$rootpw = <RPASS>;
chomp($rootpw);
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
"part of the standard perl distribution. If you want to use it, you must\n",
"download and install the module. You can find it at\n",
"http://www.perl.com/CPAN/CPAN.html\n";
# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
# use Term::ReadKey;
# print "Bind Password: ";
# ReadMode('noecho');
# $rootpw = ReadLine(0);
# chomp($rootpw);
# ReadMode('normal');
}
if( $rootpw eq "" )
{
usage_and_exit();
}
if( $entry eq "" )
{
usage_and_exit();
}
#
# Check the actual existence of the entry to inactivate/activate
# and at the same time, validate the various parm: port, host, rootdn, rootpw
#
@exist=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" dn`;
$retCode1=$?;
if ( $retCode1 != 0 )
{
$retCode1=$?>>8;
exit $retCode1;
}
@isRole=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(&(objectclass=LDAPsubentry)(objectclass=nsRoleDefinition))\" dn`;
$nbLineRole=@isRole;
$retCode2=$?;
if ( $retCode2 != 0 )
{
$retCode2=$?>>8;
exit $retCode2;
}
if ( $nbLineRole == 1 )
{
debug("Groups of users\n");
$role=1;
}
else
{
debug("Single user\n");
$single=1;
}
#
# First of all, check the existence of the nsaccountlock attribute in the entry
#
$isLocked=0;
if ( $single == 1 )
{
$searchAccountLock="$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s base -b \"$entry\" \"(objectclass=*)\" nsaccountlock";
open (LDAP1, "$searchAccountLock |");
while (<LDAP1>) {
s/\n //g;
if (/^nsaccountlock: (.*)\n/) {
$L_currentvalue = $1;
$L_currentvalue=~ tr/A-Z/a-z/;
if ( $L_currentvalue eq "true")
{
$isLocked=1;
}
elsif ( $L_currentvalue eq "false" )
{
$isLocked=0;
}
}
}
close(LDAP1);
}
debug("Is the entry already locked? ==> $isLocked\n");
#
# Get the suffix name of that entry
#
# Remove the space at the beginning (just in case...)
# -I "uid=jvedder , ou=People , o=sun.com"
@suffix=split /([,])/,$entry;
$result="";
foreach $part (@suffix)
{
$part=~s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("Entry to $operation: #@suffix#\n");
debug("Entry to $operation: #@suffixN#\n");
# Get the suffix
$cont=0;
while ($cont == 0)
{
# Look if suffix is the suffix of the entry
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,o=sun.com\""
#
debug("\tSuffix from the entry: #@suffixN#\n");
@mapping=`$ldapsearch -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -s one -b \"cn=mapping tree, cn=config\" \"cn=\\"@suffixN\\"\" cn `;
$retCode=$?;
if ( $retCode != 0 )
{
$retCode=$?>>8;
exit $retCode;
}
# If we get a result, remove the dn:
# dn: cn="o=sun.com",cn=mapping tree,cn=config
# cn: "o=sun.com"
#
shift @mapping;
foreach $res (@mapping)
{
# Break the string cn: "o=sun.com" into pieces
@cn= split(/ /,$res);
# And remove the cn: part
shift @cn;
# Now compare the suffix we extract from the mapping tree
# with the suffix derived from the entry
debug("\tSuffix from mapping tree: #@cn#\n");
if ( @cn eq @suffixN ) {
debug("Found matching suffix\n");
$cont=1;
}
}
if ( $cont == 0 )
{
# Remove the current rdn to try another suffix
shift @suffix;
$result="";
foreach $part (@suffix)
{
$part=~ s/^ +//;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@suffixN=$result;
debug("\t\tNothing found => go up one level in rdn #@suffix#\n");
$len=@suffix;
if ( $len == 0 )
{
debug("Can not find suffix. Problem\n");
$cont=2;
}
}
}
if ( $cont == 2)
{
out("Can not find suffix for entry $entry\n");
exit 100;
}
if ( $operation eq "inactivate" )
{
#
# Now that we have the suffix and we know if we deal with a single entry or
# a role, just try to create the COS and roles associated.
#
@base=(
"cn=nsManagedDisabledRole,@suffixN",
"cn=nsDisabledRole,@suffixN",
"cn=nsAccountInactivationTmp,@suffixN",
"\'cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\'",
"cn=nsAccountInactivation_cos,@suffixN" );
$addrolescos="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c -a >> {{DEV-NULL}} 2>&1 ";
@role1=(
"dn: cn=nsManagedDisabledRole,@suffixN\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsSimpleRoleDefinition\n",
"objectclass: nsManagedRoleDefinition\n",
"cn: nsManagedDisabledRole\n\n" );
@role2=(
"dn: cn=nsDisabledRole,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: nsRoleDefinition\n",
"objectclass: nsComplexRoleDefinition\n",
"objectclass: nsNestedRoleDefinition\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n",
"cn: nsDisabledRole\n\n" );
@cos1=(
"dn: cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: nsContainer\n\n" );
@cos2=(
"dn: cn=\"cn=nsDisabledRole,@suffixN\",cn=nsAccountInactivationTmp,@suffixN\n",
"objectclass: top\n",
"objectclass: extensibleObject\n",
"objectclass: costemplate\n",
"objectclass: ldapsubentry\n",
"cosPriority: 1\n",
"nsAccountLock: true\n\n" );
@cos3=(
"dn: cn=nsAccountInactivation_cos,@suffixN\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: cosSuperDefinition\n",
"objectclass: cosClassicDefinition\n",
"cosTemplateDn: cn=nsAccountInactivationTmp,@suffixN\n",
"cosSpecifier: nsRole\n",
"cosAttribute: nsAccountLock operational\n\n" );
@all=(\@role1, \@role2, \@cos1, \@cos2, \@cos3);
$i=0;
foreach $current (@base)
{
debug("Creating $current ??\n");
open(FD,"| $addrolescos ");
print FD @{$all[$i]};
close(FD);
if ( $? != 0 )
{
$retCode=$?>>8;
if ( $retCode == 68 )
{
debug("Entry $current already exists, ignore error\n");
}
else
{
# Probably a more serious problem.
# Exit with LDAP error
exit $retCode;
}
}
else
{
debug("Entry $current created\n");
}
$i=$i+1;
}
}
$skipManaged=0;
$skipDisabled=0;
$directLocked=0;
$nsDisabledRole="cn=nsDisabledRole,@suffixN";
$nsDisabledRole=~ tr/A-Z/a-z/;
$nsManagedDisabledRole="cn=nsManagedDisabledRole,@suffixN";
$nsManagedDisabledRole=~ tr/A-Z/a-z/;
if ( $operation eq "inactivate" )
{
# Go through all the roles part of nsdisabledrole to check if the entry
# is a member of one of those roles
$ret=indirectLock("LDAP00", $entry, $nsDisabledRole);
if ( $ret == 0 )
{
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
# indirect lock
out("$entry already $state through $throughRole.\n");
}
else
{
# direct lock
out("$entry already $state.\n");
}
exit 100;
}
elsif ( $isLocked == 1 )
{
# the entry is not locked through a role, may be nsaccountlock is "hardcoded" ?
out("$entry already $state (probably directly).\n");
exit 103;
}
}
elsif ( $operation eq "activate" || $operation eq "get status of" )
{
$skipManaged=$single;
$skipDisabled=$role;
$ret=indirectLock("LDAP00",$entry, $nsDisabledRole);
if ( $ret == 0 )
{
# undirectly locked
if ( $throughRole ne $nsDisabledRole && $throughRole ne $nsManagedDisabledRole )
{
if ( $operation eq "activate" )
{
out("$entry inactivated through $throughRole. Can not activate it individually.\n");
exit 100;
}
else
{
out("$entry inactivated through $throughRole.\n");
exit 104;
}
}
debug("$entry locked individually\n");
if ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
}
elsif ( $directLocked == 0 )
{
if ( $operation eq "activate" && $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 100;
}
elsif ( $isLocked != 1 )
{
out("$entry $already $state.\n");
exit 102;
}
else
{
# not locked using our schema, but nsaccountlock is probably present
out("$entry inactivated (probably directly).\n");
exit 103;
}
}
elsif ( $operation ne "activate" )
{
out("$entry inactivated.\n");
exit 103;
}
# else Locked directly, juste unlock it!
debug("$entry locked individually\n");
}
#
# Inactivate/activate the entry
#
$action="$ldapmodify -p $port -h $host -D \"$rootdn\" -w \"$rootpw\" -c >> {{DEV-NULL}} 2>&1";
if ( $single == 1 )
{
@record=(
"dn: $entry\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: cn=nsManagedDisabledRole,@suffixN\n\n" );
}
else
{
@record=(
"dn: cn=nsDisabledRole,@suffixN\n",
"changetype: modify\n",
"$modrole: nsRoleDN\n",
"nsRoleDN: $entry\n\n" );
}
open(FD,"| $action ");
print FD @record;
close(FD);
if ( $? != 0 )
{
debug("$modrole, $entry\n");
$retCode=$?>>8;
exit $retCode;
}
out("$entry $state.\n");
exit 0;
--- NEW FILE template-ns-newpwpolicy.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
# installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
$prefix = "{{DS-ROOT}}";
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
# Add new password policy specific entries
#############################################################################
# enable the use of Perldap functions
require DynaLoader;
use Getopt::Std;
use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Utils qw(:all);
use Mozilla::LDAP::API qw(:api :ssl :apiv3 :constant); # Direct access to C API
#############################################################################
# Default values of the variables
$opt_D = "{{ROOT-DN}}";
$opt_p = "{{SERVER-PORT}}";
$opt_h = "{{SERVER-NAME}}";
$opt_v = 0;
# Variables
$ldapsearch="ldapsearch -1";
$ldapmodify="ldapmodify";
#############################################################################
sub usage {
print (STDERR "ns-newpwpolicy.pl [-v] [-D rootdn] { -w password | -j filename } \n");
print (STDERR " [-p port] [-h host] -U UserDN -S SuffixDN\n\n");
print (STDERR "Arguments:\n");
print (STDERR " -? - help\n");
print (STDERR " -v - verbose output\n");
print (STDERR " -D rootdn - Directory Manager DN. Default= '$opt_D'\n");
print (STDERR " -w rootpw - password for the Directory Manager DN\n");
print (STDERR " -j filename - Read the Directory Manager's password from file\n");
print (STDERR " -p port - port. Default= $opt_p\n");
print (STDERR " -h host - host name. Default= '$opt_h'\n");
print (STDERR " -U userDN - User entry DN\n");
print (STDERR " -S suffixDN - Suffix entry DN\n");
exit 100;
}
# Process the command line arguments
{
usage() if (!getopts('vD:w:j:p:h:U:S:'));
if ($opt_j ne ""){
die "Error, cannot open password file $opt_j\n" unless (open (RPASS, $opt_j));
$opt_w = <RPASS>;
chomp($opt_w);
close(RPASS);
}
usage() if( $opt_w eq "" );
if ($opt_U eq "" && $opt_S eq "") {
print (STDERR "Please provide at least -S or -U option.\n\n");
}
# Now, check if the user/group exists
if ($opt_S) {
print (STDERR "host = $opt_h, port = $opt_p, suffixDN = \"$opt_S\"\n\n") if $opt_v;
@base=(
"cn=nsPwPolicyContainer,$opt_S",
"cn=\"cn=nsPwPolicyEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S",
"cn=\"cn=nsPwTemplateEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S",
"cn=nsPwPolicy_cos,$opt_S"
);
$ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c -a 2>&1";
$modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c 2>&1";
@container=(
"dn: cn=nsPwPolicyContainer,$opt_S\n",
"objectclass: top\n",
"objectclass: nsContainer\n\n" );
@pwpolicy=(
"dn: cn=\"cn=nsPwPolicyEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S\n",
"objectclass: top\n",
"objectclass: ldapsubentry\n",
"objectclass: passwordpolicy\n\n" );
@template=(
"dn: cn=\"cn=nsPwTemplateEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S\n",
"objectclass: top\n",
"objectclass: extensibleObject\n",
"objectclass: costemplate\n",
"objectclass: ldapsubentry\n",
"cosPriority: 1\n",
"pwdpolicysubentry: cn=\"cn=nsPwPolicyEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S\n\n" );
@cos=(
"dn: cn=nsPwPolicy_cos,$opt_S\n",
"objectclass: top\n",
"objectclass: LDAPsubentry\n",
"objectclass: cosSuperDefinition\n",
"objectclass: cosPointerDefinition\n",
"cosTemplateDn: cn=\"cn=nsPwTemplateEntry,$opt_S\",cn=nsPwPolicyContainer,$opt_S\n",
"cosAttribute: pwdpolicysubentry default operational-default\n\n" );
@all=(\@container, \@pwpolicy, \@template, \@cos);
$i=0;
foreach $current (@base)
{
open(FD,"| $ldapadd");
print FD @{$all[$i]};
close(FD);
if ( $? != 0 ) {
$retCode=$?>>8;
if ( $retCode == 68 ) {
print( STDERR "Entry \"$current\" already exists. Please ignore the error\n\n");
}
else {
# Probably a more serious problem.
# Exit with LDAP error
print(STDERR "Error $retcode while adding \"$current\". Exiting.\n");
exit $retCode;
}
}
else {
print( STDERR "Entry \"$current\" created\n\n") if $opt_v;
}
$i=$i+1;
}
$modConfig = "dn:cn=config\nchangetype: modify\nreplace:nsslapd-pwpolicy-local\nnsslapd-pwpolicy-local: on\n\n";
open(FD,"| $modifyCfg ");
print(FD $modConfig);
close(FD);
$retcode = $?;
if ( $retcode != 0 ) {
print( STDERR "Error $retcode while modifing \"cn=config\". Exiting.\n" );
exit ($retcode);
}
else {
print( STDERR "Entry \"cn=config\" modified\n\n") if $opt_v;
}
} # end of $opt_S
if ($opt_U) {
my $norm_opt_U = normalizeDN($opt_U);
print (STDERR "host = $opt_h, port = $opt_p, userDN = \"$norm_opt_U\"\n\n") if $opt_v;
$retcode = `$ldapsearch -h $opt_h -p $opt_p -b \"$norm_opt_U\" -s base \"\"`;
if ($retcode != 0 ) {
print( STDERR "the user entry $norm_opt_U does not exist. Exiting.\n");
exit ($retcode);
}
print( STDERR "the user entry $norm_opt_U found..\n\n") if $opt_v;
# Now, get the parentDN
@rdns = ldap_explode_dn($norm_opt_U, 0);
shift @rdns;
$parentDN = join(',', @rdns);
print (STDERR "parentDN is $parentDN\n\n") if $opt_v;
@base=(
"cn=nsPwPolicyContainer,$parentDN",
"cn=\"cn=nsPwPolicyEntry,$norm_opt_U\",cn=nsPwPolicyContainer,$parentDN"
);
$ldapadd="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c -a 2>&1";
$modifyCfg="$ldapmodify -p $opt_p -h $opt_h -D \"$opt_D\" -w \"$opt_w\" -c 2>&1";
@container=(
"dn: cn=nsPwPolicyContainer,$parentDN\n",
"objectclass: top\n",
"objectclass: nsContainer\n\n" );
@pwpolicy=(
"dn: cn=\"cn=nsPwPolicyEntry,$norm_opt_U\",cn=nsPwPolicyContainer,$parentDN\n",
"objectclass: top\n",
"objectclass: ldapsubentry\n",
"objectclass: passwordpolicy\n\n" );
@all=(\@container, \@pwpolicy);
$i=0;
foreach $current (@base)
{
open(FD,"| $ldapadd ");
print FD @{$all[$i]};
close(FD);
if ( $? != 0 ) {
$retCode=$?>>8;
if ( $retCode == 68 ) {
print( STDERR "Entry $current already exists. Please ignore the error\n\n");
}
else {
# Probably a more serious problem.
# Exit with LDAP error
print(STDERR "Error $retcode while adding \"$current\". Exiting.\n");
exit $retCode;
}
}
else {
print( STDERR "Entry $current created\n\n") if $opt_v;
}
$i=$i+1;
}
$target = "cn=\"cn=nsPwPolicyEntry,$norm_opt_U\",cn=nsPwPolicyContainer,$parentDN";
$modConfig = "dn: $norm_opt_U\nchangetype: modify\nreplace:pwdpolicysubentry\npwdpolicysubentry: $target\n\n";
open(FD,"| $modifyCfg ");
print(FD $modConfig);
close(FD);
$retcode = $?;
if ( $retcode != 0 ) {
print( STDERR "Error $retcode while modifing $norm_opt_U. Exiting.\n" );
exit ($retcode);
}
else {
print( STDERR "Entry \"$norm_opt_U\" modified\n\n") if $opt_v;
}
$modConfig = "dn:cn=config\nchangetype: modify\nreplace:nsslapd-pwpolicy-local\nnsslapd-pwpolicy-local: on\n\n";
open(FD,"| $modifyCfg ");
print(FD $modConfig);
close(FD);
$retcode = $?;
if ( $retcode != 0 ) {
print( STDERR "Error $retcode while modifing \"cn=config\". Exiting.\n" );
exit ($retcode);
}
else {
print( STDERR "Entry \"cn=config\" modified\n\n") if $opt_v;
}
} # end of $opt_U
}
--- NEW FILE template-repl-monitor-cgi.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
use Cgi;
$params = "";
$params .= " -h $cgiVars{'servhost'}" if $cgiVars{'servhost'};
$params .= " -p $cgiVars{'servport'}" if $cgiVars{'servport'};
$params .= " -f $cgiVars{'configfile'}" if $cgiVars{'configfile'};
$params .= " -t $cgiVars{'refreshinterval'}" if $cgiVars{'refreshinterval'};
if ($cgiVars{'admurl'}) {
$admurl = "$cgiVars{'admurl'}";
if ( $ENV{'QUERY_STRING'} ) {
$admurl .= "?$ENV{'QUERY_STRING'}";
}
elsif ( $ENV{'CONTENT_LENGTH'} ) {
$admurl .= "?$Cgi::CONTENT";
}
$params .= " -u \"$admurl\"";
}
$siteroot = $cgiVars{'siteroot'};
$prefix = "{{DS-ROOT}}";
$ENV{'PATH'} = '$prefix@ldapsdk_bindir@:$prefix/usr/lib:@ldapsdk_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib';
# Save user-specified parameters as cookies in monreplication.properties.
# Sync up with the property file so that monreplication2 is interval, and
# monreplication3 the config file pathname.
$propertyfile = "$siteroot/bin/admin/admin/bin/property/monreplication.properties";
$edit1 = "s#monreplication2=.*#monreplication2=$cgiVars{'refreshinterval'}#;";
$edit2 = "s#^monreplication3=.*#monreplication3=$cgiVars{'configfile'}#;";
system("perl -p -i.bak -e \"$edit1\" -e \"$edit2\" $propertyfile");
# Now the real work
$replmon = "$siteroot/bin/slapd/admin/scripts/template-repl-monitor.pl";
system("perl -I$siteroot/lib/perl/arch -I$siteroot/lib/perl $replmon $params");
--- NEW FILE template-repl-monitor.pl.in ---
#{{PERL-EXEC}}
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
##############################################################################
#
# FILE: repl-monitor.pl
#
# SYNOPSIS:
# repl-monitor.pl -f configuration-file [-h host] [-p port] [-r] \
# [-u refresh-url] [-t refresh-interval]
#
# repl-monitor.pl -v
#
# DESCRIPTION:
# Given an LDAP replication "supplier" server, crawl over all the ldap
# servers via direct or indirect replication agreements.
# For each master replica discovered, display the maxcsn of the master
# and the replication status of all its lower level replicas.
# All output is in HTML.
#
# OPTIONS:
#
# -f configuration-file
# The configuration file contains the sections for the connection
# parameters, the server alias, and the thresholds for different colors
# when display the time lags between consumers and master.
# If the Admin Server is running on Windows, the configuration-file
# name may have format "D:/opt/replmon.conf".
#
# The connection parameter section consists of the section name
# followed by one of more connection parameter entries:
#
# [connection]
# host:port:binddn:bindpwd:bindcert
# host:port=shadowport:binddn:bindpwd:bindcert
# ...
#
# where host:port default (*:*) to that in a replication agreement,
# binddn default (*) to "cn=Directory Manager", and bindcert is the
# pathname of cert db if you want the script to connect to the server
# via SSL. If bindcert is omitted, the connection will be simple
# bind.
# "port=shadowport" means to use shadowport instead of port if port
# is specified in the replication agreement. This is useful when
# for example, ssl port is specified in a replication agreement,
# but you can't access the cert db from the machine where this
# script is running. So you could let the script to map the ssl
# port to a non-ssl port and use the simple bind.
#
# A server may have a dedicated or a share entry in the connection
# section. The script will find out the most matched entry for a given
# server. For example, if all the ldap servers except host1 share the
# same binddn and bindpassword, the connection section then just need
# two entries:
#
# [connection]
# *:*:binddn:bindpassword:
# host1:*:binddn:bindpassword:
#
# If a host:port is assigned an alias, then the alias instead of
# host:port will be displayed in The output file. Each host:port
# can have only one alias. But each alias may be used by more than
# one host:port.
#
# [alias]
# alias = host:port
# ...
#
# CSN time lags between masters and consumers might be displayed in
# different colors based on their range. The thresholds for different
# colors may be specified in color section:
#
# [color]
# lowmark (in minutes) = color
# ...
# If the color section or color entry is missing, the default color
# set is: green for [0-5) minutes lag, yellow [5-60), and red 60 and more.
#
# -h host
# Initial replication supplier's host. Default to the current host.
#
# -p port
# Initial replication supplier's port. Default to 389.
#
# -r If specified, -r causes the routine to be entered without printing
# HTML header information. This is suitable when making multiple calls
# to this routine (e.g. when specifying multiple, different, "unrelated"
# supplier servers) and expecting a single HTML output.
#
# -t refresh-interval
# Specify the refresh interval in seconds. This option has to be
# jointly used with option -u.
#
# -u refresh-url
# The output HTML file may invoke a CGI program periodically. If
# this CGI program in turn calls this script, the effect is that
# the output HTML file would automatically refresh itself. This
# is useful for continuing monitoring. See also option -t.
#
# -v Print out the version of this script
#
# DIAGNOSTICS:
# There are several ways to invoke this script if you got error
# "Can't locate Mozilla/LDAP/Conn.pm in @INC", or
# "usage: Undefined variable":
#
# 1. Set the first line of the script to #!<DSHOME>/bin/slapd/admin/bin/perl
# and run this script directly.
#
# 2. Run
# <DSHOME>/bin/slapd/admin/bin/perl repl-monitor.pl
#
# 3. Set environment variable PERL5LIB to your Perl lib dirs where
# Mozilla::LDAP module can be located. This should be under serverroot/lib/perl
# e.g. PERL5LIB="serverroot/lib/perl/arch:serverroot/lib/perl"
#
# 4. Set LD_LIBRARY_PATH (or SHLIB_PATH) to point to the location of our
# bundled shared libraries e.g. LD_LIBRARY_PATH="serverroot/lib"
#
# 5. Invoke the script as follows if <MYPERLDIR> (serverroot/lib/perl) contains
# Mozilla/LDAP:
# <MYPERLDIR>/bin/perl -I <MYPERLDIR>/arch -I <MYPERLDIR> repl-monitor.pl
#
#############################################################################
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
# installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
# this script is always invoked by repl-monitor-cgi.pl, which sets all of these
# If using this script standalone, be sure to set the shared lib path and
# the path to the perldap modules.
$usage = "\nusage: $0 -f configuration-file [-h host] [-p port] [-r] [-u refresh-url] [-t refresh-interval]\n\nor : $0 -v\n";
use Getopt::Std; # parse command line arguments
use Mozilla::LDAP::Conn; # LDAP module for Perl
use Mozilla::LDAP::Utils qw(normalizeDN); # LULU, utilities.
use Mozilla::LDAP::API qw(:api :ssl :apiv3 :constant); # Direct access to C API
use Time::Local; # to convert GMT Z strings to localtime
#
# Global variables
#
$product = "Directory Server Replication Monitor";
$version = "Version 1.0";
#
# ldap servers given or discovered from the replication agreements:
# @servers = (host:port=shadowport:binddn:password:cert_db)
#
# entries read from the connection section of the configuration file:
# @allconnections = (host:port=shadowport:binddn:password:cert_db)
#
# aliases of ldap servers read from the configuration file:
# %allaliases{$host:$port}= (alias)
#
# replicas discovered on all ldap servers
# @allreplicas = (server#:replicaroot:replicatype:serverid:replicadn)
#
# ruvs retrieved from all replicas
# @allruvs{replica#:masterid} = (rawcsn:decimalcsn;mon/day/year hh:mi:ss)
#
# agreements discovered on all ldap supplier servers:
# @allagreements = (supplier_replica#:consumer#:conntype:schedule:status)
# the array may take another format after the consumer replicas are located:
# @allagreements = (supplier_replica#:consumer_replica#:conntype:schedule:status)
#
#main
{
# turn off buffered I/O
$| = 1;
# Check for legal options
if (!getopts('h:p:f:ru:t:v')) {
print $usage;
exit -1;
}
if ($opt_v) {
print "$product - $version\n";
exit;
}
$interval = $opt_t;
$interval = 300 if ( !$interval || $interval <= 0 );
# Get current date/time
$nowraw = localtime();
($wday, $mm, $dd, $tt, $yy) = split(/ /, $nowraw);
$now = "$wday $mm $dd $yy $tt";
# if no -r (Reenter and skip html header), print html header
if (!$opt_r) {
# print the HTML header
&print_html_header;
} else {
# print separator for new replication set
print "<hr width=90% size=3><br>\n";
}
exit -1 if &validateArgs < 0;
exit if &read_cfg_file ($opt_f) < 0;
# Start with the given host and port
# The index names in %ld are defined in Mozilla::LDAP::Utils::ldapArgs()
&add_server ("$ld{host}:$ld{port}:$ld{bind}:$ld{pswd}:$ld{cert}");
$serveridx = 0;
while ($serveridx <= $#servers) {
if (&get_replicas ($serveridx) != 0 && $serveridx == 0) {
my ($host, $port, $binddn) = split (/:/, $servers[0]);
print("Login to $host:$port as \"$binddn\" failed\n");
exit;
}
$serveridx++;
}
&find_consumer_replicas;
&process_suppliers;
# All done! - well, for the current invokation only
# print "</body></html>\n";
exit;
}
sub validateArgs
{
my ($rc) = 0;
%ld = Mozilla::LDAP::Utils::ldapArgs();
if (!$opt_v && !$opt_f) {
print "<p>Error: Missing configuration file.\n";
print "<p>If you need help on the configuration file, Please go back and click the Help button.\n";
#print $usage; # Don't show usage in CGI
$rc = -1;
}
elsif (!$opt_h) {
chop ($ld{"host"} = `hostname`);
}
return $rc;
}
sub read_cfg_file
{
my ($fn) = @_;
unless (open(CFGFILEHANDLE, $fn)) {
print "<p>Error: Can't open \"$fn\": $!.\n";
print "<p>If you need help on the configuration file, Please go back and click the Help button.\n";
return -1;
}
$section = 0;
while (<CFGFILEHANDLE>) {
next if (/^\s*\#/ || /^\s*$/);
chop ($_);
if (m/^\[(.*)\]/) {
$section = $1;
}
else {
if ( $section =~ /conn/i ) {
push (@allconnections, $_);
}
elsif ( $section =~ /alias/i ) {
m/^\s*(\S.*)\s*=\s*(\S+)/;
$allaliases {$2} = $1;
}
elsif ( $section =~ /color/i ) {
m/^\s*(-?\d+)\s*=\s*(\S+)/;
$allcolors {$1} = $2;
}
}
}
if ( ! keys (%allcolors) ) {
$allcolors {0} = "#ccffcc"; #apple green
$allcolors {5} = "#ffffcc"; #cream yellow
$allcolors {60} = "#ffcccc"; #pale pink
}
@colorkeys = sort (keys (%allcolors));
close (CFGFILEHANDLE);
return 0;
}
sub get_replicas
{
my ($serveridx) = @_;
my ($conn, $host, $port, $shadowport, $binddn, $bindpwd, $bindcert);
my ($others);
my ($replica, $replicadn);
my ($ruv, $replicaroot, $replicatype, $serverid, $masterid, $maxcsn);
my ($type, $flag, $i);
my ($myridx, $ridx, $cidx);
#
# Bind to the server
#
($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "$servers[$serveridx]", 5);
($port, $shadowport) = split (/=/, $port);
$shadowport = $port if !$shadowport;
$conn = new Mozilla::LDAP::Conn ($host, $shadowport, "$binddn", $bindpwd, $bindcert);
return -1 if (!$conn);
#
# Get all the replica on the server
#
$myridx = $#allreplicas + 1;
$replica = $conn->search ("cn=mapping tree,cn=config",
"sub",
"(objectClass=nsDS5Replica)", 0,
qw(nsDS5ReplicaRoot nsDS5ReplicaType nsDS5Flags nsDS5ReplicaId));
while ($replica) {
$replicadn = $replica->getDN;
$replicaroot = normalizeDN ($replica->{nsDS5ReplicaRoot}[0]);
$type = $replica->{nsDS5ReplicaType}[0];
$flag = $replica->{nsDS5Flags}[0];
$serverid = $replica->{nsDS5ReplicaId}[0];
# flag = 0: change log is not created
# type = 2: read only replica
# type = 3: updatable replica
$replicatype = $flag == 0 ? "consumer" : ($type == 2 ? "hub" : "master");
push (@allreplicas, "$serveridx:$replicaroot:$replicatype:$serverid:$replicadn");
$replica = $conn->nextEntry ();
}
#
# Get ruv for each replica
#
for ($ridx = $myridx; $ridx <= $#allreplicas; $ridx++) {
$replicaroot = $1 if ($allreplicas[$ridx] =~ /^\d+:([^:]*)/);
# do a one level search with nsuniqueid in the filter - this will force the use of the
# nsuniqueid index instead of the entry dn index, which seems to be unreliable in
# heavily loaded servers
$ruv = $conn->search($replicaroot, "one",
"(&(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff)(objectClass=nsTombstone))",
0, qw(nsds50ruv nsruvReplicaLastModified));
next if !$ruv; # this should be an error case . . .
for ($ruv->getValues('nsds50ruv')) {
if (m/\{replica\s+(\d+).+?\}\s*\S+\s*(\S+)/i) {
$masterid = $1;
$maxcsn = &to_decimal_csn ($2);
$allruvs {"$ridx:$masterid"} = "$2:$maxcsn";
}
}
for ($ruv->getValues('nsruvReplicaLastModified')) {
if (m/\{replica\s+(\d+).+?\}\s*(\S+)/i) {
$masterid = $1;
$lastmodifiedat = hex($2);
my ($sec, $min, $hour, $mday, $mon, $year) = localtime ($lastmodifiedat);
$mon++;
$year += 1900;
$hour = "0".$hour if ($hour < 10);
$min = "0".$min if ($min < 10);
$sec = "0".$sec if ($sec < 10);
$allruvs {"$ridx:$masterid"} .= ";$mon/$mday/$year $hour:$min:$sec";
}
}
}
#
# Get all agreements for each supplier replica
#
for ($ridx = $myridx; $ridx <= $#allreplicas; $ridx++) {
$_ = $allreplicas[$ridx];
# Skip consumers
next if m/:consumer:/i;
m/:([^:]*)$/;
$replicadn = $1;
my @attrlist = qw(cn nsds5BeginReplicaRefresh nsds5replicaUpdateInProgress
nsds5ReplicaLastInitStatus nsds5ReplicaLastInitStart
nsds5ReplicaLastInitEnd nsds5replicaReapActive
nsds5replicaLastUpdateStart nsds5replicaLastUpdateEnd
nsds5replicaChangesSentSinceStartup nsds5replicaLastUpdateStatus
nsds5ReplicaHost
nsds5ReplicaPort nsDS5ReplicaBindMethod nsds5ReplicaUpdateSchedule);
$agreement = $conn->search("$replicadn", "sub", "(objectClass=nsDS5ReplicationAgreement)",
0, @attrlist);
while ($agreement) {
my %agmt = ();
# Push consumer to server stack if we have not already
$host = ($agreement->getValues('nsDS5ReplicaHost'))[0];
$port = ($agreement->getValues('nsDS5ReplicaPort'))[0];
$cidx = &add_server ("$host:$port");
for (@attrlist) {
$agmt{$_} = ($agreement->getValues($_))[0];
}
if ($agmt{nsDS5ReplicaBindMethod} =~ /simple/i) {
$agmt{nsDS5ReplicaBindMethod} = 'n';
}
if (!$agmt{nsds5ReplicaUpdateSchedule} ||
($agmt{nsds5ReplicaUpdateSchedule} eq '0000-2359 0123456') ||
($agmt{nsds5ReplicaUpdateSchedule} eq '*') ||
($agmt{nsds5ReplicaUpdateSchedule} eq '* *')) {
$agmt{nsds5ReplicaUpdateSchedule} = 'always in sync';
}
$agmt{ridx} = $ridx;
$agmt{cidx} = $cidx;
push @allagreements, \%agmt;
$agreement = $conn->nextEntry ();
}
}
$conn->close;
}
#
# Initially, the agreements have consumer host:port info instead of
# replica info. This routine will find the consumer replica info
#
sub find_consumer_replicas
{
my ($m_ridx); # index of master's replica
my ($s_ridx); # index of supplier's replica
my ($c_ridx); # index of consumer's replica
my ($c_sidx); # index of consumer server
my ($remainder); #
my ($s_replicaroot); # supplier replica root
my ($c_replicaroot); # consumer replica root
my ($j, $val);
#
# Loop through every agreement defined on the current supplier replica
#
foreach (@allagreements) {
$s_ridx = $_->{ridx};
$c_sidx = $_->{cidx};
$s_replicaroot = $1 if ($allreplicas[$s_ridx] =~ /^\d+:([^:]*)/);
$c_replicaroot = "";
# $c_ridx will be assigned to -$c_sidx
# if the condumer is not accessible
# $c_sidx will not be zero since it's
# not the first server.
$c_ridx = -$c_sidx; # $c_sidx will not be zero
# Loop through consumer's replicas and find
# the counter part for the current supplier
# replica
for ($j = 0; $j <= $#allreplicas; $j++) {
# Get a replica on consumer
# I'm not sure what's going on here, but possibly could be made
# much simpler with normalizeDN and/or ldap_explode_dn
if ($allreplicas[$j] =~ /^$c_sidx:([^:]*)/) {
$val = $1;
# We need to find out the consumer
# replica that matches the supplier
# replicaroot most.
if ($s_replicaroot =~ /^.*$val$/i &&
length ($val) >= length ($c_replicaroot)) {
$c_ridx = $j;
# Avoid case-sensitive comparison
last if (length($s_replicaroot) == length($val));
$c_replicaroot = $val;
}
}
}
$_->{ridx} = $s_ridx;
$_->{cidx} = $c_ridx;
}
}
sub process_suppliers
{
my ($ridx, $mid, $maxcsn);
$mid = "";
$last_sidx = -1; # global variable for print html page
for ($ridx = 0; $ridx <= $#allreplicas; $ridx++) {
# Skip consumers and hubs
next if $allreplicas[$ridx] !~ /:master:(\d+):/i;
$mid = $1;
# Skip replicas without agreements defined yet
next if (! grep {$_->{ridx} == $ridx} @allagreements);
$maxcsn = &print_master_header ($ridx, $mid);
if ( "$maxcsn" != "none" ) {
&print_consumer_header ();
&print_consumers ($ridx, $mid);
}
&print_supplier_end;
}
if ($mid eq "") {
print "<p>The server is not a master or it has no replication agreement\n";
}
}
sub print_master_header
{
my ($ridx, $mid) = @_;
my ($myruv) = $allruvs {"$ridx:$mid"};
my ($maxcsnval) = split ( /;/, "$myruv" );
my ($maxcsn) = &to_string_csn ($maxcsnval);
my ($sidx, $replicaroot, $replicatype, $serverid) = split (/:/, $allreplicas[$ridx]);
# Print the master name
if ( $last_sidx != $sidx ) {
my ($ldapurl) = &get_ldap_url ($sidx, $sidx);
&print_legend if ( $last_sidx < 0);
print "<p><p><hr><p>\n";
print "\n<p><center class=page-subtitle><font color=#0099cc>\n";
print "Master:  $ldapurl</center>\n";
$last_sidx = $sidx;
}
# Print the current replica info onthe master
print "\n<p><table border=0 cellspacing=1 cellpadding=6 cols=10 width=100% class=bgColor9>\n";
print "\n<tr><td colspan=10><center>\n";
print "<font class=areatitle>Replica ID: </font>";
print "<font class=text28>$serverid</font>\n";
print "<font class=areatitle>Replica Root: </font>";
print "<font class=text28>$replicaroot</font>\n";
print "<font class=areatitle>Max CSN: </font>";
print "<font class=text28>$maxcsn</font>\n";
return $maxcsn;
}
sub print_consumer_header
{
#Print the header of consumer
print "\n<tr class=bgColor16>\n";
print "<th nowrap>Receiver</th>\n";
print "<th nowrap>Time Lag</th>\n";
print "<th nowrap>Max CSN</th>\n";
print "<th nowrap>Last Modify Time</th>\n";
print "<th nowrap>Supplier</th>\n";
print "<th nowrap>Sent/Skipped</th>\n";
print "<th nowrap>Update Status</th>\n";
print "<th nowrap>Update Started</th>\n";
print "<th nowrap>Update Ended</th>\n";
print "<th nowrap colspan=2>Schedule</th>\n";
print "<th nowrap>SSL?</th>\n";
print "</tr>\n";
}
sub print_consumers
{
my ($m_ridx, $mid) = @_;
my ($ignore, $m_replicaroot) = split (/:/, $allreplicas[$m_ridx]);
my (@consumers, @ouragreements, @myagreements);
my ($s_ridx, $c_ridx, $conntype, $schedule, $status);
my ($c_maxcsn_str, $lag, $markcolor);
my ($c_replicaroot, $c_replicatype);
my ($first_entry);
my ($nrows);
my ($found);
undef @ouragreements;
# Collect all the consumer replicas for the current master replica
push (@consumers, $m_ridx);
foreach (@consumers) {
$s_ridx = $_;
for (@allagreements) {
next if ($_->{ridx} != $s_ridx);
$c_ridx = $_->{cidx};
next if $c_ridx == $m_ridx;
push @ouragreements, $_;
$found = 0;
foreach (@consumers) {
if ($_ == $c_ridx) {
$found = 1;
last;
}
}
push (@consumers, $c_ridx) if !$found;
}
}
# Print each consumer replica
my ($myruv) = $allruvs {"$m_ridx:$mid"};
my ($m_maxcsn) = split ( /;/, "$myruv" );
foreach (@consumers) {
$c_ridx = $_;
next if $c_ridx == $m_ridx;
if ($c_ridx >= 0) {
$myruv = $allruvs {"$c_ridx:$mid"};
($c_maxcsn, $c_lastmodified) = split ( /;/, "$myruv" );
($c_maxcsn_str, $lag, $markcolor) = &cacl_time_lag ($m_maxcsn, $c_maxcsn);
$c_maxcsn_str =~ s/ /\<br\>/;
($c_sidx, $c_replicaroot, $c_replicatype) = split (/:/, $allreplicas[$c_ridx]);
$c_replicaroot = "same as master" if $m_replicaroot eq $c_replicaroot;
}
else {
# $c_ridx is actually -$c_sidx when c is not available
$c_sidx = -$c_ridx;
$c_maxcsn_str = "_";
$lag = "n/a";
$markcolor = red;
$c_replicaroot = "_";
$c_replicatype = "_";
}
$nrows = 0;
foreach (@ouragreements) {
next if ($_->{cidx} != $c_ridx);
$nrows++;
}
$first_entry = 1;
foreach (@ouragreements) {
next if ($_->{cidx} != $c_ridx);
$s_ridx = $_->{ridx};
$conntype = $_->{nsDS5ReplicaBindMethod};
$status = $_->{nsds5replicaLastUpdateStatus};
$schedule = $_->{nsds5ReplicaUpdateSchedule};
$s_sidx = $1 if $allreplicas [$s_ridx] =~ /^(\d+):/;
$s_ldapurl = &get_ldap_url ($s_sidx, "n/a");
# Print out the consumer's replica and ruvs
print "\n<tr class=bgColor13>\n";
if ($first_entry) {
$first_entry = 0;
$c_ldapurl = &get_ldap_url ($c_sidx, $conntype);
print "<td rowspan=$nrows width=5% class=bgColor5>$c_ldapurl<BR>Type: $c_replicatype</td>\n";
print "<td rowspan=$nrows width=5% nowrap bgcolor=$markcolor><center>$lag</center></td>\n";
print "<td rowspan=$nrows width=15% nowrap>$c_maxcsn_str</td>\n";
print "<td rowspan=$nrows width=15% nowrap>$c_lastmodified</td>\n";
}
print "<td width=5% nowrap><center>$s_ldapurl</center></td>\n";
my $changecount = $_->{nsds5replicaChangesSentSinceStartup};
if ( $changecount =~ /^$mid:(\d+)\/(\d+) / || $changecount =~ / $mid:(\d+)\/(\d+) / ) {
$changecount = "$1 / $2";
}
elsif ( $changecount =~ /^(\d+)$/ ) {
$changecount = $changecount . " / " . "$_->{nsds5replicaChangesSkippedSinceStartup}";
}
else {
$changecount = "0 / 0";
}
print "<td width=3% nowrap>$changecount</td>\n";
my $redfontstart = "";
my $redfontend = "";
if ($status =~ /error/i) {
$redfontstart = "<font color='red'>";
$redfontend = "</font>";
}
elsif ($status =~ /^(\d+) /) {
if ( $1 != 0 ) {
# warning
$redfontstart = "<font color='#FF7777'>";
$redfontend = "</font>";
}
}
print "<td width=20% nowrap>$redfontstart$status$redfontend</td>\n";
print "<td nowrap>", &format_z_time($_->{nsds5replicaLastUpdateStart}), "</td>\n";
print "<td nowrap>", &format_z_time($_->{nsds5replicaLastUpdateEnd}), "</td>\n";
if ( $schedule =~ /always/i ) {
print "<td colspan=2 width=10% nowrap>$schedule</td>\n";
}
else {
my ($ndays, @days);
$schedule =~ /(\d\d)(\d\d)-(\d\d)(\d\d) (\d+)/;
print "<td width=10% nowrap>$1:$2-$3:$4</td>\n";
$ndays = $5;
$ndays =~ s/(\d)/$1,/g;
@days = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[eval $ndays];
print "<td width=10% nowrap>@days</td>\n";
}
print "<td width=3% nowrap class=bgColor5>$conntype</td>\n";
}
}
}
sub cacl_time_lag
{
my ($s_maxcsn, $c_maxcsn) = @_;
my ($markcolor);
my ($csn_str);
my ($s_tm, $c_tm, $lag_tm, $lag_str, $hours, $minute);
$csn_str = &to_string_csn ($c_maxcsn);
if ($s_maxcsn && !$c_maxcsn) {
$lag_str = "- ?:??:??";
$markcolor = &get_color (36000); # assume consumer has big latency
}
elsif (!$s_maxcsn && $c_maxcsn) {
$lag_str = "+ ?:??:??";
$markcolor = &get_color (1); # consumer is ahead of supplier
}
elsif ($s_maxcsn le $c_maxcsn) {
$lag_str = "0:00:00";
$markcolor = &get_color (0);
}
else {
my ($rawcsn, $decimalcsn) = split (/:/, $s_maxcsn);
($s_tm) = split(/ /, $decimalcsn);
($rawcsn, $decimalcsn) = split (/:/, $c_maxcsn);
($c_tm) = split(/ /, $decimalcsn);
if ($s_tm > $c_tm) {
$lag_tm = $s_tm - $c_tm;
$lag_str = "- ";
$markcolor = &get_color ($lag_tm);
}
else {
$lag_tm = $c_tm - $s_tm;
$lag_str = "+ ";
$markcolor = $allcolors{ $colorkeys[0] }; # no delay
}
$hours = int ($lag_tm / 3600);
$lag_str .= "$hours:";
$lag_tm = $lag_tm % 3600;
$minutes = int ($lag_tm / 60);
$minutes = "0".$minutes if ($minutes < 10);
$lag_str .= "$minutes:";
$lag_tm = $lag_tm % 60;
$lag_tm = "0".$lag_tm if ($lag_tm < 10);
$lag_str .= "$lag_tm";
}
return ($csn_str, $lag_str, $markcolor);
}
#
# The subroutine would append a new entry to the end of
# @servers if the host and port are new to @servers.
#
sub add_server
{
my ($host, $port, $binddn, $bindpwd, $bindcert) = split (/:/, "@_");
my ($shadowport) = $port;
my ($domainpattern) = '\.[^:]+';
my ($i);
# Remove the domain name from the host name
my ($hostnode) = $host;
$hostnode = $1 if $host =~ /^(\w+)\./;
# new host:port
if ($binddn eq "" || $bindpwd eq "" && $bindcert eq "") {
#
# Look up connection parameter in the order of
# host:port
# host:*
# *:port
# *:*
#
my (@myconfig, $h, $p, $d, $w, $c);
(@myconfig = grep (/^$hostnode($domainpattern)*:$port\D/i, @allconnections)) ||
(@myconfig = grep (/^$hostnode($domainpattern)*:\*:/i, @allconnections)) ||
(@myconfig = grep (/^\*:$port\D/, @allconnections)) ||
(@myconfig = grep (/^\*:\*\D/, @allconnections));
if ($#myconfig >= 0) {
($h, $p, $d, $w, $c) = split (/:/, $myconfig[0]);
($p, $shadowport) = split (/=/, $p);
$p = "" if $p eq "*";
$c = "" if $c eq "*";
}
if ($binddn eq "" || $binddn eq "*") {
if ($d eq "" || $d eq "*") {
$binddn = "cn=Directory Manager";
}
else {
$binddn = $d;
}
}
$bindpwd = $w if ($bindpwd eq "" || $bindpwd eq "*");
$bindcert = $c if ($bindcert eq "" || $bindcert eq "*");
}
for ($i = 0; $i <= $#servers; $i++) {
return $i if ($servers[$i] =~ /$hostnode($domainpattern)*:\d*=$shadowport\D/i);
}
push (@servers, "$host:$port=$shadowport:$binddn:$bindpwd:$bindcert");
return $i;
}
sub get_ldap_url
{
my ($sidx, $conntype) = @_;
my ($host, $port) = split(/:/, $servers[$sidx]);
my ($shadowport);
($port, $shadowport) = split (/=/, $port);
my ($protocol, $ldapurl);
if ($port eq 636 && $conntype eq "0" || $conntype =~ /SSL/i) {
$protocol = ldaps;
}
else {
$protocol = ldap;
}
my ($instance) = $allaliases { "$host:$port" };
$instance = "$host:$port" if !$instance;
if ($conntype eq "n/a") {
$ldapurl = $instance;
}
else {
$ldapurl = "<a href=\"$protocol://$host:$port/\">$instance</a>";
}
return $ldapurl;
}
sub to_decimal_csn
{
my ($maxcsn) = @_;
if (!$maxcsn || $maxcsn eq "") {
return "none";
}
my ($tm, $seq, $masterid, $subseq) = unpack("a8 a4 a4 a4", $maxcsn);
$tm = hex($tm);
$seq = hex($seq);
$masterid = hex($masterid);
$subseq = hex($subseq);
return "$tm $seq $masterid $subseq";
}
sub to_string_csn
{
my ($rawcsn, $decimalcsn) = split(/:/, "@_");
if (!$rawcsn || $rawcsn eq "") {
return "none";
}
my ($tm, $seq, $masterid, $subseq) = split(/ /, $decimalcsn);
my ($sec, $min, $hour, $mday, $mon, $year) = localtime($tm);
$mon++;
$year += 1900;
foreach ($sec, $min, $hour, $mday, $mon) {
$_ = "0".$_ if ($_ < 10);
}
my ($csnstr) = "$mon/$mday/$year $hour:$min:$sec";
$csnstr .= " $seq $subseq" if ( $seq != 0 || $subseq != 0 );
return "$rawcsn ($csnstr)";
}
sub get_color
{
my ($lag_minute) = @_;
$lag_minute /= 60;
my ($color) = $allcolors { $colorkeys[0] };
foreach (@colorkeys) {
last if ($lag_minute < $_);
$color = $allcolors {$_};
}
return $color;
}
# subroutine to remove escaped encoding
sub unescape
{
#my ($_) = @_;
tr/+/ /;
s/%(..)/pack("c",hex($1))/ge;
$_;
}
sub print_html_header
{
# print the HTML header
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><html>\n";
print "<head><title>Replication Status</title>\n";
# print "<link type=text/css rel=stylesheet href=\"master-style.css\">\n";
print "<style text/css>\n";
print "Body, p, table, td, ul, li {color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n";
print "A {color:blue; text-decoration: none;}\n";
print "BODY {font-family: arial, helvetica, sans-serif}\n";
print "P {font-family: arial, helvetica, sans-serif}\n";
print "TH {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
print "TD {font-family: arial, helvetica, sans-serif}\n";
print ".bgColor1 {background-color: #003366;}\n";
print ".bgColor4 {background-color: #cccccc;}\n";
print ".bgColor5 {background-color: #999999;}\n";
print ".bgColor9 {background-color: #336699;}\n";
print ".bgColor13 {background-color: #ffffff;}\n";
print ".bgColor16 {background-color: #6699cc;}\n";
print ".text8 {color: #0099cc; font-size: 11px; font-weight: bold;}\n";
print ".text28 {color: #ffcc33; font-size: 12px; font-weight: bold;}\n";
print ".areatitle {font-weight: bold; color: #ffffff; font-family: arial, helvetica, sans-serif}\n";
print ".page-title {font-weight: bold; font-size: larger; font-family: arial, helvetica, sans-serif}\n";
print ".page-subtitle {font-weight: bold; font-family: arial, helvetica, sans-serif}\n";
print "</style></head>\n<body class=bgColor4>\n";
if ($opt_u) {
print "<meta http-equiv=refresh content=$interval; URL=$opt_u>\n";
}
print "<table border=0 cellspacing=0 cellpadding=10 width=100% class=bgColor1>\n";
print "<tr><td><font class=text8>$now</font></td>\n";
print "<td align=center class=page-title><font color=#0099CC>";
print "Directory Server Replication Status</font>\n";
if ($opt_u) {
print "<br><font class=text8>(This page updates every $interval seconds)</font>\n";
}
print "</td><td align=right valign=center width=25%><font class=text8>$version";
print "</font></td></table>\n";
}
sub print_legend
{
my ($nlegends) = $#colorkeys + 1;
print "\n<center><p><font class=page-subtitle color=#0099cc>Time Lag Legend:</font><p>\n";
print "<table cellpadding=6 cols=$nlegends width=40%>\n<tr>\n";
my ($i, $j);
for ($i = 0; $i < $nlegends - 1; $i++) {
$j = $colorkeys[$i];
print "\n<td bgcolor=$allcolors{$j}><center>within $colorkeys[$i+1] min</center></td>\n";
}
$j = $colorkeys[$i];
print "\n<td bgcolor=$allcolors{$j}><center>over $colorkeys[$i] min</center></td>\n";
print "\n<td bgcolor=red><center>server n/a</center></td>\n";
print "</table></center>\n";
}
sub print_supplier_end
{
print "</table>\n";
}
# given a string in generalized time format, convert to ascii time
sub format_z_time
{
my $zstr = shift;
return "n/a" if (! $zstr);
my ($year, $mon, $day, $hour, $min, $sec) =
($zstr =~ /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/);
my $time = timegm($sec, $min, $hour, $day, ($mon-1), $year);
($sec, $min, $hour, $day, $mon, $year) = localtime($time);
$mon++;
$year += 1900;
foreach ($sec, $min, $hour, $day, $mon) {
$_ = "0".$_ if ($_ < 10);
}
return "$mon/$day/$year $hour:$min:$sec";
}
--- NEW FILE template-verify-db.pl.in ---
#{{PERL-EXEC}}
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
sub getDbDir
{
(my $here) = @_;
my @dbdirs = ();
opendir(DIR, $here) or die "can't opendir $here : $!";
while (defined($dir = readdir(DIR)))
{
my $thisdir;
if ("$here" eq ".")
{
$thisdir = $dir;
}
else
{
$thisdir = $here . "{{SEP}}" . $dir;
}
if (-d $thisdir)
{
if (!($thisdir =~ /\./))
{
opendir(SUBDIR, "$thisdir") or die "can't opendir $thisdir : $!";
while (defined($file = readdir(SUBDIR)))
{
if ($file eq "DBVERSION")
{
$#dbdirs++;
$dbdirs[$#dbdirs] = $thisdir;
}
}
closedir(SUBDIR);
}
}
}
closedir(DIR);
return \@dbdirs;
}
sub getLastLogfile
{
(my $here) = @_;
my $logfile = "";
opendir(DIR, $here) or die "can't opendir $here : $!";
while (defined($file = readdir(DIR)))
{
if ($file =~ /log./)
{
$logfile = $file;
}
}
closedir(DIR);
return \$logfile;
}
$isWin = -d '\\';
if ($isWin) {
$NULL = "nul";
} else {
$NULL = "/dev/null";
}
print("*****************************************************************\n");
print("verify-db: This tool should only be run if recovery start fails\n" .
"and the server is down. If you run this tool while the server is\n" .
"running, you may get false reports of corrupted files or other\n" .
"false errors.\n");
print("*****************************************************************\n");
# get dirs having DBVERSION
my $dbdirs = getDbDir(".");
my $brand_ds = {{DS-BRAND}};
my $prefix = "{{DS-ROOT}}";
$ENV{'PATH'} = '$prefix@db_bindir@:$prefix/usr/lib:@db_bindir@:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '@db_libdir@:/usr/lib';
$ENV{'SHLIB_PATH'} = '@db_libdir@:/usr/lib';
for (my $i = 0; $i < @$dbdirs; $i++)
{
# run db_printlog -h <dbdir> for each <dbdir>
print "Verify log files in $$dbdirs[$i] ... ";
open(PRINTLOG, "db_printlog -h $$dbdirs[$i] 2>&1 1> $NULL |");
sleep 1;
my $haserr = 0;
while ($l = <PRINTLOG>)
{
if ("$l" ne "")
{
if ($haserr == 0)
{
print "\n";
}
print "LOG ERROR: $l";
$haserr++;
}
}
close(PRINTLOG);
if ($haserr == 0 && $? == 0)
{
print "Good\n";
}
else
{
my $logfile = getLastLogfile($$dbdirs[$i]);
print "Log file(s) in $$dbdirs[$i] could be corrupted.\n";
print "Please delete a log file $$logfile, and try restarting the server.\n";
}
}
for (my $i = 0; $i < @$dbdirs; $i++)
{
# changelog
opendir(DB, $$dbdirs[$i]) or die "can't opendir $$dbdirs[$i] : $!";
while (defined($db = readdir(DB)))
{
if ($db =~ /\.db/)
{
my $thisdb = $$dbdirs[$i] . "{{SEP}}" . $db;
print "Verify $thisdb ... ";
open(DBVERIFY, "db_verify $thisdb 2>&1 1> $NULL |");
sleep 1;
my $haserr = 0;
while ($l = <DBVERIFY>)
{
if ($haserr == 0)
{
print "\n";
}
if ("$l" ne "")
{
$haserr++;
print "DB ERROR: $l";
}
}
close(DBVERIFY);
if ($haserr == 0 && $? == 0)
{
print "Good\n";
}
else
{
print "changelog file $db in $$dbdirs[$i] is corrupted.\n";
print "Please restore your backup and recover the database.\n";
}
}
}
closedir(DB);
# backend: get instance dirs under <dbdir>
my $instdirs = getDbDir($$dbdirs[$i]);
for (my $j = 0; $j < @$instdirs; $j++)
{
opendir(DIR, $$instdirs[$j]) or die "can't opendir $here : $!";
while (defined($db = readdir(DIR)))
{
if ($db =~ /\.db/)
{
my $thisdb = $$instdirs[$j] . "{{SEP}}" . $db;
print "Verify $thisdb ... ";
open(DBVERIFY, "db_verify $thisdb 2>&1 1> $NULL |");
sleep 1;
my $haserr = 0;
while ($l = <DBVERIFY>)
{
if ($haserr == 0)
{
print "\n";
}
if ("$l" ne "")
{
$haserr++;
print "DB ERROR: $l";
}
}
close(DBVERIFY);
if ($haserr == 0 && $? == 0)
{
print "Good\n";
}
else
{
if ("$db" =~ /id2entry.db/)
{
print "Primary db file $db in $$instdirs[$j] is corrupted.\n";
print "Please restore your backup and recover the database.\n";
}
else
{
print "Secondary index file $db in $$instdirs[$j] is corrupted.\n";
print "Please run db2index(.pl) for reindexing.\n";
}
}
}
}
closedir(DIR);
}
}
Index: template-cl-dump.pl
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-cl-dump.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- template-cl-dump.pl 25 Oct 2006 00:04:42 -0000 1.8
+++ template-cl-dump.pl 25 Oct 2006 20:36:46 -0000 1.9
@@ -99,6 +99,8 @@
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
# installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
+$prefix = "{{DS-ROOT}}";
+
$ENV{'LD_LIBRARY_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
Index: template-ns-newpwpolicy.pl
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-ns-newpwpolicy.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- template-ns-newpwpolicy.pl 25 Oct 2006 00:04:42 -0000 1.6
+++ template-ns-newpwpolicy.pl 25 Oct 2006 20:36:46 -0000 1.7
@@ -42,6 +42,8 @@
# enable the use of our bundled perldap with our bundled ldapsdk libraries
# all of this nonsense can be omitted if the mozldapsdk and perldap are
# installed in the operating system locations (e.g. /usr/lib /usr/lib/perl5)
+$prefix = "{{DS-ROOT}}";
+
$ENV{'PATH'} = '$prefix/usr/lib/mozldap6:$prefix/usr/lib:/usr/lib/mozldap6:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
@@ -64,12 +66,6 @@
$opt_h = "{{SERVER-NAME}}";
$opt_v = 0;
-$ENV{'PATH'} = '$prefix{{SEP}}usr{{SEP}}lib:{{SEP}}usr{{SEP}}lib{{SEP}}mozldap';
-$ENV{'LD_LIBRARY_PATH'} .= ":";
-$ENV{'LD_LIBRARY_PATH'} .= "$prefix{{SEP}}usr{{SEP}}lib:{{SEP}}usr{{SEP}}lib{{SEP}}mozldap";
-$ENV{'SHLIB_PATH'} .= ":";
-$ENV{'SHLIB_PATH'} .= "$prefix{{SEP}}usr{{SEP}}lib:{{SEP}}usr{{SEP}}lib{{SEP}}mozldap";
-
# Variables
$ldapsearch="ldapsearch -1";
$ldapmodify="ldapmodify";
Index: template-repl-monitor-cgi.pl
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-repl-monitor-cgi.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- template-repl-monitor-cgi.pl 25 Oct 2006 00:04:42 -0000 1.6
+++ template-repl-monitor-cgi.pl 25 Oct 2006 20:36:46 -0000 1.7
@@ -56,6 +56,8 @@
$params .= " -u \"$admurl\"";
}
$siteroot = $cgiVars{'siteroot'};
+$prefix = "{{DS-ROOT}}";
+
$ENV{'PATH'} = '$prefix/usr/lib/mozldap6:$prefix/usr/lib:/usr/lib/mozldap6:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
$ENV{'SHLIB_PATH'} = '$prefix/usr/lib/dirsec:$prefix/usr/lib:/usr/lib/dirsec:/usr/lib';
Index: template-verify-db.pl
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-verify-db.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- template-verify-db.pl 25 Oct 2006 00:04:42 -0000 1.6
+++ template-verify-db.pl 25 Oct 2006 20:36:46 -0000 1.7
@@ -112,6 +112,8 @@
# get dirs having DBVERSION
my $dbdirs = getDbDir(".");
my $brand_ds = {{DS-BRAND}};
+my $prefix = "{{DS-ROOT}}";
+
$ENV{'PATH'} = '$prefix/usr/bin:$prefix/usr/lib:/usr/bin:/usr/lib';
$ENV{'LD_LIBRARY_PATH'} = ':/usr/lib';
$ENV{'SHLIB_PATH'} = ':/usr/lib';
16 years, 11 months
[Fedora-directory-commits] ldapserver/m4 db.m4, 1.2, 1.3 mozldap.m4, 1.3, 1.4
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver/m4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5158/m4
Modified Files:
db.m4 mozldap.m4
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Changes:
1) added template files to AC_CONFIG_FILES list
2) added db_bindir and ldapsdk_bindir to pass their tools path to the template
files. The paths are hardcoded for now.
Index: db.m4
===================================================================
RCS file: /cvs/dirsec/ldapserver/m4/db.m4,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- db.m4 24 Oct 2006 21:11:01 -0000 1.2
+++ db.m4 25 Oct 2006 20:36:45 -0000 1.3
@@ -50,6 +50,8 @@
fi
],
AC_MSG_RESULT(no))
+dnl default path for the db tools (see [210947] for more details)
+db_bindir=/usr/bin
dnl - check in system locations
if test -z "$db_inc"; then
Index: mozldap.m4
===================================================================
RCS file: /cvs/dirsec/ldapserver/m4/mozldap.m4,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mozldap.m4 24 Oct 2006 21:11:02 -0000 1.3
+++ mozldap.m4 25 Oct 2006 20:36:45 -0000 1.4
@@ -89,6 +89,9 @@
if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then
AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib].])
fi
+dnl default path for the ldap c sdk tools (see [210947] for more details)
+ldapsdk_bindir=/usr/lib/mozldap6
+
dnl make sure the ldap sdk version is 6 or greater - we do not support
dnl the old 5.x or prior versions - the ldap server code expects the new
dnl ber types and other code used with version 6
16 years, 11 months
[Fedora-directory-commits] ldapserver configure.ac,1.3,1.4
by Doctor Conrad
Author: nhosoi
Update of /cvs/dirsec/ldapserver
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5158
Modified Files:
configure.ac
Log Message:
Resolves: #212098
Summary: Use autoconf to generate task perl script templates
Changes:
1) added template files to AC_CONFIG_FILES list
2) added db_bindir and ldapsdk_bindir to pass their tools path to the template
files. The paths are hardcoded for now.
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- configure.ac 24 Oct 2006 21:11:01 -0000 1.3
+++ configure.ac 25 Oct 2006 20:36:45 -0000 1.4
@@ -104,10 +104,12 @@
AC_SUBST(ldapsdk_inc)
AC_SUBST(ldapsdk_lib)
AC_SUBST(ldapsdk_libdir)
+AC_SUBST(ldapsdk_bindir)
AC_SUBST(db_inc)
AC_SUBST(db_incdir)
AC_SUBST(db_lib)
AC_SUBST(db_libdir)
+AC_SUBST(db_bindir)
AC_SUBST(sasl_inc)
AC_SUBST(sasl_lib)
AC_SUBST(sasl_libdir)
@@ -153,4 +155,19 @@
AC_CONFIG_FILES([wrappers/mmldif])
AC_CONFIG_FILES([wrappers/pwdhash])
AC_CONFIG_FILES([wrappers/rsearch])
+
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-bak2db.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-cl-dump.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2bak.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2index.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-db2ldif.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ldif2db.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ns-accountstatus.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ns-activate.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ns-inactivate.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-ns-newpwpolicy.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-repl-monitor-cgi.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-repl-monitor.pl])
+AC_CONFIG_FILES([ldap/admin/src/scripts/template-verify-db.pl])
+
AC_OUTPUT
16 years, 11 months