Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 157378 Details for
Bug 237356
Move DS Admin Code into Admin Server
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
add ldif templates; pwdhash with no config files
cvsdiffs (text/plain), 26.93 KB, created by
Rich Megginson
on 2007-06-19 15:29:24 UTC
(
hide
)
Description:
add ldif templates; pwdhash with no config files
Filename:
MIME Type:
Creator:
Rich Megginson
Created:
2007-06-19 15:29:24 UTC
Size:
26.93 KB
patch
obsolete
>Index: ldapserver/Makefile.am >=================================================================== >RCS file: /cvs/dirsec/ldapserver/Makefile.am,v >retrieving revision 1.43 >diff -u -8 -r1.43 Makefile.am >--- ldapserver/Makefile.am 15 Jun 2007 17:02:28 -0000 1.43 >+++ ldapserver/Makefile.am 19 Jun 2007 15:24:44 -0000 >@@ -1,32 +1,37 @@ > # look for included m4 files in the ./m4/ directory > ACLOCAL_AMFLAGS = -I m4 >+NULLSTRING := >+SPACE := $(NULLSTRING) # the space is between the ) and the # >+COLON := $(NULLSTRING):# a colon >+QUOTE := $(NULLSTRING)"# a double quote" > > #------------------------ > # Compiler Flags > #------------------------ > BUILDNUM := $(shell perl $(srcdir)/buildnum.pl) >+NQBUILDNUM := $(subst \,,$(subst $(QUOTE),,$(BUILDNUM))) > DEBUG_DEFINES = @debug_defs@ > DS_DEFINES = -DBUILD_NUM=$(BUILDNUM) > DS_INCLUDES = -I$(srcdir)/ldap/include -I$(srcdir)/ldap/servers/slapd -I$(srcdir)/include -I. > # these paths are dependent on the settings of prefix and exec_prefix which may be specified > # at make time. So we cannot use AC_DEFINE in the configure.ac because that would set the > # values prior to their being defined. Defining them here ensures that they are properly > # expanded before use. See create_instance.h for more details. The quoting ensures that > # the values are quoted for the shell command, and the value expands to a quoted string > # value in the header file e.g. > # #define LOCALSTATEDIR "/var" > # without the quotes, it would be > # #define LOCALSTATEDIR /var > # which would be an error > PATH_DEFINES = -DLOCALSTATEDIR="\"$(localstatedir)\"" -DSYSCONFDIR="\"$(sysconfdir)\"" \ > -DLIBDIR="\"$(libdir)\"" -DBINDIR="\"$(bindir)\"" \ > -DDATADIR="\"$(datadir)\"" -DDOCDIR="\"$(docdir)\"" \ >- -DSBINDIR="\"$(sbindir)\"" -DPLUGINDIR="\"$(serverplugindir)\"" >+ -DSBINDIR="\"$(sbindir)\"" -DPLUGINDIR="\"$(serverplugindir)\"" -DTEMPLATEDIR="\"$(sampledatadir)\"" > > AM_CPPFLAGS = $(DEBUG_DEFINES) $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES) > PLUGIN_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@ > # We need to make sure that libpthread is linked before libc on HP-UX. > if HPUX > AM_LDFLAGS = -lpthread > endif > >@@ -72,17 +77,18 @@ > serverdir = $(libdir)@serverdir@ > serverplugindir = $(libdir)@serverplugindir@ > taskdir = $(datadir)@scripttemplatedir@ > initdir = $(sysconfdir)@initdir@ > instconfigdir = @instconfigdir@ > perldir = $(libdir)@perldir@ > infdir = $(datadir)@infdir@ > >-shared_lib_suffix = @shared_lib_suffix@ >+defaultuser=@defaultuser@ >+defaultgroup=@defaultgroup@ > > #------------------------ > # Build Products > #------------------------ > sbin_PROGRAMS = ns-slapd > > bin_PROGRAMS = dbscan-bin ds_newinst-bin dsktune-bin infadd-bin ldap-agent-bin \ > ldclt-bin ldif-bin migratecred-bin mmldif-bin pwdhash-bin rsearch-bin >@@ -126,16 +132,24 @@ > $(srcdir)/ldap/ldif/European.ldif \ > $(srcdir)/ldap/ldif/Eurosuffix.ldif \ > $(srcdir)/ldap/ldif/Example.ldif \ > $(srcdir)/ldap/ldif/Example-roles.ldif \ > $(srcdir)/ldap/ldif/Example-views.ldif \ > $(srcdir)/ldap/ldif/roledit.ldif \ > $(srcdir)/ldap/ldif/tasks.ldif \ > $(srcdir)/ldap/ldif/template.ldif \ >+ ldap/ldif/template-dse.ldif \ >+ ldap/ldif/template-suffix-db.ldif \ >+ ldap/ldif/template-ldapi.ldif \ >+ ldap/ldif/template-ldapi-default.ldif \ >+ ldap/ldif/template-ldapi-autobind.ldif \ >+ ldap/ldif/template-pampta.ldif \ >+ ldap/ldif/template-dnaplugin.ldif \ >+ ldap/ldif/template-bitwise.ldif \ > $(srcdir)/ldap/servers/slapd/tools/rsearch/scripts/dbgen-FamilyNames \ > $(srcdir)/ldap/servers/slapd/tools/rsearch/scripts/dbgen-GivenNames \ > $(srcdir)/ldap/servers/slapd/tools/rsearch/scripts/dbgen-OrgUnits > > schema_DATA = $(srcdir)/ldap/schema/00core.ldif \ > $(srcdir)/ldap/schema/01common.ldif \ > $(srcdir)/ldap/schema/05rfc2247.ldif \ > $(srcdir)/ldap/schema/05rfc2927.ldif \ >@@ -1019,18 +1033,20 @@ > -e 's,@instconfigdir\@,$(instconfigdir),g' \ > -e 's,@ECHO_N\@,$(ECHO_N),g' \ > -e 's,@ECHO_C\@,$(ECHO_C),g' \ > -e 's,@brand\@,$(brand),g' \ > -e 's,@capbrand\@,$(capbrand),g' \ > -e 's,@vendor\@,$(vendor),g' \ > -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \ > -e 's,@BUILDNUM\@,$(BUILDNUM),g' \ >+ -e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \ > -e 's,@perldir\@,$(perldir),g' \ >- -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g' >+ -e 's,@defaultuser\@,$(defaultuser),g' \ >+ -e 's,@defaultgroup\@,$(defaultgroup),g' > else > fixupcmd = sed \ > -e 's,@bindir\@,$(bindir),g' \ > -e 's,@sbindir\@,$(sbindir),g' \ > -e 's,@libdir\@,$(libdir),g' \ > -e 's,@nspr_libdir\@,$(nspr_libdir),g' \ > -e 's,@nss_libdir\@,$(nss_libdir),g' \ > -e 's,@ldapsdk_libdir\@,$(ldapsdk_libdir),g' \ >@@ -1052,18 +1068,20 @@ > -e 's,@instconfigdir\@,$(instconfigdir),g' \ > -e 's,@ECHO_N\@,$(ECHO_N),g' \ > -e 's,@ECHO_C\@,$(ECHO_C),g' \ > -e 's,@brand\@,$(brand),g' \ > -e 's,@capbrand\@,$(capbrand),g' \ > -e 's,@vendor\@,$(vendor),g' \ > -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \ > -e 's,@BUILDNUM\@,$(BUILDNUM),g' \ >+ -e 's,@NQBUILD_NUM\@,$(NQBUILDNUM),g' \ > -e 's,@perldir\@,$(perldir),g' \ >- -e 's,@shared_lib_suffix\@,$(shared_lib_suffix),g' >+ -e 's,@defaultuser\@,$(defaultuser),g' \ >+ -e 's,@defaultgroup\@,$(defaultgroup),g' > endif > > %: %.in > mkdir -p $(dir $@) > $(fixupcmd) $^ > $@ > > %/$(PACKAGE_NAME): %/initscript.in > $(fixupcmd) $^ > $@ >Index: ldapserver/configure.ac >=================================================================== >RCS file: /cvs/dirsec/ldapserver/configure.ac,v >retrieving revision 1.31 >diff -u -8 -r1.31 configure.ac >--- ldapserver/configure.ac 15 Jun 2007 17:02:29 -0000 1.31 >+++ ldapserver/configure.ac 19 Jun 2007 15:24:44 -0000 >@@ -192,26 +192,33 @@ > configdir=/$PACKAGE_NAME/config > # location of property/resource files, relative to datadir > propertydir=/$PACKAGE_NAME/properties > # relative to sysconfdir > schemadir=/$PACKAGE_NAME/schema > # relative to libdir > perldir=/$PACKAGE_NAME/perl > >+# default user, group >+defaultuser=nobody >+defaultgroup=nobody >+ > AC_SUBST(configdir) > AC_SUBST(sampledatadir) > AC_SUBST(propertydir) > AC_SUBST(schemadir) > AC_SUBST(serverdir) > AC_SUBST(serverplugindir) > AC_SUBST(scripttemplatedir) > AC_SUBST(perldir) > AC_SUBST(infdir) > >+AC_SUBST(defaultuser) >+AC_SUBST(defaultgroup) >+ > # check for --with-instconfigdir > AC_MSG_CHECKING(for --with-instconfigdir) > AC_ARG_WITH(instconfigdir, > AS_HELP_STRING([--with-instconfigdir=/path], > [Base directory for instance specific writable configuration directories (default $sysconfdir/$PACKAGE_NAME)]), > [ > if test $withval = yes ; then > AC_ERROR([Please specify a full path with --with-instconfigdir]) >@@ -223,17 +230,16 @@ > instconfigdir='$(sysconfdir)/$(PACKAGE_NAME)' > ]) > AC_SUBST(instconfigdir) > > # WINNT should be true if building on Windows system not using > # 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 > case $host in > *-*-linux*) > AC_DEFINE([XP_UNIX], [1], [UNIX]) > AC_DEFINE([Linux], [1], [Linux]) > AC_DEFINE([LINUX], [1], [Linux]) >@@ -261,17 +267,16 @@ > AC_DEFINE([hpux], [1], [HP-UX]) > AC_DEFINE([HPUX], [1], [HP-UX]) > AC_DEFINE([HPUX11], [1], [HP-UX 11]) > AC_DEFINE([HPUX11_11], [1], [HP-UX 11.11]) > AC_DEFINE([CPU_hppa], [], [cpu type pa-risc]) > 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*) > AC_DEFINE([XP_UNIX], [1], [UNIX]) > AC_DEFINE([SVR4], [1], [SVR4]) > AC_DEFINE([__svr4], [1], [SVR4]) > AC_DEFINE([__svr4__], [1], [SVR4]) > AC_DEFINE([_SVID_GETTOD], [1], [SVID_GETTOD]) >@@ -297,17 +302,16 @@ > # relative to sysconfdir > initdir=/init.d > ;; > *) > platform="" > ;; > esac > AC_SUBST(initdir) >-AC_SUBST(shared_lib_suffix) > > AM_CONDITIONAL(HPUX,test "$platform" = "hpux") > AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris") > > # Check for library dependencies > m4_include(m4/nspr.m4) > m4_include(m4/nss.m4) > m4_include(m4/mozldap.m4) >Index: ldapserver/ldap/admin/src/scripts/DialogManager.pm >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/DialogManager.pm,v >retrieving revision 1.2 >diff -u -8 -r1.2 DialogManager.pm >--- ldapserver/ldap/admin/src/scripts/DialogManager.pm 15 Jun 2007 22:11:15 -0000 1.2 >+++ ldapserver/ldap/admin/src/scripts/DialogManager.pm 19 Jun 2007 15:24:44 -0000 >@@ -89,16 +89,20 @@ > } > } > > # see if the user answered with the special BACK answer > sub isBack { > my $self = shift; > my $ans = shift; > >+ if (!$ans) { >+ return 0; >+ } >+ > # the word "back" > if ($ans =~ /back/i) { > return 1; > } > # a Ctrl-B sequence > if ($ans eq '') { > return 1; > } >Index: ldapserver/ldap/admin/src/scripts/Inf.pm >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/Inf.pm,v >retrieving revision 1.1 >diff -u -8 -r1.1 Inf.pm >--- ldapserver/ldap/admin/src/scripts/Inf.pm 8 Jun 2007 01:09:16 -0000 1.1 >+++ ldapserver/ldap/admin/src/scripts/Inf.pm 19 Jun 2007 15:24:44 -0000 >@@ -62,35 +62,54 @@ > > 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; >+ my $curSection = ""; > > if ($filename) { > $self->{filename} = $filename; > } else { > $filename = $self->{filename}; > } > >+ my $incontinuation = 0; >+ my $curkey; > open INF, $filename or die "Error: could not open inf file $filename: $!"; > while (<INF>) { >- # e.g. [General] >- if (/^\[(.*?)\]/) { >+ my $iscontinuation; >+ chop; # trim trailing newline >+ if (/^\s*$/) { # skip blank/empty lines >+ $incontinuation = 0; >+ next; >+ } >+ if (/^\s*\#/) { # skip comment lines >+ $incontinuation = 0; >+ next; >+ } >+ if (/\\$/) { # line ends in \ - continued on next line >+ chop; >+ $iscontinuation = 1; >+ } >+ if ($incontinuation) { >+ $self->{$curSection}->{$curkey} .= "\n" . $_; # add line in entirety to current value >+ } elsif (/^\[(.*?)\]/) { # e.g. [General] > $curSection = $1; >- } elsif (/^\s*$/) { >- next; # skip blank lines >- } elsif (/^\s*\#/) { >- next; # skip comment lines >- } elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) { >- $self->{$curSection}->{$1} = $2; >+ } elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) { # key = value >+ $curkey = $1; >+ $self->{$curSection}->{$curkey} = $2; >+ } >+ if ($iscontinuation) { # if line ends with a backslash, continue the data on the next line >+ $incontinuation = 1; >+ } else { >+ $incontinuation = 0; > } > } > close INF; > } > > sub section { > my $self = shift; > my $key = shift; >Index: ldapserver/ldap/admin/src/scripts/Setup.pm.in >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/Setup.pm.in,v >retrieving revision 1.3 >diff -u -8 -r1.3 Setup.pm.in >--- ldapserver/ldap/admin/src/scripts/Setup.pm.in 15 Jun 2007 22:11:15 -0000 1.3 >+++ ldapserver/ldap/admin/src/scripts/Setup.pm.in 19 Jun 2007 15:24:44 -0000 >@@ -106,16 +106,17 @@ > "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 = {}; >+ $self->{res} = shift; > 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, >@@ -142,17 +143,17 @@ > $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 >+ 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; > } > } > >@@ -171,39 +172,44 @@ > > # 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 >+# all messages are localizable - you must define a resource key >+# the first string passed to this method is a resource key >+# additional strings are used as "arguments" to that resource key >+# if you want to print un-localizable messages, use debug or write >+# directly to the log or screen > 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; > } >+ my $string = $self->{res}->getText(@text); > if ($level) { >- $self->log($level, @text); >+ $self->log($level, $string); > } >- print @text; >+ print $string; > } > > sub doExit { > my $self = shift; >- $self->msg($FATAL, "Exiting . . .\n"); >- $self->msg("Log file is " . $self->{log}->{filename} . "\n"); >+ $self->msg($FATAL, 'setup_exiting', $self->{log}->{filename}); > exit 1; > } > > # get a list of the directory servers in configdir > sub getDirServers { > my $self = shift; > if (!$self->{dirservers}) { > $self->{dirservers} = []; >Index: ldapserver/ldap/admin/src/scripts/setup-ds.res.in >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/setup-ds.res.in,v >retrieving revision 1.3 >diff -u -8 -r1.3 setup-ds.res.in >--- ldapserver/ldap/admin/src/scripts/setup-ds.res.in 15 Jun 2007 22:11:15 -0000 1.3 >+++ ldapserver/ldap/admin/src/scripts/setup-ds.res.in 19 Jun 2007 15:24:45 -0000 >@@ -80,8 +80,10 @@ > 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 > > # ----------- miscellaneous ---------------- > backend_already_exists = A database backend with the name '%s' already exists. Config entry DN '%s'. Please choose another backend name. addSuffix can generate a unique backend name if you do not specify a backend name.\n\n > suffix_already_exists = The suffix '%s' already exists. Config entry DN '%s'.\n\n > error_creating_suffix_backend = Could not create the suffix '%s'. There was an error creating the backend database named '%s' for the suffix. Error: %s\n\n > error_creating_suffix = Could not create the suffix '%s'. Error: %s\n\n >+ >+setup_exiting = Exiting . . .\nLog file is '%s'\n\n >Index: ldapserver/ldap/cm/newinst/slapd.inf.in >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/cm/newinst/slapd.inf.in,v >retrieving revision 1.1 >diff -u -8 -r1.1 slapd.inf.in >--- ldapserver/ldap/cm/newinst/slapd.inf.in 15 Jun 2007 17:02:29 -0000 1.1 >+++ ldapserver/ldap/cm/newinst/slapd.inf.in 19 Jun 2007 15:24:45 -0000 >@@ -42,22 +42,24 @@ > Components=slapd > > [slapd] > Name= @capbrand@ Directory Server > InstanceNamePrefix= Directory Server > NickName= slapd > Version= @PACKAGE_VERSION@ > Compatible= 1.0 >-BuildNumber= @BUILDNUM@ >-Expires= 0 >-Security= domestic >-Vendor= @vendor@ >+BuildNumber= @NQBUILD_NUM@ > Description= @capbrand@ Directory Server > ProductName=Directory Server >+Vendor= @vendor@ >+# the rest of these are obsolete, but left here for >+# compatability with the old setuputil >+Expires= 0 >+Security= domestic > IsDirLite=false > PrePreInstall= dsktune > PreInstall= ns-config > PostInstall= bin/slapd/admin/bin/ns-update > PreUninstall= bin/slapd/admin/bin/uninstall > PostUninstall= > Checked=True > Mandatory=False >Index: ldapserver/ldap/servers/slapd/dynalib.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/dynalib.c,v >retrieving revision 1.6 >diff -u -8 -r1.6 dynalib.c >--- ldapserver/ldap/servers/slapd/dynalib.c 10 Nov 2006 23:45:40 -0000 1.6 >+++ ldapserver/ldap/servers/slapd/dynalib.c 19 Jun 2007 15:24:45 -0000 >@@ -50,25 +50,46 @@ > #endif > > > static struct dynalib { > char *dl_name; > PRLibrary *dl_handle; > } **libs = NULL; > >-static void symload_report_error( char *libpath, char *symbol, char *plugin, >+static void symload_report_error( const char *libpath, char *symbol, char *plugin, > int libopen ); > >+/* construct a full path and name of a plugin >+ very similar to PR_GetLibraryName except that function inserts >+ the string "lib" at the beginning of name, making that function >+ unsuitable for constructing plugin names >+*/ >+static char *get_plugin_name(const char *dir, const char *name); >+ >+static void free_plugin_name(char *name) >+{ >+ PR_smprintf_free(name); >+} >+ > void * > sym_load( char *libpath, char *symbol, char *plugin, int report_errors ) > { > return sym_load_with_flags(libpath, symbol, plugin, report_errors, PR_FALSE, PR_FALSE); > } > >+/* libpath is the pathname from the plugin config entry - it may be an absolute path >+ or a relative path. It does not have to have the shared lib/dll suffix. The >+ PR_GetLibraryName function will create the correct library name and path, including >+ the correct shared library suffix for the platform. So, for example, if you just >+ pass in "libacl-plugin" as the libpath, and you are running on linux, the code >+ will first test for the existence of "libacl-plugin", then will construct the full >+ pathname to load as "PLUGINDIR/libacl-plugin.so" where PLUGINDIR is set during >+ build time to something like /usr/lib/brand/plugins. >+*/ > void * > sym_load_with_flags( char *libpath, char *symbol, char *plugin, int report_errors, PRBool load_now, PRBool load_global ) > { > int i; > void *handle; > PRLibSpec libSpec; > unsigned int flags = PR_LD_LAZY; /* default PR_LoadLibrary flag */ > >@@ -87,40 +108,51 @@ > > if (load_now) { > flags = PR_LD_NOW; > } > if (load_global) { > flags |= PR_LD_GLOBAL; > } > >+ if (PR_SUCCESS != PR_Access(libpath, PR_ACCESS_READ_OK)) { >+ libSpec.value.pathname = get_plugin_name(PLUGINDIR, libpath); >+ /* then just handle that failure case with symload_report_error below */ >+ } >+ > if ( (handle = PR_LoadLibraryWithFlags( libSpec, flags )) == NULL ) { > if ( report_errors ) { >- symload_report_error( libpath, symbol, plugin, 0 /* lib not open */ ); >+ symload_report_error( libSpec.value.pathname, symbol, plugin, 0 /* lib not open */ ); >+ } >+ if (libSpec.value.pathname != libpath) { >+ free_plugin_name((char *)libSpec.value.pathname); /* cast ok - allocated by get_plugin_name */ > } > return( NULL ); > } > > libs = (struct dynalib **) slapi_ch_realloc( (char *) libs, (i + 2) * > sizeof(struct dynalib) ); > libs[i] = (struct dynalib *) slapi_ch_malloc( sizeof(struct dynalib) ); > libs[i]->dl_name = slapi_ch_strdup( libpath ); > libs[i]->dl_handle = handle; > libs[ i + 1 ] = NULL; > > handle = PR_FindSymbol( libs[i]->dl_handle, symbol ); > if ( NULL == handle && report_errors ) { >- symload_report_error( libpath, symbol, plugin, 1 /* lib open */ ); >+ symload_report_error( libSpec.value.pathname, symbol, plugin, 1 /* lib open */ ); >+ } >+ if (libSpec.value.pathname != libpath) { >+ free_plugin_name((char *)libSpec.value.pathname); /* cast ok - allocated by PR_GetLibraryName */ > } > return handle; > } > > > static void >-symload_report_error( char *libpath, char *symbol, char *plugin, int libopen ) >+symload_report_error( const char *libpath, char *symbol, char *plugin, int libopen ) > { > char *errtext = NULL; > PRInt32 errlen, err; > > errlen = PR_GetErrorTextLength(); > if ( errlen > 0 ) { > errtext = slapi_ch_malloc( errlen ); > if (( err = PR_GetErrorText( errtext )) > 0 ) { >@@ -134,8 +166,27 @@ > "Could not load symbol \"%s\" from \"%s\" for plugin %s\n", > symbol, libpath, plugin ); > } else { > LDAPDebug( LDAP_DEBUG_ANY, > "Could not open library \"%s\" for plugin %s\n", > libpath, plugin, 0 ); > } > } >+ >+/* PR_GetLibraryName does almost everything we need, and unfortunately >+ a little bit more - it adds "lib" to be beginning of the library >+ name. So we have to strip that part off. >+*/ >+static char * >+get_plugin_name(const char *path, const char *lib) >+{ >+ char *fullname = PR_GetLibraryName(path, lib); >+ char *ptr = PL_strrstr(fullname, "/lib"); >+ >+ if (ptr) { >+ ++ptr; /* now points at the "l" */ >+ /* just copy the remainder of the string on top of here */ >+ memmove(ptr, ptr+3, strlen(ptr+3)+1); >+ } >+ >+ return fullname; >+} >Index: ldapserver/ldap/servers/slapd/tools/pwenc.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/tools/pwenc.c,v >retrieving revision 1.8 >diff -u -8 -r1.8 pwenc.c >--- ldapserver/ldap/servers/slapd/tools/pwenc.c 10 Nov 2006 23:45:51 -0000 1.8 >+++ ldapserver/ldap/servers/slapd/tools/pwenc.c 19 Jun 2007 15:24:45 -0000 >@@ -75,17 +75,17 @@ > int *module_ldap_debug; > #endif > int detached; > FILE *error_logfp; > FILE *access_logfp; > struct pw_scheme *pwdhashscheme; > int heflag = 0; > >-static int slapd_config(const char *configdir); >+static int slapd_config(const char *configdir, const char *configfile); > static int entry_has_attr_and_value(Slapi_Entry *e, const char *attrname, char *value); > > static void > usage( name ) > char *name; > { > fprintf( stderr, "usage: %s -D config-dir [-H] [-s scheme | -c comparepwd ] password...\n", name ); > exit( 1 ); >@@ -119,16 +119,51 @@ > memmove( s + 1, s + 3, strlen( s + 3 ) + 1 ); > } > } > } > return r; > } > > >+static slapdFrontendConfig_t * >+init_config(char *configdir) >+{ >+ char *abs_configdir = NULL; >+ char *configfile = NULL; >+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE]; >+ slapdFrontendConfig_t *slapdFrontendConfig = NULL; >+ >+ if (configdir == NULL) { /* use default */ >+ configdir = TEMPLATEDIR; >+ configfile = "template-dse.ldif"; >+ } >+ /* kexcoff: quite the same as slapd_bootstrap_config */ >+ FrontendConfig_init(); >+ >+ abs_configdir = rel2abspath( configdir ); >+ if ( config_set_configdir( "configdir (-D)", abs_configdir, >+ errorbuf, 1) != LDAP_SUCCESS ) { >+ fprintf( stderr, "%s\n", errorbuf ); >+ return( NULL ); >+ } >+ slapi_ch_free((void **)&abs_configdir); >+ >+ slapdFrontendConfig = getFrontendConfig(); >+ if (0 == slapd_config(slapdFrontendConfig->configdir, configfile)) { >+ fprintf(stderr, >+ "The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n", >+ slapdFrontendConfig->configdir); >+ return(NULL); >+ } >+ >+ return slapdFrontendConfig; >+} >+ >+ > int > main( argc, argv ) > int argc; > char *argv[]; > { > int i, rc; > char *enc, *cmp, *name; > struct pw_scheme *pwsp, *cmppwsp; >@@ -154,73 +189,70 @@ > fprintf( stderr, "Fatal error: unable to initialize the NSS subcomponent." ); > return( 1 ); > } > > > while (( i = getopt( argc, argv, opts )) != EOF ) { > switch ( i ) { > case 'D': >- /* kexcoff: quite the same as slapd_bootstrap_config */ >- FrontendConfig_init(); >- >- configdir = rel2abspath( optarg ); >- if ( config_set_configdir( "configdir (-D)", configdir, >- errorbuf, 1) != LDAP_SUCCESS ) { >- fprintf( stderr, "%s\n", errorbuf ); >- return( 1 ); >+ if (slapdFrontendConfig) { >+ fprintf(stderr, "The -D configdir argument must be given only once, and must be the first argument given\n"); >+ usage(name); >+ return 1; > } >- slapi_ch_free((void **)&configdir); >- >- >- slapdFrontendConfig = getFrontendConfig(); >- if (0 == slapd_config(slapdFrontendConfig->configdir)) { >- fprintf(stderr, >- "The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n", >- slapdFrontendConfig->configdir); >+ if (!(slapdFrontendConfig = init_config(optarg))) { > return(1); > } > break; > > case 's': /* set hash scheme */ > if (!slapdFrontendConfig) { >- usage( name ); >- return( 1 ); >+ if (!(slapdFrontendConfig = init_config(NULL))) { >+ usage( name ); >+ return(1); >+ } > } > if (( pwsp = pw_name2scheme( optarg )) == NULL ) { > fprintf( stderr, "%s: unknown hash scheme \"%s\"\n", name, > optarg ); > return( 1 ); > } > break; > > case 'c': /* compare encoded password to password */ > if (!slapdFrontendConfig) { >- usage( name ); >- return( 1 ); >+ if (!(slapdFrontendConfig = init_config(NULL))) { >+ usage( name ); >+ return(1); >+ } > } > cpwd = optarg; > break; > > case 'H': /* password(s) is(are) hex-encoded */ > if (!slapdFrontendConfig) { >- usage( name ); >- return( 1 ); >+ if (!(slapdFrontendConfig = init_config(NULL))) { >+ usage( name ); >+ return(1); > } >- heflag = 1; >- break; >+ } >+ heflag = 1; >+ break; > > default: > usage( name ); > } > } > > if (!slapdFrontendConfig) { >- usage( name ); >- return( 1 ); >+ if (!(slapdFrontendConfig = init_config(NULL))) { >+ usage( name ); >+ return(1); >+ } > } > > if ( cpwd != NULL ) { > cmppwsp = pw_val2scheme( decode( cpwd ), &cmp, 1 ); > } > > if ( cmppwsp != NULL && pwsp != NULL ) { > fprintf( stderr, "%s: do not use -s with -c\n", name ); >@@ -267,29 +299,33 @@ > > /* -------------------------------------------------------------- */ > > /* > kexcoff: quite similar to slapd_bootstrap_config() from the server, > but it only loads password storage scheme plugins > */ > static int >-slapd_config(const char *configdir) >+slapd_config(const char *configdir, const char *givenconfigfile) > { > char configfile[MAXPATHLEN+1]; > PRFileInfo prfinfo; > int rc = 0; /* Fail */ > int done = 0; > PRInt32 nr = 0; > PRFileDesc *prfd = 0; > char *buf = 0; > char *lastp = 0; > char *entrystr = 0; > >- PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir, CONFIG_FILENAME); >+ if (!givenconfigfile) { >+ givenconfigfile = CONFIG_FILENAME; >+ } >+ >+ PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir, givenconfigfile); > if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS ) > { > fprintf(stderr, > "The given config file %s could not be accessed, error %d\n", > configfile, rc); > exit( 1 ); > } > else if (( prfd = PR_Open( configfile, PR_RDONLY,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237356
:
153230
|
153562
|
153667
|
153668
|
153674
|
153675
|
153677
|
153678
|
155103
|
155105
|
155406
|
155407
|
155408
|
155409
|
155410
|
155411
|
155412
|
155413
|
155414
|
155483
|
155484
|
155485
|
155486
|
155487
|
155488
|
155489
|
155490
|
156389
|
156510
|
156525
|
156539
|
156540
|
156541
|
156612
|
156613
|
156614
|
156626
|
156633
|
156634
|
156741
|
156829
|
156834
|
156839
|
156840
|
156895
|
157043
|
157044
|
157133
|
157159
|
157160
|
157164
|
157165
|
157167
|
157298
| 157378 |
157381
|
157388
|
157390
|
157400
|
157401
|
157407
|
157408
|
157429
|
157431
|
157469
|
157471
|
157479
|
157480
|
160762