diff options
Diffstat (limited to 'ldap/cm/newinst')
-rw-r--r-- | ldap/cm/newinst/Makefile | 190 | ||||
-rw-r--r-- | ldap/cm/newinst/fixINF.pl | 82 | ||||
-rwxr-xr-x | ldap/cm/newinst/ns-keygen | 200 | ||||
-rwxr-xr-x | ldap/cm/newinst/ns-update | 210 | ||||
-rw-r--r-- | ldap/cm/newinst/replaceToken.pl | 66 | ||||
-rwxr-xr-x | ldap/cm/newinst/setup | 564 | ||||
-rwxr-xr-x | ldap/cm/newinst/setup.patch | 318 | ||||
-rwxr-xr-x | ldap/cm/newinst/setup.pl | 176 | ||||
-rwxr-xr-x | ldap/cm/newinst/setup.sh | 43 | ||||
-rw-r--r-- | ldap/cm/newinst/slapd-patch.inf | 58 | ||||
-rw-r--r-- | ldap/cm/newinst/slapd.inf.in | 66 | ||||
-rwxr-xr-x | ldap/cm/newinst/uninstall | 107 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-config.cc | 1118 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-config.h | 241 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-dialog.cc | 4346 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-dialog.h | 106 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-dsalib_dn.c | 50 | ||||
-rw-r--r-- | ldap/cm/newinst/ux-guesses.cc | 184 |
18 files changed, 0 insertions, 8125 deletions
diff --git a/ldap/cm/newinst/Makefile b/ldap/cm/newinst/Makefile deleted file mode 100644 index 5e4bffd6..00000000 --- a/ldap/cm/newinst/Makefile +++ /dev/null @@ -1,190 +0,0 @@ -# -# 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 -# -# Source for the install forms and CGI programs - -.SUFFIXES: .cc - -BUILD_ROOT = ../../.. -LDAP_SRC = ../.. - -MODULE=slapdInstallBin -# override BUILD_MODULE = HTTP_ADMIN - -include $(BUILD_ROOT)/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -test: - echo $(SETUPUTIL_VERSION) - echo $(SETUPUTIL_RELEASE) - -# MODULE_CFLAGS = -DUSE_ADMSERV - -BINDEST=$(LDAP_ADMIN_BIN_RELDIR) -OBJDEST=$(LDAP_ADMOBJDIR) - -ifndef $(OFFLAG) -OFFLAG=-o -endif - -# we don't want to build with warnings-as-errors for the cm/ stuff, because -# it's crappy C++ code which is LITTERED with warnings, most of which we -# can't fix because it comes from files in dist/, etc. -ifeq ($(ARCH), Linux) -CFLAGS := $(subst -Werror,,$(CFLAGS)) -endif - -NOSTDCLEAN=true -NOSTDSTRIP=true - -OSOBJS= -OBJS1=$(OBJDEST)/ux-dialog.o $(OBJDEST)/ux-config.o $(OBJDEST)/ux-dsalib_dn.o -OBJS1GT=$(OBJDEST)/ux-guesses.o - -PROGS= ns-config -ifeq ($(ARCH),WINNT) -BINS= -OSOBJS= -OBJS1= -OBJS2= -OSLIBS= -OSDEPLIBS= -LIBS= -else -BINS=$(addprefix $(BINDEST)/, $(PROGS)) -endif -INFO= $(OBJDIR)/$(DIR) -PATCHINFO= $(ABS_OBJDIR)/$(DIR) - -# Source for staged installation utilities -INCDIR=$(SETUPUTIL_INCLUDE) -I$(LDAP_SRC)/admin/include -I$(LDAP_SRC)/admin/lib -I$(LDAP_SRC)/admin/src - -all: $(OBJDEST) $(BINDEST) $(SETUPUTIL_DEP) $(LDAPSDK_DEP) $(SECURITY_DEP) $(NSPR_DEP) $(OSOBJS) $(OBJS1) $(OBJS2) $(BINS) $(INFO) $(BINDEST)/ns-update $(BINDEST)/uninstall -# removed ns-keygen from build - it was only used for Dir Lite -# $(BINDEST)/ns-keygen -ifeq ($(ARCH), BSDI) -CFLAGS += -DNO_DOMAINNAME -endif - -ifeq ($(ARCH), IRIX) -CFLAGS += -exceptions -EXTRA_LIBS += -lm -lc -endif - -ifeq ($(ARCH), OSF1) -EXTRA_LIBS += -lm -endif - -#LIBLDAPU= ldapu -#LIBLDAP= $(LDAP_LIBPATH)/libldap$(LDAP_SUF).a -#DEPLIBS=$(addprefix $(OBJDIR)/lib/lib, \ -# $(addsuffix .$(LIB_SUFFIX), $(LIBLDAPU))) $(OSDEPLIBS) - -ifeq ($(ARCH), HPUX) - -ifeq ($(NSOS_RELEASE),B.10.10) -CURSES=-lHcurses -endif - -ifeq ($(NSOS_RELEASE),B.11.00) - MODERNHP=1 -endif - -ifeq ($(NSOS_RELEASE),B.11.11) - MODERNHP=1 -endif - -ifeq ($(NSOS_RELEASE),B.11.23) - MODERNHP=1 -endif - -ifeq ($(MODERNHP),1) -CURSES=-lHcurses -else -CURSES=/usr/lib/libcurses.a -endif -ifeq ($(USE_64), 1) -CURSES=-lcurses -endif -else -CURSES=-lcurses -ltermcap -endif - -ifeq ($(ARCH), AIX) -CURSES=-lcurses -endif - -$(BINDEST)/ns-update : ns-update - -@$(RM) $@ - $(CP) $< $@ - -$(BINDEST)/ns-keygen: ns-keygen - -@$(RM) $@ - $(CP) $< $@ - -$(BINDEST)/uninstall: uninstall - -@$(RM) $@ - $(CP) $< $@ - -$(BINDEST)/ns-config: $(OBJS1) $(OBJS2) - $(PURIFY) $(CXX) $(SHARED_FLAG) $(CFLAGS) $(MCC_INCLUDE) $(INCDIR) \ - -o $(BINDEST)/ns-config $(RPATHFLAG_PREFIX)$(RPATHFLAG)$(RPATHFLAG_EXTRAS) $(OBJS1) $(OBJS2) $(SETUPUTILLINK) $(LDAPLINK) $(SECURITYLINK) $(NSPRLINK) \ - $(SASL_LINK) $(EXTRA_LIBS) $(CURSES) - -ifeq ($(ARCH), WINNT) -$(INFO): - $(PERL) fixINF.pl $(BUILD_MODULE) $(NOSP_DIR_VERSION) $(BUILD_ROOT)/$(BUILD_ARCH)/buildnum.dat slapd.inf $(SECURITY) $(PRODUCT) $(IS_DIR_LITE) $(INSTANCE_NAME_PREFIX) $@.inf $(BUILD_BOMB) "bin/admin/ns-admin,bin/admin/ns-admin.so" -else -$(INFO): - $(PERL) fixINF.pl $(BUILD_MODULE) $(NOSP_DIR_VERSION) $(BUILD_ROOT)/$(BUILD_ARCH)/buildnum.dat slapd.inf $(SECURITY) $(PRODUCT) $(IS_DIR_LITE) $(INSTANCE_NAME_PREFIX) $@.inf $(BUILD_BOMB) "$(addprefix lib/,$(LDAP_SOLIBS)) bin/admin/libnsslapd.sl bin/slapd/bin/ns-slapd bin/slapd/bin/ns-slapd.so bin/slapd/bin/libnsslapd_shr.a" -ifdef BUILD_PATCH - $(PERL) fixINF.pl $(BUILD_MODULE) $(NOSP_DIR_VERSION) $(BUILD_ROOT)/$(BUILD_ARCH)/buildnum.dat slapd-patch.inf $(SECURITY) $(PRODUCT_NAME) $(IS_DIR_LITE) $(INSTANCE_NAME_PREFIX) $(PATCHINFO)-patch.inf $(BUILD_BOMB) "$(addprefix lib/,$(LDAP_SOLIBS)) bin/admin/libnsslapd.sl bin/slapd/bin/ns-slapd bin/slapd/bin/ns-slapd.so bin/slapd/bin/libnsslapd_shr.a" -endif -endif - -$(OBJDEST)/%.o: %.c - $(CC) $(NONSHARED) $(CFLAGS) $(MCC_INCLUDE) $(INCDIR) -c $< $(OFFLAG)$@ - -$(OBJDEST)/%.o: %.cc - $(CXX) $(NONSHARED) $(CFLAGS) $(MCC_INCLUDE) $(INCDIR) -c $< $(OFFLAG)$@ - -ns-config-gt: $(OBJS1GT) - $(PURIFY) $(CXX) $(NONSHARED) $(CFLAGS) $(MCC_INCLUDE) $(INCDIR) \ - -o ns-config-gt $(OBJS1GT) $(SETUPUTILLINK) $(LIBLDAP) \ - $(EXTRA_LIBS) $(CURSES) diff --git a/ldap/cm/newinst/fixINF.pl b/ldap/cm/newinst/fixINF.pl deleted file mode 100644 index 7a6c1ca8..00000000 --- a/ldap/cm/newinst/fixINF.pl +++ /dev/null @@ -1,82 +0,0 @@ -# -# 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 -# -# parameters: BUILD_MODULE versionString buildnum.dat input security name isdirLite output [expDefine] - -$module = shift; -$version = shift; -$buildFile = shift; -$input = shift; -$security = shift; -$name = shift; -$isdirLite = shift; -$instanceNamePrefix = shift; -$output = shift; -$expDefine = shift; -if ($expDefine) { - ( $junk, $expires ) = split( /=/, $expDefine ); - if ( ! $expires ) { - $expires = 0; - } -} else { - $expires = 0; -} - -# get the build number -open( FILE, $buildFile ); -while ( <FILE> ) { - last if ( $buildNum ) = /\\"(.*)\\"/; -} -close( FILE ); - -# copy the input file to the output file changing stuff along the way -open( FILE, $input ); -open( OUT, ">$output" ); -while ( <FILE> ) { - s/%%%INSTANCE_NAME_PREFIX%%%/$instanceNamePrefix/; - s/%%%SERVER_NAME%%%/$name/; - s/%%%SERVER_VERSION%%%/$version/; - s/%%%SERVER_BUILD_NUM%%%/$buildNum/; - s/%%%PUMPKIN_HOUR%%%/$expires/; - s/%%%SECURITY%%%/$security/; - s/%%%IS_DIR_LITE%%%/$isdirLite/; - print OUT; -} -close( OUT ); -close( FILE ); diff --git a/ldap/cm/newinst/ns-keygen b/ldap/cm/newinst/ns-keygen deleted file mode 100755 index 5c23e957..00000000 --- a/ldap/cm/newinst/ns-keygen +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# Usage ns-keygen password_file fully_qualified_hostname -# Example: -# ./ns-keygen ../password.txt myhost.directory.fedora.redhat.com -# -# Assumes that NSHOME is Set -# if NSHOME is not set, it will be derived from the path of this script, which is -# usually NSHOME/bin/slapd/admin/bin - -if [ $# -ge 2 ] -then - passwd_file="$1" - certDN="$2" -else - echo "ERROR:Incorrect Usage: $0 password_file certDN" - exit -fi - -if [ ! "$NSHOME" ]; then - fullpath=`pwd` - if echo $0 | grep \^/ > /dev/null 2>&1 ; then # is absolute - fullpath=`dirname $0` - else # is a relative path - could be ./ or ../ or something else - base=`basename $0` - if [ "$base" != $0 ]; then # e.g. ns-keygen bare from that directory - savedir=$fullpath - cd `dirname $0` - fullpath=`pwd` - cd $savedir - fi - fi - # is $0 relative or absolute path? - NSHOME=`echo $fullpath | sed -e s@/bin/slapd/admin/bin@@g` -fi - -# set the LD_LIBRARY_PATH - required for the cert tools -TOOL_PATH=$NSHOME/bin/slapd/admin/bin ; export TOOL_PATH -# for HPUX -SHLIB_PATH=$TOOL_PATH:$TOOL_PATH/../lib:$TOOL_PATH/../../lib:$TOOL_PATH/../../../lib:$TOOL_PATH/../../../../lib:$SHLIB_PATH ; export SHLIB_PATH -# for other unix -LD_LIBRARY_PATH=$TOOL_PATH:$TOOL_PATH/../lib:$TOOL_PATH/../../lib:$TOOL_PATH/../../../lib:$TOOL_PATH/../../../../lib:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH - -#echo password file name is: $passwd_file -#echo certDN is: $certDN - -rm -f key3.db key4.db cert7.db cert8.db secmodule.db secmod.db random.dat keyid.dat - -# Check for password file - -# -# Set umask for best security -# -umask 077 - -# -# Create some "random" data. -# -ps -ale >>random.dat -date >>random.dat -netstat -a >>random.dat - -if [ ! -s "$passwd_file" ] -then - echo "Error:Password file is missing." - exit 1 -fi - -# -# Set the key database password -# -$TOOL_PATH/certutil -W -d . -f "$passwd_file" -RC=$? -if [ $RC != 0 ] -then - echo "Error:Unable to set the key database password." - exit 1 -fi - -# -# Create and sign a self-signed certificate for this -# server using the server name -# -$TOOL_PATH/certutil -S -s "$certDN" -x -t u,, \ - -v 60 -d . -n Server-Cert -f "$passwd_file" -z random.dat -RC=$? -if [ $RC != 0 ] -then - echo "Error:Unable to create the cert." - exit 1 -fi - -hostname=`uname -n` - -# -# Copy the key/cert db & password file to the correct place. -# -keydb=key3.db -if [ -f key4.db ] ; then - keydb=key4.db -fi - -if [ -f $NSHOME/alias/slapd-$hostname-$keydb ]; then - echo "Found existing key database - copying to $NSHOME/alias/slapd-$hostname-$keydb.bak" - cp $NSHOME/alias/slapd-$hostname-$keydb $NSHOME/alias/slapd-$hostname-$keydb.bak - if [ ! -f $NSHOME/alias/slapd-$hostname-$keydb.orig ] ; then - cp $NSHOME/alias/slapd-$hostname-$keydb $NSHOME/alias/slapd-$hostname-$keydb.orig - fi -fi -cp $keydb $NSHOME/alias/slapd-$hostname-$keydb -RC=$? -if [ $RC != 0 ] -then - echo "Error:Key Database $keydb could not be copied" - exit 1 -fi - -certdb=cert7.db -if [ -f cert8.db ] ; then - certdb=cert8.db -fi -if [ -f $NSHOME/alias/slapd-$hostname-$certdb ]; then - echo "Found existing cert database - copying to $NSHOME/alias/slapd-$hostname-$certdb.bak" - cp $NSHOME/alias/slapd-$hostname-$certdb $NSHOME/alias/slapd-$hostname-$certdb.bak - if [ ! -f $NSHOME/alias/slapd-$hostname-$certdb.orig ] ; then - cp $NSHOME/alias/slapd-$hostname-$certdb $NSHOME/alias/slapd-$hostname-$certdb.orig - fi -fi -cp $certdb $NSHOME/alias/slapd-$hostname-$certdb -RC=$? -if [ $RC != 0 ] -then - echo "Error:Cert Database $certdb could not be copied" - exit 1 -fi - -# create and copy pin file -passwd=`cat $passwd_file` -if [ -f $NSHOME/alias/slapd-$hostname-pin.txt ]; then - echo "Found existing pin file - copying to $NSHOME/alias/slapd-$hostname-pin.txt.bak" - cp $NSHOME/alias/slapd-$hostname-pin.txt $NSHOME/alias/slapd-$hostname-pin.txt.bak - if [ ! -f $NSHOME/alias/slapd-$hostname-pin.txt.orig ]; then - cp $NSHOME/alias/slapd-$hostname-pin.txt $NSHOME/alias/slapd-$hostname-pin.txt.orig - fi -fi -echo "Internal (Software) Token:$passwd" > $NSHOME/alias/slapd-$hostname-pin.txt -RC=$? -if [ $RC != 0 ] -then - echo "Error:password file could not be copied" - exit 1 -fi -# Test the new location for the files. - -# -# Cleanup -rm -f random.dat - -# -# End -# diff --git a/ldap/cm/newinst/ns-update b/ldap/cm/newinst/ns-update deleted file mode 100755 index 2a67acd9..00000000 --- a/ldap/cm/newinst/ns-update +++ /dev/null @@ -1,210 +0,0 @@ -#!/bin/sh -# -# 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 -# -# This file essentially serves as a wrapper around the instance -# creation and configuration program (index) since it must be run from -# the directory it lives in due to run time shared library -# dependencies - -# ns-update is supposed to be placed in _libdir/<brand>-ds -brand_ds=`echo $0 | sed -e "s#.*/\([a-z]*-ds\)/.*#\1#"` -if [ -z ${brand_ds} ]; then - brand_ds=`pwd | sed -e "s#.*/\([a-z]*-ds\)/.*#\1#"` -fi -sroot=`echo $0 | sed -e "s#/lib/$brand_ds/.\*##g"` -PERL=perl # just use perl from PATH - -# run_ds_create "$sroot" "$dir" "$inffile" -run_ds_create() -{ - sroot="$1" - shift - dir="$1" - shift - inffile="$1" - - # the inffile is incomplete - it needs the instance specific stuff - dseldif=$sroot/var/lib/$dir/dse.ldif - port=`grep \^nsslapd-port: $dseldif | sed -e s/\^nsslapd-port:[\ \ ]*//` - rootdn=`grep \^nsslapd-rootdn: $dseldif | sed -e s/\^nsslapd-rootdn:[\ \ ]*//` - id=`echo $dir | sed -e s/^slapd-//` - suffix="o=NetscapeRoot" - - realfile=/tmp/fds$$.inf - cp $inffile $realfile - echo "" >> $realfile - echo "[slapd]" >> $realfile - echo "ServerIdentifier= $id" >> $realfile - echo "ServerPort= $port" >> $realfile - echo "RootDN= $rootdn" >> $realfile - # dummy password - echo "RootDNPwd= password" >> $realfile - echo "Suffix= $suffix" >> $realfile - - cwd=`pwd` - cd `dirname $0` - - ./ds_create -r -f $realfile - - rm -f $realfile - cd $cwd -} - -start_server() -{ - NETSITE_ROOT=$1 - REQUEST_METHOD=GET - export NETSITE_ROOT REQUEST_METHOD - QUERY_STRING="InstanceName=$2" - SERVER_NAMES=$2 - export QUERY_STRING SERVER_NAMES - cwd=`pwd` - cd `dirname $0` - ./start 2>&1 | grep -v '^Content' | grep -v '^ds_' - cd $cwd -} - -# get the inf file name -seenfarg= -inffile= - -# if the -r flag is present, this means we're doing a -# reinstall or an upgrade, so restart the servers -for arg in "$@" ; do - if [ "$arg" = "-r" ]; then - reconfig=1 - fi - if [ "$arg" = "-S" ]; then - iDSISolaris=1 - fi - if [ $seenfarg ]; then - inffile="$arg" - seenfarg= - fi - if [ "$arg" = "-f" ]; then - seenfarg=1 - fi -done - -extraflags= -# For Solaris 9+ specific installation, the following -# method of determining reconfiguration by checking -# the existence of <sroot>/slapd-nickname/config -# directory cannot be used. This is because the -# server_root is the same for all instances. Also, it -# uses standard Solaris supplied perl. -if [ "$iDSISolaris" = "" ]; then - # for some reason, we are not being passed the -r flag during - # reinstall; so, determine if there are existing server - # instances in this server root, and assume -r if there - # are - if [ "$reconfig" = "" ]; then - cd $sroot/var/lib - for dir in slapd-* ; do - if [ -f $dir/dse.ldif ]; then - reconfig=1 - extraflags="-r" - break - fi - done - fi -fi - -if [ $reconfig ] ; then - cd $sroot - for dir in slapd-* ; do - # first, fix any old password files - if [ -d etc/$brand_ds/$dir ]; then - cd etc/$brand_ds/$dir - echo Converting $dir to new format password file . . . - $PERL $sroot/lib/$brand_ds/migratePwdFile $sroot $dir - cd ../../.. - fi - # Copy new schema ldiffiles - echo Copying new schema ldiffiles . . . - $PERL $sroot/lib/$brand_ds/upgradeServer $brand_ds $sroot $dir - - # next, start the server - echo Starting $dir . . . - start_server $sroot $dir - echo "" - - # more reconfiguration - run_ds_create "$sroot" "$dir" "$inffile" "$extraflags" "$@" - - done - # fix any non-instance specific files - omit server instance argument - $PERL $sroot/lib/$brand_ds/upgradeServer $brand_ds $sroot -fi - -cd `dirname $0` - -# we need to make sure the alias directory is owned by the server user/group -# in order for the server to be able to create the initial key/cert db files - -if [ ! -f "$inffile" ] ; then - echo "WARNING: Could not read the setup info file $inffile" -else -# grab the ssuser and ssgrp - ssuser=`grep SuiteSpotUserID $inffile | sed -e 's/SuiteSpotUserID[ ]*=[ ]*//'` - ssgrp=`grep SuiteSpotGroup $inffile | sed -e 's/SuiteSpotGroup[ ]*=[ ]*//'` -# echo "user = $ssuser group = $ssgrp" -# chown the alias directory - chown $ssuser:$ssgrp $sroot/alias -fi - -rc=0 -# not reconfig - run ds_create as usual -if test -z "$reconfig" ; then - ./ds_create $* $extraflags -fi -rc=$? - -# dsgw package should take care of this ??? -## chown the cookie directory - bug 175098 -#if [ "$ssuser" ] ; then -# if [ "$ssgrp" ] ; then -# chown $ssuser:$ssgrp $sroot/bin/slapd/authck -# else -# chown $ssuser $sroot/bin/slapd/authck -# fi -#fi - -exit $rc diff --git a/ldap/cm/newinst/replaceToken.pl b/ldap/cm/newinst/replaceToken.pl deleted file mode 100644 index 474ef304..00000000 --- a/ldap/cm/newinst/replaceToken.pl +++ /dev/null @@ -1,66 +0,0 @@ -# -# 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 -# - -# The first argument is the file to edit -# The remaining arguments are pairs of values: the first value of the pair is -# the token to look for, and the second is the value to replace it with e.g. -# if the input file foo contains -# $NETSITE_ROOT/%%%PERL_RUNTIME%%% -w perlscript ... -# then running $(PERL) thisscript foo %%%PERL_RUNTIME%%% foo/bar/perl5 > output/foo -# will result in output/foo containing -# NETSITE_ROOT/foo/bar/perl5 -w perlscript ... - -($input, %tokens) = @ARGV; - -if (! $input) { - print STDERR "Usage: $ $0 <inputfilename> [token1 replace1] ... [tokenN replaceN]\n"; - exit 1; -} - -open(INPUT, $input) or die "Error: could not open file $input: $!"; - -while (<INPUT>) { - while (($key, $value) = each %tokens) { - s/$key/$value/g; - } - print; -} - -close INPUT; diff --git a/ldap/cm/newinst/setup b/ldap/cm/newinst/setup deleted file mode 100755 index cc38ce88..00000000 --- a/ldap/cm/newinst/setup +++ /dev/null @@ -1,564 +0,0 @@ -#!/bin/sh -# -# 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 -# - -########################### -# -# This shell script provides a way to set up a new installation after -# the binaries have already been extracted. This is typically after -# using native packaging support to install the package e.g. RPM, -# pkgadd, depot, etc. This script will show the license, readme, -# dsktune, then run the usual setup pre and post installers. This -# script should be run from the server root directory since it uses -# pwd to get the server root directory. -# -########################## - -# get command line arguments - -# see if silent mode - -counter=0 -doMktmp() { - tmpfile=`mktemp /tmp/${1}XXXXXX 2> /dev/null` - if ! [ $tmpfile ] ; then - tmpfile=/tmp/$1.$counter.$$ - counter=`expr $counter + 1` - fi - echo $tmpfile -} - -doExit() { - echo "ERROR Exiting . . ." | tee -a $logfile - if [ $tmpinffile ]; then - rm -f $inffile - fi - echo "Log file is $logfile" - exit 1 -} - -askYN() { - prompt="$1" - finished= - while ! [ $finished ]; do - echo "" - echo -n "$prompt (yes/no) " | tee -a $logfile - read ans - echo $ans >> $logfile - case "$ans" in - y*|Y*) finished=1 ;; - n*|N*) exit 1 ;; - *) echo "Please answer yes or no" | tee -a $logfile ;; - esac - done -} - -ask123() { - prompt=$2 - default=$1 - finished= - ans= - while ! [ $finished ]; do - echo -n "" - echo "" - echo -n $prompt "" | tee -a $logfile - read ans - echo $ans >> $logfile - if ! [ $ans ]; then - return $default - fi - case "$ans" in - 1|2|3) finished=1 ;; - *) echo "Please answer 1, 2, or 3" | tee -a $logfile ;; - esac - done - return $ans -} - -getFQDN() { - max=0 - maxhost= - defhost=`hostname` - echo "getFQDN: hostname = $defhost" >> $logfile - hosthost=`host $defhost | grep -v "not found" | awk '{print $1}'` - echo "getFQDN: host $defhost = $hosthost" >> $logfile - for host in $defhost $hosthost `hostname -f` `hostname -a` ; do - len=`echo $host | wc -c` - echo "getFQDN: host $host has length $len" >> $logfile - if [ $len -gt $max ]; then - max=$len - maxhost=$host - echo "getFQDN: new max host $host has length $max" >> $logfile - fi - done - echo $maxhost -} - -getValFromAdminConf() { - cattr=$1 - cfile=$2 - rval=`grep -i $cattr $sroot/admin-serv/config/$cfile | awk '{print $2}'` - echo $rval -} - -getValFromAdmpw() { - cfile=$1 - rval=`head -1 $sroot/admin-serv/config/$cfile | cut -f1 -d\:` - echo $rval -} - -getValFromInf() { - cattr=$1 - cfile=$2 - rval=`grep -i ^$cattr $cfile | head -1 | sed -e 's/^.*=[ ]*//'` - echo $rval -} - -logfile=`doMktmp log` -myargs= -silent= -inffile= -tmpinffile= -nextisinffile= -keepinffile= -# set by user or from existing files during upgrade -user= -# set by user or from existing files during upgrade -group= -for arg in "$@" ; do - if [ "$arg" = "-s" ]; then - silent=1 - elif [ "$arg" = "-k" ]; then - keepinffile=1 - elif [ "$arg" = "-f" ]; then - nextisinffile=1 - elif [ $nextisinffile ]; then - inffile="$arg" - nextisinffile= - else - myargs="$myargs $arg" - fi -done - -# figure out where we are and make sure we cd to the serverroot dir -setupdir=`dirname $0` -sroot=`dirname $setupdir` -cd $sroot -currentdir=`pwd` - -if [ "$currentdir" != "$sroot" ]; then - # running setup using a relative path - bname=`basename $setupdir` - if [ "$bname" = "." ]; then - setupdir=$currentdir - else - setupdir=`echo $currentdir/$bname` - fi - sroot=`dirname $setupdir` - cd $sroot -fi - -rm -f $sroot/setup/install.inf - -echo "INFO Begin Setup . . ." | tee -a $logfile -# cat LICENSE.txt -if ! [ $silent ]; then - echo "" | tee -a $logfile - echo "" | tee -a $logfile - echo "" | tee -a $logfile - cat LICENSE.txt | tee -a $logfile - askYN "Do you accept the license terms?" -fi - -# cat README.txt -if ! [ $silent ]; then - cat README.txt | tee -a $logfile - askYN "Continue?" -fi - -isadminsslon=0 -sslparams="" - -adminSSLOff() { - conffile=$1 - confparam=$2 - tmpfile=$3 - if [ -f $conffile ]; then - security=`grep -i "^$confparam" $conffile | awk '{print $1}'` - issecure=`grep -i "^$confparam" $conffile | awk '{print $2}'` - if [ "$issecure" = "on" -o "$issecure" = "ON" -o "$issecure" = "On" -o "$issecure" = "oN" ] - then - if [ $isadminsslon -eq 0 ]; then - $sroot/stop-admin - isadminsslon=1 - fi - echo $conffile=$security >> $tmpfile - cat $conffile | sed -e "s/^\($security\) .*/\1 off/g" > $conffile.01 - mv $conffile.01 $conffile - chown $user:$group $conffile - echo "$conffile: SSL off ..." - fi - fi -} - -adminXmlSSLOff() { - conffile=$1 - confparam=$2 - tmpfile=$3 - if [ -f $conffile ]; then - grep -i "\<security=\"on\"" $conffile > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ] - then - if [ $isadminsslon -eq 0 ]; then - $sroot/stop-admin - isadminsslon=1 - fi - echo $conffile=$confparam >> $tmpfile - cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"off\"/g" > $conffile.0 - mv $conffile.0 $conffile - chown $user:$group $conffile - echo "$conffile: SSL off ..." - fi - sslparams0=`grep -i "<.*SSLPARAMS " $conffile` - rval=$? - if [ $rval -eq 0 ] - then - if [ $isadminsslon -eq 0 ]; then - $sroot/stop-admin - isadminsslon=1 - fi -echo adminXmlSSLOff: SSLPARAMS off - sslparams1=`echo $sslparams0 | sed -e 's/\//\\\\\//g'` - sslparams=`echo $sslparams1 | sed -e 's/\"/\\\\\"/g'` - cat $conffile | sed -e "s/\($sslparams\)/\<\!-- \1 --\>/g" > $conffile.1 - mv $conffile.1 $conffile - chown $user:$group $conffile - fi - fi -} - -SSLOff() { - rm -f dssecure.txt assecure.txt > /dev/null 2>&1 - touch dssecure.txt - touch assecure.txt - - for dir in $sroot/slapd-* ; do - if [ -f $dir/config/dse.ldif ]; then - security=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $1}'` - issecure=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $2}'` - if [ "$issecure" = "on" -o "$issecure" = "ON" -o "$issecure" = "On" -o "$issecure" = "oN" ] - then - echo $dir >> dssecure.txt - $dir/stop-slapd - cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 off/g" > $dir/config/dse.ldif.0 - mv $dir/config/dse.ldif.0 $dir/config/dse.ldif - chown $user:$group $dir/config/dse.ldif - echo "$dir/config/dse.ldif: SSL off ..." - fi - fi - done - if [ -d $sroot/admin-serv/config ]; then - adminSSLOff $sroot/admin-serv/config/adm.conf security: assecure.txt - adminSSLOff $sroot/admin-serv/config/local.conf configuration.nsServerSecurity: assecure.txt - if [ -f $sroot/admin-serv/config/magnus.conf ] ; then - adminSSLOff $sroot/admin-serv/config/magnus.conf Security assecure.txt - fi - if [ -f $sroot/admin-serv/config/server.xml ] ; then - adminXmlSSLOff $sroot/admin-serv/config/server.xml security assecure.txt - fi - - if [ $isadminsslon -ne 0 ]; then - $sroot/start-admin - fi - fi -} - -adminSSLOn() { - conffile=$1 - confparam=$2 - if [ -f $conffile ]; then - cat $conffile | sed -e "s/^\($confparam\) .*/\1 on/g" > $conffile.00 - mv $conffile.00 $conffile - chown $user:$group $conffile - echo "$conffile $confparam: SSL on ..." - fi -} - -adminXmlSSLOn() { - conffile=$1 - if [ -f $conffile ]; then - cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"on\"/g" > $conffile.2 - mv $conffile.2 $conffile - chown $user:$group $conffile - fi - grep -i "<.*SSLPARAMS " $conffile > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ] - then - cat $conffile | sed -e "s/<\!-- *$sslparams *-->/$sslparams/g" > $conffile.3 - mv $conffile.3 $conffile - chown $user:$group $conffile - fi - echo "$conffile: SSL on ..." -} - -SSLOn() { - if [ -f dssecure.txt ]; then - for dir in `cat dssecure.txt` ; do - if [ -f $dir/config/dse.ldif ]; then - security=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $1}'` - $dir/stop-slapd - cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 on/g" > $dir/config/dse.ldif.0 - mv $dir/config/dse.ldif.0 $dir/config/dse.ldif - chown $user:$group $dir/config/dse.ldif - echo "$dir/config/dse.ldif: SSL on ..." - echo "Restarting Directory Server: $dir/start-slapd" - $dir/start-slapd - fi - done - rm -f dssecure.txt > /dev/null 2>&1 - fi - - if [ $isadminsslon -ne 0 ]; then - $sroot/stop-admin - fi - if [ -f assecure.txt ]; then - for confline in `cat assecure.txt` ; do - conffile=`echo $confline | awk -F= '{print $1}'` - confparam=`echo $confline | awk -F= '{print $2}'` - echo $conffile | grep "\.xml$" > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ]; then - adminXmlSSLOn $conffile $confparam - else - adminSSLOn $conffile $confparam - fi - done - rm -f assecure.txt > /dev/null 2>&1 - fi - if [ $isadminsslon -ne 0 ]; then - echo "Restarting Administration Server: $sroot/start-admin" - $sroot/start-admin - fi - -} - -# check whether it is an in-place installation -if [ -f $sroot/admin-serv/config/adm.conf ]; then - dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'` - if [ -f $sroot/$dsinst/config/dse.ldif ]; then - user=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'` - group=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'` - fi - - SSLOff - - if [ -f $sroot/$dsinst/config/dse.ldif ]; then - # it is an in=place installation - ldaphost=`getValFromAdminConf "ldapHost:" "adm.conf"` - ldapport=`getValFromAdminConf "ldapPort:" "adm.conf"` - adminport=`getValFromAdminConf "\<port:" "adm.conf"` - adminid=`getValFromAdmpw "admpw"` - sysuser=`getValFromAdminConf "nsSuiteSpotUser:" "local.conf"` - admindomain=`echo $ldaphost | awk -F. '{print $5 ? $2 "." $3 "." $4 "." $5: $4 ? $2 "." $3 "." $4 : $3 ? $2 "." $3 : $2 ? $2 : ""}'` - if [ "$admindomain" = "" ]; then - admindomain=`domainname` - fi - - echo "In order to reconfigure your installation, the Configuration Directory" - echo "Administrator password is required. Here is your current information:" - echo "" - echo "Configuration Directory: ldap://$ldaphost:$ldapport/o=NetscapeRoot" - echo "Configuration Administrator ID: $adminid" - echo "" - echo "At the prompt, please enter the password for the Configuration Administrator." - echo "" - echo "administrator ID: $adminid" - siepasswd="" - while [ "$siepasswd" = "" ]; do - printf "Password: " - read siepasswd - done - - inffile=$sroot/setup/myinstall.inf - echo "[General]" > $inffile - echo "FullMachineName= $ldaphost" >> $inffile - echo "SuiteSpotUserID= $user" >> $inffile - echo "SuitespotGroup= $group" >> $inffile - echo "ServerRoot= $sroot" >> $inffile - echo "ConfigDirectoryLdapURL= ldap://$ldaphost:$ldapport/o=NetscapeRoot" >> $inffile - echo "ConfigDirectoryAdminID= $adminid" >> $inffile - echo "AdminDomain= $admindomain" >> $inffile - echo "ConfigDirectoryAdminPwd= $siepasswd" >> $inffile - echo "" >> $inffile - echo "[admin]" >> $inffile - echo "ServerAdminID= $adminid" >> $inffile - echo "ServerAdminPwd= $siepasswd" >> $inffile - echo "SysUser= $sysuser" >> $inffile - echo "Port= $adminport" >> $inffile - echo "ServerIpAddress=" >> $inffile - - # set silent mode - silent=1 - fi -fi - -# dsktune -if ! [ $silent ]; then - bin/slapd/server/dsktune | tee -a $logfile - askYN "Continue?" -fi - -# install mode -if ! [ $silent ]; then - echo "" - echo "Please select the install mode:" - echo " 1 - Express - minimal questions" - echo " 2 - Typical - some customization (default)" - echo " 3 - Custom - lots of customization" - - ask123 "2" "Please select 1, 2, or 3 (default: 2) " - installmode=$? -fi - -# if silent mode, do not run the pre-installer programs -# otherwise, create a temp file for their use -if ! [ $silent ]; then - inffile=`doMktmp setup` - tmpinffile=1 - - # put some common answers in the file - hostname=`getFQDN` - if ! [ $hostname ] ; then - hostname=localhost.localdomain - fi - echo "" | tee -a $logfile - echo -n "Hostname to use (default: $hostname) " | tee -a $logfile - read ans - echo $ans >> $logfile - if [ "$ans" ]; then - hostname="$ans" - fi - - user=nobody - group=nobody - echo "" - echo -n "Server user ID to use (default: $user) " | tee -a $logfile - read ans - echo $ans >> $logfile - if [ "$ans" ]; then - user="$ans" - fi - echo "" - echo -n "Server group ID to use (default: $group) " | tee -a $logfile - read ans - echo $ans >> $logfile - if [ "$ans" ]; then - group="$ans" - fi - - echo '[General]' >> $inffile - echo "FullMachineName = $hostname" >> $inffile - echo "SuiteSpotUserID = $user" >> $inffile - echo "SuiteSpotGroup = $group" >> $inffile - echo ServerRoot = `pwd` >> $inffile - - # check if ds instance directory exists or not - # if it does, run ns-config with the reconfigure option - doreconfig="" - ls -d slapd-* > /dev/null 2>&1 - if [ $? -eq 0 ]; then - doreconfig="-r" - fi - - # first, run ds - cd bin/slapd/admin/bin - ./ns-config -f $inffile -l $logfile -m $installmode $doreconfig || doExit - cd ../../../.. - - # next, run admin - cd bin/admin - ./ns-config -f $inffile -l $logfile -m $installmode $doreconfig || doExit - cd ../.. -fi - -# do the post installers -silentarg="" -if ! [ $silent ] ; then - silentarg="-s" -fi - -`pwd`/bin/slapd/admin/bin/ns-update $silentarg $myargs -f $inffile | tee -a $logfile || doExit - -`pwd`/bin/admin/ns-update $doreconfig $silentarg $myargs -f $inffile | tee -a $logfile || doExit - -SSLOn - -# get user, host, port for startconsole -adminport=`getValFromInf Port $inffile` -adminhost=`getValFromInf FullMachineName $inffile` -adminuser=`getValFromInf ConfigDirectoryAdminID $inffile` - -echo "" -echo "You can now use the console. Here is the command to use to start the console:" | tee -a $logfile -echo "cd $sroot" | tee -a $logfile -echo "./startconsole -u $adminuser -a http://$adminhost:$adminport/" | tee -a $logfile -echo"" -echo "INFO Finished with setup, logfile is setup/setup.log" | tee -a $logfile -if [ -f setup/setup.log ] ; then - cat $logfile >> setup/setup.log -else - cp $logfile setup/setup.log -fi -rm -f $logfile - -if [ $tmpinffile ]; then - if [ $keepinffile ]; then - if [ -f setup/install.inf ]; then - cat $inffile >> setup/install.inf - else - cp $inffile setup/install.inf - fi - chmod 600 setup/install.inf - fi - rm -f $inffile -fi - -exit 0 diff --git a/ldap/cm/newinst/setup.patch b/ldap/cm/newinst/setup.patch deleted file mode 100755 index ebc67ec0..00000000 --- a/ldap/cm/newinst/setup.patch +++ /dev/null @@ -1,318 +0,0 @@ -#!/bin/sh -# -# 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 -# - -# -# This script is a wrapper for dssetup used for inplace upgrade / patch -# installation. -# -clear - -echo " Fedora Project" -echo " Fedora Server Products Installation/Uninstallation" -echo "-------------------------------------------------------------------------------" -echo "" -echo "" -echo "BY INSTALLING THIS SOFTWARE YOU ARE CONSENTING TO BE BOUND BY" -echo "AND ARE BECOMING A PARTY TO THE AGREEMENT FOUND IN THE" -echo "LICENSE.TXT FILE. IF YOU DO NOT AGREE TO ALL OF THE TERMS" -echo "OF THIS AGREEMENT, PLEASE DO NOT INSTALL OR USE THIS SOFTWARE." -echo "" -printf "Do you agree to the license terms? [No]: " -read ans - -if [ "$ans" != "Y" -a "$ans" != "YES" -a "$ans" != "Yes" -a "$ans" != "y" -a "$ans" != "yes" ]; then - exit 1; -fi - -clear - -echo " Fedora Project" -echo " Fedora Server Products Installation/Uninstallation" -echo "-------------------------------------------------------------------------------" -echo "" -echo "" -echo "This program will extract the patch files and install them" -echo "into a directory where the Directory Server is already installed." -echo "" -echo "To accept the default shown in brackets, press the Enter key." -echo "" -printf "Install location [/opt/fedora/servers]: " -read serverroot - -if [ ! -d $serverroot ]; then - echo "" - echo "Directory $serverroot does not exist." - exit 1 -fi - -if [ ! -f $serverroot/admin-serv/config/adm.conf ]; then - echo "" - echo "Administration Server's configuration file $serverroot/admin-serv/config/adm.conf does not exist." - exit 1 -fi - -getValFromAdminConf() { - cattr=$1 - cfile=$2 - rval=`grep -i $cattr $serverroot/admin-serv/config/$cfile | awk '{print $2}'` - echo $rval -} - -getValFromAdmpw() { - cfile=$1 - rval=`head -1 $serverroot/admin-serv/config/$cfile | awk -F\: '{print $1}'` - echo $rval -} - -dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'` -dsconffile=$serverroot/$dsinst/config/dse.ldif -if [ ! -f $dsconffile ]; then - echo "" - echo "Directory Server's configuration file $dsconffile does not exist." - exit 1 -fi - -clear - -isadminsslon=0 -sslparams="" - -adminSSLOff() { - conffile=$1 - confparam=$2 - tmpfile=$3 - if [ -f $conffile ]; then - security=`grep -i "^$confparam" $conffile | awk '{print $1}'` - issecure=`grep -i "^$confparam" $conffile | awk '{print $2}'` - if [ "$issecure" = "on" -o "$issecure" = "ON" -o "$issecure" = "On" -o "$issecure" = "oN" ] - then - if [ $isadminsslon -eq 0 ]; then - $serverroot/stop-admin - isadminsslon=1 - fi - echo $conffile=$security >> $tmpfile - cat $conffile | sed -e "s/^\($security\) .*/\1 off/g" > $conffile.0 - mv $conffile.0 $conffile - echo "$conffile: SSL off ..." - fi - fi -} - -adminXmlSSLOff() { - conffile=$1 - confparam=$2 - tmpfile=$3 - if [ -f $conffile ]; then - grep -i "\<security=\"on\"" $conffile > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ] - then - if [ $isadminsslon -eq 0 ]; then - $serverroot/stop-admin - isadminsslon=1 - fi - echo $conffile=$confparam >> $tmpfile - cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"off\"/g" > $conffile.0 - mv $conffile.0 $conffile - echo "$conffile: SSL off ..." - fi - sslparams0=`grep -i "<.*SSLPARAMS " $conffile` - rval=$? - if [ $rval -eq 0 ] - then - if [ $isadminsslon -eq 0 ]; then - $serverroot/stop-admin - isadminsslon=1 - fi - sslparams1=`echo $sslparams0 | sed -e 's/\//\\\\\//g'` - sslparams=`echo $sslparams1 | sed -e 's/\"/\\\\\"/g'` - cat $conffile | sed -e "s/\($sslparams\)/\<\!-- \1 --\>/g" > $conffile.0 - mv $conffile.0 $conffile - echo "$conffile: SSL off ..." - fi - fi -} - -rm -f dssecure.txt assecure.txt > /dev/null 2>&1 -touch dssecure.txt -touch assecure.txt - -for dir in $serverroot/slapd-* ; do - if [ -f $dir/config/dse.ldif ]; then - security=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $1}'` - issecure=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $2}'` - if [ "$issecure" = "on" -o "$issecure" = "ON" -o "$issecure" = "On" -o "$issecure" = "oN" ] - then - echo $dir >> dssecure.txt - $dir/stop-slapd - cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 off/g" > $dir/config/dse.ldif.0 - mv $dir/config/dse.ldif.0 $dir/config/dse.ldif - echo "$dir/config/dse.ldif: SSL off ..." - $dir/start-slapd - fi - fi -done - -if [ -d $serverroot/admin-serv/config ]; then - adminSSLOff $serverroot/admin-serv/config/adm.conf security: assecure.txt - adminSSLOff $serverroot/admin-serv/config/local.conf configuration.nsServerSecurity: assecure.txt - adminSSLOff $serverroot/admin-serv/config/magnus.conf Security assecure.txt - adminXmlSSLOff $serverroot/admin-serv/config/server.xml security assecure.txt - - if [ $isadminsslon -ne 0 ]; then - $serverroot/start-admin - fi -fi - -ldaphost=`getValFromAdminConf "ldapHost:" "adm.conf"` -ldapport=`getValFromAdminConf "ldapPort:" "adm.conf"` -adminid=`getValFromAdmpw "admpw"` -suitespotuser=`ls -l $dsconffile | awk '{print $3}'` -suitespotgroup=`ls -l $dsconffile | awk '{print $4}'` -admindomain=`echo $ldaphost | awk -F. '{if ($5) {print $2 "." $3 "." $4 "." $5} else if ($4) {print $2 "." $3 "." $4} else if ($3) {print $2 "." $3} else if ($2) {print $2} else {print ""}}'` -if [ "$admindomain" = "" ]; then - admindomain=`domainname` -fi - -clear - -echo " Fedora Project" -echo " Directory Installation/Uninstallation" -echo "-------------------------------------------------------------------------------" -echo "" -echo "In order to reconfigure your installation, the Configuration Directory" -echo "Administrator password is required. Here is your current information:" -echo "" -echo "Configuration Directory: ldap://$ldaphost:$ldapport/o=NetscapeRoot" -echo "Configuration Administrator ID: $adminid" -echo "" -echo "At the prompt, please enter the password for the Configuration Administrator." -echo "" -echo "administrator ID: $adminid" -siepasswd="" -while [ "$siepasswd" = "" ]; do - printf "Password: " - read siepasswd -done - -inffile=./myinstall.inf - -echo "[General]" > $inffile -echo "FullMachineName= $ldaphost" >> $inffile -echo "SuiteSpotUserID= $suitespotuser" >> $inffile -echo "SuitespotGroup= $suitespotgroup" >> $inffile -echo "ServerRoot= $serverroot" >> $inffile -echo "ConfigDirectoryLdapURL= ldap://$ldaphost:$ldapport/" >> $inffile -echo "ConfigDirectoryAdminID= $adminid" >> $inffile -echo "AdminDomain= $admindomain" >> $inffile -echo "ConfigDirectoryAdminPwd= $siepasswd" >> $inffile -echo "Components= slapd-71sp1" >> $inffile -echo "" >> $inffile -echo "[slapd-71sp1]" >> $inffile -echo "Components= slapd-71sp1" >> $inffile - -clear - -./dssetup -s -f $inffile - -adminSSLOn() { - conffile=$1 - confparam=$2 - if [ -f $conffile ]; then - cat $conffile | sed -e "s/^\($confparam\) .*/\1 on/g" > $conffile.0 - mv $conffile.0 $conffile - echo "$conffile $confparam: SSL on ..." - fi -} - -adminXmlSSLOn() { - conffile=$1 - if [ -f $conffile ]; then - cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"on\"/g" > $conffile.0 - mv $conffile.0 $conffile - fi - grep -i "<.*SSLPARAMS " $conffile > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ] - then - cat $conffile | sed -e "s/<\!-- *$sslparams *-->/$sslparams/g" > $conffile.0 - mv $conffile.0 $conffile - fi - echo "$conffile: SSL on ..." -} - -if [ -f dssecure.txt ]; then - for dir in `cat dssecure.txt` ; do - clear - if [ -f $dir/config/dse.ldif ]; then - security=`grep -i "^nsslapd-security:" $dir/config/dse.ldif | awk '{print $1}'` - $dir/stop-slapd - cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 on/g" > $dir/config/dse.ldif.0 - mv $dir/config/dse.ldif.0 $dir/config/dse.ldif - echo "$dir/config/dse.ldif: SSL on ..." - echo "Restarting Directory Server: $dir/start-slapd" - $dir/start-slapd - fi - done - rm -f dssecure.txt -fi - -if [ $isadminsslon -ne 0 ]; then - $serverroot/stop-admin -fi -if [ -f assecure.txt ]; then - for confline in `cat assecure.txt` ; do - conffile=`echo $confline | awk -F= '{print $1}'` - confparam=`echo $confline | awk -F= '{print $2}'` - echo $conffile | grep "\.xml$" > /dev/null 2>&1 - rval=$? - if [ $rval -eq 0 ]; then - adminXmlSSLOn $conffile $confparam - else - adminSSLOn $conffile $confparam - fi - done - rm -f assecuire.txt -fi -if [ $isadminsslon -ne 0 ]; then - echo "Restarting Administration Server: $serverroot/start-admin" - $serverroot/start-admin -fi - diff --git a/ldap/cm/newinst/setup.pl b/ldap/cm/newinst/setup.pl deleted file mode 100755 index 978db5be..00000000 --- a/ldap/cm/newinst/setup.pl +++ /dev/null @@ -1,176 +0,0 @@ -#!./tools/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) 2005 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# This program will package a downloaded JRE into a nsjre.zip -# file suitable for a DS install. - -use lib './lib'; -use FileHandle; - -autoflush STDERR 1; -autoflush STDOUT 1; - -delete $ENV{LD_LIBRARY_PATH}; - -# Set required JRE version -if ($^O eq "hpux") { - $jdkVersion = "HP's 32-bit HP-UX"; - $reqVersion = "1.4.2.07"; - delete $ENV{SHLIB_PATH}; -} elsif ($^O eq "MSWin32") { - $jdkVersion = "Sun's 32-bit MS Windows"; - $reqVersion = "1.4.2_05"; -} elsif ($^O eq "linux") { - $jdkVersion = "Sun's 32-bit Linux"; - $reqVersion = "1.4.2_05"; -} elsif ($^O eq "solaris") { - $jdkVersion = "Sun's 32-bit Solaris"; - $reqVersion = "1.4.2_05"; -} else { - print("Unsupported operating system: $^O!\n"); - exit; -} - -# Check if base/nsjre.zip or base/jre.z already exists -unless (-e "./base/nsjre.zip" || -e "./base/jre.z") { - # Check if NSJRE environment variable is set - if ($ENV{NSJRE}) { - chomp ($jrepath = $ENV{NSJRE}); - print ("Using NSJRE environment variable: $jrepath\n"); - } else { - print ("In order to run setup, you need to have version"); - print (" $reqVersion of\n"); - print ("$jdkVersion Java runtime environment on your system.\n\n"); - print ("Enter the path to the unpackaged JRE: "); - chomp ($jrepath = <STDIN>); - } - - VerifyJRE(); - CreatePackage(); - CleanUp(); -} - -# Kick off setup -exec("./dssetup @ARGV"); - -sub VerifyJRE { - print ("\nVerifying JRE..."); - unless (-e "$jrepath" && -r "$jrepath") { die ("\nError: Can't access JRE: $!\n"); } - unless (-e "$jrepath/bin" && -r "$jrepath/bin") { die ("\nError: Can't access $jrepath/bin: $!\n"); } - unless (-e "$jrepath/bin" && -r "$jrepath/lib") { die ("\nError: Can't access $jrepath/lib: $!\n"); } - unless (-e "$jrepath/bin/java" || -e "$jrepath/bin/java.exe") { die ("\nError: Invalid JRE found: $!\n"); } - - my $jreVersion = `\"$jrepath/bin/java\" -version 2>&1`; - $jreVersion =~ /".*"/; - $foundVersion = $&; - print (" Found JRE $foundVersion\n"); - unless ($foundVersion =~ $reqVersion) { - print ("\nWarning: This product was certified with JRE version \"$reqVersion\". You have version $foundVersion.\n"); - print ("The product may not behave correctly if you use this JRE.\n"); - print ("Would you like to continue anyway [yes/no]? "); - chomp ($answer = <STDIN>); - unless ($answer eq "yes") { exit; } - } -} - -sub CreatePackage { - print ("Creating JRE package..."); - - # Create packaging area - mkdir ("bin", 0755) || die ("Error: Can't create ./bin: $!\n"); - mkdir ("bin/base", 0755) || die ("Error: Can't create ./bin/base: $!\n"); - mkdir ("bin/base/jre", 0755) || die ("Error: Can't create ./bin/base/jre: $!\n"); - - # Copy bin and lib from JRE into packaging area, then create zip archive - if ($^O eq "MSWin32") { - system ("xcopy /E /I /Q \"$jrepath/bin\" \"bin/base/jre/bin\"") == 0 || - die ("\nError: Can't copy JRE: $!\n"); - system ("xcopy /E /I /Q \"$jrepath/lib\" \"bin/base/jre/lib\"") == 0 || - die ("\nError: Can't copy JRE: $!\n"); - system ("./tools/zip -q -r ./base/jre.z ./bin") == 0 || - die ("\nError: Can't create JRE archive: $!\n"); - } else { - system ("cp -R $jrepath/bin ./bin/base/jre") == 0 || - die ("\nError: Can't copy JRE: $!\n"); - system ("cp -R $jrepath/lib ./bin/base/jre") == 0 || - die ("\nError: Can't copy JRE: $!\n"); - - # On HP-UX, we need to move some libraries in the JRE package - if ($^O eq "hpux") { - system ("cp -f ./bin/base/jre/lib/PA_RISC/native_threads/libhpi.sl ./bin/base/jre/lib/PA_RISC/libhpi.sl") == 0 || - die ("\nError: Can't create JRE archive: $!\n"); - system ("cp -f ./bin/base/jre/lib/PA_RISC2.0/native_threads/libhpi.sl ./bin/base/jre/lib/PA_RISC2.0/libhpi.sl") == 0 || - die ("\nError: Can't create JRE archive: $!\n"); - system ("cp -f ./bin/base/jre/lib/PA_RISC2.0W/native_threads/libhpi.sl ./bin/base/jre/lib/PA_RISC2.0W/libhpi.sl") == 0 || - die ("\nError: Can't create JRE archive: $!\n"); - } - - system ("./tools/zip -q -r ./base/nsjre.zip ./bin") == 0 || - die ("\nError: Can't create JRE archive: $!\n"); - } - - print (" Done\n"); -} - -sub CleanUp { - print ("Cleaning up..."); - - # Remove packaging area - RemoveFiles ("./bin"); - rmdir ("./bin") || die ("Error: can't remove ./bin: $!\n"); - - print (" Done\n"); -} - -sub RemoveFiles { - my $dir = shift; - opendir (DIR, $dir) || die ("Error: Can't open $dir: $!"); - my @entries = map { "$dir/$_" } grep { !/^\.$|^\.\.$/ } readdir DIR; - closedir DIR; - for (@entries) { - if (-l $_) { - unlink || die ("Error: Can't remove $_: $!\n"); - } elsif (-d $_) { - RemoveFiles($_); - rmdir($_) || die ("Error: Can't remove $_: $!\n"); - } else { - unlink || die ("Error: Can't remove $_: $!\n"); - } - } -} - diff --git a/ldap/cm/newinst/setup.sh b/ldap/cm/newinst/setup.sh deleted file mode 100755 index 640d416b..00000000 --- a/ldap/cm/newinst/setup.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# --- 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 --- - -setupdir=`dirname $0` -cd ${setupdir} - -# Kick off setup script -./setup.pl $* diff --git a/ldap/cm/newinst/slapd-patch.inf b/ldap/cm/newinst/slapd-patch.inf deleted file mode 100644 index c09309fb..00000000 --- a/ldap/cm/newinst/slapd-patch.inf +++ /dev/null @@ -1,58 +0,0 @@ -# -# 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 -# -[General] -Name= %%%SERVER_NAME%%% -Components=slapd-10 - -[slapd-10] -Name= %%%SERVER_NAME%%% -InstanceNamePrefix= %%%INSTANCE_NAME_PREFIX%%% -Description= %%%SERVER_NAME%%% -NickName= slapd-10 -Version= %%%SERVER_VERSION%%% -BuildNumber= %%%SERVER_BUILD_NUM%%% -Archive= nsslapd-10.zip -SourcePath=slapd-10 -PreInstall= ns-config -r -PostInstall= bin/slapd/admin/bin/ns-update -PreUninstall= bin/slapd/admin/bin/uninstall -PostUninstall= -Checked=True -Mandatory=False -IsLdap=True diff --git a/ldap/cm/newinst/slapd.inf.in b/ldap/cm/newinst/slapd.inf.in deleted file mode 100644 index bc84c6e6..00000000 --- a/ldap/cm/newinst/slapd.inf.in +++ /dev/null @@ -1,66 +0,0 @@ -# -# 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) 2007 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -[General] -Name=@capbrand@ Directory Suite -Components=slapd - -[slapd] -Name= @capbrand@ Directory Server -InstanceNamePrefix= Directory Server -NickName= slapd -Version= @PACKAGE_VERSION@ -Compatible= 1.0 -BuildNumber= @NQBUILD_NUM@ -Description= @capbrand@ Directory Server -ProductName=Directory Server -Vendor= @vendor@ -# the rest of these are obsolete, but left here for -# compatability with the old setuputil -Expires= 0 -Security= domestic -IsDirLite=false -PrePreInstall= dsktune -PreInstall= ns-config -PostInstall= bin/slapd/admin/bin/ns-update -PreUninstall= bin/slapd/admin/bin/uninstall -PostUninstall= -Checked=True -Mandatory=False -IsLdap=True diff --git a/ldap/cm/newinst/uninstall b/ldap/cm/newinst/uninstall deleted file mode 100755 index f48fa343..00000000 --- a/ldap/cm/newinst/uninstall +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -# -# 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 -# - -# determine server root directory from $0; this script is being run -# from server root/bin/slapd/admin/bin - -sroot=`echo $0 | sed 's#/bin/slapd/admin/bin/.*##g'` - -# check if Solaris 9+ specific un-installation -for arg in $* ; do - if [ "$arg" = "-S" ]; then - iDSISolaris=1 - fi -done - -if [ "$iDSISolaris" = "1" ]; then - vardir=`echo $sroot | sed 's#/usr/iplanet/#/var/#'` - etcdir=`echo $sroot | sed 's#/usr/#/etc/#'` -fi - -# search for all slapd-* directories - -cd $sroot || { - echo "Could not change dir to server root directory $sroot" - exit 1 -} - -NETSITE_ROOT=$sroot -REQUEST_METHOD=GET -export NETSITE_ROOT REQUEST_METHOD -# for each server instance -for dir in slapd-* ; do - QUERY_STRING="InstanceName=$dir" - SERVER_NAMES=$dir - export QUERY_STRING SERVER_NAMES - # try to remove the nice way . . . - cd bin/slapd/admin/bin - status=0 - ./ds_remove $* > /dev/null 2>&1 || status=$? - cd $sroot - # wait for that to finish - sleep 2 - if [ $status -ne 0 -o -d $dir ]; then - # something went wrong; kill with extreme prejudice . . . - # Solaris 9+ specific un-installation - if [ -f $dir/logs/pid ]; then - pid=`cat $dir/logs/pid` - # kill the server - kill -9 $pid > /dev/null 2>&1 - # wait for it to stop - sleep 2 - fi - # remove the instance directory - rm -rf $dir - fi - # Solaris 9+ specific un-installation - if [ "$iDSISolaris" = "1" ]; then - rm -rf $etcdir/$dir - rm -rf $vardir/$dir - fi - -done - -# remove some other stuff which is dynamically created -if [ "$iDSISolaris" = "" ]; then - rm -rf bin/slapd -fi - -exit 0 diff --git a/ldap/cm/newinst/ux-config.cc b/ldap/cm/newinst/ux-config.cc deleted file mode 100644 index df1cf5c8..00000000 --- a/ldap/cm/newinst/ux-config.cc +++ /dev/null @@ -1,1118 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/********************************************************************* -** -** NAME: -** ux-config.cc -** -** DESCRIPTION: -** Fedora Directory Server Pre-installation Program -** -** NOTES: -** This program is intended for UNIX only and is NOT thread-safe. -** Based on the original ux-config.c. -** -*********************************************************************/ - -extern "C" { -#include <stdio.h> -#include <string.h> -#ifdef AIX -#include <strings.h> -#endif -#include "nspr.h" -#include "plstr.h" -} -/* Newer g++ wants the new std header forms */ -#if defined( Linux ) -#include <strstream> -using std::ostrstream; -/* But some platforms won't accept those (specifically HP-UX aCC */ -#else -#include <strstream.h> -#endif -#include "dialog.h" -#include "ux-config.h" -#include "ux-dialog.h" -#include "install_keywords.h" -#include "utf8.h" -extern "C" { -#include <dsalib.h> - -#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux) -#include <netdb.h> -#endif -} - -extern const char *DEFAULT_SYSUSER = "root"; -extern const char *DEFAULT_OLDROOT = "/usr/ns-home"; - -const int RECONFIG_EXIT_CODE = 7; - -/* - * iDSISolaris is set to 1 for Solaris 9+ specific installation. - * This can be done by passing -S as the command line argument. - */ -int iDSISolaris = 0; - -static char * -my_strdup(const char *s) -{ - char *ret = 0; - if (s) - { - ret = new char[strlen(s) + 1]; - strcpy(ret, s); - } - - return ret; -} - -/********************************************************************* -** -** METHOD: -** main -** DESCRIPTION: -** This is the ns-config program. This program functions as -** - The Pre-installation program used during the Installation -** of the Directory Server. In this case, the program -** is supposed to be executed by the common installer (ns-setup) -** and can be executed from anywhere. -** -** - The stand-alone configuration program used to re-configure -** the directory server. In this case, the program has -** to be executed from the serverroot. -** -** SIDE EFFECTS: -** None -** RESTRICTIONS: -** -** ALGORITHM: -** -**********************************************************************/ -int -main(int argc, char **argv) -{ - int err = 0; - - SlapdPreInstall program(argc, argv); - - err = program.init(); - if (!err) - { - err = program.start(); - } - - return err; -} - -SlapdPreInstall::SlapdPreInstall(int argc, char **argv) : _reconfig(False) -{ - setInstallMode(Interactive); - setInstallType(Typical); - _configured = False; - - getOptions(argc, argv); - -} - -SlapdPreInstall::~SlapdPreInstall() -{ -} - -void -SlapdPreInstall::getOptions(int argc, char **argv) -{ - int opt; - - while ((opt = getopt(argc,argv, "l:f:m:rsS")) != EOF) - { - switch (opt) - { - case 'l': - _logFile = strdup(optarg); - break; - case 'f': - _infoFile = strdup(optarg); - break; - case 's': - setInstallMode(Silent); - break; - case 'm': - setInstallType((InstallType)atoi(optarg)); - break; - case 'r': - _reconfig = True; - break; - case 'S': - /* - * Solaris 9+ specific installation - */ - iDSISolaris = 1; - break; - default: - fprintf(stderr, "SlapdPreInstall::getOptions(): " - "invalid option [%s]\n", argv[optind-1]); - break; - } - } -} - - -int -SlapdPreInstall::init() -{ - char errMsg[256]; - struct stat fi; - Bool shell = True; - - _installInfo = NULL; - _slapdInfo = new InstallInfo; - - if (installMode() != Silent) - { - Dialog::initDisplay("Directory", "Fedora Project"); - } - - if ((installMode() == Silent && _infoFile == (char *) NULL) || - (_infoFile != (char *) NULL && InstUtil::fileExists(_infoFile) == False)) - { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: answer cache not found\n"); - if (installMode() == Silent) - { - printf(errMsg); - } - else - { - DialogAlert alert(errMsg); - alert.execute(); - } - return -1; - } - - _serverRoot = InstUtil::getCurrentDir(); - if (installMode() != Silent) - { - if (_infoFile == (char *) NULL) - { - // Not executing from the Shell, check if this is the server - if (stat ("admin-serv", &fi) != 0) - { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: %s is not a server root\n",_serverRoot.data()); - DialogAlert alert(errMsg); - alert.execute(); - return -1; - } - shell = False; - // if we are here, we are being run to reconfigure - _reconfig = True; - } - } - - if (installMode() == Silent) - { - if (_logFile == (char *) NULL) - { - // Should have a logfile - _logFile = _serverRoot + "/setup/install.log"; - } - _installLog = new InstallLog (_logFile); - } - - if (shell) - { - _installInfo = new InstallInfo(_infoFile); - _serverRoot = _installInfo->get(SLAPD_KEY_SERVER_ROOT); - if (!(_adminInfo = _installInfo->getSection("admin"))) - { - _adminInfo = new InstallInfo; - } - } - else - { - // Retrieve configuration data into installInfo - _infoFile = _serverRoot + "/" + "setup/install.inf"; - _installInfo = new InstallInfo(); - if (initDefaultConfig() == -1) { - const char *guess_host = InstUtil::guessHostname(); - if (guess_host) { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: %s is not an addressable hostname\n", - guess_host); - } else { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: cannot determine an addressable hostname\n"); - } - DialogAlert alert(errMsg); - alert.execute(); - return -1; - } - if (getDNSDomain() == NULL) { - const char *guess_domain = InstUtil::guessDomain(); - - if (guess_domain == NULL) { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: cannot determine domainname\n"); - } else { - PR_snprintf(errMsg, sizeof(errMsg), "ERROR: domainname is not valid for DNS\n"); - } - DialogAlert alert(errMsg); - alert.execute(); - return -1; - } - } - - setDefaultScript(_slapdInfo); - - char *url = 0; - char *adminid = 0; - char *admin_domain = 0; - getDefaultLdapInfo(_serverRoot, &url, &adminid, &admin_domain); - if (url && admin_domain) // in some cases adminid is NULL - { - if (!adminid) - { - // look up the admin ID in the config ds - } - // use these values as our default values - _installInfo->set(SLAPD_KEY_K_LDAP_URL, url); - if (adminid) - { - _installInfo->set(SLAPD_KEY_SERVER_ADMIN_ID, adminid); - } - _installInfo->set(SLAPD_KEY_ADMIN_DOMAIN, admin_domain); - // since this server root is already configured to use - // an existing configuration directory server, we will - // not allow the user to install another one here, so - // the directory server created here will be a user - // directory; we will still need to ask for the admin - // user password - _slapdInfo->set(SLAPD_KEY_USE_EXISTING_MC, "Yes"); - _slapdInfo->set(SLAPD_KEY_USE_EXISTING_UG, "No"); - _slapdInfo->set(SLAPD_KEY_SLAPD_CONFIG_FOR_MC, "No"); - } - else - { - _slapdInfo->set(SLAPD_KEY_SLAPD_CONFIG_FOR_MC, "Yes"); - } - - return 0; -} -/* - * PVO - */ - -int -SlapdPreInstall::initDefaultConfig() -{ - // PVO - should read from DS instead - if (_adminInfo->isEmpty()) - { - const char *guess_host = InstUtil::guessHostname(); - - if (guess_host) { -#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux) - static char test_host[BIG_BUF] = {0}; - struct hostent *hp; - - PL_strncpyz(test_host,guess_host,sizeof(test_host)); - hp = gethostbyname(test_host); - if (hp == NULL) { - return -1; - } -#endif - } - _installInfo->set(SLAPD_KEY_SERVER_ROOT, _serverRoot); - _installInfo->set(SLAPD_KEY_FULL_MACHINE_NAME, guess_host); - _installInfo->set(SLAPD_KEY_K_LDAP_URL, NSString("ldap://") - + guess_host - + "/" - + DEFAULT_LDAP_SUFFIX); - _installInfo->set(SLAPD_KEY_SUITESPOT_USERID, DEFAULT_SSUSER); - _installInfo->set(SS_GROUP, DEFAULT_SSGROUP); - } - else - { - _configured = True; - } - return 0; -} - -inline void -changeIndex(int &ii, int incr, int min, int max) -{ - ii += incr; - if (ii < min) - ii = min; - if (ii > max) - ii = max; -} - -int -SlapdPreInstall::start() -{ - // if we're in silent install mode, don't execute any of the dialogs, just - // assume the user knows what he/she is doing . . . - if (installMode() == Silent) - { - if (_reconfig) - shutdownServers(); - return 0; - } - - // only enable win mode if we are not doing a silent install because - // it messes up terminal settings - enableWinMode(); - - DialogAction action = DIALOG_NEXT; - int err = 0; - Dialog *advancedDialogList[] = { - &askUseExistingMC, - &askMCHost, - &askMCPort, - &askMCDN, - &askMCAdminDomain, - &askUseExistingUG, - &askUGHost, - &askUGPort, - &askUGSuffix, - &askUGDN, - &askSlapdPort, - &askSlapdServerID, - &askMCAdminID, - &askSlapdSuffix, - &askSlapdRootDN, - &askAdminDomain, - /* - &askReplication, - &askSIR, - &askChangeLogSuffix, - &askChangeLogDir, - &askConsumerDN, - &askSIRHost, - &askSIRPort, - &askSIRDN, - &askSIRSuffix, - &askSIRDays, - &askSIRTimes, - &askCIR, - &askCIRHost, - &askCIRPort, - &askCIRDN, - &askCIRSuffix, - &askCIRInterval, - &askCIRDays, - &askCIRTimes, - &askReplicationDN, - */ - &askSample, - &askPopulate, - &askDisableSchemaChecking - }; - Dialog *advancediDSISolarisForceUGDialogList[] = { - &askSlapdPort, - &askSlapdServerID, - &askMCHost, - &askMCPort, - &askMCDN, - &askSlapdSuffix, - &askSlapdRootDN, - &askSample, - &askPopulate, - &askDisableSchemaChecking - }; - Dialog *normalDialogList[] = { - &askUseExistingMC, - &askMCHost, - &askMCPort, - &askMCDN, - &askUseExistingUG, - &askUGHost, - &askUGPort, - &askUGSuffix, - &askUGDN, - &askSlapdPort, - &askSlapdServerID, - &askMCAdminID, - &askSlapdSuffix, - &askSlapdRootDN, - &askAdminDomain - }; - Dialog *normalForceUGDialogList[] = { - &askSlapdPort, - &askSlapdServerID, - &askMCDN, - &askSlapdSuffix, - &askSlapdRootDN - }; - Dialog *normaliDSISolarisForceUGDialogList[] = { - &askSlapdPort, - &askSlapdServerID, - &askMCHost, - &askMCPort, - &askMCDN, - &askSlapdSuffix, - &askSlapdRootDN - }; - Dialog *expressDialogList[] = { - &askMCAdminID, - &askSlapdRootDN - }; - Dialog *expressForceUGDialogList[] = { - &askMCDN, - &askSlapdRootDN - }; - Dialog *expressiDSISolarisForceUGDialogList[] = { - &askMCHost, - &askMCPort, - &askMCDN, - &askSlapdRootDN - }; - Dialog *reconfigDialogList[] = { - &askReconfigMCAdminPwd - }; - const int nNormalDialogs = sizeof(normalDialogList) / sizeof(normalDialogList[0]); - const int nExpressDialogs = sizeof(expressDialogList) / sizeof(expressDialogList[0]); - const int nExpressForceUGDialogs = sizeof(expressForceUGDialogList) / sizeof(expressForceUGDialogList[0]); - const int nExpressiDSISolarisForceUGDialogs = sizeof(expressiDSISolarisForceUGDialogList) / sizeof(expressiDSISolarisForceUGDialogList[0]); - const int nAdvancedDialogs = sizeof(advancedDialogList) / sizeof(advancedDialogList[0]); - const int nAdvancediDSISolarisForceUGDialogs = sizeof(advancediDSISolarisForceUGDialogList) / sizeof(advancediDSISolarisForceUGDialogList[0]); - const int nReconfigDialogs = sizeof(reconfigDialogList) / sizeof(reconfigDialogList[0]); - const int nNormalForceUGDialogs = sizeof(normalForceUGDialogList) / sizeof(normalForceUGDialogList[0]); - const int nNormaliDSISolarisForceUGDialogs = sizeof(normaliDSISolarisForceUGDialogList) / sizeof(normaliDSISolarisForceUGDialogList[0]); - - int nDialogs = nNormalDialogs; - Dialog** dialogList = normalDialogList; - if (_reconfig) - { - nDialogs = nReconfigDialogs; - dialogList = reconfigDialogList; - } - else if (installType() == Express) - { - nDialogs = nExpressDialogs; - dialogList = expressDialogList; - } - else if (installType() == Custom) - { - nDialogs = nAdvancedDialogs; - dialogList = advancedDialogList; - } - else if (!iDSISolaris && featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { - if (installType() == Typical) - { - nDialogs = nNormalForceUGDialogs; - dialogList = normalForceUGDialogList; - } - else if (installType() == Express) - { - nDialogs = nExpressForceUGDialogs; - dialogList = expressForceUGDialogList; - } - } - - if (iDSISolaris && featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { - if (installType() == Typical) - { - nDialogs = nNormaliDSISolarisForceUGDialogs; - dialogList = normaliDSISolarisForceUGDialogList; - } - else if (installType() == Express) - { - nDialogs = nExpressiDSISolarisForceUGDialogs; - dialogList = expressiDSISolarisForceUGDialogList; - } - else if (installType() == Custom) - { - nDialogs = nAdvancediDSISolarisForceUGDialogs; - dialogList = advancediDSISolarisForceUGDialogList; - } - - } - - getDefaultScript()->set(SLAPD_KEY_SECURITY_ON, "No"); - - int ii = 0; - - // initialize all dialogs - - if (!_reconfig) - { - for (ii = 0; ii < nAdvancedDialogs; ++ii) - { - advancedDialogList[ii]->registerDialogNext(this); - advancedDialogList[ii]->enable8BitInput(); - // this next bit of hackery allows us to use the dialog->setup() - // method of each dialog to setup the default values for the - // .inf file; if the SETUP_ONLY flag is set, each setup() method - // will just return DIALOG_NEXT after setting up the default - // values; pretty sneaky, huh? - advancedDialogList[ii]->setUserData(SETUP_DEFAULTS, SETUP_ONLY); - advancedDialogList[ii]->setUserData(ACTION, DIALOG_NEXT); - advancedDialogList[ii]->execute(); - advancedDialogList[ii]->setUserData(SETUP_DEFAULTS, (long)0); - } - advancedDialogList[nAdvancedDialogs-1]->registerDialogLast(this); - } - else - { - for (ii = 0; ii < nReconfigDialogs; ++ii) - { - reconfigDialogList[ii]->registerDialogNext(this); - reconfigDialogList[ii]->enable8BitInput(); - } - reconfigDialogList[nReconfigDialogs-1]->registerDialogLast(this); - } - - ii = 0; - int min = 0; - // keep looping until we hit the end - while (ii < nDialogs) - { - int incr = 1; // go to next by default - Dialog *d = dialogList[ii]; - - // tell the dialog what the action was that brought it here so that - // the dialog knows if it was called as the result of a next or - // a prev or whatever - d->setUserData(ACTION, (long)action); -// cerr << "set action in dialog " << ii << " to " << action << endl; -// cerr << "DIALOG_PREV, SAME, NEXT = " << DIALOG_PREV << "," << DIALOG_SAME << "," << DIALOG_NEXT << endl; - - // execute the dialog -// cerr << "executing dialog number " << ii << endl; - action = d->execute(); - if (action == DIALOG_PREV) - { - incr = -1; // go to prev -// cerr << "prev" << endl; - } - else if (action == DIALOG_SAME) - { - incr = 0; // repeat this state -// cerr << "same" << endl; - } - else if (action != DIALOG_NEXT) - { - incr = nDialogs; - err = -1; // could just break here, I suppose . . . - } - else - { -// cerr << "next" << endl; - } - - changeIndex(ii, incr, min, nDialogs); - } - - if (err == 0) - { - if (!_reconfig) - { - _installInfo->addSection("slapd", _slapdInfo); - if (!_installInfo->getSection("admin") && _adminInfo && - !_adminInfo->isEmpty()) - { - _installInfo->addSection("admin", _adminInfo); - delete _adminInfo; - _adminInfo = 0; - } - - if (!_installInfo->get(SLAPD_KEY_K_LDAP_HOST)) - { - _installInfo->set(SLAPD_KEY_K_LDAP_HOST, - _installInfo->get(SLAPD_KEY_FULL_MACHINE_NAME)); - } - if (!_installInfo->get(SLAPD_KEY_K_LDAP_PORT)) - { - _installInfo->set(SLAPD_KEY_K_LDAP_PORT, - _slapdInfo->get(SLAPD_KEY_SERVER_PORT)); - } - const char *test = 0; - if (!(test = _installInfo->get(SLAPD_KEY_BASE_SUFFIX)) || !*test) - { - // if there's no config directory suffix we must use - // o=NetscapeRoot - _installInfo->set(SLAPD_KEY_BASE_SUFFIX, DEFAULT_ROOT_DN); - } - - // only UG directories have a user base suffix . . . - if (featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - _slapdInfo->remove(SLAPD_KEY_SUFFIX); - - // if there is no LdapURL and other ldap info in the installInfo, write - // it - if (!_installInfo->get(SLAPD_KEY_K_LDAP_URL)) - { - // construct a new LdapURL based on host, port, and suffix - const char *suffix = _installInfo->get(SLAPD_KEY_BASE_SUFFIX); - if (!suffix || !*suffix) - suffix = DEFAULT_ROOT_DN; - NSString ldapURL = NSString("ldap://") + - _installInfo->get(SLAPD_KEY_K_LDAP_HOST) + ":" + - _installInfo->get(SLAPD_KEY_K_LDAP_PORT) + "/" + - suffix; - _installInfo->set(SLAPD_KEY_K_LDAP_URL, ldapURL); - } - - if (!featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { - // if this is to be both the MC and the UG host . . . - if (!featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - { - // use the MC admin ID for the UG admin ID - if (!_installInfo->get(SLAPD_KEY_USER_GROUP_ADMIN_ID)) - _installInfo->set(SLAPD_KEY_USER_GROUP_ADMIN_ID, - _installInfo->get(SLAPD_KEY_SERVER_ADMIN_ID)); - - if (!_installInfo->get(SLAPD_KEY_USER_GROUP_ADMIN_PWD)) - _installInfo->set(SLAPD_KEY_USER_GROUP_ADMIN_PWD, - _installInfo->get(SLAPD_KEY_SERVER_ADMIN_PWD)); - } - } - - // set the ug ldap url if we need one - if (!_installInfo->get(SLAPD_KEY_USER_GROUP_LDAP_URL)) - { - if (featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - { - NSString url = NSString("ldap://") + - _installInfo->get(SLAPD_KEY_UG_HOST) + ":" + - _installInfo->get(SLAPD_KEY_UG_PORT) + "/" + - _installInfo->get(SLAPD_KEY_UG_SUFFIX); - _installInfo->set(SLAPD_KEY_USER_GROUP_LDAP_URL, url); - } - else // the directory we're creating is the UG - { - NSString url = NSString("ldap://") + - _installInfo->get(SLAPD_KEY_FULL_MACHINE_NAME) + ":" + - _slapdInfo->get(SLAPD_KEY_SERVER_PORT) + "/" + - _slapdInfo->get(SLAPD_KEY_SUFFIX); - _installInfo->set(SLAPD_KEY_USER_GROUP_LDAP_URL, url); - } - } - - if (!_installInfo->get(SLAPD_KEY_USER_GROUP_ADMIN_ID)) - _installInfo->set(SLAPD_KEY_USER_GROUP_ADMIN_ID, - _slapdInfo->get(SLAPD_KEY_ROOTDN)); - - if (!_installInfo->get(SLAPD_KEY_USER_GROUP_ADMIN_PWD)) - _installInfo->set(SLAPD_KEY_USER_GROUP_ADMIN_PWD, - _slapdInfo->get(SLAPD_KEY_ROOTDNPWD)); - } else { - // for reconfigure, just shutdown the servers - shutdownServers(); - } - - // remove the fields we don't need - _installInfo->remove(SLAPD_KEY_K_LDAP_HOST); - _installInfo->remove(SLAPD_KEY_K_LDAP_PORT); - _installInfo->remove(SLAPD_KEY_BASE_SUFFIX); - _installInfo->remove(SLAPD_KEY_UG_HOST); - _installInfo->remove(SLAPD_KEY_UG_PORT); - _installInfo->remove(SLAPD_KEY_UG_SUFFIX); - - // normalize and convert the DN valued attributes to LDAPv3 style - normalizeDNs(); - - // format for .inf file - _installInfo->setFormat(1); - - // convert internally stored UTF8 to local - _installInfo->toLocal(); - _installInfo->write(_infoFile); - } - - disableWinMode(); - - return err; -} - -int -SlapdPreInstall::cont() -{ - return 0; -} - -void -SlapdPreInstall::clear() -{ -} - -void -SlapdPreInstall::add(Dialog *p) -{ - p = p; -} -void -SlapdPreInstall::resetLast() -{ -} - -void -SlapdPreInstall::addLast(Dialog *p) -{ - p = p; -} -void -SlapdPreInstall::setParent(void *parent) -{ - parent = parent; - return; -} -void * -SlapdPreInstall::parent() const -{ - return (void *) this; -} - -void -SlapdPreInstall::setAdminScript(InstallInfo *script) -{ - _adminInfo = script; -} - -InstallInfo * -SlapdPreInstall::getAdminScript() const -{ - return _adminInfo; -} - -InstallInfo * -SlapdPreInstall::getBaseScript() const -{ - return _installInfo; -} - -void -SlapdPreInstall::showAlert(const char *msg) -{ - char *localMsg = UTF8ToLocal(msg); - DialogAlert alert(localMsg); - alert.execute(); - nsSetupFree(localMsg); - - return; -} - -int -SlapdPreInstall::verifyRemoteLdap( - const char *host, - const char *port, - const char *suffix, - const char *binddn, - const char *binddnpwd -) const -{ - const char *myhost = getDefaultScript()->get(host); - if (!myhost) - myhost = getBaseScript()->get(host); - const char *myport = getDefaultScript()->get(port); - if (!myport) - myport = getBaseScript()->get(port); - const char *mysuffix = getDefaultScript()->get(suffix); - if (!mysuffix) - mysuffix = getBaseScript()->get(suffix); - if (!mysuffix) - mysuffix = DEFAULT_ROOT_DN; - const char *mydn = getDefaultScript()->get(binddn); - if (!mydn) - mydn = getBaseScript()->get(binddn); - const char *mypwd = getDefaultScript()->get(binddnpwd); - if (!mypwd) - mypwd = getBaseScript()->get(binddnpwd); - - char *s = PR_smprintf("ldap://%s:%s/%s", myhost, myport, (suffix && mysuffix) ? mysuffix : ""); - int status = authLdapUser(s, mydn, mypwd, NULL, NULL); - PR_smprintf_free(s); - return status; -} - -int -SlapdPreInstall::verifyAdminDomain( - const char *host, - const char *port, - const char *suffix, - const char *admin_domain, - const char *binddn, - const char *binddnpwd -) const -{ - const char *myhost = getDefaultScript()->get(host); - if (!myhost) - myhost = getBaseScript()->get(host); - const char *myport = getDefaultScript()->get(port); - if (!myport) - myport = getBaseScript()->get(port); - const char *mysuffix = getDefaultScript()->get(suffix); - if (!mysuffix) - mysuffix = getBaseScript()->get(suffix); - if (!mysuffix) - mysuffix = DEFAULT_ROOT_DN; - const char *mydn = getDefaultScript()->get(binddn); - if (!mydn) - mydn = getBaseScript()->get(binddn); - const char *mypwd = getDefaultScript()->get(binddnpwd); - if (!mypwd) - mypwd = getBaseScript()->get(binddnpwd); - const char *myadmin_domain = getDefaultScript()->get(admin_domain); - if (!myadmin_domain) - myadmin_domain = getBaseScript()->get(admin_domain); - - char *s = PR_smprintf("ldap://%s:%s/%s", myhost, myport, (suffix && mysuffix) ? mysuffix : ""); - LdapError ldapErr; - Ldap ldap(ldapErr, s, mydn, mypwd); - int status = ldapErr; - if (!status && admin_domain && myadmin_domain && mysuffix) - { - LdapEntry ad(&ldap); - NSString dn = NSString("ou=") + myadmin_domain + ", " + mysuffix; - status = ad.retrieve(dn); - } - - PR_smprintf_free(s); - return status; -} - -const char * -SlapdPreInstall::getDNSDomain() const -{ - static char domain[BIG_BUF] = {0}; - - if (domain[0]) - return domain; - - const char *FQDN = - getBaseScript()->get(SLAPD_KEY_FULL_MACHINE_NAME); - if (!FQDN) { - FQDN = InstUtil::guessHostname(); - } - - const char *ptr = NULL; - if (FQDN != NULL) { - // copy the domain name part (not the hostname) into the suffix - // find the last '.' in the FQDN - ptr = strchr(FQDN, '.'); - } - - if (FQDN == NULL || ptr == NULL) { - const char *guess_domain = InstUtil::guessDomain(); - - if (guess_domain) { - /* ensure domain is of at least 2 components */ - const char *dptr = strchr(guess_domain, '.'); - if (dptr == NULL) { - return NULL; - } - - PL_strncpyz(domain, guess_domain, sizeof(domain)); - return domain; - } else { - return NULL; - } - } - - ++ptr; - PL_strncpyz(domain, ptr, sizeof(domain)); - - return domain; -} - -const char * -SlapdPreInstall::getDefaultSuffix() const -{ - const char *SUF = "dc="; - const int SUF_LEN = 3; - static char suffix[BIG_BUF] = {0}; - - if (suffix[0]) - return suffix; - - char *sptr = suffix; - PL_strcatn(sptr, sizeof(suffix), SUF); - sptr += SUF_LEN; - for (const char *ptr = getDNSDomain(); ptr && *ptr; *ptr++) { - if (*ptr == '.') { - PL_strcatn(sptr, sizeof(suffix), ", "); - sptr += 2; - PL_strcatn(sptr, sizeof(suffix), SUF); - sptr += SUF_LEN; - } else { - *sptr++ = *ptr; - } - } - *sptr = 0; - if (!*suffix) - PR_snprintf(suffix, sizeof(suffix), "%s%s", SUF, "unknown-domain"); - - return suffix; -} - -const char * -SlapdPreInstall::getConsumerDN() const -{ - static char dn[BIG_BUF]; - - dn[0] = 0; - const char *suffix = - getDefaultScript()->get(SLAPD_KEY_SUFFIX); - if (suffix) - PR_snprintf(dn, sizeof(dn), "cn=Replication Consumer, %s", suffix); - else - PR_snprintf(dn, sizeof(dn), "cn=Replication Consumer"); - - return dn; -} - -int -SlapdPreInstall::featureIsEnabled(const char *which) const -{ - const char *val = getDefaultScript()->get(which); - if (!val) - val = getBaseScript()->get(which); - if (!val || !*val || !strncasecmp(val, "no", strlen(val))) - return 0; // feature is disabled - - return 1; // feature is enabled -} - -void -SlapdPreInstall::shutdownServers() -{ - const char *nick = "slapd"; - const char *script = "stop-slapd"; - int len = strlen(nick); - const char *sroot = getBaseScript()->get(SLAPD_KEY_SERVER_ROOT); - if (!sroot) - return; - - DIR* srootdir = opendir(sroot); - if (!srootdir) - return; - - struct dirent* entry = 0; - while ((entry = readdir(srootdir))) - { - // look for instance directories - if (!strncasecmp(entry->d_name, nick, len)) - { - NSString instanceDir = NSString(sroot) + "/" + entry->d_name; - if (InstUtil::dirExists(instanceDir)) - { - NSString prog = instanceDir + "/" + script; - // call the stop-slapd script - if (InstUtil::fileExists(prog)) - { - cout << "Shutting down server " << entry->d_name - << " . . . " << flush; - int status = InstUtil::execProgram(prog); - if (status) - // attempt to determine cause of failure - cout << "Could not shutdown server: status=" << status - << " error=" << errno << endl; - else - cout << "Done." << endl; - } - } - } - } - closedir(srootdir); - - return; -} - -void -SlapdPreInstall::normalizeDNs() -{ - static const char *DN_VALUED_ATTRS[] = { - SLAPD_KEY_SUFFIX, - SLAPD_KEY_ROOTDN, - SLAPD_KEY_CIR_SUFFIX, - SLAPD_KEY_CIR_BINDDN, - SLAPD_KEY_REPLICATIONDN, - SLAPD_KEY_CONSUMERDN, - SLAPD_KEY_SIR_SUFFIX, - SLAPD_KEY_SIR_BINDDN - }; - static const int N = sizeof(DN_VALUED_ATTRS)/sizeof(DN_VALUED_ATTRS[0]); - static const char *URL_ATTRS[] = { - SLAPD_KEY_K_LDAP_URL, - SLAPD_KEY_USER_GROUP_LDAP_URL - }; - static const int NURLS = sizeof(URL_ATTRS)/sizeof(URL_ATTRS[0]); - - int ii; - for (ii = 0; _slapdInfo && (ii < N); ++ii) - { - const char *attr = DN_VALUED_ATTRS[ii]; - char *dn = my_strdup(_slapdInfo->get(attr)); - if (dn) - { - _slapdInfo->remove(attr); - _slapdInfo->set(attr, dn_normalize_convert(dn)); - fflush(stdout); - delete [] dn; - } - } - - for (ii = 0; _installInfo && (ii < NURLS); ++ii) - { - const char *attr = URL_ATTRS[ii]; - const char *url = _installInfo->get(attr); - LDAPURLDesc *desc = 0; - if (url && !ldap_url_parse((char *)url, &desc) && desc) - { - char *dn = dn_normalize_convert(my_strdup(desc->lud_dn)); - if (dn) - { - char port[6]; - PR_snprintf(port, sizeof(port), "%d", desc->lud_port); - NSString newurl = NSString("ldap://") + desc->lud_host + - ":" + port + "/" + dn; - _installInfo->set(attr, newurl); - delete [] dn; - } - } - if (desc) - ldap_free_urldesc(desc); - } -} diff --git a/ldap/cm/newinst/ux-config.h b/ldap/cm/newinst/ux-config.h deleted file mode 100644 index 5fb55c28..00000000 --- a/ldap/cm/newinst/ux-config.h +++ /dev/null @@ -1,241 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/********************************************************************* -** -** -** NAME: -** ux-config.h -** -** DESCRIPTION: -** Fedora Directory Server Pre-installation Program -** -** NOTES: -** -** HISTORY: -** $Log: ux-config.h,v $ -** Revision 1.7 2006/11/10 23:44:40 nhosoi -** Resolves: #214533 -** Summary: configure needs to support --with-fhs (Comment #6) -** Changes: Added the following include next to the end of the copyright block. -** + -** +#ifdef HAVE_CONFIG_H -** +# include <config.h> -** +#endif -** + -** -** Revision 1.6 2005/04/19 22:07:21 nkinder -** Fixed licensing typo -** -** Revision 1.5 2005/04/15 22:40:11 nkinder -** 155068 - Added license to source files -** -** Revision 1.4 2005/03/25 02:09:16 nhosoi -** [Bug 146919] Directory Server rebranding -** 1) Brandx -> Fedora -** 2) Pick up new internal component set (Admin SDK, Setup SDK, Admin Server) -** 3) Use JRE from the Admin Server package -** 4) Docs -** a) Componentize Docs -** b) Rebrand Docs -** c) Drop packaging Administration Guide in the external version -** -** Revision 1.3 2005/02/28 23:37:49 nkinder -** 149951 - Updated source code copyrights -** -** Revision 1.2 2005/02/02 19:35:43 nhosoi -** [146919] De-brand the Directory Server as "brandx" -** -** Revision 1.1.1.1 2005/01/21 00:40:49 cvsadm -** Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth) -** -** Revision 1.1.2.6.8.9 2005/01/14 01:22:10 nhosoi -** For the open-source project. -** 1) eliminated 'netsite' level -** 2) moved ns/config one level lower -** 3) moved fasttime to lib/base -** -** Revision 1.1.2.6.8.8 2003/09/22 19:38:51 ulfw -** Update copyright years from 2001 to 2001-2003 -** -** Revision 1.1.2.6.8.7 2001/11/02 23:32:56 richm -** XXX use new copyright XXX -** -** Revision 1.1.2.6.8.6 2001/10/06 20:01:04 richm -** ldapserver/ldap/cm/newinst/ux-config.h -** 1.1.2.6.8.5 -** 20010918 -** -** Remove copyright caracter form copyright -** -** -** ==================================================== -** -** Revision 1.1.2.6.8.5 2001/09/21 15:25:29 richm -** rebrand to Netscape and change version to 6.0 -** -** Revision 1.1.2.6.8.4 2001/02/13 09:40:08 rmarco -** copyrights -** -** Revision 1.1.2.6.8.3 2000/08/22 10:07:32 elp -** First bunch of branding fixes. -** Replaced 'Netscape Directory Server' by 'iPlanet Directory Server'. -** -** Revision 1.1.2.6.8.2 2000/08/08 19:34:10 mwahl -** ensure domainname is valid before beginning install -** -** Revision 1.1.2.6.8.1 1999/02/23 02:14:08 ggood -** Merge changes made on server4_directory_branch after 4.0 RTM to DirectoryBranch -** -** Revision 1.1.2.7 1998/11/25 02:07:59 rweltman -** Merging from DS 4.0 RTM into server4_directory_branch -** -** Revision 1.1.2.6.4.2 1998/11/06 21:33:15 richm -** added normalizeDNs -** -** Revision 1.1.2.6.4.1 1998/10/15 18:23:05 richm -** check for bogus admin domain -** -** Revision 1.1.2.6 1998/07/23 21:32:39 richm -** allow re-installation into existing server root -** -** Revision 1.1.2.5 1998/06/15 23:52:08 richm -** added support for user/group separation, better flow control, and support for AS 0611 -** -** Revision 1.1.2.4 1997/12/17 21:10:19 richm -** updated for minor 19971216 changes to admin setup sdk -** -** Revision 1.1.2.3 1997/12/06 01:43:18 richm -** upgraded to latest changes from 12.03 admin -** -** Revision 1.1.2.2 1997/11/12 23:42:57 richm -** updates for unix installer -** -** Revision 1.1.2.1 1997/11/04 01:57:53 richm -** Kingpin UNIX installation modules -** -** Revision 1.1.2.4 1997/10/22 02:46:08 pvo -** Removed restore(). -** -** Revision 1.1.2.3 1997/10/01 17:24:11 pvo -** Changed include path. -** -** Revision 1.1.2.2 1997/09/27 02:43:39 pvo -** Check in. -** -** -*********************************************************************/ -#include "dialog.h" -#include "ux-util.h" -extern const char *DEFAULT_SYSUSER; -extern const char *DEFAULT_OLDROOT; - - -class SlapdPreInstall:public DialogManager -{ -public: - - SlapdPreInstall(int, char **); - ~SlapdPreInstall(); - - int init(); - - int start(); - void add (Dialog *); - void addLast(Dialog *); - void resetLast(); - void clear(); - int cont(); - void setParent(void *); - void *parent() const; - - void setAdminScript(InstallInfo *script); - InstallInfo *getAdminScript() const; - - InstallInfo *getBaseScript() const; - - int verifyRemoteLdap(const char *host, const char *port, const char *suffix, - const char *binddn, const char *binddnpwd) const; - - int verifyAdminDomain(const char *host, const char *port, const char *suffix, - const char *admin_domain, - const char *binddn, const char *binddnpwd) const; - - const char *getDNSDomain() const; - const char *getDefaultSuffix() const; - const char *getConsumerDN() const; - int featureIsEnabled(const char *which) const; - - static void showAlert(const char *msg); - -private: - - NSString _serverRoot; - - NSString _infoFile; - InstallInfo *_installInfo; - InstallInfo *_slapdInfo; - InstallInfo *_adminInfo; - - NSString _logFile; - InstallLog *_installLog; - - Bool _configured; - Bool _reconfig; - - - void getOptions(int argc, char **argv); - int initDefaultConfig(); - - void shutdownServers(); - - void normalizeDNs(); -}; - -typedef SlapdPreInstall DialogManagerType; - -inline DialogManagerType* -getManager(Dialog *me) -{ - return (DialogManagerType*)me->manager(); -} - diff --git a/ldap/cm/newinst/ux-dialog.cc b/ldap/cm/newinst/ux-dialog.cc deleted file mode 100644 index a66b5939..00000000 --- a/ldap/cm/newinst/ux-dialog.cc +++ /dev/null @@ -1,4346 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/********************************************************************* -** -** NAME: -** ux-dialog.cc -** -** DESCRIPTION: -** Netscape Directory Server Pre-installation Program -** Definitions for UI dialogs. -** -** NOTES: -** -** -*********************************************************************/ - -#if !defined(HPUX) || defined(_HP_NAMESPACE_STD) -#include <iostream> -#include <strstream> -#include <fstream> -using namespace std; -using std::ostrstream; -#else -/* older HP-UX compiler, using libstd 1 (no -AA) */ -#include <iostream.h> /* use old name on older systems */ -#include <strstream.h> -#include <fstream.h> -#endif - -#include <errno.h> -#include <stdio.h> -#include <unistd.h> -#include <ctype.h> -#include <string.h> -#include <strings.h> -#include "utf8.h" -#include "ux-util.h" -#include "dialog.h" -#include "ux-dialog.h" -#include "ux-config.h" -#include "install_keywords.h" -extern "C" { -#include "dsalib.h" -#include "nspr.h" -#include "plstr.h" -} - -static const char *DEFAULT_SLAPDUSER = "cn=Directory Manager"; - -// #define DEBUG 2 - -/* -** Forward References -*/ - -static DialogAction askSlapdPortSetup (Dialog *me); -static DialogAction askSlapdPortNext(Dialog *me); -static DialogAction askSlapdServerIDSetup (Dialog *me); -static DialogAction askSlapdServerIDNext(Dialog *me); -static DialogAction askSlapdRootDNSetup(Dialog *me); -static DialogAction askSlapdRootDNNext (Dialog *me); -static DialogAction askMCAdminIDSetup (Dialog *me); -static DialogAction askMCAdminIDNext (Dialog *me); -static DialogAction askReconfigMCAdminPwdSetup (Dialog *me); -static DialogAction askReconfigMCAdminPwdNext (Dialog *me); -static DialogAction askSlapdSuffixSetup (Dialog *me); -static DialogAction askSlapdSuffixNext (Dialog *me); -static DialogAction askSampleSetup (Dialog *me); -static DialogAction askSampleNext (Dialog *me); -static DialogAction askPopulateSetup (Dialog *me); -static DialogAction askPopulateNext (Dialog *me); -static DialogAction askOrgSizeSetup (Dialog *me); -static DialogAction askOrgSizeNext (Dialog *me); -static DialogAction askCIRSetup(Dialog *me); -static DialogAction askCIRNext(Dialog *me); -static DialogAction askCIRHostSetup(Dialog *me); -static DialogAction askCIRHostNext(Dialog *me); -static DialogAction askCIRPortSetup(Dialog *me); -static DialogAction askCIRPortNext(Dialog *me); -static DialogAction askCIRDNSetup(Dialog *me); -static DialogAction askCIRDNNext(Dialog *me); -static DialogAction askCIRSuffixSetup(Dialog *me); -static DialogAction askCIRSuffixNext(Dialog *me); -static DialogAction askCIRSSLSetup(Dialog *me); -static DialogAction askCIRSSLNext(Dialog *me); -static DialogAction askCIRIntervalSetup(Dialog *me); -static DialogAction askCIRIntervalNext(Dialog *me); -static DialogAction askCIRDaysSetup(Dialog *me); -static DialogAction askCIRDaysNext(Dialog *me); -static DialogAction askCIRTimesSetup(Dialog *me); -static DialogAction askCIRTimesNext(Dialog *me); -static DialogAction askSIRSetup(Dialog *me); -static DialogAction askSIRNext(Dialog *me); -static DialogAction askChangeLogSuffixSetup(Dialog *me); -static DialogAction askChangeLogSuffixNext(Dialog *me); -static DialogAction askChangeLogDirSetup(Dialog *me); -static DialogAction askChangeLogDirNext(Dialog *me); -static DialogAction askReplicationDNSetup(Dialog *me); -static DialogAction askReplicationDNNext(Dialog *me); -static DialogAction askReplicationSetup(Dialog *me); -static DialogAction askReplicationNext(Dialog *me); -static DialogAction askConsumerDNSetup(Dialog *me); -static DialogAction askConsumerDNNext(Dialog *me); -static DialogAction askSIRHostSetup(Dialog *me); -static DialogAction askSIRHostNext(Dialog *me); -static DialogAction askSIRPortSetup(Dialog *me); -static DialogAction askSIRPortNext(Dialog *me); -static DialogAction askSIRDNSetup(Dialog *me); -static DialogAction askSIRDNNext(Dialog *me); -static DialogAction askSIRSuffixSetup(Dialog *me); -static DialogAction askSIRSuffixNext(Dialog *me); -static DialogAction askSIRSSLSetup(Dialog *me); -static DialogAction askSIRSSLNext(Dialog *me); -static DialogAction askSIRDaysSetup(Dialog *me); -static DialogAction askSIRDaysNext(Dialog *me); -static DialogAction askSIRTimesSetup(Dialog *me); -static DialogAction askSIRTimesNext(Dialog *me); -static DialogAction askUseExistingMCSetup(Dialog *me); -static DialogAction askUseExistingMCNext(Dialog *me); -static DialogAction askMCHostSetup(Dialog *me); -static DialogAction askMCHostNext(Dialog *me); -static DialogAction askMCPortSetup(Dialog *me); -static DialogAction askMCPortNext(Dialog *me); -static DialogAction askMCDNSetup(Dialog *me); -static DialogAction askMCDNNext(Dialog *me); -static DialogAction askDisableSchemaCheckingSetup(Dialog *me); -static DialogAction askDisableSchemaCheckingNext(Dialog *me); -static DialogAction askMCAdminDomainSetup(Dialog *me); -static DialogAction askMCAdminDomainNext(Dialog *me); -static DialogAction askAdminDomainSetup(Dialog *me); -static DialogAction askAdminDomainNext(Dialog *me); -static DialogAction askUseExistingUGSetup(Dialog *me); -static DialogAction askUseExistingUGNext(Dialog *me); -static DialogAction askUGHostSetup(Dialog *me); -static DialogAction askUGHostNext(Dialog *me); -static DialogAction askUGPortSetup(Dialog *me); -static DialogAction askUGPortNext(Dialog *me); -static DialogAction askUGDNSetup(Dialog *me); -static DialogAction askUGDNNext(Dialog *me); -static DialogAction askUGSuffixSetup(Dialog *me); -static DialogAction askUGSuffixNext(Dialog *me); - -static int -isAValidDN(const char *dn_to_test) -{ - int ret = 1; - - if (!dn_to_test || !*dn_to_test) - { - ret = 0; - } - else - { - char **rdnList = ldap_explode_dn(dn_to_test, 0); - char **rdnNoTypes = ldap_explode_dn(dn_to_test, 1); - if (!rdnList || !rdnList[0] || !rdnNoTypes || !rdnNoTypes[0] || - !*rdnNoTypes[0] || !strcasecmp(rdnList[0], rdnNoTypes[0])) - { - ret = 0; - } - if (rdnList) - ldap_value_free(rdnList); - if (rdnNoTypes) - ldap_value_free(rdnNoTypes); - } - - if ((ret == 1) && ds_dn_uses_LDAPv2_quoting(dn_to_test)) - { - char *newdn = strdup(dn_to_test); - dn_normalize_convert(newdn); - char *oldlocaldn = UTF8ToLocal(dn_to_test); - char *newlocaldn = UTF8ToLocal(newdn); - free(newdn); - NSString msg = NSString( - "The given value [") + oldlocaldn + "] is quoted in the deprecated LDAPv2 style\n" + - "quoting format. It will be automatically converted to use the\n" + - "LDAPv3 style escaped format [" + newlocaldn + "]."; - DialogManagerType::showAlert(msg); - nsSetupFree(oldlocaldn); - nsSetupFree(newlocaldn); - } - - return ret; -} - -static int -contains8BitChars(const char *s) -{ - int ret = 0; - - if (s && *s) - { - for (; !ret && *s; ++s) - { - ret = (*s & 0x80); - } - } - - return ret; -} - -static int -rootDNPwdIsValid(const char *pwd) -{ - if (!pwd || !*pwd || (strlen(pwd) < 8)) - return 0; - - return !contains8BitChars(pwd); -} - -static int -isValid(const char *s) -{ - if (!s) - return 1; // null is a valid response (means to accept default) - - int ret = 1; - - char *ncs = (char *)s; // cast away const-ness for ldaputf8 stuff - // trim spaces from the beginning of the string - while (*ncs && ldap_utf8isspace(ncs)) - LDAP_UTF8INC(ncs); - - if (!*ncs) // empty string or all spaces - ret = 0; - - return ret; -} - -static int -isValidServerID(const char *s) -{ - if (!s || !*s) - return 0; - - if (!isValid(s)) - return 0; - - if (contains8BitChars(s)) - return 0; - - // server ID should contain alphanum, _, -, . since it will - // be used for both a filename and a DN component - const char *badChars = "`~!@#$%^&*()[]|\\\"\':;,+=/<>?"; - const char *p = s; - for (; *p && !strchr(badChars, *p); ++p) - ; - - if (!*p) // the string contains all valid chars - return 1; - - return 0; -} - -static int -isValidYesNo(const char *s) -{ - if (!s) - return 1; // null means accept default - - const char *msg = 0; - if (isValid(s)) - { - int len = strlen(s); - if (strncasecmp(s, "yes", len) && strncasecmp(s, "no", len)) - { - msg = "Please type yes or no."; - } - } - else - { - msg = "Please specify a valid string."; - } - - if (msg) - { - DialogManagerType::showAlert(msg); - return 0; - } - - return 1; -} - -static int -dialogSetup (Dialog *me, const char *which, const char *defaultAns) -{ - const char *ans = getManager(me)->getDefaultScript()->get(which); - if (!ans) - ans = getManager(me)->getAdminScript()->get(which); - if (!ans) - ans = getManager(me)->getBaseScript()->get(which); - - int status; - if (ans == NULL) - status = 0; - else - status = 1; -/* - int status = (int)ans; // 0 - there was already a value in the script - // not zero - no value already in script -*/ - if (ans) - me->setDefaultAns(ans); - else if (defaultAns) - me->setDefaultAns(defaultAns); - - return status; -} - -DialogInput askSlapdPort( -"The standard directory server network port number is 389. However, if\n" -"you are not logged as the superuser, or port 389 is in use, the\n" -"default value will be a random unused port number greater than 1024.\n" -"If you want to use port 389, make sure that you are logged in as the\n" -"superuser, that port 389 is not in use, and that you run the admin\n" -"server as the superuser.\n", - -"Directory server network port", - -NULL, - -askSlapdPortSetup, -askSlapdPortNext -); - -static DialogAction -askSlapdPortSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askSlapdPortSetup" << endl; -#endif - char tmp[10]; - int port = 389; - const char *defPort = - getManager(me)->getDefaultScript()->get(SLAPD_KEY_SERVER_PORT); - - if (defPort && *defPort && atoi(defPort) > 0) - { - PL_strncpyz(tmp, defPort, sizeof(tmp)); - port = atoi(defPort); - } - else - PR_snprintf(tmp, sizeof(tmp), "%d", port); - - // see if default port is available - if (InstUtil::portAvailable(port) == False) - { - // start with a random port number, and keep going until we find - // an available port - int origport = port = InstUtil::guessPort(); - while (InstUtil::portAvailable(port) == False) - { - ++port; - if (port > MAXPORT) - port = MINPORT; - if (port == origport) - { - port = -1; // NO AVAILABLE PORTS!!!!!!! - break; - } - } - } - - if (port == -1) // NO AVAILABLE PORTS!!!!!!! - { -#if DEBUG > 1 - cerr << "Leaving askSlapdPortSetup DIALOG_ERROR" << endl; -#endif - return DIALOG_ERROR; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SERVER_PORT, (long)port); - - dialogSetup(me, SLAPD_KEY_SERVER_PORT, tmp); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askSlapdPortSetup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - -#if DEBUG > 1 - cerr << "Leaving askSlapdPortSetup DIALOG_SAME" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askSlapdPortNext(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askSlapdPortNext" << endl; -#endif - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int port, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SERVER_PORT, tmp); - - port = atoi(tmp); - PR_snprintf(testbuf, sizeof(testbuf), "%d", port); - if (strncmp(testbuf, tmp, 6) || port > MAXPORT || port < 1) - { - PR_snprintf(testbuf, sizeof(testbuf), "OVERFLOW ERROR: Unable to bind to port %d\n" - "Please choose another port between 1 and %d.\n\n", - port, MAXPORT); - err = -1; - } - else if (InstUtil::portAvailable(port) == False) - { - PR_snprintf(testbuf, sizeof(testbuf), "ERROR: Unable to bind to port %d\n" - "Please choose another port.\n\n", port); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - -#if DEBUG > 1 - cerr << "Leaving askSlapdPortNext" << endl; -#endif - return DIALOG_NEXT; -} - -DialogInput askSlapdServerID( -"Each instance of a directory server requires a unique identifier.\n" -"Press Enter to accept the default, or type in another name and press\n" -"Enter.\n", - -"Directory server identifier", - -NULL, - -askSlapdServerIDSetup, -askSlapdServerIDNext -); - -static DialogAction -askSlapdServerIDSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askSlapdServerIDSetup" << endl; -#endif - // extract the hostname part of the FQDN - const char *tmp = 0; - char *basehost = 0; - if ((tmp = getManager(me)->getBaseScript()->get(SLAPD_KEY_FULL_MACHINE_NAME))) { - basehost = strdup(tmp); - } else { - basehost = strdup(InstUtil::guessHostname()); - } - if (!basehost) - return DIALOG_ERROR; - char *ptr = strchr(basehost, '.'); - if (ptr) - { - *ptr = 0; - } - else - { - free(basehost); - basehost = 0; - } - - const char *ans = - getManager(me)->getDefaultScript()->get(SLAPD_KEY_SERVER_IDENTIFIER); - - if (!ans && basehost) - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SERVER_IDENTIFIER, - basehost); - else if (!ans && !basehost) - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SERVER_IDENTIFIER, - InstUtil::guessHostname()); - - if (ans) - { - me->setDefaultAns(ans); - } - else if (basehost) - { - me->setDefaultAns(basehost); - } - else - { - me->setDefaultAns(InstUtil::guessHostname()); - } - - if (basehost) - free(basehost); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askSlapdServerIDSetup DIALOG_SAME" << endl; -#endif - return DIALOG_NEXT; - } - -#if DEBUG > 1 - cerr << "Leaving askSlapdServerIDSetup DIALOG_SAME" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askSlapdServerIDNext(Dialog *me) -{ - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - if (!tmp) - { - err = -1; - PR_snprintf(testbuf, sizeof(testbuf), "The name must not be empty"); - } - else if (!isValid(tmp)) - { - err = -1; - PR_snprintf(testbuf, sizeof(testbuf), "Please specify a valid value for the name."); - } - else if (contains8BitChars(tmp)) - { - err = -1; - PR_snprintf(testbuf, sizeof(testbuf), "The server ID must contain 7 bit ascii only."); - } - else if (!isValidServerID(tmp)) - { - err = -1; - PR_snprintf(testbuf, sizeof(testbuf), "The server ID must be a valid filename and DN component."); - } - - if (!err) - { - // see if an instance by the same name already exists - - NSString instanceDir = NSString( - getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ROOT) - ) + "/slapd-" + tmp; - if (InstUtil::fileExists(instanceDir)) - { - PR_snprintf(testbuf, sizeof(testbuf), "ERROR: a server instance named [%s] already exists." - " Please choose a unique name.\n", tmp); - err = -1; - } - } - - if (tmp) - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SERVER_IDENTIFIER, tmp); - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askMCAdminID( -"Please enter the administrator ID for the Fedora configuration\n" -"directory server. This is the ID typically used to log in to the\n" -"console. You will also be prompted for the password.\n", - -"Fedora configuration directory server\nadministrator ID", - -"admin", - -askMCAdminIDSetup, -askMCAdminIDNext -); - -static DialogAction -askMCAdminIDSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askMCAdminIDSetup" << endl; -#endif - if (getManager(me)->getAdminScript() && - getManager(me)->getAdminScript()->get(SLAPD_KEY_ADMIN_SERVER_ID) && - getManager(me)->getAdminScript()->get(SLAPD_KEY_ADMIN_SERVER_PWD)) - { - // see if the MC Admin ID has been provided - if (getManager(me)->getBaseScript() && - !(getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID) && - getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_PWD))) - { - getManager(me)->getBaseScript()->set( - SLAPD_KEY_SERVER_ADMIN_ID, - getManager(me)->getAdminScript()->get(SLAPD_KEY_ADMIN_SERVER_ID) - ); - getManager(me)->getBaseScript()->set( - SLAPD_KEY_SERVER_ADMIN_PWD, - getManager(me)->getAdminScript()->get(SLAPD_KEY_ADMIN_SERVER_PWD) - ); - } - } - - dialogSetup(me, SLAPD_KEY_SERVER_ADMIN_ID, "admin"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askMCAdminIDSetup setup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - - // this dialog is only used for creating the MC Admin; don't use it if - // we will be using an existing MC i.e. we are not creating the MC host - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { -#if DEBUG > 1 - cerr << "Leaving askMCAdminIDSetup DIALOG_NEXT" << endl; -#endif - return action; - } - -#if DEBUG > 1 - cerr << "Leaving askMCAdminIDSetup DIALOG_SAME" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askMCAdminIDNext(Dialog *me) -{ - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askMCAdminIDNext setup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - - const char *adminUser; - const char *adminPwd; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - adminUser = me->defaultAns(); - } - else - { - adminUser = buf; - } - - if (!isValid(adminUser)) - { - DialogManagerType::showAlert("Please enter a valid ID."); - return DIALOG_SAME; - } - else if (!isAValidDN(adminUser) && contains8BitChars(adminUser)) - { - DialogManagerType::showAlert("The user ID value must be 7 bit ASCII only."); - return DIALOG_SAME; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_ID, adminUser); - - while (1) - { -// cerr << "before password in askMCAdminIDNext" << endl; - me->showString("Password: "); -// cerr << "after password in askMCAdminIDNext" << endl; - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - continue; - } - else if (contains8BitChars(inp)) - { - DialogManagerType::showAlert("Password must contain 7 bit characters only."); - return DIALOG_SAME; - } - else if (!isValid(inp)) - { - DialogManagerType::showAlert("Please enter a valid password."); - return DIALOG_SAME; - } - else - { - me->showString("Password (again): "); - if (me->getPassword() == 0) - { - return DIALOG_PREV; - } - else - { - adminPwd = me->input(); - if (strcmp(inp,adminPwd)) - { - DialogManagerType::showAlert("Passwords don't match."); - return DIALOG_SAME; - } - break; - } - } - free(inp); - } - } - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_PWD, adminPwd); - return DIALOG_NEXT; -} - -DialogInput askSlapdSuffix( -"The suffix is the root of your directory tree. You may have more than\n" -"one suffix.\n", - -"Suffix", - -NULL, - -askSlapdSuffixSetup, -askSlapdSuffixNext -); - -static DialogAction -askSlapdSuffixSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return action; - - if (!getManager(me)->getDefaultScript()->get(SLAPD_KEY_SUFFIX)) { - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_SUFFIX, getManager(me)->getDefaultSuffix()); - } - - dialogSetup(me, SLAPD_KEY_SUFFIX, getManager(me)->getDefaultSuffix()); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSlapdSuffixNext(Dialog *me) -{ - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SUFFIX, val); - - // check the value to see if it is a valid DN - if (!isAValidDN(val)) - { - DialogManagerType::showAlert("A suffix must be a valid DN."); - return DIALOG_SAME; - } - else if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askSlapdRootDN( -"Certain directory server operations require an administrative user.\n" -"This user is referred to as the Directory Manager and typically has a\n" -"bind Distinguished Name (DN) of cn=Directory Manager. Press Enter to\n" -"accept the default value, or enter another DN. In either case, you\n" -"will be prompted for the password for this user. The password must\n" -"be at least 8 characters long.\n", - -"Directory Manager DN", - -DEFAULT_SLAPDUSER, - -askSlapdRootDNSetup, -askSlapdRootDNNext -); - -static DialogAction -askSlapdRootDNSetup(Dialog *me) -{ - if (!getManager(me)->getDefaultScript()->get(SLAPD_KEY_ROOTDN)) - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ROOTDN, - DEFAULT_SLAPDUSER); - - dialogSetup(me, SLAPD_KEY_ROOTDN, DEFAULT_SLAPDUSER); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSlapdRootDNNext(Dialog *me) -{ - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askSlapdRootDNNext setup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - - const char *slapdUser; - const char *slapdPwd; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - slapdUser = me->defaultAns(); - } - else - { - slapdUser = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ROOTDN, slapdUser); - - // check the value to see if it is a valid DN - if (!isAValidDN(slapdUser)) - { - DialogManagerType::showAlert("The Directory Manager must be a valid DN."); - return DIALOG_SAME; - } - else if (!isValid(slapdUser)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { -// cerr << "before password in askSlapdRootDNNext" << endl; - me->showString("Password: "); -// cerr << "after password in askSlapdRootDNNext" << endl; - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - continue; - } - else if (contains8BitChars(inp)) - { - DialogManagerType::showAlert("Password must contain 7 bit characters only."); - return DIALOG_SAME; - } - else if (!isValid(inp)) - { - DialogManagerType::showAlert("Please enter a valid password."); - return DIALOG_SAME; - } - else - { - me->showString("Password (again): "); - if (me->getPassword() == 0) - { - return DIALOG_PREV; - } - else - { - slapdPwd = me->input(); - if (strcmp(inp,slapdPwd)) - { - DialogManagerType::showAlert("Passwords don't match."); - return DIALOG_SAME; - } - else if (!rootDNPwdIsValid(inp)) - { - DialogManagerType::showAlert("Password must be at least 8 characters long"); - return DIALOG_SAME; - } - break; - } - } - free(inp); - } - } - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ROOTDNPWD, slapdPwd); - return DIALOG_NEXT; -} - -DialogYesNo askSample( -"You may install some sample entries in this directory instance. These\n" -"entries will be installed in a separate suffix and will not interfere\n" -"with the normal operation of the directory server.\n", - -"Do you want to install the sample entries?", - -"No", - -askSampleSetup, -askSampleNext -); - -static DialogAction -askSampleSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER)) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSampleNext(Dialog *me) -{ - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ADD_SAMPLE_ENTRIES, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - - return DIALOG_NEXT; -} - -DialogInput askPopulate( -"You may wish to populate your new directory instance with some data.\n" -"You may already have a file in LDIF format to use or some suggested\n" -"entries can be added. If you want to import entries from an LDIF\n" -"file, you may type in the full path and filename at the prompt. If\n" -"you want the install program to add the suggested entries, type the\n" -"word suggest at the prompt. The suggested entries are common\n" -"container entries under your specified suffix, such as ou=People and\n" -"ou=Groups, which are commonly used to hold the entries for the persons\n" -"and groups in your organization. If you do not want to add any of\n" -"these entries, type the word none at the prompt.\n", - -"Type the full path and filename, the word suggest, or the word none\n", - -"none", - -askPopulateSetup, -askPopulateNext -); - -static DialogAction -askPopulateSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER)) - return action; - - // if setting up a UG host, by default setup the suggested entries - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_INSTALL_LDIF_FILE, - "suggest"); - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ADD_ORG_ENTRIES, - "Yes"); - } - - dialogSetup(me, SLAPD_KEY_INSTALL_LDIF_FILE, "none"); - // max input buffer size is sizeof(Dialog::_buf)-1 - // Dialog::_buf is defined as char[MED_BUF] - me->setInputLen(MED_BUF-1); // it seems to get reset somewhere . . . - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askPopulateNext(Dialog *me) -{ - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER)) - return DIALOG_NEXT; - - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - if (buf && !strncasecmp(buf, "none", strlen(buf))) - { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ADD_ORG_ENTRIES, "No"); - getManager(me)->getDefaultScript()-> - set(SLAPD_KEY_INSTALL_LDIF_FILE, "none"); - } - else if (buf && !strncasecmp(buf, "suggest", strlen(buf))) - { - getManager(me)->getDefaultScript()-> - set(SLAPD_KEY_INSTALL_LDIF_FILE, "suggest"); - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ADD_ORG_ENTRIES, "Yes"); - } else { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_INSTALL_LDIF_FILE, buf); - if (!InstUtil::fileExists(buf)) - { - NSString msg = NSString("The specified filename ") + buf + "\n" + - "does not exist. Please try again.\n"; - DialogManagerType::showAlert(msg); - return DIALOG_SAME; - } - else - { - getManager(me)->getDefaultScript()-> - set(SLAPD_KEY_ADD_ORG_ENTRIES, "Yes"); - getManager(me)->getDefaultScript()-> - set(SLAPD_KEY_INSTALL_LDIF_FILE, buf); - } - } - - return DIALOG_NEXT; -} - -DialogInput askOrgSize( -"Your directory will be populated with entries based on the size of\n" -"your organization. The choices are small or large. Please specify 1\n" -"for small and 2 for large.\n", - -"Organization size (1 or 2)", - -"1", - -askOrgSizeSetup, -askOrgSizeNext -); - -static DialogAction -askOrgSizeSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER)) - return action; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_ADD_ORG_ENTRIES)) - return action; - else if (dialogSetup(me, SLAPD_KEY_ORG_SIZE, "1") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askOrgSizeNext(Dialog *me) -{ - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER)) - return DIALOG_NEXT; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_ADD_ORG_ENTRIES)) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int num, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_ORG_SIZE, tmp); - - num = atoi(tmp); - if (num != 1 && num != 2) - { - PR_snprintf(testbuf, sizeof(testbuf), "Please enter a 1 or a 2\n\n"); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogYesNo askReplication( -"Replication is used to duplicate all or part of a directory server to\n" -"another directory server. This can be used for failsafe purposes, to\n" -"ensure that the directory data is always online and up-to-date in case\n" -"one server goes down. It is also useful for distributing directory\n" -"data from a central main repository to remote directory servers.\n", - -"Do you want to configure this directory server\nto use replication?", - -"No", - -askReplicationSetup, -askReplicationNext -); - -static DialogAction -askReplicationSetup(Dialog *me) -{ - me = me; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askReplicationNext(Dialog *me) -{ - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_USE_REPLICATION, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_REPLICATION)) - { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SETUP_SUPPLIER, "No"); - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SETUP_CONSUMER, "No"); - } - - return DIALOG_NEXT; -} - -DialogYesNo askCIR( -"You may want to set up your directory server as a consumer server to\n" -"receive replicated entries from another directory server. The first\n" -"two of the following methods configure this server as a consumer:\n\n" -"1) The supplier server will push its entries to this server (SIR)\n" -"2) This server will pull the entries from the supplier (CIR)\n" -"3) This server will not be a consumer for replication (NONE)\n", - -"Do you want to set up this server as a consumer\n" -"for replication? (1, 2, or 3)", - -"3", - -askCIRSetup, -askCIRNext -); - -static DialogAction -askCIRSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_REPLICATION)) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_REPLICATION)) - return DIALOG_NEXT; - - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "3"; - } - - int val = atoi(buf); - if (!val || val < 1 || val > 3) - { - DialogManagerType::showAlert("Please enter a 1, 2, or 3."); - return DIALOG_SAME; - } - else if (val == 3) - { - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SETUP_CONSUMER, buf); - - return DIALOG_NEXT; -} - -DialogYesNo askSIR( -"You may want to set up your directory server as a supplier server to\n" -"replicate its entries to another directory server. The first two of\n" -"the following methods configure this server as a supplier:\n\n" -"1) This server will push its entries to another one (SIR)\n" -"2) Another server will pull entries from this one (CIR)\n" -"3) This server will not be a supplier for replication (NONE)\n", - -"Do you want to set up this server as a supplier\n" -"for replication? (1, 2, or 3)", - -"3", - -askSIRSetup, -askSIRNext -); - -static DialogAction -askSIRSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_REPLICATION)) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_REPLICATION)) - return DIALOG_NEXT; - - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "3"; - } - - int val = atoi(buf); - if (!val || val < 1 || val > 3) - { - DialogManagerType::showAlert("Please enter a 1, 2, or 3."); - return DIALOG_SAME; - } - else if (val == 3) - { - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SETUP_SUPPLIER, buf); - - return DIALOG_NEXT; -} - -DialogInput askCIRHost( -"Please specify the host name of the server from which the replicated\n" -"entries will be copied.\n", - -"Supplier host name", - -0, - -askCIRHostSetup, -askCIRHostNext -); - -static DialogAction -askCIRHostSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - else if (dialogSetup(me, SLAPD_KEY_CIR_HOST, 0) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRHostNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_HOST, tmp); - - if (!tmp || !isValid(tmp)) - { - DialogManagerType::showAlert("Please enter a valid hostname"); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askCIRPort( -"Please specify the port of the server from which the replicated\n" -"entries will be copied.\n", - -"Supplier port", - -"389", - -askCIRPortSetup, -askCIRPortNext -); - -static DialogAction -askCIRPortSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - const char *defaultPort = "389"; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_CIR_SECURITY_ON)) - defaultPort = "636"; - - if (dialogSetup(me, SLAPD_KEY_CIR_PORT, defaultPort) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRPortNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int port, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_PORT, tmp); - - port = atoi(tmp); - PR_snprintf(testbuf, sizeof(testbuf), "%d", port); - if (strncmp(testbuf, tmp, 6) || port > MAXPORT || port < 1) - { - PR_snprintf(testbuf, sizeof(testbuf), "OVERFLOW ERROR: Unable to bind to port %d\n" - "Please choose another port between 1 and %d.\n\n", - port, MAXPORT); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askCIRDN( -"Replication requires that this consumer has access to the portion of\n" -"the remote directory to be replicated. This requires a bind DN and\n" -"password for access to the supplier. You will first be asked for the\n" -"bind DN, then the password.\n", - -"Replication DN", - -NULL, - -askCIRDNSetup, -askCIRDNNext -); - -static DialogAction -askCIRDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CIR_BINDDN, getManager(me)->getConsumerDN()) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRDNNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *slapdUser; - char *slapdPwd = 0; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - slapdUser = me->defaultAns(); - } - else - { - slapdUser = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_BINDDN, slapdUser); - - // check to see if it is a valid DN - if (!isAValidDN(slapdUser)) - { - DialogManagerType::showAlert("The consumer must be a valid DN."); - return DIALOG_SAME; - } - else if (!isValid(slapdUser)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - free(inp); - continue; - } - else - { - slapdPwd = inp; - break; - } - } - } - - if (slapdPwd) - { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_BINDDNPWD, slapdPwd); - free(slapdPwd); - } - - return DIALOG_NEXT; -} - -DialogInput askCIRSuffix( -"Please enter the full DN of the part of the tree to replicate,\n" -"including the suffix (e.g. ou=People, o=company.com).\n", - -"Enter the directory path", - -NULL, - -askCIRSuffixSetup, -askCIRSuffixNext -); - -static DialogAction -askCIRSuffixSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CIR_SUFFIX, getManager(me)->getDefaultSuffix()) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRSuffixNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_SUFFIX, val); - - // check val to see if it is a valid DN - if (!isAValidDN(val)) - { - DialogManagerType::showAlert("The suffix must be a valid DN."); - return DIALOG_SAME; - } - if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - int status; - if ((status = getManager(me)->verifyRemoteLdap( - SLAPD_KEY_CIR_HOST, - SLAPD_KEY_CIR_PORT, - SLAPD_KEY_CIR_SUFFIX, - SLAPD_KEY_CIR_BINDDN, - SLAPD_KEY_CIR_BINDDNPWD - )) - ) - { - ostrstream msg; - msg << "Could not connect to ldap://" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_CIR_HOST) - << ":" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_CIR_PORT) - << "/" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_CIR_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_CIR_BINDDN) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The replication agreement will be created anyway. Proceeding..." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_NEXT; - } - - return DIALOG_NEXT; -} - -DialogYesNo askCIRSSL( -"You may use SSL authentication for replication if you have enabled it\n" -"on the remote server.\n", - -"Do you want to use SSL?", - -"No", - -askCIRSSLSetup, -askCIRSSLNext -); - -static DialogAction -askCIRSSLSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRSSLNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_SECURITY_ON, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - - return DIALOG_NEXT; -} - -DialogInput askCIRInterval( -"Please specify the time interval to check the remote server for new\n" -"entries to be replicated. Use the directory server console to set up\n" -"more fine-grained control. Specify the time in minutes. Use a 0\n" -"(zero) to indicate that changes should be propagated immediately all\n" -"the time.\n", - -"Replication Sync Interval (in minutes)", - -"10", - -askCIRIntervalSetup, -askCIRIntervalNext -); - -static DialogAction -askCIRIntervalSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CIR_INTERVAL, "10") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRIntervalNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int interval, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_INTERVAL, tmp); - - interval = atoi(tmp); - if (!isdigit((*tmp)) || interval < 0) - { - PR_snprintf(testbuf, sizeof(testbuf), "Please specify an integer greater than or equal to 0"); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askChangeLogSuffix( -"Changes to the database will be kept under a separate suffix in the\n" -"directory tree. These changes are used to replicate changes to other\n" -"directory servers.\n", - -"Changelog suffix", - -"cn=changelog", - -askChangeLogSuffixSetup, -askChangeLogSuffixNext -); - -static DialogAction -askChangeLogSuffixSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER)) - return action; - - if (dialogSetup(me, SLAPD_KEY_CHANGELOGSUFFIX, "cn=changelog") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askChangeLogSuffixNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER)) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CHANGELOGSUFFIX, val); - - // check to see if val is a valid DN - if (!isAValidDN(val)) - { - DialogManagerType::showAlert("The ChangeLog suffix must be a valid DN"); - return DIALOG_SAME; - } - else if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askChangeLogDir( -"Changes to the main database will be kept in a separate database\n" -"stored in a separate directory path, usually under your server\n" -"instance directory.\n", - -"Changelog database\n" -"directory", - -NULL, - -askChangeLogDirSetup, -askChangeLogDirNext -); - -static DialogAction -askChangeLogDirSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER)) - return action; - - NSString dir = NSString( - getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ROOT) - ) + "/slapd-" + - getManager(me)->getDefaultScript()->get(SLAPD_KEY_SERVER_IDENTIFIER) + - "/logs/changelogdb"; - if (dialogSetup(me, SLAPD_KEY_CHANGELOGDIR, dir) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askChangeLogDirNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER)) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CHANGELOGDIR, val); - - if (InstUtil::dirExists(val) && !InstUtil::dirWritable(val)) - { - DialogManagerType::showAlert("You do not have access to that directory. Please try again."); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askReplicationDN( -"In order to allow remote servers to replicate new entries to this\n" -"server, the remote server must have the ability to bind to this server\n" -"as some entity with permission to do so. The Supplier DN is the DN of\n" -"the entity the remote server will use to connect to this server to\n" -"supply updates. The Supplier DN also requires a password which you\n" -"will be prompted for after the DN.\n", - -"Supplier Bind DN", - -"cn=supplier", - -askReplicationDNSetup, -askReplicationDNNext -); - -static DialogAction -askReplicationDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "1")) - return action; - - if (dialogSetup(me, SLAPD_KEY_REPLICATIONDN, "cn=supplier") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askReplicationDNNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "1")) - return DIALOG_NEXT; - - const char *replicationdn; - const char *replicationpw; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - replicationdn = me->defaultAns(); - } - else - { - replicationdn = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_REPLICATIONDN, replicationdn); - - // check to see if it is a valid DN - if (!isAValidDN(replicationdn)) - { - DialogManagerType::showAlert("The Supplier Bind DN must be a valid DN"); - return DIALOG_SAME; - } - if (!isValid(replicationdn)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - continue; - } - else if (contains8BitChars(inp)) - { - DialogManagerType::showAlert("Password must contain 7 bit characters only."); - return DIALOG_SAME; - } - else if (!isValid(inp)) - { - DialogManagerType::showAlert("Please enter a valid password."); - return DIALOG_SAME; - } - else - { - me->showString("Password (again): "); - if (me->getPassword() == 0) - { - return DIALOG_PREV; - } - else - { - replicationpw = me->input(); - if (strcmp(inp,replicationpw)) - { - DialogManagerType::showAlert("Passwords don't match."); - return DIALOG_SAME; - } - break; - } - } - free(inp); - } - } - getManager(me)->getDefaultScript()->set(SLAPD_KEY_REPLICATIONPWD, replicationpw); - return DIALOG_NEXT; -} - -DialogInput askConsumerDN( -"In order to allow remote servers to replicate new entries from this\n" -"server, the remote server must have the ability to bind to this server\n" -"as some entity with permission to do so. The Consumer DN is the DN of\n" -"the entity the remote server will use to connect to this server to\n" -"pull the new entries. This entity will have access to the entire\n" -"database as well as the changelog entries. The Consumer DN also\n" -"requires a password which you will be prompted for after the DN. If\n" -"you leave this entry blank, no consumer bind DN will be created. The\n" -"default is no consumer bind DN.\n", - -"Consumer Bind DN", - -NULL, - -askConsumerDNSetup, -askConsumerDNNext -); - -static DialogAction -askConsumerDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CONSUMERDN, 0) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askConsumerDNNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "2")) - return DIALOG_NEXT; - - const char *consumerdn; - const char *consumerpw; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - consumerdn = me->defaultAns(); - } - else - { - consumerdn = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CONSUMERDN, consumerdn); - - if (!consumerdn || !*consumerdn || - !strncasecmp(consumerdn, "none", strlen(consumerdn))) - { - getManager(me)->getDefaultScript()->remove(SLAPD_KEY_CONSUMERDN); - return DIALOG_NEXT; - } - - // check to see if it is a valid dn - if (!isAValidDN(consumerdn)) - { - DialogManagerType::showAlert("The Consumer Bind DN must be a valid DN"); - return DIALOG_SAME; - } - else if (!isValid(consumerdn)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - continue; - } - else if (contains8BitChars(inp)) - { - DialogManagerType::showAlert("Password must contain 7 bit characters only."); - return DIALOG_SAME; - } - else if (!isValid(inp)) - { - DialogManagerType::showAlert("Please enter a valid password."); - return DIALOG_SAME; - } - else - { - me->showString("Password (again): "); - if (me->getPassword() == 0) - { - return DIALOG_PREV; - } - else - { - consumerpw = me->input(); - if (strcmp(inp,consumerpw)) - { - DialogManagerType::showAlert("Passwords don't match."); - return DIALOG_SAME; - } - break; - } - } - free(inp); - } - } - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CONSUMERPWD, consumerpw); - return DIALOG_NEXT; -} - -DialogInput askSIRHost( -"Please specify the host name of the server to which the replicated\n" -"entries will be pushed.\n", - -"Consumer host name", - -0, - -askSIRHostSetup, -askSIRHostNext -); - -static DialogAction -askSIRHostSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - else if (dialogSetup(me, SLAPD_KEY_SIR_HOST, 0) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRHostNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_HOST, tmp); - - if (!tmp || !isValid(tmp)) - { - DialogManagerType::showAlert("Please enter a valid hostname"); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askSIRPort( -"Please specify the port of the server to which the replicated entries\n" -"will be pushed.\n", - -"Consumer port", - -"389", - -askSIRPortSetup, -askSIRPortNext -); - -static DialogAction -askSIRPortSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - const char *defaultPort = "389"; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_SIR_SECURITY_ON)) - defaultPort = "636"; - - if (dialogSetup(me, SLAPD_KEY_SIR_PORT, defaultPort) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRPortNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int port, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_PORT, tmp); - - port = atoi(tmp); - PR_snprintf(testbuf, sizeof(testbuf), "%d", port); - if (strncmp(testbuf, tmp, 6) || port > MAXPORT || port < 1) - { - PR_snprintf(testbuf, sizeof(testbuf), "OVERFLOW ERROR: Unable to bind to port %d\n" - "Please choose another port between 1 and %d.\n\n", - port, MAXPORT); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askSIRDN( -"Replication requires that this supplier has access to the portion of\n" -"the remote directory to be replicated. This requires a bind DN and\n" -"password for access to the consumer. You will first be asked for the\n" -"bind DN, then the password. This is the same as the Supplier DN on\n" -"the consumer.\n", - -"Replication DN on the Consumer", - -"cn=supplier", - -askSIRDNSetup, -askSIRDNNext -); - -static DialogAction -askSIRDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - if (dialogSetup(me, SLAPD_KEY_SIR_BINDDN, "cn=supplier") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRDNNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *slapdUser; - char *slapdPwd = 0; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - slapdUser = me->defaultAns(); - } - else - { - slapdUser = buf; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_BINDDN, slapdUser); - - // check to see if it is a valid dn - if (!isAValidDN(slapdUser)) - { - DialogManagerType::showAlert("The Consumer Replication DN must be a valid DN"); - return DIALOG_SAME; - } - else if (!isValid(slapdUser)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - free(inp); - continue; - } - else - { - slapdPwd = inp; - break; - } - } - } - - if (slapdPwd) - { - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_BINDDNPWD, slapdPwd); - free(slapdPwd); - } - - return DIALOG_NEXT; -} - -DialogInput askSIRSuffix( -"Please enter the full DN of the part of the tree to replicate,\n" -"including the suffix (e.g. ou=People, o=company.com).\n", - -"Directory path (DN)", - -NULL, - -askSIRSuffixSetup, -askSIRSuffixNext -); - -static DialogAction -askSIRSuffixSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - if (dialogSetup(me, SLAPD_KEY_SIR_SUFFIX, getManager(me)->getDefaultSuffix()) && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRSuffixNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_SUFFIX, val); - - // check to see if it is a valid dn - if (!isAValidDN(val)) - { - DialogManagerType::showAlert("The suffix must be a valid DN"); - return DIALOG_SAME; - } - else if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - int status; - if ((status = getManager(me)->verifyRemoteLdap( - SLAPD_KEY_SIR_HOST, - SLAPD_KEY_SIR_PORT, - SLAPD_KEY_SIR_SUFFIX, - SLAPD_KEY_SIR_BINDDN, - SLAPD_KEY_SIR_BINDDNPWD - )) - ) - { - ostrstream msg; - msg << "Could not connect to ldap://" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_HOST) - << ":" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_PORT) - << "/" - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_BINDDN) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The replication agreement will be created anyway. Proceeding..." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_NEXT; - } - - return DIALOG_NEXT; -} - -DialogYesNo askSIRSSL( -"You may use SSL authentication for replication if you have enabled it\n" -"on the remote server.\n", - -"Do you want to use SSL?", - -"No", - -askSIRSSLSetup, -askSIRSSLNext -); - -static DialogAction -askSIRSSLSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRSSLNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_SECURITY_ON, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - - return DIALOG_NEXT; -} - -DialogInput askCIRDays( -"Please enter the days of the week on which you would like replication\n" -"to occur. The days are specified by a number. For example, use 0 for\n" -"Sunday, 1 for Monday, etc. Use 6 for Saturday. You may not specify a\n" -"number greater than 6 or less than 0. The numbers should be entered\n" -"one after another in a list. For example, 0123 would be Sunday,\n" -"Monday, Tuesday, and Wednesday. 06 would be Sunday and Saturday. The\n" -"default is everyday.\n", - -"Enter the replication days", - -"all", - -askCIRDaysSetup, -askCIRDaysNext -); - -static DialogAction -askCIRDaysSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CIR_DAYS, "all") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - const char *tmp; - if ((tmp = getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_DAYS)) && - !*tmp) - me->setDefaultAns("all"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRDaysNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_DAYS, val); - - int status = 0; - ostrstream msg; - - char realval[8] = "-------"; - if (!strncasecmp(val, "all", strlen(val))) - strcpy(realval, ""); // default is everyday - else - { - for (const char *ptr = val; *ptr; ++ptr) - { - if (!isdigit(*ptr)) - { - msg << "The string [" << val << "] contains non-digit characters." - << " Please re enter the string." << ends; - status = 1; - break; - } - - int ival = (int)(*ptr) - (int)'0'; - if (ival > 6) - { - msg << "The string contains an invalid value [" << ival << "]." - << " Please re enter the string." << ends; - status = 2; - break; - } - - // this step makes sure we get the numbers in order with no duplicates - realval[ival] = *ptr; - } - - if (status) - { - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - - // realval now contains a string like - // 0---4-6, but we really want 046 - int index = 0; - for (char *p2 = realval; *p2; ++p2) - { - if (*p2 != '-') - realval[index++] = *p2; - } - realval[index] = 0; - - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_DAYS, realval); - - return DIALOG_NEXT; -} - -DialogInput askSIRDays( -"Please enter the days of the week on which you would like replication\n" -"to occur. The days are specified by a number. For example, use 0 for\n" -"Sunday, 1 for Monday, etc. Use 6 for Saturday. You may not specify a\n" -"number greater than 6 or less than 0. The numbers should be entered\n" -"one after another in a list. For example, 0123 would be Sunday,\n" -"Monday, Tuesday, and Wednesday. 06 would be Sunday and Saturday. The\n" -"default is everyday.\n", - -"Enter the replication days", - -"all", - -askSIRDaysSetup, -askSIRDaysNext -); - -static DialogAction -askSIRDaysSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - if (dialogSetup(me, SLAPD_KEY_SIR_DAYS, "all") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - const char *tmp; - if ((tmp = getManager(me)->getDefaultScript()->get(SLAPD_KEY_SIR_DAYS)) && - !*tmp) - me->setDefaultAns("all"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRDaysNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_DAYS, val); - - int status = 0; - ostrstream msg; - - char realval[8] = "-------"; - if (!strncasecmp(val, "all", strlen(val))) - strcpy(realval, ""); // default is everyday - else - { - for (const char *ptr = val; *ptr; ++ptr) - { - if (!isdigit(*ptr)) - { - msg << "The string [" << val << "] contains non-digit characters." - << " Please re enter the string." << ends; - status = 1; - break; - } - - int ival = (int)(*ptr) - (int)'0'; - if (ival > 6) - { - msg << "The string contains an invalid value [" << ival << "]." - << " Please re enter the string." << ends; - status = 2; - break; - } - - // this step makes sure we get the numbers in order with no duplicates - realval[ival] = *ptr; - } - - if (status) - { - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - - // realval now contains a string like - // 0---4-6, but we really want 046 - int index = 0; - for (char *p2 = realval; *p2; ++p2) - { - if (*p2 != '-') - realval[index++] = *p2; - } - realval[index] = 0; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_DAYS, realval); - - return DIALOG_NEXT; -} - -DialogInput askCIRTimes( -"Please enter the time of day you would like replication to occur. The\n" -"time is specified as a range in the form HHMM-HHMM in 24 hour time.\n" -"HH represents the hour portion of the time, and MM the minutes.\n" -"Numbers less than 10 should be preceeded by a 0. For example, to\n" -"enable replication between 1 am and 4:30 am, specify 0100-0430. To\n" -"specify 11 am to 9 pm, use 1100-2100. 12 am to 12:59 am is specified\n" -"as 0000-0059. The default is all day.\n", - -"Enter the replication times", - -"all day", - -askCIRTimesSetup, -askCIRTimesNext -); - -static DialogAction -askCIRTimesSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return action; - - if (dialogSetup(me, SLAPD_KEY_CIR_TIMES, "all day") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askCIRTimesNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_CONSUMER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_CONSUMER), "2")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - if (!strncasecmp(val, "all day", strlen(val))) - { - val = ""; - getManager(me)->getDefaultScript()->set(SLAPD_KEY_CIR_TIMES, val); - return DIALOG_NEXT; - } - - int status = 0; - ostrstream msg; - - int pos = 0; - // format should be HHMM-HHMM - int maxvals[9] = {0, 23, 0, 59, 0, 0, 23, 0, 59}; - char teststr[3]; // 2 digits plus \0 - int testindex = 0; - for (const char *ptr = val; *ptr; ++ptr, ++pos) - { - // position 4 should contain the '-' - if (pos == 4 && *ptr != '-') - { - msg << "The time specification [" << val << "] is invalid.\n" - << "Please re enter the string." << ends; - status = 1; - break; - } - else if (pos == 4) - continue; - - if (!isdigit(*ptr) && pos != 4) - { - msg << "The time specification [" << val << "] contains non-digit characters.\n" - << "Please re enter the string." << ends; - status = 2; - break; - } - - teststr[testindex++] = *ptr; - if (pos == 1 || pos == 3 || pos == 6 || pos == 8) - { - teststr[testindex] = 0; - testindex = 0; - if (teststr[0] == '0') - teststr[0] = ' '; - int ival = atoi(teststr); - if (ival > maxvals[pos]) - { - msg << "The string contains an invalid value [" << ival << "].\n" - << "Please re enter the string." << ends; - status = 3; - break; - } - } - } - - if (pos != 9) - { - msg << "The string [" << val << "] is invalid.\n" - << "Please re enter the string." << ends; - status = 4; - } - - if (status) - { - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askSIRTimes( -"Please enter the time of day you would like replication to occur. The\n" -"time is specified as a range in the form HHMM-HHMM in 24 hour time.\n" -"HH represents the hour portion of the time, and MM the minutes.\n" -"Numbers less than 10 should be preceeded by a 0. For example, to\n" -"enable replication between 1 am and 4:30 am, specify 0100-0430. To\n" -"specify 11 am to 9 pm, use 1100-2100. 12 am to 12:59 am is specified\n" -"as 0000-0059. The default is all day.\n", - -"Enter the replication times", - -"all day", - -askSIRTimesSetup, -askSIRTimesNext -); - -static DialogAction -askSIRTimesSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return action; - - if (dialogSetup(me, SLAPD_KEY_SIR_TIMES, "all day") && - getManager(me)->installMode() == Silent) - return DIALOG_ERROR; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askSIRTimesNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_SETUP_SUPPLIER) || - strcmp(getManager(me)->getDefaultScript()->get(SLAPD_KEY_SETUP_SUPPLIER), "1")) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - if (!strncasecmp(val, "all day", strlen(val))) - { - val = ""; - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SIR_TIMES, val); - return DIALOG_NEXT; - } - - int status = 0; - ostrstream msg; - - int pos = 0; - // format should be HHMM-HHMM - int maxvals[9] = {0, 23, 0, 59, 0, 0, 23, 0, 59}; - char teststr[3]; // 2 digits plus \0 - int testindex = 0; - for (const char *ptr = val; *ptr; ++ptr, ++pos) - { - // position 4 should contain the '-' - if (pos == 4 && *ptr != '-') - { - msg << "The time specification [" << val << "] is invalid.\n" - << "Please re enter the string." << ends; - status = 1; - break; - } - else if (pos == 4) - continue; - - if (!isdigit(*ptr) && pos != 4) - { - msg << "The time specification [" << val << "] contains non-digit characters.\n" - << "Please re enter the string." << ends; - status = 2; - break; - } - - teststr[testindex++] = *ptr; - if (pos == 1 || pos == 3 || pos == 6 || pos == 8) - { - teststr[testindex] = 0; - testindex = 0; - if (teststr[0] == '0') - teststr[0] = ' '; - int ival = atoi(teststr); - if (ival > maxvals[pos]) - { - msg << "The string contains an invalid value [" << ival << "].\n" - << "Please re enter the string." << ends; - status = 3; - break; - } - } - } - - if (pos != 9) - { - msg << "The string [" << val << "] is invalid.\n" - << "Please re enter the string." << ends; - status = 4; - } - - if (status) - { - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogYesNo askUseExistingMC( -"Fedora server information is stored in the Fedora configuration\n" -"directory server, which you may have already set up. If so, you\n" -"should configure this server to be managed by the configuration\n" -"server. To do so, the following information about the configuration\n" -"server is required: the fully qualified host name of the form\n" -"<hostname>.<domainname>(e.g. hostname.domain.com), the port number,\n" -"the suffix, and the DN and password of a user having permission to\n" -"write the configuration information, usually the Fedora\n" -"configuration directory administrator.\n\n" -"If you want to install this software as a standalone server, or if you\n" -"want this instance to serve as your Fedora configuration directory\n" -"server, press Enter.\n", - -"Do you want to register this software with an existing\n" -"Fedora configuration directory server?", - -"No", - -askUseExistingMCSetup, -askUseExistingMCNext -); - -static DialogAction -askUseExistingMCSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askUseExistingMCSetup" << endl; -#endif - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - - if (action != DIALOG_PREV) - { - if (getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_URL)) - { - // tell the instance creator not to create the Config entries - // new instance - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_USE_EXISTING_MC, "Yes"); - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_SLAPD_CONFIG_FOR_MC, "No"); - } - else - { - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_USE_EXISTING_MC, "No"); - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_SLAPD_CONFIG_FOR_MC, "Yes"); - } - } - - dialogSetup(me, SLAPD_KEY_USE_EXISTING_MC, "No"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askUseExistingMCSetup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - -#if DEBUG > 1 - cerr << "Leaving askUseExistingMCSetup DIALOG_SAME" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askUseExistingMCNext(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askUseExistingMCNext" << endl; -#endif - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_USE_EXISTING_MC, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - -#if DEBUG > 1 - cerr << "Leaving askUseExistingMCNext" << endl; -#endif - return DIALOG_NEXT; -} - -DialogInput askMCHost( -"Enter the fully qualified domain name of the Fedora configuration\n" -"directory server host in the form <hostname>.<domainname>\n" -"(e.g. hostname.domain.com).\n", - -"Fedora configuration directory server\nhost name", - -0, - -askMCHostSetup, -askMCHostNext -); - -static DialogAction -askMCHostSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askMCHostNext(Dialog *me) -{ - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_K_LDAP_HOST, tmp); - - if (!tmp || !isValid(tmp)) - { - DialogManagerType::showAlert("Please enter a valid hostname"); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askMCPort( -"Please specify the port number on which the Fedora configuration\n" -"directory server listens.\n", - -"Fedora configuration directory server\nport number", - -"389", - -askMCPortSetup, -askMCPortNext -); - -static DialogAction -askMCPortSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return action; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askMCPortNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int port, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_K_LDAP_PORT, tmp); - - port = atoi(tmp); - PR_snprintf(testbuf, sizeof(testbuf), "%d", port); - if (strncmp(testbuf, tmp, 6) || port > MAXPORT || port < 1) - { - PR_snprintf(testbuf, sizeof(testbuf), "OVERFLOW ERROR: Unable to bind to port %d\n" - "Please choose another port between 1 and %d.\n\n", - port, MAXPORT); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askMCDN( -"To write configuration information into the Fedora configuration\n" -"directory, you must bind to the server as an entity with the\n" -"appropriate permissions. Usually, the Fedora configuration\n" -"directory administrator is used for this purpose, although you can\n" -"give other directory accounts the proper access.\n", - -"Fedora configuration directory server\nadministrator ID", - -0, - -askMCDNSetup, -askMCDNNext -); - -static DialogAction -askMCDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return action; - - dialogSetup(me, SLAPD_KEY_SERVER_ADMIN_ID, "admin"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askMCDNNext(Dialog *me) -{ - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - const char *slapdUser; - char *slapdPwd = 0; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - slapdUser = me->defaultAns(); - } - else - { - slapdUser = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_ID, slapdUser); - - if (!isValid(slapdUser)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - free(inp); - continue; - } - else - { - slapdPwd = inp; - break; - } - } - } - - if (slapdPwd) - { - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_PWD, slapdPwd); - free(slapdPwd); - - int status; - if ((status = getManager(me)->verifyRemoteLdap( - SLAPD_KEY_K_LDAP_HOST, - SLAPD_KEY_K_LDAP_PORT, - SLAPD_KEY_BASE_SUFFIX, - SLAPD_KEY_SERVER_ADMIN_ID, - SLAPD_KEY_SERVER_ADMIN_PWD - )) - ) - { - ostrstream msg; - msg << "Could not connect to ldap://" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_HOST) - << ":" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_PORT) - << "/" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_BASE_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The installation cannot proceed." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - else if ((getManager(me)->installType() < Custom) && - (status = getManager(me)->verifyAdminDomain( - SLAPD_KEY_K_LDAP_HOST, - SLAPD_KEY_K_LDAP_PORT, - SLAPD_KEY_BASE_SUFFIX, - SLAPD_KEY_ADMIN_DOMAIN, - SLAPD_KEY_SERVER_ADMIN_ID, - SLAPD_KEY_SERVER_ADMIN_PWD - )) - ) - { - ostrstream msg; - msg << "Could not find the Admin Domain " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_ADMIN_DOMAIN) - << " in the server" << endl << "ldap://" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_HOST) - << ":" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_PORT) - << "/" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_BASE_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID) - << " status = " << status << endl - << "You may need to re-run setup in Custom mode in order to specify" - << endl - << "the correct Admin Domain." - << endl - << "The installation cannot proceed." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - } - - // tell the instance creator not to create the config entries in the - // new instance - getManager(me)->getDefaultScript()->set(SLAPD_KEY_SLAPD_CONFIG_FOR_MC, "No"); - - return DIALOG_NEXT; -} - -DialogYesNo askDisableSchemaChecking( -"If you are going to import an old database immediately after or during\n" -"installation, and you think you may have problems with your old\n" -"schema, you may want to turn off schema checking until after the\n" -"import. If you choose to do this, schema checking will remain off\n" -"until you manually turn it back on. Fedora recommends that you turn\n" -"it back on as soon as possible.\n", - -"Do you want to disable schema checking?", - -"No", - -askDisableSchemaCheckingSetup, -askDisableSchemaCheckingNext -); - -static DialogAction -askDisableSchemaCheckingSetup(Dialog *me) -{ - me = me; - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askDisableSchemaCheckingNext(Dialog *me) -{ - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_DISABLE_SCHEMA_CHECKING, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - - return DIALOG_NEXT; -} - -DialogInput askMCAdminDomain( -"The Administration Domain is a part of the configuration directory\n" -"server used to store information about Fedora software. If you are\n" -"managing multiple software releases at the same time, or managing\n" -"information about multiple domains, you may use the Administration\n" -"Domain to keep them separate.\n\n" -"If you are not using administrative domains, press Enter to select the\n" -"default. Otherwise, enter some descriptive, unique name for the\n" -"administration domain, such as the name of the organization responsible\n" -"for managing the domain.\n", - -"Administration Domain", - -NULL, - -askMCAdminDomainSetup, -askMCAdminDomainNext -); - -static DialogAction -askMCAdminDomainSetup(Dialog *me) -{ - if (!getManager(me)->getBaseScript()->get(SLAPD_KEY_ADMIN_DOMAIN)) { - getManager(me)->getBaseScript()->set( - SLAPD_KEY_ADMIN_DOMAIN, getManager(me)->getDNSDomain()); - } - - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { -#if DEBUG > 1 - cerr << "leaving askMCAdminDomainSetup " << action << endl; -#endif - return action; - } - - // if we are creating the Configuration server, the admin domain will not - // yet exist, and we need to ask the user to create one. Otherwise, we are - // installing into an existing one - - dialogSetup(me, SLAPD_KEY_ADMIN_DOMAIN, getManager(me)->getDNSDomain()); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askMCAdminDomainNext(Dialog *me) -{ - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - const char *buf; - int status = 0; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getBaseScript()->set(SLAPD_KEY_ADMIN_DOMAIN, val); - - if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - else if (isAValidDN(val)) - { - DialogManagerType::showAlert("A DN is not allowed here. Please enter a valid string."); - return DIALOG_SAME; - } - else if ((status = getManager(me)->verifyAdminDomain( - SLAPD_KEY_K_LDAP_HOST, - SLAPD_KEY_K_LDAP_PORT, - SLAPD_KEY_BASE_SUFFIX, - SLAPD_KEY_ADMIN_DOMAIN, - SLAPD_KEY_SERVER_ADMIN_ID, - SLAPD_KEY_SERVER_ADMIN_PWD - )) - ) - { - ostrstream msg; - msg << "Could not find the Admin Domain " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_ADMIN_DOMAIN) - << " in the server" << endl << "ldap://" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_HOST) - << ":" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_PORT) - << "/" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_BASE_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The installation cannot proceed." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askAdminDomain( -"The Administration Domain is a part of the configuration directory\n" -"server used to store information about Fedora software. If you are\n" -"managing multiple software releases at the same time, or managing\n" -"information about multiple domains, you may use the Administration\n" -"Domain to keep them separate.\n\n" -"If you are not using administrative domains, press Enter to select the\n" -"default. Otherwise, enter some descriptive, unique name for the\n" -"administration domain, such as the name of the organization responsible\n" -"for managing the domain.\n", - -"Administration Domain", - -NULL, - -askAdminDomainSetup, -askAdminDomainNext -); - -static DialogAction -askAdminDomainSetup(Dialog *me) -{ - if (!getManager(me)->getBaseScript()->get(SLAPD_KEY_ADMIN_DOMAIN)) { - getManager(me)->getBaseScript()->set( - SLAPD_KEY_ADMIN_DOMAIN, getManager(me)->getDNSDomain()); - } - - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return action; - - // if we are creating the Configuration server, the admin domain will not - // yet exist, and we need to ask the user to create one. Otherwise, we are - // installing into an existing one - - dialogSetup(me, SLAPD_KEY_ADMIN_DOMAIN, getManager(me)->getDNSDomain()); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askAdminDomainNext(Dialog *me) -{ - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getBaseScript()->set(SLAPD_KEY_ADMIN_DOMAIN, val); - - if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - if (isAValidDN(val)) - { - DialogManagerType::showAlert("A DN is not allowed here. Please enter a valid string."); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogYesNo askUseExistingUG( -"If you already have a directory server you want to use to store your\n" -"data, such as user and group information, answer Yes to the following\n" -"question. You will be prompted for the host, port, suffix, and bind\n" -"DN to use for that directory server.\n\n" -"If you want this directory server to store your data, answer No.\n", - -"Do you want to use another directory to store your data?", - -"No", - -askUseExistingUGSetup, -askUseExistingUGNext -); - -static DialogAction -askUseExistingUGSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askUseExistingUGSetup" << endl; -#endif - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - // if this server is not an MC host, it must be a UG host - if (getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_MC)) - { - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_USE_EXISTING_UG, "No"); -#if DEBUG > 1 - cerr << "Leaving askUseExistingUGSetup DIALOG_NEXT" << endl; -#endif - return action; - } - else if (getManager(me)->getBaseScript()->get(SLAPD_KEY_USER_GROUP_LDAP_URL)) - { - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_USE_EXISTING_UG, "Yes"); - } - else - { - getManager(me)->getDefaultScript()->set( - SLAPD_KEY_USE_EXISTING_UG, "No"); - } - - dialogSetup(me, SLAPD_KEY_USE_EXISTING_UG, "No"); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - { -#if DEBUG > 1 - cerr << "Leaving askUseExistingUGSetup DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; - } - -#if DEBUG > 1 - cerr << "Leaving askUseExistingUGSetup DIALOG_SAME" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askUseExistingUGNext(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askUseExistingUGNext" << endl; -#endif - const char *buf = me->input(); - if (!buf || !*buf) - { - buf = me->defaultAns(); - if (!buf || !*buf) - buf = "No"; - } - - getManager(me)->getDefaultScript()->set(SLAPD_KEY_USE_EXISTING_UG, buf); - - if (!isValidYesNo(buf)) - return DIALOG_SAME; - -#if DEBUG > 1 - cerr << "Leaving askUseExistingUGNext DIALOG_NEXT" << endl; -#endif - return DIALOG_NEXT; -} - -DialogInput askUGHost( -"Enter the fully qualified domain name of the user directory host of\n" -"the form <hostname>.<domainname> (e.g. hostname.domain.com).\n", - -"User directory host name", - -0, - -askUGHostSetup, -askUGHostNext -); - -static DialogAction -askUGHostSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return action; - - dialogSetup(me, SLAPD_KEY_UG_HOST, 0); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askUGHostNext(Dialog *me) -{ - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_UG_HOST, tmp); - - if (!tmp || !isValid(tmp)) - { - DialogManagerType::showAlert("Please enter a valid hostname"); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askUGPort( -"Please specify the port number on which the user directory listens.\n", - -"User directory port number", - -"389", - -askUGPortSetup, -askUGPortNext -); - -static DialogAction -askUGPortSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return action; - - dialogSetup(me, SLAPD_KEY_UG_PORT, me->defaultAns()); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askUGPortNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return DIALOG_NEXT; - - const char *buf = me->input(); - const char *tmp; - char testbuf[1024]; - int port, err = 0; - - if (buf[0] == 0) - { - tmp = me->defaultAns(); - } - else - { - tmp = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_UG_PORT, tmp); - - port = atoi(tmp); - PR_snprintf(testbuf, sizeof(testbuf), "%d", port); - if (strncmp(testbuf, tmp, 6) || port > MAXPORT || port < 1) - { - PR_snprintf(testbuf, sizeof(testbuf), "OVERFLOW ERROR: Unable to bind to port %d\n" - "Please choose another port between 1 and %d.\n\n", - port, MAXPORT); - err = -1; - } - - if (err) - { - DialogManagerType::showAlert(testbuf); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askUGDN( -"In order to add and modify information in the user directory, you must\n" -"be able to bind to the server as an entity with the correct\n" -"permissions. This user is usually the Directory Manager, although\n" -"other users may be given the proper access. You will also be asked to\n" -"provide the password.\n", - -"User directory administrator ID", - -0, - -askUGDNSetup, -askUGDNNext -); - -static DialogAction -askUGDNSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return action; - - dialogSetup(me, SLAPD_KEY_USER_GROUP_ADMIN_ID, DEFAULT_SLAPDUSER); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askUGDNNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return DIALOG_NEXT; - - const char *slapdUser; - char *slapdPwd = 0; - const char *buf; - - buf = me->input(); - if (buf[0] == 0) - { - slapdUser = me->defaultAns(); - } - else - { - slapdUser = buf; - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_USER_GROUP_ADMIN_ID, slapdUser); - - if (!isValid(slapdUser)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - while (1) - { - me->showString("Password: "); - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - free(inp); - continue; - } - else - { - slapdPwd = inp; - break; - } - } - } - - if (slapdPwd) - { - getManager(me)->getBaseScript()->set(SLAPD_KEY_USER_GROUP_ADMIN_PWD, slapdPwd); - free(slapdPwd); - - int status; - if ((status = getManager(me)->verifyRemoteLdap( - SLAPD_KEY_UG_HOST, - SLAPD_KEY_UG_PORT, - SLAPD_KEY_UG_SUFFIX, - SLAPD_KEY_USER_GROUP_ADMIN_ID, - SLAPD_KEY_USER_GROUP_ADMIN_PWD - )) - ) - { - ostrstream msg; - msg << "Could not connect to ldap://" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_UG_HOST) - << ":" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_UG_PORT) - << "/" - << getManager(me)->getBaseScript()->get(SLAPD_KEY_UG_SUFFIX) - << endl << "for bind DN " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_USER_GROUP_ADMIN_ID) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The installation cannot proceed." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - } - - return DIALOG_NEXT; -} - -DialogInput askUGSuffix( -"Please specify the suffix for the user directory server.\n", - -"User directory server suffix", - -NULL, - -askUGSuffixSetup, -askUGSuffixNext -); - -static DialogAction -askUGSuffixSetup(Dialog *me) -{ - DialogAction action = DIALOG_NEXT; - long actionval = 0; - me->getUserData(ACTION, actionval); - action = (DialogAction)actionval; - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return action; - - dialogSetup(me, SLAPD_KEY_UG_SUFFIX, getManager(me)->getDefaultSuffix()); - - long setupval = 0; - if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY || - setupval == SETUP_ONLY) - return DIALOG_NEXT; - - return DIALOG_SAME; -} - -static DialogAction -askUGSuffixNext(Dialog *me) -{ - if (!getManager(me)->featureIsEnabled(SLAPD_KEY_USE_EXISTING_UG)) - return DIALOG_NEXT; - - const char *buf; - NSString val; - - buf = me->input(); - if (buf[0] == 0) - val = me->defaultAns(); - else - val = buf; - - getManager(me)->getBaseScript()->set(SLAPD_KEY_UG_SUFFIX, val); - - // check to see if it is a valid dn - if (!isAValidDN(val)) - { - DialogManagerType::showAlert("The suffix must be a valid DN"); - return DIALOG_SAME; - } - if (!isValid(val)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - return DIALOG_NEXT; -} - -DialogInput askReconfigMCAdminPwd( -(const char*)0, -"Fedora configuration directory server\nadministrator ID", - -(const char*)0, - -askReconfigMCAdminPwdSetup, -askReconfigMCAdminPwdNext -); - -static DialogAction -askReconfigMCAdminPwdSetup(Dialog *me) -{ -#if DEBUG > 1 - cerr << "Entering askReconfigMCAdminPwdSetup" << endl; -#endif - NSString msg = NSString( -"In order to reconfigure your installation, the Configuration Directory\n" -"Administrator password is required. Here is your current information:\n\n" -"Configuration Directory: ") + - getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_URL) + "\n" + -"Configuration Administrator ID: " + - getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID) + "\n" + -"\nAt the prompt, please enter the password for the Configuration Administrator.\n"; - - me->setText(msg); - - me->setDefaultAns(getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID)); -#if DEBUG > 1 - cerr << "Leaving askReconfigMCAdminPwdSetup" << endl; -#endif - return DIALOG_SAME; -} - -static DialogAction -askReconfigMCAdminPwdNext(Dialog *me) -{ - const char *buf; - - buf = me->input(); - if (!buf || buf[0] == 0) - { - buf = me->defaultAns(); - } - - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_ID, buf); - - if (!isValid(buf)) - { - DialogManagerType::showAlert("Please enter a valid string."); - return DIALOG_SAME; - } - - me->showString("Password: "); - while (1) - { - if (me->getPassword () == 0) - { - return DIALOG_PREV; - } - else - { - char *inp = strdup(me->input()); - - if (inp[0] == 0) - { - me->showString("Password: "); - continue; - } - else if (contains8BitChars(inp)) - { - DialogManagerType::showAlert("Password must contain 7 bit characters only."); - return DIALOG_SAME; - } - else if (!isValid(inp)) - { - DialogManagerType::showAlert("Please enter a valid password."); - return DIALOG_SAME; - } - else - { - int status; - if ((status = authLdapUser( - getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_URL), - getManager(me)->getBaseScript()->get(SLAPD_KEY_SERVER_ADMIN_ID), - inp, 0, 0))) - { - ostrstream msg; - msg << "Could not connect to " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_K_LDAP_URL) - << endl << "for ID " - << getManager(me)->getBaseScript()->get(SLAPD_KEY_USER_GROUP_ADMIN_ID) - << " status = " << status << endl - << "Please check your typing. If you have mis-typed, you can backup" - << endl - << "and retype. Otherwise, the remote server may be down at this time." - << endl - << "The reconfiguration cannot proceed." - << endl << ends; - DialogManagerType::showAlert(msg.str()); - delete [] msg.str(); - return DIALOG_SAME; - } - } - getManager(me)->getBaseScript()->set(SLAPD_KEY_SERVER_ADMIN_PWD, inp); - free(inp); - break; - } - } - - return DIALOG_NEXT; -} diff --git a/ldap/cm/newinst/ux-dialog.h b/ldap/cm/newinst/ux-dialog.h deleted file mode 100644 index 51c899f5..00000000 --- a/ldap/cm/newinst/ux-dialog.h +++ /dev/null @@ -1,106 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#ifndef _UX_DIALOG_H_ -#define _UX_DIALOG_H_ - -#include "dialog.h" -extern DialogYesNo askReconfig; -extern DialogInput askSlapdServerName; -extern DialogInput askAdminPort; -extern DialogInput askSlapdPort; -extern DialogYesNo askSecurity; -extern DialogInput askSlapdSecPort; -extern DialogInput askSlapdServerID; -extern DialogInput askSlapdSysUser; -extern DialogYesNo askConfigForMC; -extern DialogInput askMCAdminID; -extern DialogInput askSlapdSuffix; -extern DialogInput askSlapdRootDN; -extern DialogYesNo askReplication; -extern DialogYesNo askSample; -extern DialogInput askPopulate; -extern DialogInput askOrgSize; -extern DialogYesNo askCIR; -extern DialogInput askCIRHost; -extern DialogInput askCIRPort; -extern DialogInput askCIRDN; -extern DialogInput askCIRSuffix; -extern DialogYesNo askCIRSSL; -extern DialogInput askCIRInterval; -extern DialogInput askCIRDays; -extern DialogInput askCIRTimes; -extern DialogYesNo askSIR; -extern DialogInput askChangeLogSuffix; -extern DialogInput askChangeLogDir; -extern DialogInput askReplicationDN; -extern DialogInput askConsumerDN; -extern DialogYesNo askSIR; -extern DialogInput askSIRHost; -extern DialogInput askSIRPort; -extern DialogInput askSIRDN; -extern DialogInput askSIRSuffix; -extern DialogYesNo askSIRSSL; -extern DialogInput askSIRDays; -extern DialogInput askSIRTimes; -extern DialogYesNo askUseExistingMC; -extern DialogInput askMCHost; -extern DialogInput askMCPort; -extern DialogInput askMCDN; -extern DialogYesNo askDisableSchemaChecking; -extern DialogInput askMCAdminDomain; -extern DialogInput askAdminDomain; -extern DialogYesNo askUseExistingUG; -extern DialogInput askUGHost; -extern DialogInput askUGPort; -extern DialogInput askUGDN; -extern DialogInput askUGSuffix; -extern DialogInput askReconfigMCAdminPwd; - -// these keywords and values are used in the Dialog::setUserData to -// control the behavior of the dialogs -#define SETUP_DEFAULTS "SETUP_DEFAULTS" -const int SETUP_ONLY = 1; -#define ACTION "ACTION" - -#endif // _UX_DIALOG_H_ diff --git a/ldap/cm/newinst/ux-dsalib_dn.c b/ldap/cm/newinst/ux-dsalib_dn.c deleted file mode 100644 index 22ff7585..00000000 --- a/ldap/cm/newinst/ux-dsalib_dn.c +++ /dev/null @@ -1,50 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#ifdef __cplusplus -extern "C" { -#endif -#include <dsalib_dn.c> -#ifdef __cplusplus -} -#endif diff --git a/ldap/cm/newinst/ux-guesses.cc b/ldap/cm/newinst/ux-guesses.cc deleted file mode 100644 index 5f79edb6..00000000 --- a/ldap/cm/newinst/ux-guesses.cc +++ /dev/null @@ -1,184 +0,0 @@ -/** 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 **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -/* Print guesses of host and domain name as made by the setup SDK. */ - - - -/* $RCSfile: ux-guesses.cc,v $ $Revision: 1.6 $ $Date: 2006/11/10 23:44:40 $ $State: Exp $ */ -/* - * $Log: ux-guesses.cc,v $ - * Revision 1.6 2006/11/10 23:44:40 nhosoi - * Resolves: #214533 - * Summary: configure needs to support --with-fhs (Comment #6) - * Changes: Added the following include next to the end of the copyright block. - * + - * +#ifdef HAVE_CONFIG_H - * +# include <config.h> - * +#endif - * + - * - * Revision 1.5 2005/04/19 22:07:21 nkinder - * Fixed licensing typo - * - * Revision 1.4 2005/04/15 22:40:11 nkinder - * 155068 - Added license to source files - * - * Revision 1.3 2005/03/11 03:46:41 rmeggins - * This one is mostly strcpy/strcat checking, checking for null strings before strlen, removing some dead code, other odds and ends. - * - * Revision 1.2 2005/02/28 23:37:49 nkinder - * 149951 - Updated source code copyrights - * - * Revision 1.1.1.1 2005/01/21 00:40:49 cvsadm - * Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth) - * - * Revision 1.1.2.4 2004/07/14 01:39:20 dboreham - * changes to make newer C++ compilers happy - * - * Revision 1.1.1.1 2004/06/03 22:32:45 telackey - * Initial import Thu Jun 3 15:32:43 PDT 2004 - * - * Revision 1.1.2.3 2003/09/22 19:38:52 ulfw - * Update copyright years from 2001 to 2001-2003 - * - * Revision 1.1.2.2 2001/11/02 23:33:04 richm - * XXX use new copyright XXX - * - * Revision 1.1.2.1 2000/08/07 15:14:28 mwahl - * rename functions - * - * - */ - -#include "dialog.h" - -extern "C" { -#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux) -#include <netdb.h> -#endif -} - - -class PrintGuessPreInstall:public DialogManager -{ -public: - - PrintGuessPreInstall(int, char **); - ~PrintGuessPreInstall(); - - int init(); - - int start(); - - - void setParent(void *) { } - void *parent() const { return 0;} - void resetLast() { } - void add (Dialog *) { } - void addLast(Dialog *) { } - void clear() { } - int cont() { return -1;} - - -private: - Bool _reconfig; - Bool _configured; -}; - -PrintGuessPreInstall::PrintGuessPreInstall(int argc, char **argv) : _reconfig(False) -{ - setInstallMode(Interactive); - setInstallType(Typical); - _configured = False; - - /* getOptions(argc, argv); */ - -} - -PrintGuessPreInstall::~PrintGuessPreInstall() -{ - -} - -int PrintGuessPreInstall::init() -{ - return 0; -} - -int PrintGuessPreInstall::start() -{ - const char *hno = InstUtil::guessHostname(); - printf("hostname: %s\n",hno ? hno : "<unknown>"); - if (hno) { -#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux) - static char test_host[BIG_BUF] = {0}; - struct hostent *hp; - - PL_strncpyz(test_host,hno,sizeof(test_host)); - hp = gethostbyname(test_host); - if (hp == NULL) { - printf("addressable: no\n"); - } else { - printf("addressable: yes\n"); - } -#endif - } - const char *dno = InstUtil::guessDomain(); - printf("domain: %s\n",dno ? dno : "<unknown>"); - return 0; -} - - - -int main(int argc,char **argv) -{ - PrintGuessPreInstall program(argc,argv); - - int err = program.init(); - if (!err) { - err = program.start(); - } - return err; - -} |