[Fedora-directory-commits] ldapserver Makefile.am, 1.40, 1.41 configure.ac, 1.29, 1.30 aclocal.m4, 1.32, 1.33 configure, 1.43, 1.44 missing, 1.25, 1.26 install-sh, 1.25, 1.26 depcomp, 1.25, 1.26 compile, 1.25, 1.26 config.sub, 1.24, 1.25 config.guess, 1.24, 1.25 Makefile.in, 1.47, 1.48
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25137/ldapserver
Modified Files:
Makefile.am configure.ac aclocal.m4 configure missing
install-sh depcomp compile config.sub config.guess Makefile.in
Log Message:
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server
Fix Description: The Resource class needs to support more than 1 resource file e.g. for ds-base and ds-admin.
The property dir should be under $datadir. Property files are data files, not really config files.
Added a shared_lib_suffix token
Fixed some wording errors in the resource file.
Platforms tested: RHEL4
Flag Day: no
Doc impact: No new doc impact from previous commits for this bug.
Index: Makefile.am
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.am,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Makefile.am 8 Jun 2007 01:09:14 -0000 1.40
+++ Makefile.am 8 Jun 2007 20:36:52 -0000 1.41
@@ -67,7 +67,7 @@
#------------------------
configdir = $(sysconfdir)@configdir@
sampledatadir = $(datadir)@sampledatadir@
-propertydir = $(sysconfdir)@propertydir@
+propertydir = $(datadir)@propertydir@
schemadir = $(sysconfdir)@schemadir@
serverdir = $(libdir)@serverdir@
serverplugindir = $(libdir)@serverplugindir@
@@ -76,6 +76,8 @@
instconfigdir = @instconfigdir@
perldir = $(libdir)@perldir@
+shared_lib_suffix = @shared_lib_suffix@
+
#------------------------
# Build Products
#------------------------
@@ -1016,7 +1018,8 @@
-e 's,@brand\@,$(brand),g' \
-e 's,@capbrand\@,$(capbrand),g' \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@perldir\@,$(perldir),g'
+ -e 's,@perldir\@,$(perldir),g' \
+ -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g'
else
fixupcmd = sed \
-e 's,@bindir\@,$(bindir),g' \
@@ -1046,7 +1049,8 @@
-e 's,@brand\@,$(brand),g' \
-e 's,@capbrand\@,$(capbrand),g' \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@perldir\@,$(perldir),g'
+ -e 's,@perldir\@,$(perldir),g' \
+ -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g'
endif
%: %.in
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- configure.ac 8 Jun 2007 01:09:15 -0000 1.29
+++ configure.ac 8 Jun 2007 20:36:52 -0000 1.30
@@ -186,8 +186,8 @@
# Shared paths for all layouts
# relative to sysconfdir
configdir=/$PACKAGE_NAME/config
-# relative to sysconfdir
-propertydir=/$PACKAGE_NAME/property
+# location of property/resource files, relative to datadir
+propertydir=/$PACKAGE_NAME/properties
# relative to sysconfdir
schemadir=/$PACKAGE_NAME/schema
# relative to libdir
@@ -223,6 +223,7 @@
# cygnus, mingw, or the like and using cmd.exe as the shell
AM_CONDITIONAL([WINNT], false)
+shared_lib_suffix=.so
# Deal with platform dependent defines
# relative to sysconfdir
initdir=/rc.d
@@ -260,6 +261,7 @@
AC_DEFINE([OS_hpux], [1], [OS HP-UX])
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
+ shared_lib_suffix=.sl
platform="hpux"
;;
sparc-sun-solaris*)
@@ -295,6 +297,7 @@
;;
esac
AC_SUBST(initdir)
+AC_SUBST(shared_lib_suffix)
AM_CONDITIONAL(HPUX,test "$platform" = "hpux")
AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- configure 8 Jun 2007 01:09:15 -0000 1.43
+++ configure 8 Jun 2007 20:36:52 -0000 1.44
@@ -465,7 +465,7 @@
#endif"
ac_default_prefix=/opt/$PACKAGE_NAME
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CP!
P CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CP!
P CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir shared_lib_suffix HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -23177,8 +23177,8 @@
# Shared paths for all layouts
# relative to sysconfdir
configdir=/$PACKAGE_NAME/config
-# relative to sysconfdir
-propertydir=/$PACKAGE_NAME/property
+# location of property/resource files, relative to datadir
+propertydir=/$PACKAGE_NAME/properties
# relative to sysconfdir
schemadir=/$PACKAGE_NAME/schema
# relative to libdir
@@ -23228,6 +23228,7 @@
fi
+shared_lib_suffix=.so
# Deal with platform dependent defines
# relative to sysconfdir
initdir=/rc.d
@@ -23361,6 +23362,7 @@
#define _HPUX_SOURCE 1
_ACEOF
+ shared_lib_suffix=.sl
platform="hpux"
;;
sparc-sun-solaris*)
@@ -23446,6 +23448,7 @@
+
if test "$platform" = "hpux"; then
HPUX_TRUE=
HPUX_FALSE='#'
@@ -25999,6 +26002,7 @@
s,@LIBCSTD@,$LIBCSTD,;t t
s,@LIBCRUN@,$LIBCRUN,;t t
s,@initdir@,$initdir,;t t
+s,@shared_lib_suffix@,$shared_lib_suffix,;t t
s,@HPUX_TRUE@,$HPUX_TRUE,;t t
s,@HPUX_FALSE@,$HPUX_FALSE,;t t
s,@SOLARIS_TRUE@,$SOLARIS_TRUE,;t t
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Makefile.in 8 Jun 2007 01:09:15 -0000 1.47
+++ Makefile.in 8 Jun 2007 20:36:52 -0000 1.48
@@ -962,7 +962,7 @@
perldir = $(libdir)@perldir@
prefix = @prefix@
program_transform_name = @program_transform_name@
-propertydir = $(sysconfdir)@propertydir@
+propertydir = $(datadir)@propertydir@
sampledatadir = $(datadir)@sampledatadir@
sasl_inc = @sasl_inc@
sasl_lib = @sasl_lib@
@@ -972,6 +972,7 @@
scripttemplatedir = @scripttemplatedir@
serverdir = $(libdir)@serverdir@
serverplugindir = $(libdir)@serverplugindir@
+shared_lib_suffix = @shared_lib_suffix@
sharedstatedir = @sharedstatedir@
svrcore_inc = @svrcore_inc@
svrcore_lib = @svrcore_lib@
@@ -1909,7 +1910,8 @@
@BUNDLE_FALSE@ -e 's,@brand\@,$(brand),g' \
@BUNDLE_FALSE@ -e 's,@capbrand\@,$(capbrand),g' \
@BUNDLE_FALSE@ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
-@BUNDLE_FALSE@ -e 's,@perldir\@,$(perldir),g'
+@BUNDLE_FALSE@ -e 's,@perldir\@,$(perldir),g' \
+@BUNDLE_FALSE@ -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g'
# these are for the config files and scripts that we need to generate and replace
@@ -1946,7 +1948,8 @@
@BUNDLE_TRUE@ -e 's,@brand\@,$(brand),g' \
@BUNDLE_TRUE@ -e 's,@capbrand\@,$(capbrand),g' \
@BUNDLE_TRUE@ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
-@BUNDLE_TRUE@ -e 's,@perldir\@,$(perldir),g'
+@BUNDLE_TRUE@ -e 's,@perldir\@,$(perldir),g' \
+@BUNDLE_TRUE@ -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g'
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
16 years, 10 months
[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts Resource.pm, 1.1, 1.2 setup-ds.res.in, 1.1, 1.2
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25137/ldapserver/ldap/admin/src/scripts
Modified Files:
Resource.pm setup-ds.res.in
Log Message:
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server
Fix Description: The Resource class needs to support more than 1 resource file e.g. for ds-base and ds-admin.
The property dir should be under $datadir. Property files are data files, not really config files.
Added a shared_lib_suffix token
Fixed some wording errors in the resource file.
Platforms tested: RHEL4
Flag Day: no
Doc impact: No new doc impact from previous commits for this bug.
Index: Resource.pm
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/Resource.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resource.pm 8 Jun 2007 01:09:16 -0000 1.1
+++ Resource.pm 8 Jun 2007 20:36:53 -0000 1.2
@@ -51,41 +51,44 @@
my $type = shift;
my $self = {};
- $self->{filename} = shift;
+ while (@_) {
+ push @{$self->{filenames}}, shift;
+ }
$self = bless $self, $type;
- if ($self->{filename}) {
+ if (@{$self->{filenames}}) {
$self->read();
}
return $self;
}
+# the resource files are read in order given. Definitions from
+# later files override the same definitions in earlier files.
sub read {
my $self = shift;
- my $filename = shift;
- if ($filename) {
- $self->{filename} = $filename;
- } else {
- $filename = $self->{filename};
- }
-
- open RES, $filename or die "Error: could not open resource file $filename: $!";
- while (<RES>) {
- next if (/^\s*$/); # skip blank lines
- next if (/^\s*\#/); # skip comment lines
- # read name = value pairs like this
- # bol whitespace* name whitespace* '=' whitespace* value eol
- # the value will include any trailing whitespace
- if (/^\s*(.*?)\s*=\s*(.*?)$/) {
- $self->{res}->{$1} = $2;
- # replace \n with real newline
- $self->{res}->{$1} =~ s/\\n/\n/g;
+ while (@_) {
+ push @{$self->{filenames}}, shift;
+ }
+
+ for my $filename (@{$self->{filenames}}) {
+ open RES, $filename or die "Error: could not open resource file $filename: $!";
+ while (<RES>) {
+ next if (/^\s*$/); # skip blank lines
+ next if (/^\s*\#/); # skip comment lines
+ # read name = value pairs like this
+ # bol whitespace* name whitespace* '=' whitespace* value eol
+ # the value will include any trailing whitespace
+ if (/^\s*(.*?)\s*=\s*(.*?)$/) {
+ $self->{res}->{$1} = $2;
+ # replace \n with real newline
+ $self->{res}->{$1} =~ s/\\n/\n/g;
+ }
}
- }
- close RES;
+ close RES;
+ }
}
# given a resource key and optional args, return the value
Index: setup-ds.res.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/setup-ds.res.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- setup-ds.res.in 8 Jun 2007 01:09:16 -0000 1.1
+++ setup-ds.res.in 8 Jun 2007 20:36:53 -0000 1.2
@@ -34,12 +34,12 @@
dialog_hostname_warning = The hostname %s does not look like a\nfully qualified host and domain name.\nIf you feel you have made a mistake,\nplease go back to this dialog and enter another name.\n\n
# ----------- SSUser Dialog Resource ----------------
-dialog_ssuser_text = The server must run as a specific user in a specific group.\nIt is strongly recommended that this user should have no privileges\non the computer (i.e. a non-root user). The Administration Server\nwill give this user/group some permissions in specific paths/files\nto perform server-specific operations.\n\nIf you have not yet created a user and group for the server,\ncreate this user and group using your native operating\nsystem utilities.\n\n
+dialog_ssuser_text = The server must run as a specific user in a specific group.\nIt is strongly recommended that this user should have no privileges\non the computer (i.e. a non-root user). The setup procedure\nwill give this user/group some permissions in specific paths/files\nto perform server-specific operations.\n\nIf you have not yet created a user and group for the server,\ncreate this user and group using your native operating\nsystem utilities.\n\n
dialog_ssuser_prompt = System User
dialog_ssuser_error = The user '%s' is invalid.\n\n
dialog_ssuser_must_be_same = Since you are not running setup as root, the System User must be the same as your userid '%s'.\n\n
-dialog_ssuser_root_warning = You are strongly discouraged to use a non-root user for the server uid.\nIf you feel you have made a mistake,\nplease go back to this dialog and enter another system user.\n\n
+dialog_ssuser_root_warning = You are strongly encouraged to use a non-root user for the server uid.\nIf you feel you have made a mistake,\nplease go back to this dialog and enter another system user.\n\n
dialog_ssgroup_prompt = System Group
dialog_ssgroup_error = The group '%s' is invalid.\n\n
dialog_ssgroup_no_match = The system user '%s' does not belong to the group '%s'.\n\nThis is the list of users of the given group: %s\n\n
16 years, 10 months
[Fedora-directory-commits] ldapserver Makefile.am, 1.39, 1.40 configure.ac, 1.28, 1.29 aclocal.m4, 1.31, 1.32 configure, 1.42, 1.43 missing, 1.24, 1.25 install-sh, 1.24, 1.25 depcomp, 1.24, 1.25 compile, 1.24, 1.25 Makefile.in, 1.46, 1.47 config.sub, 1.23, 1.24 config.guess, 1.23, 1.24
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20988/ldapserver
Modified Files:
Makefile.am configure.ac aclocal.m4 configure missing
install-sh depcomp compile Makefile.in config.sub config.guess
Log Message:
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server
Fix Description: This adds the setup related perl modules, scripts, and resource files to the DS base code. This will allow a user to interactively setup (create an instance of) a directory server. This will also form the base of the work to add the console and admin server related setup code.
New files/directories:
$libdir/fedora-ds/perl - this is where the perl modules (Setup.pm, etc.) will be installed.
$bindir/setup-ds.pl - the script to use to interactively create an instance of directory server. This has use lib '$libdir/fedora-ds/perl' hard coded into it at build time, in order to find the "private" setup perl modules. If you invoke this script in silent mode (setup-ds.pl -s) then it is exactly the same as just using ds_newinst.pl.
$sysconfdir/fedora-ds/property/setup-ds.res - Resources for setup-ds.pl and the associated modules.
I also fixed a problem with the libns-dshttpd linkage.
Platforms tested: RHEL4
Flag Day: no
Doc impact: Yes. All of these new items will need to be documented.
Index: Makefile.am
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.am,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Makefile.am 16 May 2007 19:45:26 -0000 1.39
+++ Makefile.am 8 Jun 2007 01:09:14 -0000 1.40
@@ -74,6 +74,7 @@
taskdir = $(datadir)@scripttemplatedir@
initdir = $(sysconfdir)@initdir@
instconfigdir = @instconfigdir@
+perldir = $(libdir)@perldir@
#------------------------
# Build Products
@@ -167,7 +168,21 @@
wrappers/cl-dump \
ldap/admin/src/scripts/cl-dump.pl \
wrappers/repl-monitor \
- ldap/admin/src/scripts/repl-monitor.pl
+ ldap/admin/src/scripts/repl-monitor.pl \
+ ldap/admin/src/scripts/setup-ds.pl
+
+perl_SCRIPTS = ldap/admin/src/scripts/SetupLog.pm \
+ ldap/admin/src/scripts/Resource.pm \
+ ldap/admin/src/scripts/Util.pm \
+ ldap/admin/src/scripts/Setup.pm \
+ ldap/admin/src/scripts/SetupDialogs.pm \
+ ldap/admin/src/scripts/Inf.pm \
+ ldap/admin/src/scripts/DialogManager.pm \
+ ldap/admin/src/scripts/Dialog.pm \
+ ldap/admin/src/scripts/DSDialogs.pm \
+ ldap/admin/src/scripts/Setup.pm
+
+property_DATA = ldap/admin/src/scripts/setup-ds.res
task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
ldap/admin/src/scripts/template-db2bak \
@@ -327,7 +342,7 @@
$(libldaputil_a_SOURCES)
libns_dshttpd_la_CPPFLAGS = -I$(srcdir)/include/base $(AM_CPPFLAGS) -I$(srcdir)/lib/ldaputil @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-libns_dshttpd_la_LIBADD = $(LDAPSDK_LINK) $(NSS_LINK) $(NSPR_LINK)
+libns_dshttpd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK)
#------------------------
# libslapd
@@ -997,7 +1012,11 @@
-e 's,@package_name\@,$(PACKAGE_NAME),g' \
-e 's,@instconfigdir\@,$(instconfigdir),g' \
-e 's,@ECHO_N\@,$(ECHO_N),g' \
- -e 's,@ECHO_C\@,$(ECHO_C),g'
+ -e 's,@ECHO_C\@,$(ECHO_C),g' \
+ -e 's,@brand\@,$(brand),g' \
+ -e 's,@capbrand\@,$(capbrand),g' \
+ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+ -e 's,@perldir\@,$(perldir),g'
else
fixupcmd = sed \
-e 's,@bindir\@,$(bindir),g' \
@@ -1023,7 +1042,11 @@
-e 's,@package_name\@,$(PACKAGE_NAME),g' \
-e 's,@instconfigdir\@,$(instconfigdir),g' \
-e 's,@ECHO_N\@,$(ECHO_N),g' \
- -e 's,@ECHO_C\@,$(ECHO_C),g'
+ -e 's,@ECHO_C\@,$(ECHO_C),g' \
+ -e 's,@brand\@,$(brand),g' \
+ -e 's,@capbrand\@,$(capbrand),g' \
+ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+ -e 's,@perldir\@,$(perldir),g'
endif
%: %.in
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- configure.ac 16 May 2007 19:45:26 -0000 1.28
+++ configure.ac 8 Jun 2007 01:09:15 -0000 1.29
@@ -139,6 +139,10 @@
# the default prefix - override with --prefix or --with-fhs
AC_PREFIX_DEFAULT([/opt/$PACKAGE_NAME])
+brand=fedora
+capbrand=Fedora
+vendor="Fedora Project"
+
m4_include(m4/fhs.m4)
# installation paths - by default, we store everything
@@ -186,6 +190,8 @@
propertydir=/$PACKAGE_NAME/property
# relative to sysconfdir
schemadir=/$PACKAGE_NAME/schema
+# relative to libdir
+perldir=/$PACKAGE_NAME/perl
AC_SUBST(configdir)
AC_SUBST(sampledatadir)
@@ -194,6 +200,7 @@
AC_SUBST(serverdir)
AC_SUBST(serverplugindir)
AC_SUBST(scripttemplatedir)
+AC_SUBST(perldir)
# check for --with-instconfigdir
AC_MSG_CHECKING(for --with-instconfigdir)
@@ -332,6 +339,10 @@
AC_SUBST(netsnmp_libdir)
AC_SUBST(netsnmp_link)
+AC_SUBST(brand)
+AC_SUBST(capbrand)
+AC_SUBST(vendor)
+
AC_DEFINE([LDAP_DEBUG], [1], [LDAP debug flag])
AC_DEFINE([LDAP_DONT_USE_SMARTHEAP], [1], [Don't use smartheap])
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- configure 16 May 2007 19:45:26 -0000 1.42
+++ configure 8 Jun 2007 01:09:15 -0000 1.43
@@ -465,7 +465,7 @@
#endif"
ac_default_prefix=/opt/$PACKAGE_NAME
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CP!
P CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CP!
P CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_bitwise_TRUE enable_bitwise_FALSE configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -23054,6 +23054,10 @@
# the default prefix - override with --prefix or --with-fhs
+brand=fedora
+capbrand=Fedora
+vendor="Fedora Project"
+
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2006 Red Hat, Inc.
# All rights reserved.
@@ -23177,6 +23181,9 @@
propertydir=/$PACKAGE_NAME/property
# relative to sysconfdir
schemadir=/$PACKAGE_NAME/schema
+# relative to libdir
+perldir=/$PACKAGE_NAME/perl
+
@@ -25147,6 +25154,10 @@
+
+
+
+
cat >>confdefs.h <<\_ACEOF
#define LDAP_DEBUG 1
_ACEOF
@@ -25978,6 +25989,7 @@
s,@serverdir@,$serverdir,;t t
s,@serverplugindir@,$serverplugindir,;t t
s,@scripttemplatedir@,$scripttemplatedir,;t t
+s,@perldir@,$perldir,;t t
s,@instconfigdir@,$instconfigdir,;t t
s,@WINNT_TRUE@,$WINNT_TRUE,;t t
s,@WINNT_FALSE@,$WINNT_FALSE,;t t
@@ -26022,6 +26034,9 @@
s,@netsnmp_lib@,$netsnmp_lib,;t t
s,@netsnmp_libdir@,$netsnmp_libdir,;t t
s,@netsnmp_link@,$netsnmp_link,;t t
+s,@brand@,$brand,;t t
+s,@capbrand@,$capbrand,;t t
+s,@vendor@,$vendor,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- Makefile.in 16 May 2007 19:45:26 -0000 1.46
+++ Makefile.in 8 Jun 2007 01:09:15 -0000 1.47
@@ -94,8 +94,9 @@
am__installdirs = "$(DESTDIR)$(serverdir)" \
"$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" \
- "$(DESTDIR)$(initdir)" "$(DESTDIR)$(taskdir)" \
- "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" \
+ "$(DESTDIR)$(initdir)" "$(DESTDIR)$(perldir)" \
+ "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" \
+ "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(propertydir)" \
"$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"
serverLTLIBRARIES_INSTALL = $(INSTALL)
serverpluginLTLIBRARIES_INSTALL = $(INSTALL)
@@ -268,7 +269,8 @@
libhttp_client_plugin_la_OBJECTS = \
$(am_libhttp_client_plugin_la_OBJECTS)
libns_dshttpd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am__objects_1 = lib/ldaputil/libns_dshttpd_la-cert.lo \
lib/ldaputil/libns_dshttpd_la-certmap.lo \
lib/ldaputil/libns_dshttpd_la-dbconf.lo \
@@ -711,8 +713,10 @@
$(am__DEPENDENCIES_1)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
initSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+perlSCRIPT_INSTALL = $(INSTALL_SCRIPT)
taskSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-SCRIPTS = $(bin_SCRIPTS) $(init_SCRIPTS) $(task_SCRIPTS)
+SCRIPTS = $(bin_SCRIPTS) $(init_SCRIPTS) $(perl_SCRIPTS) \
+ $(task_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -786,10 +790,11 @@
$(rsearch_bin_SOURCES)
configDATA_INSTALL = $(INSTALL_DATA)
nodist_propertyDATA_INSTALL = $(INSTALL_DATA)
+propertyDATA_INSTALL = $(INSTALL_DATA)
sampledataDATA_INSTALL = $(INSTALL_DATA)
schemaDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(config_DATA) $(nodist_property_DATA) $(sampledata_DATA) \
- $(schema_DATA)
+DATA = $(config_DATA) $(nodist_property_DATA) $(property_DATA) \
+ $(sampledata_DATA) $(schema_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -892,11 +897,13 @@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
+brand = @brand@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+capbrand = @capbrand@
#------------------------
# Install Paths
@@ -952,6 +959,7 @@
nss_lib = @nss_lib@
nss_libdir = @nss_libdir@
oldincludedir = @oldincludedir@
+perldir = $(libdir)@perldir@
prefix = @prefix@
program_transform_name = @program_transform_name@
propertydir = $(sysconfdir)@propertydir@
@@ -969,6 +977,7 @@
svrcore_lib = @svrcore_lib@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
+vendor = @vendor@
# look for included m4 files in the ./m4/ directory
ACLOCAL_AMFLAGS = -I m4
@@ -1092,8 +1101,21 @@
wrappers/cl-dump \
ldap/admin/src/scripts/cl-dump.pl \
wrappers/repl-monitor \
- ldap/admin/src/scripts/repl-monitor.pl
+ ldap/admin/src/scripts/repl-monitor.pl \
+ ldap/admin/src/scripts/setup-ds.pl
+
+perl_SCRIPTS = ldap/admin/src/scripts/SetupLog.pm \
+ ldap/admin/src/scripts/Resource.pm \
+ ldap/admin/src/scripts/Util.pm \
+ ldap/admin/src/scripts/Setup.pm \
+ ldap/admin/src/scripts/SetupDialogs.pm \
+ ldap/admin/src/scripts/Inf.pm \
+ ldap/admin/src/scripts/DialogManager.pm \
+ ldap/admin/src/scripts/Dialog.pm \
+ ldap/admin/src/scripts/DSDialogs.pm \
+ ldap/admin/src/scripts/Setup.pm
+property_DATA = ldap/admin/src/scripts/setup-ds.res
task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
ldap/admin/src/scripts/template-db2bak \
ldap/admin/src/scripts/template-db2index \
@@ -1243,7 +1265,7 @@
$(libldaputil_a_SOURCES)
libns_dshttpd_la_CPPFLAGS = -I$(srcdir)/include/base $(AM_CPPFLAGS) -I$(srcdir)/lib/ldaputil @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-libns_dshttpd_la_LIBADD = $(LDAPSDK_LINK) $(NSS_LINK) $(NSPR_LINK)
+libns_dshttpd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK)
#------------------------
# libslapd
@@ -1883,7 +1905,11 @@
@BUNDLE_FALSE@ -e 's,@package_name\@,$(PACKAGE_NAME),g' \
@BUNDLE_FALSE@ -e 's,@instconfigdir\@,$(instconfigdir),g' \
@BUNDLE_FALSE@ -e 's,@ECHO_N\@,$(ECHO_N),g' \
-@BUNDLE_FALSE@ -e 's,@ECHO_C\@,$(ECHO_C),g'
+@BUNDLE_FALSE@ -e 's,@ECHO_C\@,$(ECHO_C),g' \
+@BUNDLE_FALSE@ -e 's,@brand\@,$(brand),g' \
+@BUNDLE_FALSE@ -e 's,@capbrand\@,$(capbrand),g' \
+@BUNDLE_FALSE@ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+@BUNDLE_FALSE@ -e 's,@perldir\@,$(perldir),g'
# these are for the config files and scripts that we need to generate and replace
@@ -1916,7 +1942,11 @@
@BUNDLE_TRUE@ -e 's,@package_name\@,$(PACKAGE_NAME),g' \
@BUNDLE_TRUE@ -e 's,@instconfigdir\@,$(instconfigdir),g' \
@BUNDLE_TRUE@ -e 's,@ECHO_N\@,$(ECHO_N),g' \
-@BUNDLE_TRUE@ -e 's,@ECHO_C\@,$(ECHO_C),g'
+@BUNDLE_TRUE@ -e 's,@ECHO_C\@,$(ECHO_C),g' \
+@BUNDLE_TRUE@ -e 's,@brand\@,$(brand),g' \
+@BUNDLE_TRUE@ -e 's,@capbrand\@,$(capbrand),g' \
+@BUNDLE_TRUE@ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+@BUNDLE_TRUE@ -e 's,@perldir\@,$(perldir),g'
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -3753,6 +3783,25 @@
echo " rm -f '$(DESTDIR)$(initdir)/$$f'"; \
rm -f "$(DESTDIR)$(initdir)/$$f"; \
done
+install-perlSCRIPTS: $(perl_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(perldir)" || $(mkdir_p) "$(DESTDIR)$(perldir)"
+ @list='$(perl_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(perlSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(perldir)/$$f'"; \
+ $(perlSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(perldir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-perlSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(perl_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(perldir)/$$f'"; \
+ rm -f "$(DESTDIR)$(perldir)/$$f"; \
+ done
install-taskSCRIPTS: $(task_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(taskdir)" || $(mkdir_p) "$(DESTDIR)$(taskdir)"
@@ -8768,6 +8817,23 @@
echo " rm -f '$(DESTDIR)$(propertydir)/$$f'"; \
rm -f "$(DESTDIR)$(propertydir)/$$f"; \
done
+install-propertyDATA: $(property_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(propertydir)" || $(mkdir_p) "$(DESTDIR)$(propertydir)"
+ @list='$(property_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(propertyDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(propertydir)/$$f'"; \
+ $(propertyDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(propertydir)/$$f"; \
+ done
+
+uninstall-propertyDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(property_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(propertydir)/$$f'"; \
+ rm -f "$(DESTDIR)$(propertydir)/$$f"; \
+ done
install-sampledataDATA: $(sampledata_DATA)
@$(NORMAL_INSTALL)
test -z "$(sampledatadir)" || $(mkdir_p) "$(DESTDIR)$(sampledatadir)"
@@ -8984,7 +9050,7 @@
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) \
$(DATA) config.h
installdirs:
- for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
+ for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(perldir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -9113,9 +9179,10 @@
info-am:
install-data-am: install-configDATA install-initSCRIPTS \
- install-nodist_propertyDATA install-sampledataDATA \
- install-schemaDATA install-serverLTLIBRARIES \
- install-serverpluginLTLIBRARIES install-taskSCRIPTS
+ install-nodist_propertyDATA install-perlSCRIPTS \
+ install-propertyDATA install-sampledataDATA install-schemaDATA \
+ install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
+ install-taskSCRIPTS
install-exec-am: install-binPROGRAMS install-binSCRIPTS \
install-sbinPROGRAMS
@@ -9148,7 +9215,8 @@
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-configDATA uninstall-info-am uninstall-initSCRIPTS \
- uninstall-nodist_propertyDATA uninstall-sampledataDATA \
+ uninstall-nodist_propertyDATA uninstall-perlSCRIPTS \
+ uninstall-propertyDATA uninstall-sampledataDATA \
uninstall-sbinPROGRAMS uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
uninstall-taskSCRIPTS
@@ -9165,7 +9233,8 @@
install-binPROGRAMS install-binSCRIPTS install-configDATA \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-initSCRIPTS install-man \
- install-nodist_propertyDATA install-sampledataDATA \
+ install-nodist_propertyDATA install-perlSCRIPTS \
+ install-propertyDATA install-sampledataDATA \
install-sbinPROGRAMS install-schemaDATA \
install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
install-strip install-taskSCRIPTS installcheck installcheck-am \
@@ -9174,7 +9243,8 @@
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-configDATA uninstall-info-am uninstall-initSCRIPTS \
- uninstall-nodist_propertyDATA uninstall-sampledataDATA \
+ uninstall-nodist_propertyDATA uninstall-perlSCRIPTS \
+ uninstall-propertyDATA uninstall-sampledataDATA \
uninstall-sbinPROGRAMS uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
uninstall-taskSCRIPTS
16 years, 10 months
[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts DSDialogs.pm, NONE, 1.1 Dialog.pm, NONE, 1.1 DialogManager.pm, NONE, 1.1 Inf.pm, NONE, 1.1 Resource.pm, NONE, 1.1 Setup.pm.in, NONE, 1.1 SetupDialogs.pm, NONE, 1.1 SetupLog.pm, NONE, 1.1 Util.pm, NONE, 1.1 setup-ds.pl.in, NONE, 1.1 setup-ds.res.in, NONE, 1.1
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20988/ldapserver/ldap/admin/src/scripts
Added Files:
DSDialogs.pm Dialog.pm DialogManager.pm Inf.pm Resource.pm
Setup.pm.in SetupDialogs.pm SetupLog.pm Util.pm setup-ds.pl.in
setup-ds.res.in
Log Message:
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server
Fix Description: This adds the setup related perl modules, scripts, and resource files to the DS base code. This will allow a user to interactively setup (create an instance of) a directory server. This will also form the base of the work to add the console and admin server related setup code.
New files/directories:
$libdir/fedora-ds/perl - this is where the perl modules (Setup.pm, etc.) will be installed.
$bindir/setup-ds.pl - the script to use to interactively create an instance of directory server. This has use lib '$libdir/fedora-ds/perl' hard coded into it at build time, in order to find the "private" setup perl modules. If you invoke this script in silent mode (setup-ds.pl -s) then it is exactly the same as just using ds_newinst.pl.
$sysconfdir/fedora-ds/property/setup-ds.res - Resources for setup-ds.pl and the associated modules.
I also fixed a problem with the libns-dshttpd linkage.
Platforms tested: RHEL4
Flag Day: no
Doc impact: Yes. All of these new items will need to be documented.
--- NEW FILE DSDialogs.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
package DSDialogs;
use strict;
use Net::Domain qw(hostname hostfqdn);
use DialogManager;
use Setup;
use Dialog;
use Util;
my $dsport = new Dialog (
$TYPICAL,
'dialog_dsport_text',
sub {
my $self = shift;
my $port = $self->{manager}->{inf}->{slapd}->{ServerPort};
if (!defined($port)) {
$port = 389;
}
if (!portAvailable($port)) {
$port = getAvailablePort();
}
return $port;
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
if ($ans !~ /\d+/) {
$self->{manager}->alert("dialog_dsport_error", $ans);
} elsif (!portAvailable($ans)) {
$self->{manager}->alert("dialog_dsport_error", $ans);
} else {
$res = $DialogManager::NEXT;
$self->{manager}->{inf}->{slapd}->{ServerPort} = $ans;
}
return $res;
},
['dialog_dsport_prompt']
);
my $dsserverid = new Dialog (
$TYPICAL,
'dialog_dsserverid_text',
sub {
my $self = shift;
my $serverid = $self->{manager}->{inf}->{slapd}->{ServerIdentifier};
if (!defined($serverid)) {
$serverid = $self->{manager}->{inf}->{General}->{FullMachineName};
if (!defined($serverid)) {
$serverid = hostname;
} else { # strip out the leftmost domain component
$serverid =~ s/\..*$//;
}
}
return $serverid;
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
my $path = $self->{manager}->{setup}->{configdir} . "/slapd-" . $ans;
if ($ans !~ /^[0-9a-zA-Z_-]+$/) {
$self->{manager}->alert("dialog_dsserverid_error", $ans);
} elsif (-d $path) {
$self->{manager}->alert("dialog_dsserverid_inuse", $ans);
} else {
$res = $DialogManager::NEXT;
$self->{manager}->{inf}->{slapd}->{ServerIdentifier} = $ans;
}
return $res;
},
['dialog_dsserverid_prompt']
);
my $dssuffix = new Dialog (
$TYPICAL,
'dialog_dssuffix_text',
sub {
my $self = shift;
my $suffix = $self->{manager}->{inf}->{slapd}->{Suffix};
if (!defined($suffix)) {
$suffix = $self->{manager}->{inf}->{General}->{FullMachineName};
if (!defined($suffix)) {
$suffix = hostfqdn;
}
# convert fqdn to dc= domain components
$suffix = "dc=$suffix";
$suffix =~ s/\./, dc=/g;
}
return $suffix;
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
if (!isValidDN($ans)) {
$self->{manager}->alert("dialog_dssuffix_error", $ans);
} else {
$res = $DialogManager::NEXT;
$self->{manager}->{inf}->{slapd}->{Suffix} = $ans;
}
return $res;
},
['dialog_dssuffix_prompt']
);
my $dsrootdn = new Dialog (
$EXPRESS,
'dialog_dsrootdn_text',
sub {
my $self = shift;
my $index = shift;
my $rootdn;
if ($index == 0) { # return undef for password defaults
$rootdn = $self->{manager}->{inf}->{slapd}->{RootDN};
if (!defined($rootdn)) {
$rootdn = "cn=Directory Manager";
}
}
return $rootdn;
},
sub {
my $self = shift;
my $ans = shift;
my $index = shift;
my $res = $DialogManager::SAME;
if ($index == 0) { # verify DN
if (!isValidDN($ans)) {
$self->{manager}->alert("dialog_dsrootdn_error", $ans);
} else {
$res = $DialogManager::NEXT;
$self->{manager}->{inf}->{slapd}->{RootDN} = $ans;
}
} elsif ($index == 1) { # verify initial password
my $test = $ans;
if ($test) {
$test =~ s/\s//g;
}
if (!$ans or (length($ans) < 8)) {
$self->{manager}->alert("dialog_dsrootpw_tooshort", 8);
} elsif (length($test) != length($ans)) {
$self->{manager}->alert("dialog_dsrootpw_invalid");
} else {
$res = $DialogManager::NEXT;
$self->{firstpassword} = $ans; # save for next index
}
} elsif ($index == 2) { # verify second password
if ($ans ne $self->{firstpassword}) {
$self->{manager}->alert("dialog_dsrootpw_nomatch");
} else {
$self->{manager}->{inf}->{slapd}->{RootDNPwd} = $ans;
$res = $DialogManager::NEXT;
}
}
return $res;
},
['dialog_dsrootdn_prompt'], ['dialog_dsrootpw_prompt1', 1], ['dialog_dsrootpw_prompt2', 1]
);
my $dssample = new DialogYesNo (
$CUSTOM,
'dialog_dssample_text',
0,
sub {
my $self = shift;
my $ans = shift;
my $res = $self->handleResponse($ans);
if ($res == $DialogManager::NEXT) {
$self->{manager}->{inf}->{slapd}->{AddSampleEntries} = ($self->isYes() ? 'Yes' : 'No');
}
return $res;
},
['dialog_dssample_prompt'],
);
my $dspopulate = new Dialog (
$CUSTOM,
'dialog_dspopulate_text',
sub {
my $self = shift;
my $val = $self->{manager}->{inf}->{slapd}->{InstallLdifFile};
if (!defined($val)) {
$val = 'none';
}
return $val;
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
if ($ans eq 'none') {
$self->{manager}->{inf}->{slapd}->{InstallLdifFile} = 'none';
$self->{manager}->{inf}->{slapd}->{AddOrgEntries} = 'No';
$res = $DialogManager::NEXT;
} elsif ($ans eq 'suggest') {
$self->{manager}->{inf}->{slapd}->{InstallLdifFile} = 'suggest';
$self->{manager}->{inf}->{slapd}->{AddOrgEntries} = 'Yes';
$res = $DialogManager::NEXT;
} else { # a file
if (! -f $ans) {
$self->{manager}->alert("dialog_dspopulate_error", $ans);
} else {
$self->{manager}->{inf}->{slapd}->{InstallLdifFile} = $ans;
$self->{manager}->{inf}->{slapd}->{AddOrgEntries} = 'No';
$res = $DialogManager::NEXT;
}
}
return $res;
},
['dialog_dspopulate_prompt']
);
sub getDialogs {
return ($dsport, $dsserverid, $dssuffix, $dsrootdn, $dssample, $dspopulate);
}
1;
--- NEW FILE Dialog.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
package Dialog;
use DialogManager;
#require Exporter;
#@ISA = qw(Exporter);
#@EXPORT = qw();
# NOTE: This "class" is an "abstract" class. There are two methods which
# must be provided by subclasses:
# $ans = $dialog->defaultAns($promptindex);
# where $promptindex is the index into the array of prompts given when
# constructing the Dialog object
# The dialog will typically use a default answer either hardcoded in
# or from some key in the setup cache (.inf) file
#
# $resp = $dialog->handleResponse($ans, $index);
# The dialog uses this method to perform validation of the input, set the value
# in the setup cache, display errors or warnings, and tell the dialog manager
# if the prompt needs to be redisplayed, or if there was an unrecoverable error
# $resp should be $SAME to reprompt, $ERR to abort, or $NEXT to continue
# the $ans and defaultAns should be in the native charset, so the dialog
# may have to convert to/from utf8 as needed.
# a dialog consists of a title, some explanatory text, and one or more prompts
# each prompt has a default value. An example of a dialog with more than
# one prompt would be a dialog asking the user for the new root DN and password -
# in that case, there would be 3 prompts - one for the DN, one for the password,
# and one to verify the password
# The text and prompts are given as resource keys. Usually the resource value
# will be a simple string, in which case the resource key is passed in as a simple
# string. However, if the resource string contains replaceable parameters, the
# resource key is passed as an array ref consisting of the resource key as the
# first element and the parameters to use for replacement as the subsequent
# array elements e.g.
# $foo = new Dialog(['RESOURCE_KEY_CONFIG_LDAP_URL', $secure, $host, $port, $suffix], ...);
# but usually for simple cases like this:
# $foo = new Dialog('RESOURCE_KEY_WELCOME', ...);
# The manager contains the context for all of the dialogs - the setup type, the resource
# file, setup log, other context shared among the dialogs
# the type is the setup type - 1, 2, or 3 for express, typical, or custom
# type is used to say which types use this dialog
sub new {
my $type = shift;
my $self = {};
$self->{type} = shift;
$self->{text} = shift;
$self->{defaultAns} = shift;
$self->{handleResp} = shift;
$self->{prompts} = \@_;
$self = bless $self, $type;
return $self;
}
sub setManager {
my $self = shift;
$self->{"manager"} = shift;
}
# returns true if this dialog is to be displayed for the current setup type
# false otherwise
sub isDisplayed {
my $self = shift;
return $self->{type} <= $self->{"manager"}->{type};
}
# each prompt looks like this:
# [ 'resource key', is pwd ]
# The resource key is the string key of the resource
# is pwd is optional - if present, the prompt is for a password
# and should not echo the answer
# e.g.
# ['RESOURCE_USERNAME'], ['RESOURCE_PASSWORD', 1], ['RESOURCE_PASSWORD_AGAIN', 1]
sub run {
my $self = shift;
my $resp = $DialogManager::SAME;
# display the dialog text
if ($self->isDisplayed()) {
$self->{manager}->showText($self->{text});
}
# display each prompt for this dialog
my $index = 0;
my @prompts = @{$self->{prompts}};
for (my $index = 0; $index < @prompts; ++$index) {
my $prompt = $prompts[$index];
my $defaultans = $self->{defaultAns}($self, $index);
my $ans;
if ($self->isDisplayed()) {
$ans = $self->{manager}->showPrompt($prompt->[0], $defaultans, $prompt->[1]);
} else {
$ans = $defaultans;
}
# see if this is the special BACK response, and finish if so
if ($self->{"manager"}->isBack($ans)) {
$resp = $DialogManager::BACK;
last;
}
# figure out what action to take based on the users response
# this will set values in the setup info file
# this will also validate input, and display errors if the
# input is not correct - in that case, the resp will be
# SAME to reprompt, or ERR if unrecoverable
# NOTE: user cannot BACK from prompt to prompt - BACK
# always means BACK to the previous dialog
$resp = $self->{handleResp}($self, $ans, $index);
if ($resp == $DialogManager::SAME) {
if (!$self->isDisplayed()) {
$self->{manager}->alert('dialog_use_different_type');
$resp = $DialogManager::ERR;
} else {
$index--; # reprompt
}
} elsif ($resp == $DialogManager::ERR) {
last;
}
}
return $resp;
}
package DialogYesNo;
@ISA = qw(Dialog);
sub new {
my $type = shift;
my $setuptype = shift;
my $text = shift;
my $defaultIsYes = shift;
my $handler = shift || \&handleResponse;
my $prompt = shift || ['prompt_yes_no'];
my $self = Dialog->new($setuptype, $text,
\&defaultAns, $handler, $prompt);
$self->{defaultIsYes} = $defaultIsYes;
$self = bless $self, $type;
return $self;
}
sub setDefaultYes {
my $self = shift;
$self->{default} = $self->{"manager"}->getText("yes");
}
sub setDefaultNo {
my $self = shift;
$self->{default} = $self->{"manager"}->getText("no");
}
sub defaultAns {
my $self = shift;
if (exists($self->{ans})) {
return $self->{ans};
}
if (!exists($self->{default})) {
if ($self->{defaultIsYes}) {
$self->{default} = $self->{"manager"}->getText("yes");
} else {
$self->{default} = $self->{"manager"}->getText("no");
}
}
return $self->{default};
}
sub isYes {
my $self = shift;
return $self->{ans} eq $self->{"manager"}->getText("yes");
}
sub handleResponse {
my $self = shift;
my $ans = shift;
my $resp = $DialogManager::SAME;
my $yes = $self->{"manager"}->getText("yes");
my $nno = $self->{"manager"}->getText("no");
# the regexp allows us to use y or ye or yes for "yes"
if ($nno =~ /^$ans/) {
$resp = $DialogManager::NEXT;
$self->{ans} = $nno;
} elsif ($yes =~ /^$ans/) {
$resp = $DialogManager::NEXT;
$self->{ans} = $yes;
} else {
$self->{"manager"}->alert("yes_no_error");
}
return $resp;
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE DialogManager.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
package DialogManager;
use Exporter ();
@ISA = qw(Exporter);
@EXPORT = qw($BACK $SAME $NEXT $ERR);
@EXPORT_OK = qw($BACK $SAME $NEXT $ERR);
use Dialog;
use SetupLog;
# Dialog responses
$BACK = -1;
$SAME = 0;
$NEXT = 1;
$ERR = 2;
# The DialogManager controls the flow of the dialogs and contains context shared
# among all of the dialogs (resources, logs, current setup type, etc.)
# all of these are optional
sub new {
my $type = shift;
my $self = {};
$self->{setup} = shift;
$self->{res} = shift;
$self->{type} = shift;
$self->{log} = $self->{setup}->{log};
$self->{inf} = $self->{setup}->{inf};
$self = bless $self, $type;
return $self;
}
sub getType {
my $self = shift;
return $self->{type};
}
sub setType {
my $self = shift;
$self->{type} = shift;
}
sub addDialog {
my $self = shift;
for my $dialog (@_) {
$dialog->setManager($self);
push @{$self->{dialogs}}, $dialog;
}
}
# see if the user answered with the special BACK answer
sub isBack {
my $self = shift;
my $ans = shift;
# the word "back"
if ($ans =~ /back/i) {
return 1;
}
# a Ctrl-B sequence
if ($ans eq '') {
return 1;
}
return 0;
}
sub log {
my $self = shift;
if (!$self->{log}) {
print @_;
} else {
$self->{log}->logMessage($INFO, "Setup", @_);
}
}
sub getText {
my $self = shift;
return $self->{res}->getText(@_);
}
sub handleError {
my $self = shift;
my $msg = $self->{res}->getText('setup_err_exit');
$self->{log}->logMessage($FATAL, "Setup", $msg);
}
sub showText {
my $self = shift;
my $msg = shift;
my $text = $self->getText($msg);
print "\n", ("=" x 78), "\n";
# display it,
print $text;
# log it
$self->log($text);
}
sub showPrompt {
my $self = shift;
my $msg = shift;
my $defaultans = shift;
my $ispwd = shift;
my $text = $self->getText($msg);
# display it,
print $text;
# log it
$self->log($text . "\n");
# display the default answer
if ($defaultans) {
print " [$defaultans]";
}
print ": ";
# if we are prompting for a password, disable console echo
if ($ispwd) {
system("stty -echo");
}
# read the answer
my $ans = <STDIN>;
# if we are prompting for a password, enable console echo
if ($ispwd) {
system("stty echo");
print "\n";
}
chop($ans); # trim trailing newline
# see if this is the special BACK response, and finish if so
if ($self->isBack($ans)) {
$self->log("BACK\n");
return $ans;
}
if (!length($ans)) {
$ans = $defaultans;
}
# log the response, if not a password
if (!$ispwd) {
$self->log($ans . "\n");
}
return $ans;
}
sub alert {
my $self = shift;
my $msg = $self->{res}->getText(@_);
print $msg;
$self->{log}->logMessage($WARN, "Setup", $msg);
}
sub run {
my $self = shift;
my $done;
my $index = 0;
my $incr = 1;
my $rc = 0;
while (!$done) {
my $dialog = $self->{dialogs}->[$index];
my $resp = $NEXT;
$resp = $dialog->run();
if ($resp == $BACK) {
$incr = -1;
} elsif ($resp == $NEXT) {
$incr = 1;
} elsif ($resp == $SAME) {
$incr = 0;
} else {
$self->handleError($resp);
$done = 1;
$rc = 1;
}
$index += $incr;
if ($index < 0) {
$index = 0;
} elsif ($index >= @{$self->{dialogs}}) {
$done = 1;
}
}
return $rc;
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE Inf.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# manages inf files - gets values
# given keys
package Inf;
#require Exporter;
#@ISA = qw(Exporter);
#@EXPORT = qw();
sub new {
my $type = shift;
my $self = {};
$self->{filename} = shift;
$self = bless $self, $type;
if ($self->{filename}) {
$self->read();
}
return $self;
}
sub read {
# each key in the table is a section name
# the value is a hash ref of the items in that section
# in that hash ref, each key is the config param name,
# and the value is the config param value
my $self = shift;
my $filename = shift;
my $curSection;
if ($filename) {
$self->{filename} = $filename;
} else {
$filename = $self->{filename};
}
open INF, $filename or die "Error: could not open inf file $filename: $!";
while (<INF>) {
# e.g. [General]
if (/^\[(.*?)\]/) {
$curSection = $1;
} elsif (/^\s*$/) {
next; # skip blank lines
} elsif (/^\s*\#/) {
next; # skip comment lines
} elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) {
$self->{$curSection}->{$1} = $2;
}
}
close INF;
}
sub section {
my $self = shift;
my $key = shift;
if (!exists($self->{$key})) {
print "Error: unknown inf section $key\n";
return undef;
}
return $self->{$key};
}
sub writeSection {
my $self = shift;
my $name = shift;
my $fh = shift;
my $section = $self->{$name};
if (ref($section) eq 'HASH') {
print $fh "[$name]\n";
for my $key (keys %{$section}) {
if (defined($section->{$key})) {
print $fh "$key = ", $section->{$key}, "\n";
}
}
}
}
sub write {
my $self = shift;
my $filename = shift;
if ($filename) {
$self->{filename} = $filename;
} else {
$filename = $self->{filename};
}
open INF, ">$filename" or die "Error: could not write inf file $filename: $!";
# write General section first
$self->writeSection('General', \*INF);
print INF "\n";
for my $key (keys %{$self}) {
next if ($key eq 'General');
$self->writeSection($key, \*INF);
print INF "\n";
}
close INF;
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE Resource.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# manages resource bundle files - gets values
# given keys
package Resource;
use strict;
#require Exporter;
#@ISA = qw(Exporter);
#@EXPORT = qw();
sub new {
my $type = shift;
my $self = {};
$self->{filename} = shift;
$self = bless $self, $type;
if ($self->{filename}) {
$self->read();
}
return $self;
}
sub read {
my $self = shift;
my $filename = shift;
if ($filename) {
$self->{filename} = $filename;
} else {
$filename = $self->{filename};
}
open RES, $filename or die "Error: could not open resource file $filename: $!";
while (<RES>) {
next if (/^\s*$/); # skip blank lines
next if (/^\s*\#/); # skip comment lines
# read name = value pairs like this
# bol whitespace* name whitespace* '=' whitespace* value eol
# the value will include any trailing whitespace
if (/^\s*(.*?)\s*=\s*(.*?)$/) {
$self->{res}->{$1} = $2;
# replace \n with real newline
$self->{res}->{$1} =~ s/\\n/\n/g;
}
}
close RES;
}
# given a resource key and optional args, return the value
# $text = $res->getText('key');
# or
# $text = $res->getText('key', @args);
# or
# $text = $res->getText($arrayref)
# where $arrayref is ['key', @args]
sub getText {
my $self = shift;
my $key = shift;
my @args = @_;
if (ref($key) eq 'ARRAY') {
my $tmpkey = shift @{$key};
@args = @{$key};
$key = $tmpkey;
}
if (!exists($self->{res}->{$key})) {
print "Error: unknown resource key $key\n";
return undef;
}
if (!defined($self->{res}->{$key})) {
print "Error: resource key $key has no value\n";
return undef;
}
# see if the args themselves are resource keys
for (my $ii = 0; $ii < @args; ++$ii) {
if (exists($self->{res}->{$args[$ii]})) {
$args[$ii] = $self->{res}->{$args[$ii]};
}
}
my $text = sprintf $self->{res}->{$key}, @args;
return $text;
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE Setup.pm.in ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
###########################
#
# This perl module 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.
#
##########################
package Setup;
use Exporter ();
@ISA = qw(Exporter);
@EXPORT = qw($SILENT $EXPRESS $TYPICAL $CUSTOM);
@EXPORT_OK = qw($SILENT $EXPRESS $TYPICAL $CUSTOM);
# tempfiles
use File::Temp qw(tempfile tempdir);
# hostname
use Net::Domain qw(hostfqdn);
# load perldap
use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Utils qw(normalizeDN);
use Mozilla::LDAP::API qw(ldap_explode_dn);
use Mozilla::LDAP::LDIF;
use Getopt::Long;
use File::Temp qw(tempfile tempdir);
use SetupLog;
# the setup types
$SILENT = 0;
$EXPRESS = 1;
$TYPICAL = 2;
$CUSTOM = 3;
# process command line options
Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
sub VersionMessage {
print "@capbrand@ Directory Server Setup Program Version @PACKAGE_VERSION@\n";
}
sub HelpMessage {
print <<EOF;
Usage: $0 [--options] -- [args]
options:
--help This message
--version Print the version and exit
--debug Turn on debugging
--silent Use silent setup - no user input
--file=name Use the file 'name' in .inf format to supply the default answers
--keepcache Do not delete the temporary .inf file generated by this program
--logfile Log setup messages to this file - otherwise, a temp file will be used
For all options, you can also use the short name e.g. -h, -d, etc. For the -d argument,
specifying it more than once will increase the debug level e.g. -ddddd
args:
You can supply default .inf data in this format:
section.param=value
e.g.
General.FullMachineName=foo.example.com
or
"slapd.Suffix=dc=example, dc=com"
Values passed in this manner will override values in an .inf file given with the -f argument.
EOF
}
sub new {
my $type = shift;
my $self = {};
my ($debuglevel, $silent, $inffile, $keep, $preonly, $logfile);
my @otherargs;
GetOptions('help|h|?' => sub { VersionMessage(); HelpMessage(); exit 0 },
'version|v' => sub { VersionMessage(); exit 0 },
'debug|d+' => \$debuglevel,
'silent|s' => \$silent,
'file|f=s' => \$inffile,
'keepcache|k' => \$keep,
'preonly|p' => \$preonly,
'logfile|l=s' => \$logfile
);
$self->{debuglevel} = $debuglevel;
$self->{silent} = $silent;
$self->{inffile} = $inffile;
$self->{keep} = $keep;
$self->{preonly} = $preonly;
$self->{logfile} = $logfile;
$self->{log} = new SetupLog($self->{logfile});
if (!$self->{inffile}) {
my ($fh, $filename) = tempfile("setupXXXXXX", UNLINK => !$keep,
SUFFIX => ".inf", OPEN => 0,
DIR => File::Spec->tmpdir);
$self->{inffile} = $filename;
$self->{inf} = new Inf;
$self->{inf}->{filename} = $self->{inffile};
} else {
$self->{inf} = new Inf($self->{inffile});
$self->{keep} = 1; # do not delete user supplied inf file
}
# see if user passed in default inf values - also, command line
# arguments override those passed in via an inf file - this
# allows the reuse of .inf files with some parameters overridden
for (@ARGV) {
if (/^(\w+).(\w+)=(.*)$/) { # e.g. section.param=value
$self->{inf}->{$1}->{$2} = $3;
} else { # error
print STDERR "Error: unknown command line option $_\n";
usage();
exit 1;
}
}
$self->{configdir} = $ENV{DS_CONFIG_DIR} || "@instconfigdir@";
$self = bless $self, $type;
return $self;
}
# log only goes the the logfile
sub log {
my $self = shift;
my $level = shift;
$self->{log}->logMessage($level, "Setup", @_);
}
# msg does to the screen and optionally to the log file
# if you use msg like this:
# msg(0, "some message")
# it will go only to the screen
# if you use msg like this:
# msg($WARN, "some message")
# it will go to the screen and to the log at the $WARN level
sub msg {
my $self = shift;
my $level = shift;
my @text = @_;
if (!$level && @text) {
# e.g. msg(0, "string") - no logging
} elsif ($level and @text and grep {/^$level$/} $self->{log}->levels()) {
# e.g. msg($WARN, "string") - print and log
} else {
# log at default INFO level
unshift @text, $level;
$level = $INFO;
}
if ($level) {
$self->log($level, @text);
}
print @text;
}
sub doExit {
my $self = shift;
$self->msg($FATAL, "Exiting . . .\n");
$self->msg("Log file is " . $self->{log}->{filename} . "\n");
exit 1;
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE SetupDialogs.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
package SetupDialogs;
use strict;
use DialogManager;
use Setup;
use Dialog;
use Net::Domain qw(hostfqdn);
my $welcome = new DialogYesNo (
$EXPRESS,
['dialog_welcome_text', 'brand', 'brand'],
1,
sub {
my $self = shift;
my $ans = shift;
my $res = $self->handleResponse($ans);
if ($res == $DialogManager::NEXT) {
$res = $DialogManager::ERR if (!$self->isYes());
}
return $res;
},
['dialog_welcome_prompt'],
);
my $license = new DialogYesNo (
$EXPRESS,
'dialog_license_text',
0,
sub {
my $self = shift;
my $ans = shift;
my $res = $self->handleResponse($ans);
if ($res == $DialogManager::NEXT) {
$res = $DialogManager::ERR if (!$self->isYes());
}
return $res;
},
['dialog_license_prompt']
);
my $setuptype = new Dialog (
$EXPRESS,
'dialog_setuptype_text',
sub {
my $self = shift;
return $self->{manager}->getType();
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
if ($ans < $EXPRESS or $ans > $CUSTOM) {
$self->{manager}->alert("dialog_setuptype_error");
} else {
$res = $DialogManager::NEXT;
$self->{manager}->setType($ans);
}
return $res;
},
['dialog_setuptype_prompt']
);
my $hostdlg = new Dialog (
$TYPICAL,
'dialog_hostname_text',
sub {
my $self = shift;
return $self->{manager}->{inf}->{General}->{FullMachineName} ||
hostfqdn;
},
sub {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::NEXT;
if ($ans !~ /\./) {
$self->{manager}->alert("dialog_hostname_warning", $ans);
}
$self->{manager}->{inf}->{General}->{FullMachineName} = $ans;
return $res;
},
['dialog_hostname_prompt']
);
# must verify that the user or uid specified by the user to run the server as
# is a valid uid
sub verifyUserChoice {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::NEXT;
# convert numeric uid to string
my $strans = $ans;
if ($ans =~ /^\d/) { # numeric - convert to string
$strans = getpwuid $ans;
if (!$strans) {
$self->{manager}->alert("dialog_ssuser_error", $ans);
return $DialogManager::SAME;
}
}
if ($> != 0) { # if not root, the user must be our uid
my $username = getlogin;
if ($strans ne $username) {
$self->{manager}->alert("dialog_ssuser_must_be_same", $username);
return $DialogManager::SAME;
}
} else { # user is root - verify id
my $nuid = getpwnam $strans;
if (!defined($nuid)) {
$self->{manager}->alert("dialog_ssuser_error", $ans);
return $DialogManager::SAME;
}
if (!$nuid) {
$self->{manager}->alert("dialog_ssuser_root_warning");
}
}
$self->{manager}->{inf}->{General}->{SuiteSpotUserID} = $ans;
return $res;
}
# must verify that the given group is one of the groups the given user
# belongs to
sub verifyGroupChoice {
my $self = shift;
my $ans = shift;
my $res = $DialogManager::NEXT;
my ($dummy, $memstr);
my $strgrp;
my $numgrp;
if ($ans =~ /^\d/) { # numeric
$numgrp = $ans;
($strgrp, $dummy, $dummy, $memstr) = getgrgid $ans;
} else {
$strgrp = $ans;
($dummy, $dummy, $numgrp, $memstr) = getgrnam $ans;
}
if (!defined($strgrp) or !defined($numgrp)) {
$self->{manager}->alert("dialog_ssgroup_error", $ans);
return $DialogManager::SAME;
}
# get the user id, and then get the user's default group id
my $uid = $self->{manager}->{inf}->{General}->{SuiteSpotUserID};
my $usergid;
if ($uid =~ /^\d/) { # numeric
($uid, $dummy, $dummy, $usergid, $dummy) = getpwuid $uid;
} else { # string
($uid, $dummy, $dummy, $usergid, $dummy) = getpwnam $uid;
}
if ($numgrp == $usergid) {
$self->{manager}->{inf}->{General}->{SuiteSpotGroup} = $ans;
} elsif ($memstr) { # see if the user is in the member list
if ($memstr =~ /\b$uid\b/) { # uid exactly matches one of the users in the member string
$self->{manager}->{inf}->{General}->{SuiteSpotGroup} = $ans;
} else { # no match
$self->{manager}->alert("dialog_ssgroup_no_match",
$self->{manager}->{inf}->{General}->{SuiteSpotUserID},
$ans, $memstr);
$res = $DialogManager::SAME;
}
} else { # user not in group
$self->{manager}->alert("dialog_ssgroup_no_user",
$self->{manager}->{inf}->{General}->{SuiteSpotUserID},
$ans);
$res = $DialogManager::SAME;
}
return $res;
}
my $usergroup = new Dialog (
$TYPICAL,
'dialog_ssuser_text',
sub {
my $self = shift;
my $index = shift;
if ($index == 0) {
my $username = $self->{manager}->{inf}->{General}->{SuiteSpotUserID};
if (!$username) {
if ($> == 0) { # if root, use the default user
$username = "\@defaultuser\@";
} else { # if not root, use the user's uid
$username = getlogin;
}
}
return $username;
} else { # group
my $groupname = $self->{manager}->{inf}->{General}->{SuiteSpotGroup};
if (!$groupname) {
if ($> == 0) { # if root, use the default group
$groupname = "\@defaultgroup\@";
} else { # if not root, use the user's gid
$groupname = getgrgid $(;
}
}
return $groupname;
}
},
sub {
my $self = shift;
my $ans = shift;
my $index = shift;
if ($index == 0) {
return verifyUserChoice($self, $ans);
} else {
return verifyGroupChoice($self, $ans);
}
},
['dialog_ssuser_prompt'], ['dialog_ssgroup_prompt']
);
sub getDialogs {
return ($welcome, $license, $setuptype, $hostdlg, $usergroup);
}
1;
--- NEW FILE SetupLog.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# This implements SetupLog from setuputil InstallLog in perl
#
package SetupLog;
use Exporter ();
@ISA = qw(Exporter);
@EXPORT = qw($FATAL $START $SUCCESS $WARN $INFO $DEBUG);
@EXPORT_OK = qw($FATAL $START $SUCCESS $WARN $INFO $DEBUG);
use POSIX qw(strftime);
# tempfiles
use File::Temp qw(tempfile tempdir);
# exported variables
$FATAL = "Fatal";
$START = "Start";
$SUCCESS = "Success";
$WARN = "Warning";
$INFO = "Info";
$DEBUG = "Debug";
sub new {
my $type = shift;
my $filename = shift;
my $self = {};
my $fh;
if (!$filename) {
($fh, $filename) = tempfile("setupXXXXXX", UNLINK => 0,
SUFFIX => ".log", DIR => File::Spec->tmpdir);
} else {
open LOGFILE, ">$filename" or die "Error: could not open logfile $filename: $!";
$fh = \*LOGFILE;
}
$self->{fh} = $fh;
$self->{filename} = $filename;
$self = bless $self, $type;
return $self;
}
sub logMessage {
my ($self, $level, $who, $msg, @rest) = @_;
if (!$self->{fh}) {
return;
}
my $string = strftime "[%y/%m/%d:%H:%M:%S] - ", localtime;
$string .= "[$who] $level ";
$string .= sprintf $msg, @rest;
print { $self->{fh} } $string;
}
sub levels {
my $self = shift;
return ($FATAL, $START, $SUCCESS, $WARN, $INFO, $DEBUG);
}
#############################################################################
# Mandatory TRUE return value.
#
1;
--- NEW FILE Util.pm ---
# 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) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
package Util;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(portAvailable getAvailablePort isValidDN);
@EXPORT_OK = qw(portAvailable getAvailablePort isValidDN);
use strict;
use Socket;
# return true if the given port number is available, false otherwise
sub portAvailable {
my $port = shift;
my $proto = getprotobyname('tcp');
my $rc = socket(SOCK, PF_INET, SOCK_STREAM, $proto);
if ($rc == 1) {
$rc = bind(SOCK, sockaddr_in($port, INADDR_ANY));
}
close(SOCK);
return $rc and ($rc == 1);
}
# returns a randomly assigned port number, or -1
# if not able to find an available port
sub getAvailablePort {
my $MINPORT = 1024;
my $MAXPORT = 65535;
srand( time() ^ ($$ + ($$ << 15)) );
while (1) {
my $port = $MINPORT + int(rand($MAXPORT-$MINPORT));
if (portAvailable($port)) {
return $port;
}
}
}
sub isValidDN {
my $dn = shift;
return ($dn =~ /^[0-9a-zA-Z_-]+=.*$/);
}
1;
--- NEW FILE setup-ds.pl.in ---
#!/usr/bin/env perl
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
use lib '@perldir@';
use strict;
use Setup;
use Inf;
use Resource;
use DialogManager;
my $setup = new Setup;
if (!$setup->{silent}) {
my $res = new Resource("@propertydir(a)/setup-ds.res");
my $dialogmgr = new DialogManager($setup, $res, $TYPICAL);
require SetupDialogs;
require DSDialogs;
my @dialogs = SetupDialogs->getDialogs();
push @dialogs, DSDialogs->getDialogs();
$dialogmgr->addDialog(@dialogs);
my $rc = $dialogmgr->run();
if ($rc) {
$setup->doExit();
}
$setup->{inf}->write();
}
system("@bindir(a)/ds_newinst.pl $setup->{inffile}");
if (!$setup->{keep}) {
unlink $setup->{inffile};
}
$setup->doExit();
--- NEW FILE setup-ds.res.in ---
# ------------ Global Resources -----------
brand = @capbrand@
yes = yes
no = no
yes_no_error = Please answer "yes" or "no"\n\n
setup_err_exit = Setup cannot proceed. Exiting.\n\n
dialog_use_different_type = When using Silent or Express mode, some of the\ndialogs are skipped, but validation is still performed\non the default or given answers. You should run this program again and\nchoose Typical or Custom mode in order to provide a valid input\nfor the problem dialog.\n\n
# ------------ Welcome Dialog Resource ------------
dialog_welcome_text = This program will setup the %s Directory Server.\n\nIt is recommended that you have "root" privilege to setup the software.\nTips for using this program:\n - Press "Enter" to choose the default and go to the next screen\n - Type "Control-B" then "Enter" to go back to the previous screen\n - Type "Control-C" to cancel the setup program\n - You can enter multiple items using commas to separate them.\n For example: 1, 2, 3 \n\n
# %s -> brand
dialog_welcome_prompt = Would you like to continue with setup?
# ----------- License Dialog Resource -----------
dialog_license_text = BY SETTING UP AND USING THIS SOFTWARE YOU ARE CONSENTING TO BE BOUND BY\nAND ARE BECOMING A PARTY TO THE AGREEMENT FOUND IN THE\nLICENSE.TXT FILE. IF YOU DO NOT AGREE TO ALL OF THE TERMS\nOF THIS AGREEMENT, PLEASE DO NOT SETUP OR USE THIS SOFTWARE.\n\n
dialog_license_prompt = Do you agree to the license terms?
# ----------- Setup Type Dialog Resource ----------------
dialog_setuptype_text = Choose a setup type:\n\n 1. Express\n Allows you to quickly setup the servers using the most\n common options and pre-defined defaults. Useful for quick\n evaluation of the products.\n\n 2. Typical\n Allows you to specify common defaults and options.\n\n 3. Custom\n Allows you to specify more advanced options. This is \n recommended for experienced server administrators only.\n\nTo accept the default shown in brackets, press the Enter key.\n\n
dialog_setuptype_prompt = Choose a setup type
dialog_setuptype_error = Invalid setup type\n\n
# ----------- HostName Dialog Resource ----------------
dialog_hostname_text = Enter the fully qualified domain name of the computer\non which you're setting up server software. Using the form\n<hostname>.<domainname>\nExample: eros.example.com.\n\nTo accept the default shown in brackets, press the Enter key.\n\n
dialog_hostname_prompt = Computer name
dialog_hostname_warning = The hostname %s does not look like a\nfully qualified host and domain name.\nIf you feel you have made a mistake,\nplease go back to this dialog and enter another name.\n\n
# ----------- SSUser Dialog Resource ----------------
dialog_ssuser_text = The server must run as a specific user in a specific group.\nIt is strongly recommended that this user should have no privileges\non the computer (i.e. a non-root user). The Administration Server\nwill give this user/group some permissions in specific paths/files\nto perform server-specific operations.\n\nIf you have not yet created a user and group for the server,\ncreate this user and group using your native operating\nsystem utilities.\n\n
dialog_ssuser_prompt = System User
dialog_ssuser_error = The user '%s' is invalid.\n\n
dialog_ssuser_must_be_same = Since you are not running setup as root, the System User must be the same as your userid '%s'.\n\n
dialog_ssuser_root_warning = You are strongly discouraged to use a non-root user for the server uid.\nIf you feel you have made a mistake,\nplease go back to this dialog and enter another system user.\n\n
dialog_ssgroup_prompt = System Group
dialog_ssgroup_error = The group '%s' is invalid.\n\n
dialog_ssgroup_no_match = The system user '%s' does not belong to the group '%s'.\n\nThis is the list of users of the given group: %s\n\n
dialog_ssgroup_no_user = The system user '%s' does not belong to the group '%s'.\n\n
# ----------- DS port Dialog Resource ----------------
dialog_dsport_text = The standard directory server network port number is 389. However, if\nyou are not logged as the superuser, or port 389 is in use, the\ndefault value will be a random unused port number greater than 1024.\nIf you want to use port 389, make sure that you are logged in as the\nsuperuser, that port 389 is not in use.\n\n
dialog_dsport_prompt = Directory server network port
dialog_dsport_error = The port %s is in use or not available. Please choose another port.\n\n
# ----------- DS server ID Dialog Resource ----------------
dialog_dsserverid_text = Each instance of a directory server requires a unique identifier.\nThis identifier is used to name the various\ninstance specific files and directories in the file system,\nas well as for other uses as a server instance identifier.\n\n
dialog_dsserverid_prompt = Directory server identifier
dialog_dsserverid_error = The server identifier '%s' is not valid. Please choose another one.\n\n
dialog_dsserverid_inuse = The server identifier '%s' is already in use. Please choose another one.\n\n
# ----------- DS suffix Dialog Resource ----------------
dialog_dssuffix_text = The suffix is the root of your directory tree. The suffix must be a valid DN.\nIt is recommended that you use the dc=domaincomponent suffix convention.\nFor example, if your domain is example.com,\nyou should use dc=example,dc=com for your suffix.\nSetup will create this initial suffix for you,\nbut you may have more than one suffix.\nUse the directory server utilities to create additional suffixes.\n\n
dialog_dssuffix_prompt = Suffix
dialog_dssuffix_error = The suffix '%s' is not a valid DN. Please choose another one.\n\n
# ----------- DS Root DN and password Dialog Resource ----------------
dialog_dsrootdn_text = Certain directory server operations require an administrative user.\nThis user is referred to as the Directory Manager and typically has a\nbind Distinguished Name (DN) of cn=Directory Manager.\nYou will also be prompted for the password for this user. The password must\nbe at least 8 characters long, and contain no spaces.\n\n
dialog_dsrootdn_prompt = Directory Manager DN
dialog_dsrootdn_error = The input '%s' is not a valid DN. Please choose another one.\n\n
dialog_dsrootpw_prompt1 = Password
dialog_dsrootpw_prompt2 = Password (again)
dialog_dsrootpw_invalid = The password contains invalid characters. Please choose another one.\n\n
dialog_dsrootpw_tooshort = The password must be at least %s characters long. Please choose another one.\n\n
dialog_dsrootpw_nomatch = The passwords do not match. Please try again.\n\n
# ----------- DS Sample Data Dialog Resource ----------------
dialog_dssample_text = You may install some sample entries in this directory instance. These\nentries will be installed in a separate suffix and will not interfere\nwith the normal operation of the directory server.\n\n
dialog_dssample_prompt = Do you want to install the sample entries?
# ----------- DS Populate Data Dialog Resource ----------------
dialog_dspopulate_text = 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\nentries can be added. If you want to import entries from an LDIF\nfile, you may type in the full path and filename at the prompt. If\nyou want the setup program to add the suggested entries, type the\nword suggest at the prompt. The suggested entries are common\ncontainer entries under your specified suffix, such as ou=People and\nou=Groups, which are commonly used to hold the entries for the persons\nand groups in your organization. If you do not want to add any of\nthese entries, type the word none at the prompt.\n\n
dialog_dspopulate_prompt = Type the full path and filename, the word suggest, or the word none
dialog_dspopulate_error = The file '%s' was not found. Please choose another one.\n\n
16 years, 10 months
[Fedora-directory-commits] ldapserver/ldap/admin/src cfg_sspt.c, 1.11, 1.12 create_instance.c, 1.57, 1.58 ds_newinst.pl.in, 1.6, 1.7
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25184/ldapserver/ldap/admin/src
Modified Files:
cfg_sspt.c create_instance.c ds_newinst.pl.in
Log Message:
Resolves: bug 243205
Description: allow instance creation with no .inf file; allow pre-hashed RootDNPwd
Reviewed by: nhosoi (Thanks!)
Fix Description: You can now use ds_newinst.pl without (or with) a .inf file like this:
ds_newinst.pl General.SuiteSpotUserID=nobody slapd.ServerPort=3890 ....
The parameters can be supplied via the command line. The format of the parameter is section.param=value. Normal shell quoting rules apply, so you still have to do something like this:
ds_newinst.pl "slapd.Suffix=dc=example, dc=com"
for embedded spaces and the like. If you supply a filename (or '-'), it must be the first argument after ds_newinst.pl. If you then supply additional arguments after the filename, these will override the settings in the given inf file. So, for example, you could reuse the same .inf file, except provide a different hostname:
ds_newinst.pl basefile.inf General.FullMachineName=bar.example.com
This allows you to use the same base .inf file for several machines, and only change certain parameters on a per-machine basis.
ds_newinst.pl will now fill in some default values - it will use Net::Domain::hostfqdn for FullMachineName, and your login ID for SuiteSpotUserID (however, not if running ds_newinst.pl as root), and will construct the Suffix and ServerIdentifier based on the FullMachineName. RootDN will default to cn=Directory Manager. ServerRoot is no longer required.
Another enhancement is the ability to provide a pre-hashed password for the RootDNPwd parameter, to avoid having to pass around the clear text directory manager password. However, some caveats apply. If the password begins with one of the well known hash algorithms (e.g. {SHA, {SSHA, etc.), ds_newinst will assume it is already hashed. This may cause problems if users expect to be able to provide a clear text password such as {SSHA}text, but I seriously doubt anyone does that (famous last words . . .). Another problem is that the code as it currently stands uses the clear text password to bind to the server after starting the server to add some additional entries and ACIs. This cannot be done if a pre-hashed password is provided (but we're working on a solution to that problem too).
write_ldap_info() is no longer needed.
Finally, a couple of minor bug fixes.
Platforms tested: RHEL4
Flag Day: no
Doc impact: Yes. There will be some documentation changes required.
Index: cfg_sspt.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/cfg_sspt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- cfg_sspt.c 10 Nov 2006 23:44:33 -0000 1.11
+++ cfg_sspt.c 7 Jun 2007 22:40:14 -0000 1.12
@@ -1362,39 +1362,6 @@
return connection;
}
-static int
-write_ldap_info(SLAPD_CONFIG* slapd, char* base, char* admnm)
-{
- FILE* fp;
- int ret = 0;
-
- char* fmt = "%s/shared/config/ldap.conf";
- char* infoFileName = PR_smprintf(fmt, slapd->slapd_server_root);
-
- if ((fp = fopen(infoFileName, "w")) == NULL)
- {
- ret = -1;
- }
- else
- {
- fprintf(fp, "url\tldap://%s:%d/",
- slapd->host, slapd->port);
-
- if (base)
- fprintf(fp, "%s", base);
-
- fprintf(fp, "\n");
-
- fprintf(fp, "admnm\t%s\n", admnm);
-
- fclose(fp);
- }
-
- PR_smprintf_free(infoFileName);
-
- return ret;
-}
-
#ifdef TEST_CONFIG
int
config_configEntry(LDAP* connection, QUERY_VARS* query)
@@ -1630,12 +1597,6 @@
value_hostPreferencesOU, 0,
0, 0, 0);
}
-
- /*
- ** Write the ldap.info file and the SuiteSpot.ldif file
- */
-
- write_ldap_info(slapd, query->suffix, query->ssAdmID);
}
#ifdef TEST_CONFIG
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- create_instance.c 7 Jun 2007 21:23:54 -0000 1.57
+++ create_instance.c 7 Jun 2007 22:40:14 -0000 1.58
@@ -144,7 +144,6 @@
static char *ds_gen_gw_conf(char *sroot, char *cs_path, server_config_s *cf, int conf_type);
static char *install_ds(char *sroot, server_config_s *cf, char *param_name);
-static int write_ldap_info(char *slapd_server_root, server_config_s *cf);
#if defined (BUILD_PRESENCE)
static char *gen_presence_init_script(char *sroot, server_config_s *cf,
char *cs_path);
@@ -4123,9 +4122,6 @@
}
}
- /* write ldap.conf */
- write_ldap_info( sroot, cf );
-
#ifdef XP_UNIX
ds_become_localuser_name (cf->servuser);
#endif
@@ -4143,6 +4139,17 @@
}
#endif /* XP_WIN32 */
+ /* if an already hashed password is given, we cannot do the configure_suitespot()
+ stuff below, because that requires the clear text password in order to
+ bind to the server. This also means that default entries and default
+ acis will not be added to the server.
+ */
+ if (cf->rootpw == cf->roothashedpw) {
+ if (status)
+ return make_error ("Could not configure server (%d).", status);
+ return NULL;
+ }
+
memset( &query_vars, 0, sizeof(query_vars) );
if (!cf->use_existing_user_ds)
query_vars.suffix = create_instance_strdup( cf->suffix );
@@ -4199,48 +4206,6 @@
return(NULL);
}
-/* write_ldap_info() : writes ldap.conf */
-
-static int
-write_ldap_info( char *slapd_server_root, server_config_s *cf)
-{
- FILE* fp;
- int ret = 0;
-
- char* fmt = "%s/shared/config/ldap.conf";
- char* infoFileName;
-
- if (!slapd_server_root) {
- return -1;
- }
-
- infoFileName = PR_smprintf(fmt, slapd_server_root);
-
- if ((fp = fopen(infoFileName, "w")) == NULL)
- {
- ret = -1;
- }
- else
- {
- fprintf(fp, "url\tldap://%s:%d/",
- cf->servname, atoi(cf->servport));
-
- if (cf->suffix)
- fprintf(fp, "%s", cf->suffix);
-
- fprintf(fp, "\n");
-
- if (cf->cfg_sspt_uid) {
- fprintf(fp, "admnm\t%s\n", cf->cfg_sspt_uid);
- }
-
- fclose(fp);
- }
- PR_smprintf_free(infoFileName);
-
- return ret;
-}
-
/* ----------- Create a new server from configuration variables ----------- */
@@ -4542,8 +4507,17 @@
cf->rootpw = pw1;
}
- /* Encode the password in SSHA by default */
- cf->roothashedpw = (char *)ds_salted_sha1_pw_enc (cf->rootpw);
+ if (strchr(cf->rootpw, '}') &&
+ (!PL_strncasecmp(cf->rootpw, "{SHA", 4) ||
+ !PL_strncasecmp(cf->rootpw, "{SSHA", 5) ||
+ !PL_strncasecmp(cf->rootpw, "{CRYPT}", 7) ||
+ !PL_strncasecmp(cf->rootpw, "{MD5}", 5))) {
+ /* assume the password is already hashed */
+ cf->roothashedpw = cf->rootpw;
+ } else { /* assume cleartext password */
+ /* Encode the password in SSHA by default */
+ cf->roothashedpw = (char *)ds_salted_sha1_pw_enc (cf->rootpw);
+ }
}
cf->admin_domain = ds_a_get_cgi_var("admin_domain", NULL, NULL);
@@ -4555,7 +4529,7 @@
}
if ((temp = ds_a_get_cgi_var("use_existing_user_ds", NULL, NULL))) {
- cf->use_existing_config_ds = atoi(temp);
+ cf->use_existing_user_ds = atoi(temp);
} else {
cf->use_existing_user_ds = 0; /* we are creating it */
}
Index: ds_newinst.pl.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/ds_newinst.pl.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ds_newinst.pl.in 7 Jun 2007 21:23:54 -0000 1.6
+++ ds_newinst.pl.in 7 Jun 2007 22:40:14 -0000 1.7
@@ -35,6 +35,7 @@
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
+use Net::Domain qw(hostfqdn);
use IPC::Open2;
use Symbol;
use CGI::Util qw(escape);
@@ -43,9 +44,28 @@
sub usage {
my $msg = shift;
- print "Error: $msg\n";
- print "Usage: $0 [-|filename.inf]\n";
- print "Use - to read from stdin\n";
+ print <<EOF;
+Error: $msg
+Usage: $0 [-|filename.inf] [args]
+The filename, if any, should be specified first. After the filename, other args
+can be provided to override settings in the provided file in this format:
+ section.param=value
+e.g.
+ General.FullMachineName=foo.example.com
+or
+ "slapd.Suffix=dc=example, dc=com"
+
+So, for example, if you use
+ $0 filename.inf General.FullMachineName=bar.example.com
+And your filename.inf file has
+ [General]
+ FullMachineName= foo.example.com
+$0 will use bar.example.com for FullMachineName since that was the one passed on the command line
+
+$0 will attempt to generate reasonable default values for some of the parameters, but there are a couple that must be specified:
+ slapd.ServerPort slapd.RootDNPwd
+Also General.SuiteSpotUserID must be specified if running as root. If not running as root, the uid of the user will be used.
+EOF
exit 1
}
@@ -69,7 +89,7 @@
# fakes out the ds_newinst program into thinking it is getting cgi input
sub cgiFake {
- my ($sroot, $verbose, $prog, $args) = @_;
+ my ($verbose, $prog, $args) = @_;
# construct content string
my ($content, $length) = &getCgiContentAndLength($args);
@@ -87,9 +107,12 @@
chdir $dir;
my $input = gensym();
my $output = gensym();
+ # make sure the child exit code is reset before starting the fake
+ # cgi program
+ $? = 0;
my $pid = open2($input, $output, "./$exe");
sleep(1); # allow prog to init stdin read buffers
- print $output $content, "\n";
+ print $output $content;
close $output;
if ($?) {
@@ -136,48 +159,81 @@
$dest->{$dkey} = $source->{$ssec}->{$skey};
}
-my $filename = $ARGV[0];
-usage("$filename not found") if ($filename ne "-" && ! -f $filename);
+sub readInfFile {
+ my $filename = shift;
+ my $fh;
+ if ($filename eq "-") {
+ $fh = \*STDIN;
+ } else {
+ open(IN, $filename) or usage("could not open file $filename: $!");
+ $fh = \*IN;
+ }
+ while (<$fh>) {
+ # e.g. [General]
+ if (/^\[(.*?)\]/) {
+ $curSection = $1;
+ } elsif (/^\s*$/) {
+ next; # skip blank lines
+ } elsif (/^\s*\#/) {
+ next; # skip comment lines
+ } elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) {
+ $table{$curSection}->{$1} = $2;
+ }
+ }
+ if ($filename ne "-") {
+ close IN;
+ }
+}
+
+usage("No arguments given") if (!@ARGV);
+
+# process command line arguments
+for (@ARGV) {
+ if (/^(\w+).(\w+)=(.*)$/) { # e.g. section.param=value
+ $table{$1}->{$2} = $3;
+ } else { # file?
+ readInfFile($_);
+ }
+}
-my $curSection;
-# each key in the table is a section name
-# the value is a hash ref of the items in that section
-# in that hash ref, each key is the config param name,
-# and the value is the config param value
-my %table = ();
-
-my $fh;
-if ($filename eq "-") {
- $fh = \*STDIN;
-} else {
- open(IN, $filename);
- $fh = \*IN;
+#printhash (\%table);
+
+# set default values
+if (!$table{General}->{FullMachineName}) {
+ $table{General}->{FullMachineName} = hostfqdn;
}
-while (<$fh>) {
- # e.g. [General]
- if (/^\[(.*?)\]/) {
- $curSection = $1;
- } elsif (/^\s*$/) {
- next; # skip blank lines
- } elsif (/^\s*\#/) {
- next; # skip comment lines
- } elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) {
- $table{$curSection}->{$1} = $2;
- }
+
+if (!$table{General}->{SuiteSpotUserID}) {
+ if ($> != 0) { # if not root, use the user's uid
+ $table{General}->{SuiteSpotUserID} = getlogin;
+ }
+ # otherwise, the uid must be specified
}
-if ($filename ne "-") {
- close IN;
+
+if (!$table{slapd}->{RootDN}) {
+ $table{slapd}->{RootDN} = "cn=Directory Manager";
}
-#printhash (\%table);
+if (!$table{slapd}->{Suffix}) {
+ my $suffix = $table{General}->{FullMachineName};
+ # convert fqdn to dc= domain components
+ $suffix = "dc=$suffix";
+ $suffix =~ s/\./, dc=/g;
+ $table{slapd}->{Suffix} = $suffix;
+}
+
+if (!$table{slapd}->{ServerIdentifier}) {
+ my $servid = $table{General}->{FullMachineName};
+ # strip out the leftmost domain component
+ $servid =~ s/\..*$//;
+ $table{slapd}->{ServerIdentifier} = $servid;
+}
# next, construct a hash table with our arguments
my %cgiargs = ();
my $package_name = "@package_name@";
-
# the following items are always required
-addAndCheck(\%cgiargs, "sroot", \%table, "General", "ServerRoot");
addAndCheck(\%cgiargs, "servname", \%table, "General", "FullMachineName");
addAndCheck(\%cgiargs, "servuser", \%table, "General", "SuiteSpotUserID");
addAndCheck(\%cgiargs, "rootdn", \%table, "slapd", "RootDN");
@@ -185,6 +241,12 @@
addAndCheck(\%cgiargs, "servid", \%table, "slapd", "ServerIdentifier");
addAndCheck(\%cgiargs, "suffix", \%table, "slapd", "Suffix");
+if (defined($table{"General"}->{"ServerRoot"})) {
+ $cgiargs{"sroot"} = $table{"General"}->{"ServerRoot"};
+} else {
+ $cgiargs{"sroot"} = '@serverdir@';
+}
+
# either servport or ldapifilepath must be specified - the server must
# listen to something . . .
my $canlisten = 0;
@@ -200,7 +262,7 @@
$cgiargs{"ldapifilepath"} = $table{"slapd"}->{"ldapifilepath"};
}
if (! $canlisten) {
- usage("Either ServerPort or ldapifilepath must be specified in the slapd section of $filename");
+ usage("Either ServerPort or ldapifilepath must be specified in the slapd section");
}
# the following items are optional
@@ -227,6 +289,15 @@
} else {
$cgiargs{"config_dir"} = "@instconfigdir@/slapd-" . $table{"slapd"}->{"ServerIdentifier"};
}
+
+# check to see if this instance already exists
+if (-d $cgiargs{"config_dir"}) {
+ print STDERR "Error: the server already exists at ", $cgiargs{"config_dir"}, "\n";
+ print STDERR "Please remove it first if you really want to recreate it,\n";
+ print STDERR "or use a different ServerIdentifier to create another instance.\n";
+ exit 1;
+}
+
# port number for Admin Server - used to configure some web apps
$cgiargs{adminport} = $table{admin}->{Port};
@@ -300,15 +371,12 @@
# server-side default is on
}
-my $sroot = $cgiargs{sroot};
-
my $prog = "@bindir@/ds_newinst";
if (! -x $prog) {
$prog = "@libdir@/$package_name/ds_newinst";
}
-my $rc = &cgiFake($sroot, $verbose,
- $prog, \%cgiargs);
+my $rc = &cgiFake($verbose, $prog, \%cgiargs);
if (!$rc) {
print "Success! Your new directory server instance was created\n";
@@ -316,6 +384,8 @@
print "Error: Could not create new directory server instance\n";
}
+exit $rc;
+
sub printhash {
my $table = shift;
16 years, 10 months
[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.56, 1.57 create_instance.h, 1.16, 1.17 ds_newinst.pl.in, 1.5, 1.6
by Doctor Conrad
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3722/ldap/admin/src
Modified Files:
create_instance.c create_instance.h ds_newinst.pl.in
Log Message:
Resolves: bug 239765
Description: Allow mimimum schema in ds_newinst.pl
Fix Description: Fixed by abartlet. Add a new configuration param to create_instance - install_full_schema. By default this is 1, meaning the traditional behavior of installing all of the schema. If set to 0, this will only install the 00core.ldif schema file. This also required enhancements to ds_newinst.pl as well as a bug fix to allow passing in a 0 value.
Reviewed by: nhosoi, rmeggins
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- create_instance.c 16 May 2007 19:45:26 -0000 1.56
+++ create_instance.c 7 Jun 2007 21:23:54 -0000 1.57
@@ -300,6 +300,7 @@
conf->upgradingServer = 0;
conf->start_server = "1";
+ conf->install_full_schema = 1;
conf->admin_domain = NULL;
conf->config_ldap_url = NULL;
conf->user_ldap_url = NULL;
@@ -3530,14 +3531,27 @@
fclose(srcf);
fclose(f);
- /*
- * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
- */
- PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
- cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
- if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
- return t;
-
+ if (cf->install_full_schema) {
+ /*
+ * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
+ */
+ PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
+ if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
+ return t;
+ } else {
+ PR_snprintf(src, sizeof(src), "%s%c%s%cschema%c00core.ldif",
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP, FILE_PATHSEP);
+ PR_snprintf(dest, sizeof(dest), "%s%c00core.ldif",
+ cf->schema_dir, FILE_PATHSEP);
+ if( (t = create_instance_copy(src, dest, NEWFILE_MODE, 0 )) ) {
+ return t;
+ } else {
+ if (pw) {
+ chownfile(pw, dest);
+ }
+ }
+ }
#if defined (BUILD_PRESENCE)
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/presence",
cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
@@ -4490,6 +4504,9 @@
return 1;
}
cf->start_server = ds_a_get_cgi_var("start_server", NULL, NULL);
+ if (temp = ds_a_get_cgi_var("install_full_schema", NULL, NULL)) {
+ cf->install_full_schema = atoi(temp);
+ }
cf->secserv = ds_a_get_cgi_var("secserv", NULL, NULL);
if (cf->secserv && strcmp(cf->secserv, "off"))
cf->secservport = ds_a_get_cgi_var("secservport", NULL, NULL);
Index: create_instance.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- create_instance.h 1 Mar 2007 03:34:23 -0000 1.16
+++ create_instance.h 7 Jun 2007 21:23:54 -0000 1.17
@@ -185,6 +185,7 @@
#if defined(ENABLE_LDAPI)
char *ldapifilepath;
#endif
+ int install_full_schema;
} server_config_s;
Index: ds_newinst.pl.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/ds_newinst.pl.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ds_newinst.pl.in 1 Mar 2007 03:34:23 -0000 1.5
+++ ds_newinst.pl.in 7 Jun 2007 21:23:54 -0000 1.6
@@ -54,7 +54,7 @@
my $content = "";
my $firsttime = 1;
while (my ($kk, $vv) = each %{$args}) {
- next if (!$kk || !$vv);
+ next if (!defined($kk) || !defined($vv));
if ($firsttime) {
$firsttime = 0;
} else {
@@ -277,14 +277,29 @@
$cgiargs{install_ldif_file} = $table{slapd}->{InstallLdifFile};
# if for some reason you do not want the server started after instance creation
-# the following line can be commented out - NOTE that if you are creating the
+# then you can set
+# [slapd]
+# start_server = 0
+# NOTE that if you are creating the
# Configuration DS, it will be started anyway
+
if (defined($table{"slapd"}->{"start_server"})) {
$cgiargs{start_server} = $table{"slapd"}->{"start_server"};
} else { # default is on
$cgiargs{start_server} = 1;
}
+# if for some reason you do not want the full schema to be installed,
+# (such as needing to replace much of it with an AD-like schema), then set
+# [slapd]
+# install_full_schema = 0
+
+if (defined($table{"slapd"}->{"install_full_schema"})) {
+ $cgiargs{install_full_schema} = $table{"slapd"}->{"install_full_schema"};
+} else {
+ # server-side default is on
+}
+
my $sroot = $cgiargs{sroot};
my $prog = "@bindir@/ds_newinst";
16 years, 10 months
[Fedora-directory-commits] esc/src/lib/coolkey CoolKey.cpp, 1.6, 1.7 CoolKey.h, 1.5, 1.6 CoolKeyHandler.cpp, 1.3, 1.4
by Doctor Conrad
Author: jmagne
Update of /cvs/dirsec/esc/src/lib/coolkey
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3367
Modified Files:
CoolKey.cpp CoolKey.h CoolKeyHandler.cpp
Log Message:
New log file support #206783, r. mharmsen.
Index: CoolKey.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/CoolKey.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CoolKey.cpp 7 May 2007 23:51:46 -0000 1.6
+++ CoolKey.cpp 7 Jun 2007 21:21:17 -0000 1.7
@@ -16,6 +16,7 @@
* END COPYRIGHT BLOCK **/
#define FORCE_PR_LOG 1
+#define LINE_BUF_SIZE 512
#include "SlotUtils.h"
@@ -46,6 +47,161 @@
HRESULT ClearActiveKeyList(void);
ActiveKeyNode *GetNodeInActiveKeyList(const CoolKey *aKey);
+class CoolKeyLogger {
+public:
+
+ CoolKeyLogger(char *logFileName, int maxNumLines);
+ ~CoolKeyLogger();
+
+ void LogMsg(int logLevel, const char *fmt, ...);
+ void LogMsg(int logLevel,const char *msg, va_list argp);
+
+ void init();
+
+ int IsInitialized() { return initialized; }
+
+private:
+
+ void LockLog();
+ void UnlockLog();
+
+ PRLock *logLock;
+
+ int maxLines;
+
+ char *pathName;
+ PRFileDesc *fd;
+
+ int initialized;
+
+};
+
+CoolKeyLogger::CoolKeyLogger(char *logFileName, int maxNumLines)
+{
+ fd = NULL;
+ logLock = NULL;
+
+ maxLines = maxNumLines;
+ if(logFileName)
+ pathName = strdup(logFileName);
+ initialized = 0;
+}
+
+CoolKeyLogger::~CoolKeyLogger()
+{
+ char tBuff[56];
+
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s ~CoolKeyLogger:\n",GetTStamp(tBuff,56)));
+ LockLog();
+
+ PR_Close(fd);
+
+ fd = NULL;
+
+ UnlockLog();
+
+ PR_DestroyLock(logLock);
+
+ logLock = NULL;
+
+ if(pathName)
+ free(pathName);
+
+ pathName = NULL;
+}
+
+void CoolKeyLogger::LockLog()
+{
+ PR_Lock(logLock);
+}
+
+void CoolKeyLogger::UnlockLog()
+{
+ PR_Unlock(logLock);
+}
+
+void CoolKeyLogger::init()
+{
+ char tBuff[56];
+
+ PRFileInfo info;
+
+ if( !pathName)
+ return;
+
+ logLock = PR_NewLock();
+
+ PRStatus rv = PR_GetFileInfo(pathName,&info);
+
+ int fileSize = 0;
+
+ if(rv == PR_SUCCESS)
+ {
+ fileSize = info.size;
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s File info size %d! \n",GetTStamp(tBuff,56),fileSize));
+ }
+
+ //Assume average line size of about 40
+
+ if((fileSize / 40) > maxLines)
+ {
+
+ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("%s Number of lines too big, truncate file %d! \n",GetTStamp(tBuff,56),fileSize / 80));
+
+ fd = PR_Open(pathName, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600);
+ }
+ else
+ {
+ fd = PR_Open(pathName, PR_WRONLY | PR_CREATE_FILE | PR_APPEND, 0600);
+ }
+
+ if(!fd)
+ return;
+
+ initialized = 1;
+
+ return;
+}
+
+void CoolKeyLogger::LogMsg(int logLevel, const char *fmt, ...)
+{
+ va_list ap;
+ char line[LINE_BUF_SIZE];
+
+ if(!initialized)
+ return;
+
+ va_start(ap, fmt);
+
+ int end = PR_vsnprintf(line, sizeof(line)-1, fmt, ap);
+
+ LockLog();
+
+ PR_Write(fd,line,end);
+
+ UnlockLog();
+
+ va_end(ap);
+}
+
+void CoolKeyLogger::LogMsg(int logLevel, const char *msg, va_list argp)
+{
+ char line[LINE_BUF_SIZE];
+
+ if(!initialized)
+ return;
+
+ int end = PR_vsnprintf(line, sizeof(line)-1, msg, argp);
+
+ LockLog();
+
+ PR_Write(fd,line,end);
+
+ UnlockLog();
+}
+
+static CoolKeyLogger *g_Log = NULL;
+
COOLKEY_API HRESULT CoolKeyInit(const char *aAppDir)
{
char tBuff[56];
@@ -92,6 +248,9 @@
g_NSSManager = 0;
}
+ if(g_Log)
+ delete g_Log ;
+
return S_OK;
}
@@ -903,7 +1062,7 @@
assert(cardCtxt);
if (!cardCtxt) {
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't create Card Context !.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't create Card Context !.\n",GetTStamp(tBuff,56));
result = E_FAIL;
goto done;
}
@@ -911,7 +1070,7 @@
conn = CKYCardConnection_Create(cardCtxt);
assert(conn);
if (!conn) {
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't create Card Connection!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't create Card Connection!\n",GetTStamp(tBuff,56));
result = E_FAIL;
goto done;
}
@@ -919,14 +1078,14 @@
readerName = GetReaderNameForKeyID(aKey);
assert(readerName);
if (!readerName) {
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't get reader name!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't get reader name!\n",GetTStamp(tBuff,56));
result = E_FAIL;
goto done;
}
status = CKYCardConnection_Connect(conn, readerName);
if (status != CKYSUCCESS) {
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't connect to Card!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't connect to Card!\n",GetTStamp(tBuff,56));
result = E_FAIL;
goto done;
@@ -938,7 +1097,7 @@
apduRC = 0;
status = CKYApplet_SelectCoolKeyManager(conn, &apduRC);
if (status != CKYSUCCESS) {
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Can't select CoolKey manager!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Can't select CoolKey manager!\n",GetTStamp(tBuff,56));
goto done;
}
@@ -946,7 +1105,7 @@
&apduRC);
if(status != CKYSUCCESS)
{
- PR_LOG( coolKeyLog, PR_LOG_ERROR, ("%s Attempting to get key issuer info. Error actually getting IssuerInfo!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Attempting to get key issuer info. Error actually getting IssuerInfo!\n",GetTStamp(tBuff,56));
result = E_FAIL;
goto done;
}
@@ -1153,6 +1312,42 @@
return res;
}
+HRESULT CoolKeyInitializeLog(char *logFileName, int maxNumLines)
+{
+ if(g_Log)
+ return S_OK;
+
+ g_Log = new CoolKeyLogger(logFileName,maxNumLines);
+
+ if(g_Log)
+ g_Log->init();
+ else
+ return E_FAIL;
+
+ if(g_Log->IsInitialized())
+ return S_OK;
+ else
+ return E_FAIL;
+}
+
+HRESULT CoolKeyLogMsg(int logLevel, const char *fmt, ...)
+{
+
+ if(!g_Log)
+ return S_OK;
+
+ va_list ap;
+
+
+ va_start(ap, fmt);
+
+ g_Log->LogMsg(logLevel,fmt,ap);
+
+ va_end(ap);
+
+ return S_OK;
+}
+
//Utility function to get Time Stamp
char *GetTStamp(char *aTime,int aSize)
{
Index: CoolKey.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/CoolKey.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CoolKey.h 7 May 2007 23:51:46 -0000 1.5
+++ CoolKey.h 7 Jun 2007 21:21:17 -0000 1.6
@@ -176,6 +176,11 @@
COOLKEY_API int CoolKeyGetAppletVer(const CoolKey *aKey, const bool isMajor);
+COOLKEY_API HRESULT CoolKeyInitializeLog(char *logFileName, int maxNumLines);
+
+COOLKEY_API HRESULT CoolKeyLogMsg(int logLevel, const char *fmt, ...);
+
+
//Utility time function
char *GetTStamp(char *aTime,int aSize);
}
Index: CoolKeyHandler.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/coolkey/CoolKeyHandler.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CoolKeyHandler.cpp 24 Feb 2007 02:16:41 -0000 1.3
+++ CoolKeyHandler.cpp 7 Jun 2007 21:21:17 -0000 1.4
@@ -453,7 +453,7 @@
const char *readerName = NULL;
if (!aKey || aKey->mKeyType != eCKType_CoolKey || !aKey->mKeyID) {
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Insuficient input parameters. \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Insuficient input parameters. \n",GetTStamp(tBuff,56));
goto done;
}
@@ -466,14 +466,14 @@
if (!readerName) {
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot locate card reader name! \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot locate card reader name! \n",GetTStamp(tBuff,56));
goto done;
}
mDataLock = PR_NewLock();
if (!mDataLock)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannnot initialize internal locking mechanism.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannnot initialize internal locking mechanism.\n",GetTStamp(tBuff,56));
return E_FAIL;
}
@@ -481,7 +481,7 @@
mDataCondVar = PR_NewCondVar(mDataLock);
if (!mDataCondVar)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot initialize internal syncronization mechanism.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot initialize internal syncronization mechanism.\n",GetTStamp(tBuff,56));
return E_FAIL;
}
@@ -493,7 +493,7 @@
if(!mCharHostName || !mRAUrl)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Didn't collect proper config information.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Didn't collect proper config information.\n",GetTStamp(tBuff,56));
error_no = config_error_no;
goto done;
}
@@ -502,7 +502,7 @@
mCardContext = CKYCardContext_Create(SCARD_SCOPE_USER);
if (!mCardContext) {
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot create card context! \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot create card context! \n",GetTStamp(tBuff,56));
error_no = CARD_CONTEXT_ERROR;
goto done;
}
@@ -510,7 +510,7 @@
mPDUWriter = new PDUWriterThread(this);
if (!mPDUWriter) {
error_no = PDU_WRITER_ERROR;
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Cannot begin CoolKey operation. Cannot create internal PDU writer thread!\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Cannot begin CoolKey operation. Cannot create internal PDU writer thread!\n",GetTStamp(tBuff,56));
goto done;
}
@@ -581,7 +581,7 @@
if(!keyID)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR,("%s Collecting CoolKey preferences. Cannot get keyID , cannot proceed. \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR,"%s Collecting CoolKey preferences. Cannot get keyID , cannot proceed. \n",GetTStamp(tBuff,56));
return;
}
@@ -621,7 +621,7 @@
if(!tps_url)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. Cannot find value for the TPS URL. \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Collecting CoolKey preferences. Cannot find value for the TPS URL. \n",GetTStamp(tBuff,56));
return;
}
@@ -651,7 +651,7 @@
pos = tps_url_str.find(non_ssl_str,0);
if(pos == string::npos)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. TPS URL has specified an illegal protocol! \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Collecting CoolKey preferences. TPS URL has specified an illegal protocol! \n",GetTStamp(tBuff,56));
return;
}
@@ -692,7 +692,7 @@
if(!host_name_port_str.length())
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Collecting CoolKey preferences. Bad hostname and port value!.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg(PR_LOG_ERROR, "%s Collecting CoolKey preferences. Bad hostname and port value!.\n",GetTStamp(tBuff,56));
return;
}
@@ -1198,7 +1198,7 @@
PR_LOG( coolKeyLogHN, PR_LOG_DEBUG, ("%s CoolKeyHandler::ProcessTokenPDU:\n",GetTStamp(tBuff,56)));
if(!req || !context)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Bad input data. \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. Bad input data. \n",GetTStamp(tBuff,56));
return;
}
@@ -1210,7 +1210,7 @@
if(size == 0)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Can't extract PDU data from message! \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg(PR_LOG_ERROR, "%s Processing HTTP message. Can't extract PDU data from message! \n",GetTStamp(tBuff,56));
context->HttpDisconnect();
return;
}
@@ -1231,10 +1231,10 @@
CKYStatus status = CKYCardConnection_ExchangeAPDU(context->GetCardConnection(),
requestAPDU, &response);
if (status != CKYSUCCESS) {
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR,
- ("%s Processing HTTP message. Can't write apdu to card! status %d response[0] %x response[1] %x error %d \n"
+ CoolKeyLogMsg( PR_LOG_ERROR,
+ "%s Processing HTTP message. Can't write apdu to card! status %d response[0] %x response[1] %x error %d \n"
,GetTStamp(tBuff,56) ,status,CKYBuffer_GetChar(&response,0),CKYBuffer_GetChar(&response,1),
- CKYCardConnection_GetLastError(context->GetCardConnection())));
+ CKYCardConnection_GetLastError(context->GetCardConnection()));
context->HttpDisconnect(ERR_CONN_TOKEN);
@@ -1248,7 +1248,7 @@
if(pduSizeRet == 0 || !pduDataRet )
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. No PDU response from card! \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. No PDU response from card! \n",GetTStamp(tBuff,56));
context->HttpDisconnect(ERR_CONN_TOKEN);
return;
}
@@ -1267,7 +1267,7 @@
if(res == 0)
{
- PR_LOG( coolKeyLogHN, PR_LOG_ERROR, ("%s Processing HTTP message. Write back to TPS failed , disconnecting. \n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ERROR, "%s Processing HTTP message. Write back to TPS failed , disconnecting. \n",GetTStamp(tBuff,56));
context->HttpDisconnect();
}
else
@@ -1619,32 +1619,33 @@
case ENROLL:
if (result == 0) {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Enrollment success.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg(PR_LOG_ALWAYS,"%s Key Enrollment success.\n",GetTStamp(tBuff,56));
CoolKeyAuthenticate(context->GetAutoCoolKey(), context->GetPIN());
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_EnrollmentComplete,
context->GetScreenName() == NULL ? 1 : 0);
} else {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Enrollment failure. Error: %d.\n",GetTStamp(tBuff,56),description));
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Enrollment failure. Error: %d.\n",GetTStamp(tBuff,56),description);
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_EnrollmentError, description); // XXX: Need INIT_FAILED error code!
}
break;
case RESET_PIN:
if (result == 0) {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Reset Password success.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg(PR_LOG_ALWAYS,"%s Key Reset Password success.\n",GetTStamp(tBuff,56));
+
CoolKeyAuthenticate(context->GetAutoCoolKey(), context->GetPIN());
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_PINResetComplete, 0);
} else {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Reset Password failure. Error: %d.\n",GetTStamp(tBuff,56),description));
+ CoolKeyLogMsg(PR_LOG_ALWAYS, "%s Key Reset Password failure. Error: %d.\n",GetTStamp(tBuff,56),description);
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_PINResetError, description); // XXX: Need PIN_RESET_FAILED error code!
}
break;
case FORMAT:
if (result == 0) {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Format success.\n",GetTStamp(tBuff,56)));
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Format success.\n",GetTStamp(tBuff,56));
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_FormatComplete, 0);
} else {
- PR_LOG( coolKeyLogHN, PR_LOG_ALWAYS, ("%s Key Format failure. Error: %d.\n",GetTStamp(tBuff,56),description));
+ CoolKeyLogMsg( PR_LOG_ALWAYS, "%s Key Format failure. Error: %d.\n",GetTStamp(tBuff,56),description);
CoolKeyNotify(context->GetAutoCoolKey(), eCKState_FormatError, description); // XXX: Need FORMAT_FAILED error code!
}
break;
16 years, 10 months
[Fedora-directory-commits] esc/src/app/xul/esc/chrome/locale/en-US esc.properties, 1.6, 1.7
by Doctor Conrad
Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/locale/en-US
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3177
Modified Files:
esc.properties
Log Message:
New erorr messages #203466, r. mharmsen.
Index: esc.properties
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/locale/en-US/esc.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- esc.properties 7 May 2007 23:50:39 -0000 1.6
+++ esc.properties 7 Jun 2007 21:19:51 -0000 1.7
@@ -85,40 +85,48 @@
#ESC Error Messages from TPS
errorNone=Operation Completed Successfully.
serverError=Smart Card Server error.
-errorProblemResetTokenPin=Internal Smart Card Server error.
-errorTokenEnrollment=Smart card enrollment error.
+errorProblemResetTokenPin=The Smart Card Server cannot reset your smart card's password.
+errorTokenEnrollment=The Smart Card Server cannot import the required certificates into your smart card.
+errorLifeCyclePDU=The Smart Card Server cannot finalize the enrollment of your smart card.
errorCommCA=Error communicating with the Certification Authority.
errorInternalServer=Internal Smart Card Server error.
errorResetPin=Error resetting the smart card's password.
errorInternalServer=Internal Smart Card Server error.
-errorAuthFailure=Smart Card Server authentication failure.
-errorTokenDisabled=Your smart card is listed as disabled.
-errorProblemCommToken=Problem communicating with the smart card.
-errorTokenUpgrade=Cannot upgrade smart card software.
-errorInvalidTokenType=Invalid smart card type.
-errorCannotPublish=Cannot publish smart card information.
-errorCommTokenDB=Cannot communicate with smart card database.
-errorPinReset=Cannot reset the password value for the smart card.
-errorConnLost=Connection to Smart Card Server.
-errorEntryTokenDB=Can not create entry for the smart card in the smart card database.
-errorNoTokenState=Smart card found to be in an inconsistent state.
-errorInvalidLostTokenReason=Invalid reason for lost smart card submitted.
-errorTokenUnusable=Smart card found to be unusable due to compromise.
-errorNoInactiveToken=No such inactive smart card found.
-errorProcessMultiTokens=Can not process more than one active smart card.
+errorAuthFailure=The Smart Card Server cannot validate your credentials. Please try again with the correct credentials.
+errorTokenDisabled=The Smart Card Server does not know about your smart card.
+errorSecureChannel=The Smart Card Server cannot establish a secure channel with the smart card.
+errorServerMisconfig=The Smart Card Server has not been configured correctly.
+errorProblemCommToken=Your smart card can not perform the operation requested by the Smart Card Server.
+errorExternalAuth=Your smart card cannot correctly identify the Smart Card Server.
+errorTokenUpgrade=The Smart Card Server cannot upgrade the software on your smart card.
+errorTermSecureConn=The Smart Card Server can not terminate the secure cummunications channel with the smart card.
+errorInvalidTokenType=The Smart Card Server does not recognize the requested type of card enrollment.
+errorInvalidTokenTypeParams=The Smart Card Server cannot process the requested type of enrollment due to a misconfiguration.
+errorCannotPublish=The Smart Card Server cannot publish your card's certificates to the certificate directory.
+errorCommTokenDB=The Smart Card Server cannot connect to its internal database.
+errorTokenSuspended=Your smart card has been suspended.
+errorPinResetable=You are not allowed to reset the password of this smart card.
+errorConnLost=The Smart Card Manager has lost the connection to the Smart Card Server.
+errorEntryTokenDB=The Smart Card Server cannot add your smart card to its internal database.
+errorNoTokenState=The Smart Card server does not recognize your smart card's current status.
+errorInvalidLostTokenReason=The Smart Card server cannot process your smart card which has been reported lost.
+errorTokenUnusable=The Smart Card Server cannot process your smart card which has been reported stolen.
+errorNoInactiveToken=The Smart Card Server cannot restore your smart card's security keys.
+errorProcessMultiTokens=The Smart Card Server has detected that you already have one enrolled smart card. The server only allows one enrolled card per user.
+errorTokenTerminated=The Smart Card Server can not process your smart card which is marked as terminated.
errorKeyRecoveryProcessed=Smart card key recovery has been processed.
-errorKeyRecoveryFailed=Smart card key recovery failed.
+errorKeyRecoveryFailed=The Smart Card Server can not restore the security keys onto your smart card.
errorNoOperateLostToken=Cannot process this smart card, which has been reported lost.
-errorKeyArchival=Smart card key archival error.
-errorConnTKS=Problem connecting to the Smart Card TKS Server.
-errorFailUpdateTokenDB=Failed to update smart card database.
-errorCertRevocation=Internal certificate revocation error discovered.
-errorNotOwnToken=User does not own this smart card.
-errorESCMisconfigured=Smart Card Manager has been misconfigured.
-errorESCNoCommCardReader=Smart Card Manager can't communicate with card reader.
-errorESCNoTokenSession=Smart Card Manager can't initiate session with smart card.
-errorESCNoTalkTPS=Smart Card Manager can't talk to Smart Card Server.
-errorESCNoTalkTokenReader=Smart Card Manager can't talk to smart card reader.
+errorKeyArchival=The Smart Card Server can not restore the security keys onto your smart card due to a server misconfiguration.
+errorConnTKS=The Smart Card server cannot contact its security key server,which is required for processing.
+errorFailUpdateTokenDB=The Smart Card Server cannot reset the status of your smart card.
+errorCertRevocation=The Smart Card Server cannot mark the security keys on your smart card as revoked.
+errorNotOwnToken=The Smart Card Server cannot process a smart card which you do not own.
+errorESCMisconfigured=The Smart Card Manager has been misconfigured.
+errorESCNoCommCardReader=The Smart Card Manager cannot initiate communications with the smart card.
+errorESCNoTokenSession=The Smart Card Manager cannot establish a communications session with the smart card.
+errorESCNoTalkTPS=The Smart Card Manager cannot initiate communications with the Smart Card Server.
+errorESCNoTalkTokenReader=The Smart Card Manager cannot finalize communications with the smart card.
#ESC text in general Alert messages
errorCoolKeyIsAuth=coolkey.GetCoolKeyIsAuthenticated() failed!
errorAuthCoolKey=coolkey.AuthenticateCoolKey failed!
16 years, 10 months
[Fedora-directory-commits] esc/src/app/xul/esc/chrome/content/esc settings.xul, 1.6, 1.7
by Doctor Conrad
Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3005
Modified Files:
settings.xul
Log Message:
Cosmetic window size change #208479, r. mharmsen.
Index: settings.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/settings.xul,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- settings.xul 7 May 2007 23:49:23 -0000 1.6
+++ settings.xul 7 Jun 2007 21:18:45 -0000 1.7
@@ -25,8 +25,8 @@
title="&escTitle;"
onload="InitializeAdminBindingList()"
onunload="cleanup()"
- width ="730"
- height= "460"
+ width ="720"
+ height= "415"
name="admin"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
16 years, 10 months
[Fedora-directory-commits] esc/src/app/xul/esc/chrome/content/esc ESC.js, 1.14, 1.15
by Doctor Conrad
Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2854
Modified Files:
ESC.js
Log Message:
New log file support and new error msgs. #206783, #203466 r. mharmsen.
Index: ESC.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ESC.js 7 May 2007 23:49:23 -0000 1.14
+++ ESC.js 7 Jun 2007 21:17:58 -0000 1.15
@@ -131,6 +131,9 @@
netkey = netkey.QueryInterface(Components.interfaces.rhICoolKey);
gNotify = new jsNotify;
netkey.rhCoolKeySetNotifyCallback(gNotify);
+
+ var logFileName = GetESCLogPathName("esc.log");
+ netkey.CoolKeyInitializeLog(logFileName, 1000);
} catch(e) {
MyAlert(getBundleString("errorUniversalXPConnect") + e);
}
@@ -167,33 +170,33 @@
var Status_Messages = new Array(
getBundleString("errorNone"),
- getBundleString("serverError"),
- getBundleString("errorProblemCommToken"),
+ getBundleString("errorInternalServer"),
+ getBundleString("errorInternalServer"),
getBundleString("errorProblemCommToken"),
getBundleString("errorProblemResetTokenPin"),
getBundleString("errorInternalServer"),
- getBundleString("errorInternalServer"),
+ getBundleString("errorLifeCyclePDU"),
getBundleString("errorTokenEnrollment"),
getBundleString("errorProblemCommToken"),
getBundleString("errorInternalServer"),
- getBundleString("errorCommCA"),
getBundleString("errorInternalServer"),
- getBundleString("errorResetPin"),
getBundleString("errorInternalServer"),
+ getBundleString("errorInternalServer"),
+ getBundleString("errorTermSecureConn"),
getBundleString("errorAuthFailure"),
getBundleString("errorInternalServer"),
getBundleString("errorTokenDisabled"),
- getBundleString("errorProblemCommToken"),
- getBundleString("errorInternalServer"),
+ getBundleString("errorSecureChannel"),
+ getBundleString("errorServerMisconfig"),
getBundleString("errorTokenUpgrade"),
getBundleString("errorInternalServer"),
- getBundleString("errorProblemCommToken"),
- getBundleString("errorInvalidTokenType"),
+ getBundleString("errorExternalAuth"),
getBundleString("errorInvalidTokenType"),
+ getBundleString("errorInvalidTokenTypeParams"),
getBundleString("errorCannotPublish"),
getBundleString("errorCommTokenDB"),
- getBundleString("errorTokenDisabled"),
- getBundleString("errorPinReset"),
+ getBundleString("errorTokenSuspended"),
+ getBundleString("errorPinResetable"),
getBundleString("errorConnLost"),
getBundleString("errorEntryTokenDB"),
getBundleString("errorNoTokenState"),
@@ -201,10 +204,10 @@
getBundleString("errorTokenUnusable"),
getBundleString("errorNoInactiveToken"),
getBundleString("errorProcessMultiTokens"),
+ getBundleString("errorTokenTerminated"),
getBundleString("errorInternalServer"),
- getBundleString("errorKeyRecoveryProcessed"),
getBundleString("errorKeyRecoveryFailed"),
- getBundleString("errorNoOperateLostToken"),
+ getBundleString("errorInternalServer"),
getBundleString("errorKeyArchival"),
getBundleString("errorConnTKS"),
getBundleString("errorFailUpdateTokenDB"),
@@ -559,9 +562,9 @@
function TestStatusMessages()
{
- for(i = 0 ; i < 48; i++)
+ for(i = 0 ; i < 49; i++)
{
- MyAlert(Status_Messages[i]);
+ MyAlert( i + " " + Status_Messages[i]);
}
}
@@ -4263,9 +4266,9 @@
var value = line.value;
- var colonIndex = value.indexOf(":");
+ //var colonIndex = value.indexOf(":");
- value = value.substring(colonIndex + 1);
+ //value = value.substring(colonIndex + 1);
lines.push(value);
} while(hasmore);
@@ -4484,3 +4487,29 @@
adminList.focus();
}
}
+
+function GetESCLogPathName(aName)
+{
+
+ if(!aName)
+ return null;
+
+ const logFileName = aName;
+
+ // Get executable directory
+
+ var file = Components.classes["@mozilla.org/file/directory_service;1"]
+ .getService(Components.interfaces.nsIProperties)
+ .get("ProfD", Components.interfaces.nsIFile);
+
+ file = file.parent;
+ file.append(logFileName);
+
+
+ //alert("LogPathName " + file.path);
+
+
+ return file.path;
+
+
+}
16 years, 10 months