summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-08-02 14:39:01 +0000
committerRich Megginson <rmeggins@redhat.com>2007-08-02 14:39:01 +0000
commitd7531c68d34d83c17c0d1996fec6d6a0ebfc0e4b (patch)
treed9dc41736d47540967b5523a96d6a0eed9f6b379
parent2ebeaf1fbbba60e8ed0040bb904c1bb858a876c3 (diff)
downloadds-d7531c68d34d83c17c0d1996fec6d6a0ebfc0e4b.tar.gz
ds-d7531c68d34d83c17c0d1996fec6d6a0ebfc0e4b.tar.xz
ds-d7531c68d34d83c17c0d1996fec6d6a0ebfc0e4b.zip
Resolves: bug 250535
Bug Description: improve perldap script execution ability on bundled platforms Reviewed by: nkinder (Thanks!) Fix Description: Most platforms will just use perl from PATH. However, on Solaris and HP-UX, we have to use special 64 bit versions to execute perldap, since perldap is 64 bit on those platforms. Also, if bundling all of the dependent components into the single package, we need to make sure the perl library path is set correctly to find perldap. The last step will be to build our version of perldap on the bundled platforms to use rpath to point to the correct runtime library location. Platforms tested: RHEL4, HP-UX 11.23 IPF 64 bit Flag Day: no Doc impact: no
-rw-r--r--Makefile.am13
-rw-r--r--Makefile.in14
-rwxr-xr-xconfigure18
-rw-r--r--configure.ac15
-rw-r--r--ldap/admin/src/ns-newpwpolicy.pl253
-rw-r--r--ldap/admin/src/scripts/DSCreate.pm.in3
-rw-r--r--ldap/admin/src/scripts/migrate-ds.pl.in4
-rw-r--r--ldap/admin/src/scripts/setup-ds.pl.in4
-rwxr-xr-xldap/admin/src/scripts/template-ns-newpwpolicy.pl.in2
9 files changed, 59 insertions, 267 deletions
diff --git a/Makefile.am b/Makefile.am
index 4ea75be7..879d60c1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -989,6 +989,9 @@ rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBS
# i.e. it literally copies in '${prefix}' rather than expanding it out - we want this instead:
# LD_LIBRARY_PATH = /usr/lib/fedora-ds
if BUNDLE
+# on the systems on which we bundle, perldap will be in libdir/perl, so we need to point
+# the perlpath there - on other systems, perldap will be installed as a site module into
+# the system perl
fixupcmd = sed \
-e 's,@bindir\@,$(bindir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
@@ -1029,10 +1032,11 @@ fixupcmd = sed \
-e 's,@PACKAGE_BASE_VERSION\@,$(PACKAGE_BASE_VERSION),g' \
-e 's,@BUILDNUM\@,$(BUILDNUM),g' \
-e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \
- -e 's,@perldir\@,$(perldir),g' \
+ -e 's,@perlpath\@,$(perldir) $(libdir)/perl/arch $(libdir)/perl,g' \
-e 's,@defaultuser\@,$(defaultuser),g' \
-e 's,@defaultgroup\@,$(defaultgroup),g' \
- -e 's,@with_fhs_opt\@,@with_fhs_opt@,g'
+ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g' \
+ -e 's,@perlexec\@,@perlexec@,g'
else
fixupcmd = sed \
-e 's,@bindir\@,$(bindir),g' \
@@ -1074,10 +1078,11 @@ fixupcmd = sed \
-e 's,@PACKAGE_BASE_VERSION\@,$(PACKAGE_BASE_VERSION),g' \
-e 's,@BUILDNUM\@,$(BUILDNUM),g' \
-e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \
- -e 's,@perldir\@,$(perldir),g' \
+ -e 's,@perlpath\@,$(perldir),g' \
-e 's,@defaultuser\@,$(defaultuser),g' \
-e 's,@defaultgroup\@,$(defaultgroup),g' \
- -e 's,@with_fhs_opt\@,@with_fhs_opt@,g'
+ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g' \
+ -e 's,@perlexec\@,@perlexec@,g'
endif
%: %.in
diff --git a/Makefile.in b/Makefile.in
index b36da1a0..5ac38605 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -938,6 +938,7 @@ nss_lib = @nss_lib@
nss_libdir = @nss_libdir@
oldincludedir = @oldincludedir@
perldir = $(libdir)@perldir@
+perlexec = @perlexec@
prefix = @prefix@
program_transform_name = @program_transform_name@
propertydir = $(datadir)@propertydir@
@@ -1898,10 +1899,11 @@ rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBS
@BUNDLE_FALSE@ -e 's,@PACKAGE_BASE_VERSION\@,$(PACKAGE_BASE_VERSION),g' \
@BUNDLE_FALSE@ -e 's,@BUILDNUM\@,$(BUILDNUM),g' \
@BUNDLE_FALSE@ -e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \
-@BUNDLE_FALSE@ -e 's,@perldir\@,$(perldir),g' \
+@BUNDLE_FALSE@ -e 's,@perlpath\@,$(perldir),g' \
@BUNDLE_FALSE@ -e 's,@defaultuser\@,$(defaultuser),g' \
@BUNDLE_FALSE@ -e 's,@defaultgroup\@,$(defaultgroup),g' \
-@BUNDLE_FALSE@ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g'
+@BUNDLE_FALSE@ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g' \
+@BUNDLE_FALSE@ -e 's,@perlexec\@,@perlexec@,g'
# these are for the config files and scripts that we need to generate and replace
@@ -1910,6 +1912,9 @@ rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBS
# LD_LIBRARY_PATH = ${prefix}/lib/fedora-ds
# i.e. it literally copies in '${prefix}' rather than expanding it out - we want this instead:
# LD_LIBRARY_PATH = /usr/lib/fedora-ds
+# on the systems on which we bundle, perldap will be in libdir/perl, so we need to point
+# the perlpath there - on other systems, perldap will be installed as a site module into
+# the system perl
@BUNDLE_TRUE@fixupcmd = sed \
@BUNDLE_TRUE@ -e 's,@bindir\@,$(bindir),g' \
@BUNDLE_TRUE@ -e 's,@sbindir\@,$(sbindir),g' \
@@ -1950,10 +1955,11 @@ rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBS
@BUNDLE_TRUE@ -e 's,@PACKAGE_BASE_VERSION\@,$(PACKAGE_BASE_VERSION),g' \
@BUNDLE_TRUE@ -e 's,@BUILDNUM\@,$(BUILDNUM),g' \
@BUNDLE_TRUE@ -e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \
-@BUNDLE_TRUE@ -e 's,@perldir\@,$(perldir),g' \
+@BUNDLE_TRUE@ -e 's,@perlpath\@,$(perldir) $(libdir)/perl/arch $(libdir)/perl,g' \
@BUNDLE_TRUE@ -e 's,@defaultuser\@,$(defaultuser),g' \
@BUNDLE_TRUE@ -e 's,@defaultgroup\@,$(defaultgroup),g' \
-@BUNDLE_TRUE@ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g'
+@BUNDLE_TRUE@ -e 's,@with_fhs_opt\@,@with_fhs_opt@,g' \
+@BUNDLE_TRUE@ -e 's,@perlexec\@,@perlexec@,g'
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/configure b/configure
index c7f94a06..ae9ba258 100755
--- a/configure
+++ b/configure
@@ -465,7 +465,7 @@ ac_includes_default="\
#endif"
ac_default_prefix=/opt/$PACKAGE_NAME
-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 SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION 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 db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor 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 SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION 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 db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -23245,6 +23245,14 @@ fi
# Deal with platform dependent defines
# relative to sysconfdir
initdir=/rc.d
+# on most platforms, we will just use perl from PATH
+# On some platforms, we cannot. Why not just use any old
+# perl? Because of perldap. We use a perldap that is
+# compiled to either 32bit or 64bit, so we must use a native
+# perl binary compiled with the same bitsize. On Solaris
+# and HP-UX, /usr/bin/perl is 32 bit, so we cannot use
+# those with our 64 bit compiled product.
+perlexec='/usr/bin/env perl'
case $host in
*-*-linux*)
@@ -23327,6 +23335,8 @@ cat >>confdefs.h <<\_ACEOF
#define _HPUX_SOURCE 1
_ACEOF
+ # assume 64 bit
+ perlexec='/opt/perl_64/bin/perl'
platform="hpux"
;;
hppa*-hp-hpux*)
@@ -23375,6 +23385,8 @@ cat >>confdefs.h <<\_ACEOF
#define _HPUX_SOURCE 1
_ACEOF
+ # assume 64 bit
+ perlexec='/opt/perl_64/bin/perl'
platform="hpux"
;;
sparc-sun-solaris*)
@@ -23449,6 +23461,8 @@ _ACEOF
LIBCRUN=$LIBCRUN
platform="solaris"
+ # assume 64 bit
+ perlexec='/opt/perl5x/bin/perl'
# relative to sysconfdir
initdir=/init.d
;;
@@ -23460,6 +23474,7 @@ esac
+
if test "$platform" = "hpux"; then
HPUX_TRUE=
HPUX_FALSE='#'
@@ -26044,6 +26059,7 @@ s,@LIBDL@,$LIBDL,;t t
s,@LIBCSTD@,$LIBCSTD,;t t
s,@LIBCRUN@,$LIBCRUN,;t t
s,@initdir@,$initdir,;t t
+s,@perlexec@,$perlexec,;t t
s,@HPUX_TRUE@,$HPUX_TRUE,;t t
s,@HPUX_FALSE@,$HPUX_FALSE,;t t
s,@SOLARIS_TRUE@,$SOLARIS_TRUE,;t t
diff --git a/configure.ac b/configure.ac
index b93155a5..07db323b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,6 +238,14 @@ AM_CONDITIONAL([WINNT], false)
# Deal with platform dependent defines
# relative to sysconfdir
initdir=/rc.d
+# on most platforms, we will just use perl from PATH
+# On some platforms, we cannot. Why not just use any old
+# perl? Because of perldap. We use a perldap that is
+# compiled to either 32bit or 64bit, so we must use a native
+# perl binary compiled with the same bitsize. On Solaris
+# and HP-UX, /usr/bin/perl is 32 bit, so we cannot use
+# those with our 64 bit compiled product.
+perlexec='/usr/bin/env perl'
case $host in
*-*-linux*)
AC_DEFINE([XP_UNIX], [1], [UNIX])
@@ -260,6 +268,8 @@ case $host in
AC_DEFINE([OS_hpux], [1], [OS HP-UX])
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
+ # assume 64 bit
+ perlexec='/opt/perl_64/bin/perl'
platform="hpux"
;;
hppa*-hp-hpux*)
@@ -272,6 +282,8 @@ case $host in
AC_DEFINE([OS_hpux], [1], [OS HP-UX])
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
+ # assume 64 bit
+ perlexec='/opt/perl_64/bin/perl'
platform="hpux"
;;
sparc-sun-solaris*)
@@ -299,6 +311,8 @@ dnl Cstd and Crun are required to link any C++ related code
LIBCRUN=-lCrun
AC_SUBST([LIBCRUN], [$LIBCRUN])
platform="solaris"
+ # assume 64 bit
+ perlexec='/opt/perl5x/bin/perl'
# relative to sysconfdir
initdir=/init.d
;;
@@ -307,6 +321,7 @@ dnl Cstd and Crun are required to link any C++ related code
;;
esac
AC_SUBST(initdir)
+AC_SUBST(perlexec)
AM_CONDITIONAL(HPUX,test "$platform" = "hpux")
AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
diff --git a/ldap/admin/src/ns-newpwpolicy.pl b/ldap/admin/src/ns-newpwpolicy.pl
deleted file mode 100644
index 8ef8f107..00000000
--- a/ldap/admin/src/ns-newpwpolicy.pl
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/usr/bin/env perl
-#
-# 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)
-#BEGIN {
-# my $savedir = `pwd`;
-# my $dirname = `dirname $0`;
-# chdir $dirname;
-# my $sroot = `pwd`;
-# $sroot =~ s@/slapd-.*@@;
-# chomp($sroot);
-# chdir $savedir;
-# push @INC, "$sroot/lib/perl/arch", "$sroot/lib/perl";
-# if ($ENV{LD_LIBRARY_PATH}) {
-# $ENV{LD_LIBRARY_PATH} .= ":";
-# }
-# $ENV{LD_LIBRARY_PATH} .= "$sroot/shared/lib";
-# # this is only needed for HP/ux PA-RISC, but it doesn't hurt other platforms
-# if ($ENV{SHLIB_PATH}) {
-# $ENV{SHLIB_PATH} .= ":";
-# }
-# $ENV{SHLIB_PATH} .= "$sroot/shared/lib";
-#}
-$ENV{'LD_LIBRARY_PATH'} = "$prefix{{SEP}}usr{{SEP}}lib:{{SEP}}usr{{SEP}}lib{{SEP}}mozldap6:{{SEP}}usr{{SEP}}lib{{SEP}}dirsec";
-# Add new password policy specific entries
-
-#############################################################################
-# enable the use of Perldap functions
-require DynaLoader;
-
-use Getopt::Std;
-use Mozilla::LDAP::Conn;
-use Mozilla::LDAP::Entry;
-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 = "cn=directory manager";
-$opt_p = 389;
-$opt_h = "localhost";
-$opt_v = 0;
-
-#############################################################################
-
-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) {
- my $norm_opt_S = normalizeDN($opt_S);
- print (STDERR "host = $opt_h, port = $opt_p, suffixDN = $norm_opt_S\n\n") if $opt_v;
- %ld = Mozilla::LDAP::Utils::ldapArgs();
- $ld->{"host"} = $opt_h;
- $ld->{"port"} = $opt_p;
- $ld->{"bind"} = $opt_D;
- $ld->{"pswd"} = $opt_w;
- $conn = new Mozilla::LDAP::Conn(\%ld); die "No LDAP connection" unless $conn;
-
- $entry_1 = new Mozilla::LDAP::Entry;
- $dn1 = "cn=nsPwPolicyContainer, " . $norm_opt_S;
- print (STDERR "adding $dn1\n\n") if $opt_v;
- $entry_1->setDN("$dn1");
- $entry_1->setValues("objectclass", "top", "nsContainer");
- $conn->add($entry_1);
- $error = $conn->getErrorCode();
- if ( ( $error ne 0 ) && ( $error ne 68 ) ) {
- $conn->printError();
- exit (-1);
- }
-
- $entry_2 = new Mozilla::LDAP::Entry;
- $dn2 = "cn=\"cn=nsPwPolicyEntry,$norm_opt_S\",cn=nsPwPolicyContainer," . $norm_opt_S;
- print (STDERR "adding $dn2\n\n") if $opt_v;
- $entry_2->setDN("$dn2");
- $entry_2->setValues("objectclass", "top", "ldapsubentry", "passwordpolicy");
- $conn->add($entry_2);
- $conn->printError() if $conn->getErrorCode();
-
- $entry_3 = new Mozilla::LDAP::Entry;
- $dn3 = "cn=\"cn=nsPwTemplateEntry,$norm_opt_S\",cn=nsPwPolicyContainer, " . $norm_opt_S;
- print (STDERR "adding $dn3\n\n") if $opt_v;
- $entry_3->setDN("$dn3");
- $entry_3->setValues("objectclass", "top", "extensibleObject", "costemplate", "ldapsubentry");
- $entry_3->setValues("cospriority", "1");
- $entry_3->setValues("pwdpolicysubentry", "$dn2");
- $conn->add($entry_3);
- $conn->printError() if $conn->getErrorCode();
-
- $entry_4 = new Mozilla::LDAP::Entry;
- $dn4 = "cn=nsPwPolicy_cos, " . $norm_opt_S;
- print (STDERR "adding $dn4\n\n") if $opt_v;
- $entry_4->setDN("$dn4");
- $entry_4->setValues("objectclass", "top", "cosSuperDefinition", "cosPointerDefinition", "ldapsubentry");
- $entry_4->setValues("cosTemplateDn", "$dn3");
- $entry_4->setValues("cosAttribute", "pwdpolicysubentry default operational-default");
- $conn->add($entry_4);
- $conn->printError() if $conn->getErrorCode();
-
- $cfg_entry = $conn->search("cn=config", "base", "(objectclass=*)");
- $conn->printError() if $conn->getErrorCode();
- print (STDERR "modifying cn=config\n\n") if $opt_v;
- $cfg_entry->setValues("nsslapd-pwpolicy-local", "on");
- $conn->update($cfg_entry);
- $conn->printError() if $conn->getErrorCode();
-
- $conn->close if $conn;
-
- } # 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;
- %ld = Mozilla::LDAP::Utils::ldapArgs();
- $ld->{"host"} = $opt_h;
- $ld->{"port"} = $opt_p;
- $ld->{"bind"} = $opt_D;
- $ld->{"pswd"} = $opt_w;
- $conn = new Mozilla::LDAP::Conn(\%ld); die "No LDAP connection" unless $conn;
-
- $user_entry = $conn->search($norm_opt_U, "base", "(objectclass=*)");
- $conn->printError() if $conn->getErrorCode();
- if (! $user_entry) {
- print (STDERR "The user entry $norm_opt_U does not exist. Exiting.\n");
- exit (-1);
- }
-
- 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;
-
- # Now, check if the nsContainer entry exists at the parent level
- $dn1 = "cn=nsPwPolicyContainer, " . $parentDN;
- $entry = $conn->search($dn1, "base", "(objectclass=*)");
- my $error = $conn->getErrorCode();
- $conn->printError()
- if (( $error ne 0 ) && ( $error ne 32 ) && ( $error ne 68 ));
-
- if (! $entry) {
- print (STDERR "nsContainer doesn't exist. Creating one now..\n\n") if $opt_v;
-
- $entry_1 = new Mozilla::LDAP::Entry;
-
- print (STDERR "adding $dn1\n\n") if $opt_v;
- $entry_1->setDN("$dn1");
- $entry_1->setValues("objectclass", "top", "nsContainer");
- $conn->add($entry_1);
- $conn->printError() if $conn->getErrorCode();
- } else {
- print (STDERR "nsContainer exists..\n\n") if $opt_v;
- }
-
- $entry_2 = new Mozilla::LDAP::Entry;
- $dn2 = "cn=\"cn=nsPwPolicyEntry,$norm_opt_U\",cn=nsPwPolicyContainer," . $parentDN;
- print (STDERR "adding $dn2\n\n") if $opt_v;
- $entry_2->setDN("$dn2");
- $entry_2->setValues("objectclass", "top", "ldapsubentry", "passwordpolicy");
- $conn->add($entry_2);
- $conn->printError() if $conn->getErrorCode();
-
- print (STDERR "modifying $norm_opt_U\n\n") if $opt_v;
- $user_entry->setValues("pwdpolicysubentry", "$dn2");
- $conn->update($user_entry);
- $conn->printError() if $conn->getErrorCode();
-
- $cfg_entry = $conn->search("cn=config", "base", "(objectclass=*)");
- $conn->printError() if $conn->getErrorCode();
- print (STDERR "modifying cn=config\n\n") if $opt_v;
- $cfg_entry->setValues("nsslapd-pwpolicy-local", "on");
- $conn->update($cfg_entry);
- $conn->printError() if $conn->getErrorCode();
-
- $conn->close if $conn;
-
- } # end of $opt_U
-}
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index cee2c93a..a122d536 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -201,7 +201,8 @@ sub makeDSDirs {
sub createInstanceScripts {
my $inf = shift;
- my $myperl = "!/usr/bin/env perl";
+ my $perlexec = "@perlexec@" || "/usr/bin/env perl";
+ my $myperl = "!$perlexec";
my $mydevnull = (-f "/dev/null" ? " /dev/null " : " NUL ");
my %maptable = (
"DS-ROOT" => $inf->{General}->{prefix},
diff --git a/ldap/admin/src/scripts/migrate-ds.pl.in b/ldap/admin/src/scripts/migrate-ds.pl.in
index bd718d58..df14ea07 100644
--- a/ldap/admin/src/scripts/migrate-ds.pl.in
+++ b/ldap/admin/src/scripts/migrate-ds.pl.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!@perlexec@
# 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
@@ -47,7 +47,7 @@
#
##########################
-use lib '@perldir@';
+use lib qw(@perlpath@);
use strict;
diff --git a/ldap/admin/src/scripts/setup-ds.pl.in b/ldap/admin/src/scripts/setup-ds.pl.in
index 32cb0c34..7fdc9772 100644
--- a/ldap/admin/src/scripts/setup-ds.pl.in
+++ b/ldap/admin/src/scripts/setup-ds.pl.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!@perlexec@
# 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
@@ -37,7 +37,7 @@
# END COPYRIGHT BLOCK
#
-use lib '@perldir@';
+use lib qw(@perlpath@);
use strict;
diff --git a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
index c52dae82..caf06dbd 100755
--- a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
+++ b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
@@ -39,6 +39,8 @@
# END COPYRIGHT BLOCK
#
+use lib qw(@perlpath@);
+
# 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)