diff options
-rw-r--r-- | Makefile.am | 13 | ||||
-rw-r--r-- | Makefile.in | 51 | ||||
-rw-r--r-- | aclocal.m4 | 34 | ||||
-rwxr-xr-x | configure | 208 | ||||
-rw-r--r-- | ldap/ldif/template-dse.ldif.in | 10 | ||||
-rw-r--r-- | ldap/servers/plugins/schema_reload/schema_reload.c | 264 | ||||
-rw-r--r-- | ldap/servers/slapd/attrsyntax.c | 28 | ||||
-rw-r--r-- | ldap/servers/slapd/backend.c | 93 | ||||
-rw-r--r-- | ldap/servers/slapd/backend_manager.c | 12 | ||||
-rw-r--r-- | ldap/servers/slapd/dse.c | 220 | ||||
-rw-r--r-- | ldap/servers/slapd/entry.c | 9 | ||||
-rw-r--r-- | ldap/servers/slapd/mapping_tree.c | 18 | ||||
-rw-r--r-- | ldap/servers/slapd/pblock.c | 30 | ||||
-rw-r--r-- | ldap/servers/slapd/proto-slap.h | 12 | ||||
-rw-r--r-- | ldap/servers/slapd/schema.c | 1176 | ||||
-rw-r--r-- | ldap/servers/slapd/schemaparse.c | 18 | ||||
-rw-r--r-- | ldap/servers/slapd/slap.h | 8 | ||||
-rw-r--r-- | ldap/servers/slapd/slapi-plugin.h | 3 | ||||
-rw-r--r-- | ldap/servers/slapd/slapi-private.h | 14 | ||||
-rw-r--r-- | ltmain.sh | 233 |
20 files changed, 1483 insertions, 971 deletions
diff --git a/Makefile.am b/Makefile.am index 872be3b8..c0e4817b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -117,8 +117,9 @@ serverplugin_LTLIBRARIES = libacl-plugin.la libattr-unique-plugin.la \ libdistrib-plugin.la libhttp-client-plugin.la libcollation-plugin.la \ libmemberof-plugin.la libpassthru-plugin.la libpresence-plugin.la \ libpwdstorage-plugin.la libreferint-plugin.la libreplication-plugin.la \ - libretrocl-plugin.la libroles-plugin.la libstatechange-plugin.la libsyntax-plugin.la \ - libviews-plugin.la $(LIBPAM_PASSTHRU_PLUGIN) $(LIBDNA_PLUGIN) $(LIBBITWISE_PLUGIN) + libretrocl-plugin.la libroles-plugin.la libstatechange-plugin.la \ + libsyntax-plugin.la libviews-plugin.la libschemareload-plugin.la \ + $(LIBPAM_PASSTHRU_PLUGIN) $(LIBDNA_PLUGIN) $(LIBBITWISE_PLUGIN) nodist_property_DATA = ns-slapd.properties @@ -829,6 +830,14 @@ libviews_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) libviews_plugin_la_LDFLAGS = -avoid-version #------------------------ +# libschemareload-plugin +#------------------------ +libschemareload_plugin_la_SOURCES = ldap/servers/plugins/schema_reload/schema_reload.c + +libschemareload_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) +libschemareload_plugin_la_LDFLAGS = -avoid-version + +#------------------------ # libdna-plugin #------------------------ libdna_plugin_la_SOURCES = ldap/servers/plugins/dna/dna.c diff --git a/Makefile.in b/Makefile.in index 5796c61b..a63bc845 100644 --- a/Makefile.in +++ b/Makefile.in @@ -426,6 +426,10 @@ am_libroles_plugin_la_OBJECTS = \ ldap/servers/plugins/roles/libroles_plugin_la-roles_cache.lo \ ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.lo libroles_plugin_la_OBJECTS = $(am_libroles_plugin_la_OBJECTS) +libschemareload_plugin_la_LIBADD = +am_libschemareload_plugin_la_OBJECTS = ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo +libschemareload_plugin_la_OBJECTS = \ + $(am_libschemareload_plugin_la_OBJECTS) libslapd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @@ -735,7 +739,8 @@ SOURCES = $(libavl_a_SOURCES) $(libldaputil_a_SOURCES) \ $(libreferint_plugin_la_SOURCES) \ $(libreplication_plugin_la_SOURCES) \ $(libretrocl_plugin_la_SOURCES) $(libroles_plugin_la_SOURCES) \ - $(libslapd_la_SOURCES) $(libstatechange_plugin_la_SOURCES) \ + $(libschemareload_plugin_la_SOURCES) $(libslapd_la_SOURCES) \ + $(libstatechange_plugin_la_SOURCES) \ $(libsyntax_plugin_la_SOURCES) $(libviews_plugin_la_SOURCES) \ $(dbscan_bin_SOURCES) $(dsktune_bin_SOURCES) \ $(infadd_bin_SOURCES) $(ldap_agent_bin_SOURCES) \ @@ -760,7 +765,8 @@ DIST_SOURCES = $(libavl_a_SOURCES) $(libldaputil_a_SOURCES) \ $(libreferint_plugin_la_SOURCES) \ $(libreplication_plugin_la_SOURCES) \ $(libretrocl_plugin_la_SOURCES) $(libroles_plugin_la_SOURCES) \ - $(libslapd_la_SOURCES) $(libstatechange_plugin_la_SOURCES) \ + $(libschemareload_plugin_la_SOURCES) $(libslapd_la_SOURCES) \ + $(libstatechange_plugin_la_SOURCES) \ $(libsyntax_plugin_la_SOURCES) $(libviews_plugin_la_SOURCES) \ $(dbscan_bin_SOURCES) $(dsktune_bin_SOURCES) \ $(infadd_bin_SOURCES) $(ldap_agent_bin_SOURCES) \ @@ -855,7 +861,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOLARIS_FALSE = @SOLARIS_FALSE@ @@ -1040,8 +1045,9 @@ serverplugin_LTLIBRARIES = libacl-plugin.la libattr-unique-plugin.la \ libdistrib-plugin.la libhttp-client-plugin.la libcollation-plugin.la \ libmemberof-plugin.la libpassthru-plugin.la libpresence-plugin.la \ libpwdstorage-plugin.la libreferint-plugin.la libreplication-plugin.la \ - libretrocl-plugin.la libroles-plugin.la libstatechange-plugin.la libsyntax-plugin.la \ - libviews-plugin.la $(LIBPAM_PASSTHRU_PLUGIN) $(LIBDNA_PLUGIN) $(LIBBITWISE_PLUGIN) + libretrocl-plugin.la libroles-plugin.la libstatechange-plugin.la \ + libsyntax-plugin.la libviews-plugin.la libschemareload-plugin.la \ + $(LIBPAM_PASSTHRU_PLUGIN) $(LIBDNA_PLUGIN) $(LIBBITWISE_PLUGIN) nodist_property_DATA = ns-slapd.properties noinst_LIBRARIES = libavl.a libldaputil.a @@ -1732,6 +1738,13 @@ libviews_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) libviews_plugin_la_LDFLAGS = -avoid-version #------------------------ +# libschemareload-plugin +#------------------------ +libschemareload_plugin_la_SOURCES = ldap/servers/plugins/schema_reload/schema_reload.c +libschemareload_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) +libschemareload_plugin_la_LDFLAGS = -avoid-version + +#------------------------ # libdna-plugin #------------------------ libdna_plugin_la_SOURCES = ldap/servers/plugins/dna/dna.c @@ -3087,6 +3100,17 @@ ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.lo: \ ldap/servers/plugins/roles/$(DEPDIR)/$(am__dirstamp) libroles-plugin.la: $(libroles_plugin_la_OBJECTS) $(libroles_plugin_la_DEPENDENCIES) $(LINK) -rpath $(serverplugindir) $(libroles_plugin_la_LDFLAGS) $(libroles_plugin_la_OBJECTS) $(libroles_plugin_la_LIBADD) $(LIBS) +ldap/servers/plugins/schema_reload/$(am__dirstamp): + @$(mkdir_p) ldap/servers/plugins/schema_reload + @: > ldap/servers/plugins/schema_reload/$(am__dirstamp) +ldap/servers/plugins/schema_reload/$(DEPDIR)/$(am__dirstamp): + @$(mkdir_p) ldap/servers/plugins/schema_reload/$(DEPDIR) + @: > ldap/servers/plugins/schema_reload/$(DEPDIR)/$(am__dirstamp) +ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo: \ + ldap/servers/plugins/schema_reload/$(am__dirstamp) \ + ldap/servers/plugins/schema_reload/$(DEPDIR)/$(am__dirstamp) +libschemareload-plugin.la: $(libschemareload_plugin_la_OBJECTS) $(libschemareload_plugin_la_DEPENDENCIES) + $(LINK) -rpath $(serverplugindir) $(libschemareload_plugin_la_LDFLAGS) $(libschemareload_plugin_la_OBJECTS) $(libschemareload_plugin_la_LIBADD) $(LIBS) ldap/servers/slapd/$(am__dirstamp): @$(mkdir_p) ldap/servers/slapd @: > ldap/servers/slapd/$(am__dirstamp) @@ -4128,6 +4152,8 @@ mostlyclean-compile: -rm -f ldap/servers/plugins/roles/libroles_plugin_la-roles_cache.lo -rm -f ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.$(OBJEXT) -rm -f ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.lo + -rm -f ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.$(OBJEXT) + -rm -f ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo -rm -f ldap/servers/plugins/shared/libattr_unique_plugin_la-utils.$(OBJEXT) -rm -f ldap/servers/plugins/shared/libattr_unique_plugin_la-utils.lo -rm -f ldap/servers/plugins/statechange/libstatechange_plugin_la-statechange.$(OBJEXT) @@ -4782,6 +4808,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/rever/$(DEPDIR)/libdes_plugin_la-rever.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/roles/$(DEPDIR)/libroles_plugin_la-roles_cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/roles/$(DEPDIR)/libroles_plugin_la-roles_plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/schema_reload/$(DEPDIR)/libschemareload_plugin_la-schema_reload.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/shared/$(DEPDIR)/libattr_unique_plugin_la-utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/statechange/$(DEPDIR)/libstatechange_plugin_la-statechange.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bin.Plo@am__quote@ @@ -6719,6 +6746,13 @@ ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.lo: ldap/servers/plug @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libroles_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/roles/libroles_plugin_la-roles_plugin.lo `test -f 'ldap/servers/plugins/roles/roles_plugin.c' || echo '$(srcdir)/'`ldap/servers/plugins/roles/roles_plugin.c +ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo: ldap/servers/plugins/schema_reload/schema_reload.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libschemareload_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo -MD -MP -MF "ldap/servers/plugins/schema_reload/$(DEPDIR)/libschemareload_plugin_la-schema_reload.Tpo" -c -o ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo `test -f 'ldap/servers/plugins/schema_reload/schema_reload.c' || echo '$(srcdir)/'`ldap/servers/plugins/schema_reload/schema_reload.c; \ +@am__fastdepCC_TRUE@ then mv -f "ldap/servers/plugins/schema_reload/$(DEPDIR)/libschemareload_plugin_la-schema_reload.Tpo" "ldap/servers/plugins/schema_reload/$(DEPDIR)/libschemareload_plugin_la-schema_reload.Plo"; else rm -f "ldap/servers/plugins/schema_reload/$(DEPDIR)/libschemareload_plugin_la-schema_reload.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/schema_reload/schema_reload.c' object='ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libschemareload_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/schema_reload/libschemareload_plugin_la-schema_reload.lo `test -f 'ldap/servers/plugins/schema_reload/schema_reload.c' || echo '$(srcdir)/'`ldap/servers/plugins/schema_reload/schema_reload.c + ldap/servers/slapd/libslapd_la-add.lo: ldap/servers/slapd/add.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libslapd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/slapd/libslapd_la-add.lo -MD -MP -MF "ldap/servers/slapd/$(DEPDIR)/libslapd_la-add.Tpo" -c -o ldap/servers/slapd/libslapd_la-add.lo `test -f 'ldap/servers/slapd/add.c' || echo '$(srcdir)/'`ldap/servers/slapd/add.c; \ @am__fastdepCC_TRUE@ then mv -f "ldap/servers/slapd/$(DEPDIR)/libslapd_la-add.Tpo" "ldap/servers/slapd/$(DEPDIR)/libslapd_la-add.Plo"; else rm -f "ldap/servers/slapd/$(DEPDIR)/libslapd_la-add.Tpo"; exit 1; fi @@ -8636,6 +8670,7 @@ clean-libtool: -rm -rf ldap/servers/plugins/retrocl/.libs ldap/servers/plugins/retrocl/_libs -rm -rf ldap/servers/plugins/rever/.libs ldap/servers/plugins/rever/_libs -rm -rf ldap/servers/plugins/roles/.libs ldap/servers/plugins/roles/_libs + -rm -rf ldap/servers/plugins/schema_reload/.libs ldap/servers/plugins/schema_reload/_libs -rm -rf ldap/servers/plugins/shared/.libs ldap/servers/plugins/shared/_libs -rm -rf ldap/servers/plugins/statechange/.libs ldap/servers/plugins/statechange/_libs -rm -rf ldap/servers/plugins/syntaxes/.libs ldap/servers/plugins/syntaxes/_libs @@ -9016,6 +9051,8 @@ distclean-generic: -rm -f ldap/servers/plugins/rever/$(am__dirstamp) -rm -f ldap/servers/plugins/roles/$(DEPDIR)/$(am__dirstamp) -rm -f ldap/servers/plugins/roles/$(am__dirstamp) + -rm -f ldap/servers/plugins/schema_reload/$(DEPDIR)/$(am__dirstamp) + -rm -f ldap/servers/plugins/schema_reload/$(am__dirstamp) -rm -f ldap/servers/plugins/shared/$(DEPDIR)/$(am__dirstamp) -rm -f ldap/servers/plugins/shared/$(am__dirstamp) -rm -f ldap/servers/plugins/statechange/$(DEPDIR)/$(am__dirstamp) @@ -9064,7 +9101,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libtool \ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ldap/libraries/libavl/$(DEPDIR) ldap/servers/plugins/acl/$(DEPDIR) ldap/servers/plugins/bitwise/$(DEPDIR) ldap/servers/plugins/chainingdb/$(DEPDIR) ldap/servers/plugins/collation/$(DEPDIR) ldap/servers/plugins/cos/$(DEPDIR) ldap/servers/plugins/distrib/$(DEPDIR) ldap/servers/plugins/dna/$(DEPDIR) ldap/servers/plugins/http/$(DEPDIR) ldap/servers/plugins/memberof/$(DEPDIR) ldap/servers/plugins/pam_passthru/$(DEPDIR) ldap/servers/plugins/passthru/$(DEPDIR) ldap/servers/plugins/presence/$(DEPDIR) ldap/servers/plugins/pwdstorage/$(DEPDIR) ldap/servers/plugins/referint/$(DEPDIR) ldap/servers/plugins/replication/$(DEPDIR) ldap/servers/plugins/retrocl/$(DEPDIR) ldap/servers/plugins/rever/$(DEPDIR) ldap/servers/plugins/roles/$(DEPDIR) ldap/servers/plugins/shared/$(DEPDIR) ldap/servers/plugins/statechange/$(DEPDIR) ldap/servers/plugins/syntaxes/$(DEPDIR) ldap/servers/plugins/uiduniq/$(DEPDIR) ldap/servers/plugins/views/$(DEPDIR) ldap/servers/slapd/$(DEPDIR) ldap/servers/slapd/back-ldbm/$(DEPDIR) ldap/servers/slapd/tools/$(DEPDIR) ldap/servers/slapd/tools/ldclt/$(DEPDIR) ldap/servers/slapd/tools/rsearch/$(DEPDIR) ldap/servers/snmp/$(DEPDIR) ldap/systools/$(DEPDIR) lib/base/$(DEPDIR) lib/ldaputil/$(DEPDIR) lib/libaccess/$(DEPDIR) lib/libadmin/$(DEPDIR) lib/libsi18n/$(DEPDIR) + -rm -rf ldap/libraries/libavl/$(DEPDIR) ldap/servers/plugins/acl/$(DEPDIR) ldap/servers/plugins/bitwise/$(DEPDIR) ldap/servers/plugins/chainingdb/$(DEPDIR) ldap/servers/plugins/collation/$(DEPDIR) ldap/servers/plugins/cos/$(DEPDIR) ldap/servers/plugins/distrib/$(DEPDIR) ldap/servers/plugins/dna/$(DEPDIR) ldap/servers/plugins/http/$(DEPDIR) ldap/servers/plugins/memberof/$(DEPDIR) ldap/servers/plugins/pam_passthru/$(DEPDIR) ldap/servers/plugins/passthru/$(DEPDIR) ldap/servers/plugins/presence/$(DEPDIR) ldap/servers/plugins/pwdstorage/$(DEPDIR) ldap/servers/plugins/referint/$(DEPDIR) ldap/servers/plugins/replication/$(DEPDIR) ldap/servers/plugins/retrocl/$(DEPDIR) ldap/servers/plugins/rever/$(DEPDIR) ldap/servers/plugins/roles/$(DEPDIR) ldap/servers/plugins/schema_reload/$(DEPDIR) ldap/servers/plugins/shared/$(DEPDIR) ldap/servers/plugins/statechange/$(DEPDIR) ldap/servers/plugins/syntaxes/$(DEPDIR) ldap/servers/plugins/uiduniq/$(DEPDIR) ldap/servers/plugins/views/$(DEPDIR) ldap/servers/slapd/$(DEPDIR) ldap/servers/slapd/back-ldbm/$(DEPDIR) ldap/servers/slapd/tools/$(DEPDIR) ldap/servers/slapd/tools/ldclt/$(DEPDIR) ldap/servers/slapd/tools/rsearch/$(DEPDIR) ldap/servers/snmp/$(DEPDIR) ldap/systools/$(DEPDIR) lib/base/$(DEPDIR) lib/ldaputil/$(DEPDIR) lib/libaccess/$(DEPDIR) lib/libadmin/$(DEPDIR) lib/libsi18n/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -9098,7 +9135,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ldap/libraries/libavl/$(DEPDIR) ldap/servers/plugins/acl/$(DEPDIR) ldap/servers/plugins/bitwise/$(DEPDIR) ldap/servers/plugins/chainingdb/$(DEPDIR) ldap/servers/plugins/collation/$(DEPDIR) ldap/servers/plugins/cos/$(DEPDIR) ldap/servers/plugins/distrib/$(DEPDIR) ldap/servers/plugins/dna/$(DEPDIR) ldap/servers/plugins/http/$(DEPDIR) ldap/servers/plugins/memberof/$(DEPDIR) ldap/servers/plugins/pam_passthru/$(DEPDIR) ldap/servers/plugins/passthru/$(DEPDIR) ldap/servers/plugins/presence/$(DEPDIR) ldap/servers/plugins/pwdstorage/$(DEPDIR) ldap/servers/plugins/referint/$(DEPDIR) ldap/servers/plugins/replication/$(DEPDIR) ldap/servers/plugins/retrocl/$(DEPDIR) ldap/servers/plugins/rever/$(DEPDIR) ldap/servers/plugins/roles/$(DEPDIR) ldap/servers/plugins/shared/$(DEPDIR) ldap/servers/plugins/statechange/$(DEPDIR) ldap/servers/plugins/syntaxes/$(DEPDIR) ldap/servers/plugins/uiduniq/$(DEPDIR) ldap/servers/plugins/views/$(DEPDIR) ldap/servers/slapd/$(DEPDIR) ldap/servers/slapd/back-ldbm/$(DEPDIR) ldap/servers/slapd/tools/$(DEPDIR) ldap/servers/slapd/tools/ldclt/$(DEPDIR) ldap/servers/slapd/tools/rsearch/$(DEPDIR) ldap/servers/snmp/$(DEPDIR) ldap/systools/$(DEPDIR) lib/base/$(DEPDIR) lib/ldaputil/$(DEPDIR) lib/libaccess/$(DEPDIR) lib/libadmin/$(DEPDIR) lib/libsi18n/$(DEPDIR) + -rm -rf ldap/libraries/libavl/$(DEPDIR) ldap/servers/plugins/acl/$(DEPDIR) ldap/servers/plugins/bitwise/$(DEPDIR) ldap/servers/plugins/chainingdb/$(DEPDIR) ldap/servers/plugins/collation/$(DEPDIR) ldap/servers/plugins/cos/$(DEPDIR) ldap/servers/plugins/distrib/$(DEPDIR) ldap/servers/plugins/dna/$(DEPDIR) ldap/servers/plugins/http/$(DEPDIR) ldap/servers/plugins/memberof/$(DEPDIR) ldap/servers/plugins/pam_passthru/$(DEPDIR) ldap/servers/plugins/passthru/$(DEPDIR) ldap/servers/plugins/presence/$(DEPDIR) ldap/servers/plugins/pwdstorage/$(DEPDIR) ldap/servers/plugins/referint/$(DEPDIR) ldap/servers/plugins/replication/$(DEPDIR) ldap/servers/plugins/retrocl/$(DEPDIR) ldap/servers/plugins/rever/$(DEPDIR) ldap/servers/plugins/roles/$(DEPDIR) ldap/servers/plugins/schema_reload/$(DEPDIR) ldap/servers/plugins/shared/$(DEPDIR) ldap/servers/plugins/statechange/$(DEPDIR) ldap/servers/plugins/syntaxes/$(DEPDIR) ldap/servers/plugins/uiduniq/$(DEPDIR) ldap/servers/plugins/views/$(DEPDIR) ldap/servers/slapd/$(DEPDIR) ldap/servers/slapd/back-ldbm/$(DEPDIR) ldap/servers/slapd/tools/$(DEPDIR) ldap/servers/slapd/tools/ldclt/$(DEPDIR) ldap/servers/slapd/tools/rsearch/$(DEPDIR) ldap/servers/snmp/$(DEPDIR) ldap/systools/$(DEPDIR) lib/base/$(DEPDIR) lib/ldaputil/$(DEPDIR) lib/libaccess/$(DEPDIR) lib/libadmin/$(DEPDIR) lib/libsi18n/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1578,27 +1578,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -4305,9 +4288,6 @@ CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -4441,11 +4421,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. @@ -4457,7 +4437,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4537,7 +4517,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -6373,7 +6353,6 @@ do done done done -IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -6406,7 +6385,6 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do done ]) SED=$lt_cv_path_SED -AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) @@ -465,7 +465,7 @@ ac_includes_default="\ #endif" ac_default_prefix=/opt/$PACKAGE_NAME -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path 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 EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path 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. @@ -3838,7 +3838,6 @@ do done done done -IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -3873,7 +3872,6 @@ done fi SED=$lt_cv_path_SED - echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 @@ -4314,7 +4312,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4317 "configure"' > conftest.$ac_ext + echo '#line 4315 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5449,7 +5447,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5452:" \ +echo "$as_me:5450:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -6512,11 +6510,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6515: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6513: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6519: \$? = $ac_status" >&5 + echo "$as_me:6517: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6780,11 +6778,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6783: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6781: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6787: \$? = $ac_status" >&5 + echo "$as_me:6785: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6884,11 +6882,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6887: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6885: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6891: \$? = $ac_status" >&5 + echo "$as_me:6889: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8349,31 +8347,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 8356 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -9250,7 +9227,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9253 "configure" +#line 9230 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9350,7 +9327,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9353 "configure" +#line 9330 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9681,9 +9658,6 @@ CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -9817,11 +9791,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_predep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_postdep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. @@ -9833,7 +9807,7 @@ postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_compiler_lib_search_path | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9913,7 +9887,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -11693,11 +11667,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11696: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11670: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11700: \$? = $ac_status" >&5 + echo "$as_me:11674: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11797,11 +11771,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11800: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11774: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11804: \$? = $ac_status" >&5 + echo "$as_me:11778: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12329,31 +12303,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 12336 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -12737,9 +12690,6 @@ CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -12873,11 +12823,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. @@ -12889,7 +12839,7 @@ postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -12969,7 +12919,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -13391,11 +13341,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13394: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13344: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13398: \$? = $ac_status" >&5 + echo "$as_me:13348: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13495,11 +13445,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13498: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13448: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13502: \$? = $ac_status" >&5 + echo "$as_me:13452: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14940,31 +14890,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 14947 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -15348,9 +15277,6 @@ CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -15484,11 +15410,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. @@ -15500,7 +15426,7 @@ postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -15580,7 +15506,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -15722,11 +15648,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15725: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15651: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15729: \$? = $ac_status" >&5 + echo "$as_me:15655: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15990,11 +15916,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15993: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15919: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15997: \$? = $ac_status" >&5 + echo "$as_me:15923: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16094,11 +16020,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16097: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16023: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16101: \$? = $ac_status" >&5 + echo "$as_me:16027: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17559,31 +17485,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '#line 17566 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -17967,9 +17872,6 @@ CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -18103,11 +18005,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. @@ -18119,7 +18021,7 @@ postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -18199,7 +18101,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -18451,9 +18353,6 @@ CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC -gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` -gcc_ver=\`gcc -dumpversion\` - # An ERE matcher. EGREP=$lt_EGREP @@ -18587,11 +18486,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. @@ -18603,7 +18502,7 @@ postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -18683,7 +18582,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries -sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -26104,7 +26003,6 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@SED@,$SED,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@ECHO@,$ECHO,;t t diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in index c9b4556f..ca3dd542 100644 --- a/ldap/ldif/template-dse.ldif.in +++ b/ldap/ldif/template-dse.ldif.in @@ -200,6 +200,16 @@ nsslapd-plugininitfunc: ces_init nsslapd-plugintype: syntax nsslapd-pluginenabled: on +dn: cn=Schema Reload,cn=plugins,cn=config +objectclass: top +objectclass: nsSlapdPlugin +objectclass: extensibleObject +cn: Schema Reload +nsslapd-pluginpath: libschemareload-plugin +nsslapd-plugininitfunc: schemareload_init +nsslapd-plugintype: object +nsslapd-pluginenabled: on + dn: cn=Space Insensitive String Syntax,cn=plugins,cn=config objectclass: top objectclass: nsSlapdPlugin diff --git a/ldap/servers/plugins/schema_reload/schema_reload.c b/ldap/servers/plugins/schema_reload/schema_reload.c new file mode 100644 index 00000000..d4661f19 --- /dev/null +++ b/ldap/servers/plugins/schema_reload/schema_reload.c @@ -0,0 +1,264 @@ +/** 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) 2008 Red Hat, Inc. + * All rights reserved. + * END COPYRIGHT BLOCK **/ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +/* + * Dynamic schema file reload plugin + * + * plugin entry in dse.ldif + * dn: cn=Schema Reload,cn=plugins,cn=config + * objectClass: top + * objectClass: nsSlapdPlugin + * objectClass: extensibleObject + * cn: Schema Reload + * nsslapd-pluginPath: libschemareload-plugin + * nsslapd-pluginInitfunc: schemareload_init + * nsslapd-pluginType: object + * nsslapd-pluginEnabled: on + * nsslapd-pluginId: schemareload + * nsslapd-pluginVersion: <plugin_version> + * nsslapd-pluginVendor: <vendor name> + * nsslapd-pluginDescription: task plugin to reload schema files + * + * config task entry in dse.ldif (registered in schemareload_start) + * dn: cn=schema reload task, cn=tasks, cn=config + * objectClass: top + * objectClass: extensibleObject + * cn: schema reload task + * + * To invoke the sample task, run the command line: + * $ ldapmodify -h <host> -p <port> -D "cn=Directory Manager" -w <pw> -a + * dn: cn=schema reload task 0, cn=schema reload task, cn=tasks, cn=config + * objectClass: top + * objectClass: extensibleObject + * cn: schema reload task 0 + * [ schemadir: path to reload files from ] + */ + +#include "slapi-plugin.h" +#include "nspr.h" +#include "dirver.h" /* PRODUCTTEXT */ +#include <dirlite_strings.h> /* PLUGIN_MAGIC_VENDOR_STR */ + +static PRLock *schemareload_lock = NULL; + +static Slapi_PluginDesc pdesc = { "schemareload", + PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT, + "task plugin to reload schema files" }; + +static int schemareload_add(Slapi_PBlock *pb, Slapi_Entry *e, + Slapi_Entry *eAfter, int *returncode, char *returntext, + void *arg); +static int schemareload_start(Slapi_PBlock *pb); + +/* + * Init function + * Specified in the plugin entry as "nsslapd-pluginInitfunc: schemareload_init" + */ +int +schemareload_init( Slapi_PBlock *pb ) +{ + int rc = 0; + schemareload_lock = PR_NewLock(); + if (NULL == schemareload_lock) { + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", + "Failed to create global schema reload lock."); + return rc; + } + rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, + (void *) SLAPI_PLUGIN_VERSION_03 ); + rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, + (void *)&pdesc ); + rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN, + (void *) schemareload_start ); + + return rc; +} + +/* + * Task start function + * Register the function schemareload_add, which invokes the task on demand. + */ +static int +schemareload_start(Slapi_PBlock *pb) +{ + int rc = slapi_task_register_handler("schema reload task", schemareload_add); + return rc; +} + +/* + * Task thread + * This is the heart of the reload-schema-file task: + * - calling the schema APIs to validate the schema files, + * - reloading them if the files are valid. + * Not necessary be a thread, but it'd not disturb the server's other jobs. + */ +static void +schemareload_thread(void *arg) +{ + Slapi_Task *task = (Slapi_Task *)arg; + int i, rv = 0; + int total_work = 2; + /* fetch our argument from the task */ + char *schemadir = (char *)slapi_task_get_data(task); + + /* update task state to show it's running */ + slapi_task_begin(task, total_work); + PR_Lock(schemareload_lock); /* make schema reload serialized */ + slapi_task_log_notice(task, "Schema reload task starts (schema dir: %s) ...\n", schemadir?schemadir:"default"); + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "Schema reload task starts (schema dir: %s) ...\n", schemadir?schemadir:"default"); + + rv = slapi_validate_schema_files(schemadir); + slapi_task_inc_progress(task); + + if (LDAP_SUCCESS == rv) { + slapi_task_log_notice(task, "Schema validation passed."); + slapi_task_log_status(task, "Schema validation passed."); + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "Schema validation passed.\n"); + + rv = slapi_reload_schema_files(schemadir); + slapi_task_inc_progress(task); + + /* update task state to say we're finished */ + if (LDAP_SUCCESS == rv) { + slapi_task_log_notice(task, "Schema reload task finished."); + slapi_task_log_status(task, "Schema reload task finished."); + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "Schema reload task finished.\n"); + } else { + slapi_task_log_notice(task, "Schema reload task failed."); + slapi_task_log_status(task, "Schema reload task failed."); + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "Schema reload task failed.\n"); + } + PR_Unlock(schemareload_lock); + } else { + slapi_task_log_notice(task, "Schema validation failed."); + slapi_task_log_status(task, "Schema validation failed."); + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "Schema validation failed.\n"); + PR_Unlock(schemareload_lock); + } + + /* this will queue the destruction of the task */ + slapi_task_finish(task, rv); +} + +/* extract a single value from the entry (as a string) -- if it's not in the + * entry, the default will be returned (which can be NULL). + * you do not need to free anything returned by this. + */ +static const char *fetch_attr(Slapi_Entry *e, const char *attrname, + const char *default_val) +{ + Slapi_Attr *attr; + Slapi_Value *val = NULL; + + if (slapi_entry_attr_find(e, attrname, &attr) != 0) + return default_val; + slapi_attr_first_value(attr, &val); + return slapi_value_get_string(val); +} + +static void +schemareload_destructor(Slapi_Task *task) +{ + if (task) { + char *schemadir = (char *)slapi_task_get_data(task); + slapi_ch_free_string(&schemadir); + } +} + +/* + * Invoked when the task instance is added by the client (step 5 of the comment) + * Get the necessary attributes from the task entry, and spawns a thread to do + * the task. + */ +static int +schemareload_add(Slapi_PBlock *pb, Slapi_Entry *e, + Slapi_Entry *eAfter, int *returncode, char *returntext, + void *arg) +{ + PRThread *thread = NULL; + const char *cn; + int rv = SLAPI_DSE_CALLBACK_OK; + Slapi_PBlock *mypb = NULL; + Slapi_Task *task = NULL; + char *schemadir = NULL; + + *returncode = LDAP_SUCCESS; + if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + *returncode = LDAP_OBJECT_CLASS_VIOLATION; + rv = SLAPI_DSE_CALLBACK_ERROR; + goto out; + } + + /* get arg(s) */ + schemadir = fetch_attr(e, "schemadir", NULL); + + /* allocate new task now */ + task = slapi_new_task(slapi_entry_get_ndn(e)); + if (task == NULL) { + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", "unable to allocate new task!\n"); + *returncode = LDAP_OPERATIONS_ERROR; + rv = SLAPI_DSE_CALLBACK_ERROR; + goto out; + } + + /* set a destructor that will clean up schemadir for us when the task is complete */ + slapi_task_set_destructor_fn(task, schemareload_destructor); + + /* Stash our argument in the task for use by the task thread */ + slapi_task_set_data(task, slapi_ch_strdup(schemadir)); + + /* start the schema reload task as a separate thread */ + thread = PR_CreateThread(PR_USER_THREAD, schemareload_thread, + (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, + PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE); + if (thread == NULL) { + slapi_log_error(SLAPI_LOG_FATAL, "schemareload", + "unable to create schema reload task thread!\n"); + *returncode = LDAP_OPERATIONS_ERROR; + rv = SLAPI_DSE_CALLBACK_ERROR; + slapi_task_finish(task, *returncode); + } else { + /* thread successful */ + rv = SLAPI_DSE_CALLBACK_OK; + } + +out: + return rv; +} diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c index 1afa3c3d..3cda3277 100644 --- a/ldap/servers/slapd/attrsyntax.c +++ b/ldap/servers/slapd/attrsyntax.c @@ -452,6 +452,7 @@ slapi_attr_syntax_normalize( const char *s ) if((asi=attr_syntax_get_by_name_locking_optional(s, PR_TRUE, PR_FALSE)) != NULL ) { r = slapi_ch_strdup(asi->asi_name); + attr_syntax_return( asi ); } if ( NULL == asi ) { r = attr_syntax_normalize_no_lookup( s ); @@ -501,6 +502,7 @@ attr_syntax_get_plugin_by_name_with_default( const char *type ) } if ( NULL != asi ) { plugin = asi->asi_plugin; + attr_syntax_return( asi ); } return( plugin ); } @@ -890,6 +892,19 @@ attr_syntax_delete_if_not_flagged(struct asyntaxinfo *asip, void *arg) } } +static int +attr_syntax_force_to_delete(struct asyntaxinfo *asip, void *arg) +{ + struct attr_syntax_enum_flaginfo *fi; + + PR_ASSERT( asip != NULL ); + fi = (struct attr_syntax_enum_flaginfo *)arg; + PR_ASSERT( fi != NULL ); + + attr_syntax_delete_no_lock( asip, PR_FALSE ); + return ATTR_SYNTAX_ENUM_REMOVE; +} + /* * Clear 'flag' within all attribute definitions. @@ -921,6 +936,19 @@ attr_syntax_delete_all_not_flagged( unsigned long flag ) (void *)&fi, PR_TRUE ); } +/* + * Delete all attribute definitions + */ +void +attr_syntax_delete_all() +{ + struct attr_syntax_enum_flaginfo fi; + + memset( &fi, 0, sizeof(fi)); + attr_syntax_enumerate_attrs( attr_syntax_force_to_delete, + (void *)&fi, PR_TRUE ); +} + static int attr_syntax_init(void) { diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c index ed8c2274..42cb2cf2 100644 --- a/ldap/servers/slapd/backend.c +++ b/ldap/servers/slapd/backend.c @@ -48,52 +48,52 @@ void be_init( Slapi_Backend *be, const char *type, const char *name, int isprivate, int logchanges, int sizelimit, int timelimit ) { char text[128]; - slapdFrontendConfig_t *fecfg; - be->be_suffix = NULL; + slapdFrontendConfig_t *fecfg; + be->be_suffix = NULL; be->be_suffixlock= PR_NewLock(); be->be_suffixcount= 0; - /* e.g. dn: cn=config,cn=NetscapeRoot,cn=ldbm database,cn=plugins,cn=config */ - PR_snprintf(text, sizeof(text),"cn=%s,cn=%s,cn=plugins,cn=config", name, type); + /* e.g. dn: cn=config,cn=NetscapeRoot,cn=ldbm database,cn=plugins,cn=config */ + PR_snprintf(text, sizeof(text),"cn=%s,cn=%s,cn=plugins,cn=config", name, type); be->be_basedn= slapi_ch_strdup(slapi_dn_normalize(text)); - PR_snprintf(text, sizeof(text), "cn=config,cn=%s,cn=%s,cn=plugins,cn=config", name, type); - be->be_configdn= slapi_ch_strdup(slapi_dn_normalize(text)); - PR_snprintf(text, sizeof(text), "cn=monitor,cn=%s,cn=%s,cn=plugins,cn=config", name, type); - be->be_monitordn= slapi_ch_strdup(slapi_dn_normalize(text)); - be->be_sizelimit = sizelimit; - be->be_timelimit = timelimit; - /* maximum group nesting level before giving up */ - be->be_maxnestlevel = SLAPD_DEFAULT_GROUPNESTLEVEL; - be->be_noacl= 0; + PR_snprintf(text, sizeof(text), "cn=config,cn=%s,cn=%s,cn=plugins,cn=config", name, type); + be->be_configdn= slapi_ch_strdup(slapi_dn_normalize(text)); + PR_snprintf(text, sizeof(text), "cn=monitor,cn=%s,cn=%s,cn=plugins,cn=config", name, type); + be->be_monitordn= slapi_ch_strdup(slapi_dn_normalize(text)); + be->be_sizelimit = sizelimit; + be->be_timelimit = timelimit; + /* maximum group nesting level before giving up */ + be->be_maxnestlevel = SLAPD_DEFAULT_GROUPNESTLEVEL; + be->be_noacl= 0; be->be_flags=0; - if (( fecfg = getFrontendConfig()) != NULL ) - { - if ( fecfg->backendconfig != NULL && fecfg->backendconfig[ 0 ] != NULL ) - { - be->be_backendconfig = slapi_ch_strdup( fecfg->backendconfig[0] ); - } - else - { - be->be_backendconfig= NULL; - } - be->be_readonly = fecfg->readonly; - } - else - { - be->be_readonly= 0; - be->be_backendconfig= NULL; - } - be->be_lastmod = LDAP_UNDEFINED; - be->be_type = slapi_ch_strdup(type); - be->be_include = NULL; - be->be_private = isprivate; + if (( fecfg = getFrontendConfig()) != NULL ) + { + if ( fecfg->backendconfig != NULL && fecfg->backendconfig[ 0 ] != NULL ) + { + be->be_backendconfig = slapi_ch_strdup( fecfg->backendconfig[0] ); + } + else + { + be->be_backendconfig= NULL; + } + be->be_readonly = fecfg->readonly; + } + else + { + be->be_readonly= 0; + be->be_backendconfig= NULL; + } + be->be_lastmod = LDAP_UNDEFINED; + be->be_type = slapi_ch_strdup(type); + be->be_include = NULL; + be->be_private = isprivate; be->be_logchanges = logchanges; - be->be_database = NULL; - be->be_writeconfig = NULL; + be->be_database = NULL; + be->be_writeconfig = NULL; be->be_delete_on_exit = 0; - be->be_state = BE_STATE_STOPPED; - be->be_state_lock = PR_NewLock(); - be->be_name = slapi_ch_strdup(name); - be->be_mapped = 0; + be->be_state = BE_STATE_STOPPED; + be->be_state_lock = PR_NewLock(); + be->be_name = slapi_ch_strdup(name); + be->be_mapped = 0; } void @@ -115,12 +115,17 @@ be_done(Slapi_Backend *be) /* JCM char **be_include; ??? */ slapi_ch_free((void **)&be->be_name); PR_DestroyLock(be->be_state_lock); + if (be->be_lock != NULL) + { + PR_DestroyRWLock(be->be_lock); + be->be_lock = NULL; + } } void slapi_be_delete_onexit (Slapi_Backend *be) { - be->be_delete_on_exit = 1; + be->be_delete_on_exit = 1; } void @@ -161,6 +166,12 @@ slapi_be_issuffix( const Slapi_Backend *be, const Slapi_DN *suffix ) return r; } +int +be_isdeleted( const Slapi_Backend *be ) +{ + return BE_STATE_DELETED == be->be_state; +} + void be_addsuffix(Slapi_Backend *be,const Slapi_DN *suffix) { diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c index ca355ca9..b562a299 100644 --- a/ldap/servers/slapd/backend_manager.c +++ b/ldap/servers/slapd/backend_manager.c @@ -149,6 +149,15 @@ be_new_internal(struct dse *pdse, const char *type, const char *name) return be; } +/* + * Rule: before coming to this point, slapi_be_Wlock(be) must be acquired. + */ +void +be_replace_dse_internal(Slapi_Backend *be, struct dse *pdse) +{ + be->be_database->plg_private= (void*)pdse; +} + Slapi_Backend* slapi_get_first_backend (char **cookie) { @@ -341,8 +350,7 @@ be_cleanupall() slapi_pblock_set( &pb, SLAPI_BACKEND, backends[i] ); (*backends[i]->be_cleanup)( &pb ); - be_done(backends[i]); - slapi_ch_free((void **)&backends[i]); + slapi_be_free(&backends[i]); } } slapi_ch_free((void**)&backends); diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c index 74127880..49f12000 100644 --- a/ldap/servers/slapd/dse.c +++ b/ldap/servers/slapd/dse.c @@ -210,7 +210,7 @@ dse_get_entry_copy( struct dse* pdse, const Slapi_DN *dn, int use_lock ) Slapi_Entry *e= NULL; struct dse_node *n; - if (use_lock == DSE_USE_LOCK) + if (use_lock == DSE_USE_LOCK && pdse->dse_rwlock) PR_RWLock_Rlock(pdse->dse_rwlock); n = dse_find_node( pdse, dn ); @@ -219,7 +219,7 @@ dse_get_entry_copy( struct dse* pdse, const Slapi_DN *dn, int use_lock ) e = slapi_entry_dup(n->entry); } - if (use_lock == DSE_USE_LOCK) + if (use_lock == DSE_USE_LOCK && pdse->dse_rwlock) PR_RWLock_Unlock(pdse->dse_rwlock); return e; @@ -444,6 +444,31 @@ dse_internal_delete_entry( caddr_t data, caddr_t arg ) * Get rid of a dse structure. */ int +dse_destroy(struct dse *pdse) +{ + int nentries = 0; + if (pdse->dse_rwlock) + PR_RWLock_Wlock(pdse->dse_rwlock); + slapi_ch_free((void **)&(pdse->dse_filename)); + slapi_ch_free((void **)&(pdse->dse_tmpfile)); + slapi_ch_free((void **)&(pdse->dse_fileback)); + slapi_ch_free((void **)&(pdse->dse_filestartOK)); + dse_callback_deletelist(&pdse->dse_callback); + charray_free(pdse->dse_filelist); + nentries = avl_free(pdse->dse_tree, dse_internal_delete_entry); + if (pdse->dse_rwlock) { + PR_RWLock_Unlock(pdse->dse_rwlock); + PR_DestroyRWLock(pdse->dse_rwlock); + } + slapi_ch_free((void **)&pdse); + LDAPDebug( SLAPI_DSE_TRACELEVEL, "Removed [%d] entries from the dse tree.\n", + nentries,0,0 ); +} + +/* + * Get rid of a dse structure. + */ +int dse_deletedse(Slapi_PBlock *pb) { struct dse *pdse = NULL; @@ -452,22 +477,10 @@ dse_deletedse(Slapi_PBlock *pb) if (pdse) { - int nentries = 0; - PR_RWLock_Wlock(pdse->dse_rwlock); - slapi_ch_free((void **)&(pdse->dse_filename)); - slapi_ch_free((void **)&(pdse->dse_tmpfile)); - slapi_ch_free((void **)&(pdse->dse_fileback)); - slapi_ch_free((void **)&(pdse->dse_filestartOK)); - dse_callback_deletelist(&pdse->dse_callback); - nentries = avl_free(pdse->dse_tree, dse_internal_delete_entry); - PR_RWLock_Unlock(pdse->dse_rwlock); - PR_DestroyRWLock(pdse->dse_rwlock); - slapi_ch_free((void **)&pdse); - LDAPDebug( SLAPI_DSE_TRACELEVEL, "Removed [%d] entries from the dse tree.\n", - nentries,0,0 ); + dse_destroy(pdse); } - /* data is freed, so make sure no one tries to use it */ + /* data is freed, so make sure no one tries to use it */ slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, NULL); return 0; @@ -633,9 +646,9 @@ dse_updateNumSubOfParent(struct dse *pdse, const Slapi_DN *child, int op) static int dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, - int primary_file ) + int primary_file ) { - Slapi_Entry *e= NULL; + Slapi_Entry *e= NULL; char *entrystr= NULL; char *buf = NULL; char *lastp = NULL; @@ -643,44 +656,47 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, PRInt32 nr = 0; PRFileInfo prfinfo; PRFileDesc *prfd = 0; + int schema_flags = 0; + + slapi_pblock_get(pb, SLAPI_SCHEMA_FLAGS, &schema_flags); if ( (NULL != pdse) && (NULL != filename) ) { if ( (rc = PR_GetFileInfo( filename, &prfinfo )) != PR_SUCCESS ) { - /* the "real" file does not exist; see if there is a tmpfile */ - if ( pdse->dse_tmpfile && - PR_GetFileInfo( pdse->dse_tmpfile, &prfinfo ) == PR_SUCCESS ) { - rc = PR_Rename(pdse->dse_tmpfile, filename); - if (rc == PR_SUCCESS) { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "The configuration file %s was restored from backup %s\n", - filename, pdse->dse_tmpfile); - rc = 1; - } else { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "The configuration file %s was not restored from backup %s, error %d\n", - filename, pdse->dse_tmpfile, rc); - rc = 0; - } - } else { - rc = 0; /* fail */ - } + /* the "real" file does not exist; see if there is a tmpfile */ + if ( pdse->dse_tmpfile && + PR_GetFileInfo( pdse->dse_tmpfile, &prfinfo ) == PR_SUCCESS ) { + rc = PR_Rename(pdse->dse_tmpfile, filename); + if (rc == PR_SUCCESS) { + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "The configuration file %s was restored from backup %s\n", + filename, pdse->dse_tmpfile); + rc = 1; + } else { + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "The configuration file %s was not restored from backup %s, error %d\n", + filename, pdse->dse_tmpfile, rc); + rc = 0; + } + } else { + rc = 0; /* fail */ + } } if ( (rc = PR_GetFileInfo( filename, &prfinfo )) != PR_SUCCESS ) { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "The configuration file %s could not be accessed, error %d\n", - filename, rc); + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "The configuration file %s could not be accessed, error %d\n", + filename, rc); rc = 0; /* Fail */ } else if (( prfd = PR_Open( filename, PR_RDONLY, SLAPD_DEFAULT_FILE_MODE )) == NULL ) { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "The configuration file %s could not be read. " - SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n", - filename, - PR_GetError(), slapd_pr_strerror(PR_GetError())); + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "The configuration file %s could not be read. " + SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n", + filename, + PR_GetError(), slapd_pr_strerror(PR_GetError())); rc = 0; /* Fail */ } else @@ -690,9 +706,9 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, buf = slapi_ch_malloc( prfinfo.size + 1 ); if (( nr = slapi_read_buffer( prfd, buf, prfinfo.size )) < 0 ) { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "Could only read %d of %d bytes from config file %s\n", - nr, prfinfo.size, filename); + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "Could only read %d of %d bytes from config file %s\n", + nr, prfinfo.size, filename); rc = 0; /* Fail */ done= 1; } @@ -702,16 +718,18 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, if(!done) { - int dont_check_dups = 0; - int str2entry_flags = SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES | - SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF ; - - PR_ASSERT(pb); - slapi_pblock_get(pb, SLAPI_DSE_DONT_CHECK_DUPS, &dont_check_dups); - if ( !dont_check_dups ) { - str2entry_flags |= SLAPI_STR2ENTRY_REMOVEDUPVALS; - } - + int dont_check_dups = 0; + int str2entry_flags = SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES | + SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF ; + if (schema_flags & DSE_SCHEMA_LOCKED) + str2entry_flags |= SLAPI_STR2ENTRY_NO_SCHEMA_LOCK; + + PR_ASSERT(pb); + slapi_pblock_get(pb, SLAPI_DSE_DONT_CHECK_DUPS, &dont_check_dups); + if ( !dont_check_dups ) { + str2entry_flags |= SLAPI_STR2ENTRY_REMOVEDUPVALS; + } + /* Convert LDIF to entry structures */ rc= 1; /* assume we will succeed */ while (( entrystr = dse_read_next_entry( buf, &lastp )) != NULL ) @@ -722,47 +740,47 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, int returncode = 0; char returntext[SLAPI_DSE_RETURNTEXT_SIZE]= {0}; - LDAPDebug(SLAPI_DSE_TRACELEVEL, "dse_read_one_file" - " processing entry \"%s\" in file %s%s\n", - slapi_entry_get_dn_const(e), filename, - primary_file ? " (primary file)" : "" ); + LDAPDebug(SLAPI_DSE_TRACELEVEL, "dse_read_one_file" + " processing entry \"%s\" in file %s%s\n", + slapi_entry_get_dn_const(e), filename, + primary_file ? " (primary file)" : "" ); - /* remove the numsubordinates attr, which may be bogus */ - slapi_entry_attr_delete(e, subordinatecount); + /* remove the numsubordinates attr, which may be bogus */ + slapi_entry_attr_delete(e, subordinatecount); - /* set the "primary file" flag if appropriate */ - slapi_pblock_set( pb, SLAPI_DSE_IS_PRIMARY_FILE, &primary_file ); + /* set the "primary file" flag if appropriate */ + slapi_pblock_set( pb, SLAPI_DSE_IS_PRIMARY_FILE, &primary_file ); if(dse_call_callback(pdse, pb, DSE_OPERATION_READ, - DSE_FLAG_PREOP, e, NULL, &returncode, - returntext) == SLAPI_DSE_CALLBACK_OK) + DSE_FLAG_PREOP, e, NULL, &returncode, + returntext) == SLAPI_DSE_CALLBACK_OK) { - /* this will free the entry if not added, so it is - definitely consumed by this call */ - dse_add_entry_pb(pdse, e, pb); + /* this will free the entry if not added, so it is + definitely consumed by this call */ + dse_add_entry_pb(pdse, e, pb); + } + else /* free entry if not used */ + { + slapi_log_error(SLAPI_LOG_FATAL, "dse", + "The entry %s in file %s is invalid, error code %d (%s) - %s\n", + slapi_entry_get_dn_const(e), + filename, returncode, + ldap_err2string(returncode), + returntext); + slapi_entry_free(e); + rc = 0; /* failure */ } - else /* free entry if not used */ - { - slapi_log_error(SLAPI_LOG_FATAL, "dse", - "The entry %s in file %s is invalid, error code %d (%s) - %s\n", - slapi_entry_get_dn_const(e), - filename, returncode, - ldap_err2string(returncode), - returntext); - slapi_entry_free(e); - rc = 0; /* failure */ - } } else { - slapi_log_error( SLAPI_LOG_FATAL, "dse", - "parsing dse entry [%s]\n", entrystr ); - rc = 0; /* failure */ - } + slapi_log_error( SLAPI_LOG_FATAL, "dse", + "parsing dse entry [%s]\n", entrystr ); + rc = 0; /* failure */ + } } } - slapi_ch_free((void **)&buf); + slapi_ch_free((void **)&buf); } } - return rc; + return rc; } /* @@ -892,7 +910,8 @@ dse_check_for_readonly_error(Slapi_PBlock *pb, struct dse* pdse) { int rc = 0; /* default: no error */ - PR_RWLock_Rlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Rlock(pdse->dse_rwlock); if ( !pdse->dse_is_updateable ) { if ( !pdse->dse_readonly_error_reported ) { @@ -908,7 +927,8 @@ dse_check_for_readonly_error(Slapi_PBlock *pb, struct dse* pdse) rc = 1; /* return an error to the client */ } - PR_RWLock_Unlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Unlock(pdse->dse_rwlock); if ( rc != 0 ) { slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL, @@ -1056,7 +1076,8 @@ dse_add_entry_pb(struct dse* pdse, Slapi_Entry *e, Slapi_PBlock *pb) slapi_pblock_get(pb, SLAPI_DSE_MERGE_WHEN_ADDING, &merge); /* keep write lock during both tree update and file write operations */ - PR_RWLock_Wlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Wlock(pdse->dse_rwlock); if (merge) { rc= avl_insert( &(pdse->dse_tree), n, entry_dn_cmp, dupentry_merge ); @@ -1079,7 +1100,8 @@ dse_add_entry_pb(struct dse* pdse, Slapi_Entry *e, Slapi_PBlock *pb) } else { /* duplicate entry ignored */ dse_node_delete(&n); /* This also deletes the contained entry */ } - PR_RWLock_Unlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Unlock(pdse->dse_rwlock); if (rc == -1) { @@ -1254,7 +1276,7 @@ dse_replace_entry( struct dse* pdse, Slapi_Entry *e, int write_file, int use_loc if ( NULL != e ) { struct dse_node *n= dse_node_new(e); - if (use_lock) + if (use_lock && pdse->dse_rwlock) PR_RWLock_Wlock(pdse->dse_rwlock); rc = avl_insert( &(pdse->dse_tree), n, entry_dn_cmp, dupentry_replace ); if (write_file) @@ -1265,7 +1287,7 @@ dse_replace_entry( struct dse* pdse, Slapi_Entry *e, int write_file, int use_loc dse_node_delete(&n); rc = 0; /* for return to caller */ } - if (use_lock) + if (use_lock && pdse->dse_rwlock) PR_RWLock_Unlock(pdse->dse_rwlock); } return rc; @@ -1366,7 +1388,8 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e) slapi_pblock_get(pb, SLAPI_DSE_DONT_WRITE_WHEN_ADDING, &dont_write_file); /* keep write lock for both tree deleting and file writing */ - PR_RWLock_Wlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Wlock(pdse->dse_rwlock); if ((deleted_node = (struct dse_node *)avl_delete(&pdse->dse_tree, n, entry_dn_cmp))) dse_node_delete(&deleted_node); @@ -1379,7 +1402,8 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e) SLAPI_OPERATION_DELETE); dse_write_file_nolock(pdse); } - PR_RWLock_Unlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Unlock(pdse->dse_rwlock); return 1; } @@ -1555,9 +1579,11 @@ do_dse_search(struct dse* pdse, Slapi_PBlock *pb, int scope, const Slapi_DN *bas */ if ( pb->pb_op == NULL || !operation_is_flag_set( pb->pb_op, OP_FLAG_PS_CHANGESONLY )) { - PR_RWLock_Rlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Rlock(pdse->dse_rwlock); dse_apply_nolock(pdse,dse_search_filter_entry,(caddr_t)&stuff); - PR_RWLock_Unlock(pdse->dse_rwlock); + if (pdse->dse_rwlock) + PR_RWLock_Unlock(pdse->dse_rwlock); } if (stuff.ss) /* something was found which matched our criteria */ diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 4254af6f..57f1d47f 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -1067,7 +1067,14 @@ slapi_str2entry( char *s, int flags ) if ( flags & SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES ) { - slapi_schema_expand_objectclasses( e ); + if ( flags & SLAPI_STR2ENTRY_NO_SCHEMA_LOCK ) + { + schema_expand_objectclasses_nolock( e ); + } + else + { + slapi_schema_expand_objectclasses( e ); + } } if ( flags & SLAPI_STR2ENTRY_TOMBSTONE_CHECK ) diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index ab57f33e..2b09f123 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/ldap/servers/slapd/mapping_tree.c @@ -1605,7 +1605,7 @@ mapping_tree_init() mapping_tree_node_add_child(mapping_tree_root, node); node= add_internal_mapping_tree_node("cn=monitor", be, mapping_tree_root); mapping_tree_node_add_child(mapping_tree_root, node); - be= slapi_be_select_by_instance_name( "schema-internal" ); + be= slapi_be_select_by_instance_name( DSE_SCHEMA ); node= add_internal_mapping_tree_node("cn=schema", be, mapping_tree_root); mapping_tree_node_add_child(mapping_tree_root, node); @@ -2003,7 +2003,7 @@ int slapi_mapping_tree_select(Slapi_PBlock *pb, Slapi_Backend **be, Slapi_Entry mtn_unlock(); *be = slapi_be_select_by_instance_name(DSE_BACKEND); - if(*be != NULL) + if(*be != NULL && !be_isdeleted(*be)) { ret = LDAP_SUCCESS; slapi_be_Rlock(*be); /* also done inside mtn_get_be() below */ @@ -2026,7 +2026,7 @@ int slapi_mapping_tree_select(Slapi_PBlock *pb, Slapi_Backend **be, Slapi_Entry * fail if the backend is read-only, * or if the whole server is readonly AND backend is public (!private) */ - if ((ret == LDAP_SUCCESS) && *be && + if ((ret == LDAP_SUCCESS) && *be && !be_isdeleted(*be) && ((*be)->be_readonly || (slapi_config_get_readonly() && !slapi_be_private(*be)))) { unsigned long op_type = operation_get_type(op); @@ -2101,7 +2101,7 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list, && (scope == LDAP_SCOPE_BASE) ) { mtn_unlock(); be = slapi_be_select_by_instance_name(DSE_BACKEND); - if(be != NULL) + if(be != NULL && !be_isdeleted(be)) { be_list[0]=be; be_list[1] = NULL; @@ -2128,7 +2128,7 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list, && (scope != LDAP_SCOPE_BASE)) ) && (!be || strncmp(be->be_name, "default", 8))) { - if (be) + if (be && !be_isdeleted(be)) { /* wrong backend or referall, ignore it */ slapi_log_error(SLAPI_LOG_ARGS, NULL, @@ -2139,7 +2139,7 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list, } else { - if (be) + if (be && !be_isdeleted(be)) { be_list[be_index++]=be; } @@ -2285,7 +2285,7 @@ unlock_and_return: if (ret != LDAP_SUCCESS) { - if (*be) + if (be && !be_isdeleted(be)) { slapi_be_Unlock(*be); *be = NULL; @@ -2521,7 +2521,7 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb, } if (result == LDAP_SUCCESS) { - if (*be) { + if (*be && !be_isdeleted(*be)) { slapi_log_error(SLAPI_LOG_ARGS, NULL, "mapping tree selected backend : %s\n", slapi_be_get_name(*be)); @@ -2790,7 +2790,7 @@ slapi_be_select( const Slapi_DN *sdn ) /* JCM - The name of this should change?? int slapi_on_internal_backends(const Slapi_DN *sdn) { - char *backend_names[] = {"frontend-internal", "schema-internal"}; + char *backend_names[] = {DSE_BACKEND, DSE_SCHEMA}; int internal = 1; int numOfInternalBackends = 2; int count; diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c index e309de1d..ae98dc23 100644 --- a/ldap/servers/slapd/pblock.c +++ b/ldap/servers/slapd/pblock.c @@ -559,9 +559,12 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value ) case SLAPI_PLUGIN_POSTSTART_FN: (*(IFP *)value) = pblock->pb_plugin->plg_poststart; break; - case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN: - (*(IFP *)value) = pblock->pb_plugin->plg_wire_import; - break; + case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN: + (*(IFP *)value) = pblock->pb_plugin->plg_wire_import; + break; + case SLAPI_PLUGIN_DB_ADD_SCHEMA_FN: + (*(IFP *)value) = pblock->pb_plugin->plg_add_schema; + break; case SLAPI_PLUGIN_DB_SEQ_FN: if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) { return( -1 ); @@ -1583,9 +1586,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value ) (*(int *)value) = pblock->pb_dse_is_primary_file; break; - /* used internally by schema code */ - case SLAPI_SCHEMA_USER_DEFINED_ONLY: - (*(int *)value) = pblock->pb_schema_user_defined_only; + /* used internally by schema code (schema.c) */ + case SLAPI_SCHEMA_FLAGS: + (*(int *)value) = pblock->pb_schema_flags; break; case SLAPI_URP_NAMING_COLLISION_DN: @@ -1836,9 +1839,12 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value ) case SLAPI_PLUGIN_POSTSTART_FN: pblock->pb_plugin->plg_poststart = (IFP) value; break; - case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN: - pblock->pb_plugin->plg_wire_import = (IFP) value; - break; + case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN: + pblock->pb_plugin->plg_wire_import = (IFP) value; + break; + case SLAPI_PLUGIN_DB_ADD_SCHEMA_FN: + pblock->pb_plugin->plg_add_schema = (IFP) value; + break; case SLAPI_PLUGIN_DB_SEQ_FN: if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE ) { return( -1 ); @@ -2824,9 +2830,9 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value ) pblock->pb_dse_is_primary_file = *((int *)value); break; - /* used internally by schema code only */ - case SLAPI_SCHEMA_USER_DEFINED_ONLY: - pblock->pb_schema_user_defined_only = *((int *)value); + /* used internally by schema code (schema.c) */ + case SLAPI_SCHEMA_FLAGS: + pblock->pb_schema_flags = *((int *)value); break; case SLAPI_URP_NAMING_COLLISION_DN: diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index f3f7131f..8878c2da 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -117,6 +117,7 @@ struct asyntaxinfo *attr_syntax_get_by_name_locking_optional ( const char *name, */ void attr_syntax_return( struct asyntaxinfo *asi ); void attr_syntax_return_locking_optional( struct asyntaxinfo *asi, PRBool use_lock ); +void attr_syntax_delete_all(void); /* * value.c @@ -192,6 +193,7 @@ int be_writeconfig (Slapi_Backend *be); * backend_manager.c */ Slapi_Backend *be_new_internal(struct dse *pdse, const char *type, const char *name); +void be_replace_dse_internal(Slapi_Backend *be, struct dse *pdse); int fedse_create_startOK(char *filename, char *startokfilename, const char *configdir); void be_cleanupall(); void be_flushall(); @@ -550,10 +552,12 @@ void send_referrals_from_entry(Slapi_PBlock *pb, Slapi_Entry *referral); #define DSE_OPERATION_WRITE 0x200 #define DSE_BACKEND "frontend-internal" +#define DSE_SCHEMA "schema-internal" struct dse *dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfilename, const char *configdir); struct dse *dse_new_with_filelist(char *filename, char *tmpfilename, char *backfilename, char *startokfilename, const char *configdir, char **filelist); int dse_deletedse(Slapi_PBlock *pb); +int dse_destroy(struct dse *pdse); int dse_read_file(struct dse *pdse, Slapi_PBlock *pb); int dse_bind( Slapi_PBlock *pb ); int dse_unbind( Slapi_PBlock *pb ); @@ -853,11 +857,19 @@ const CSN *g_get_global_schema_csn(); /* csn is consumed. */ void g_set_global_schema_csn(CSN *csn); void slapi_schema_expand_objectclasses( Slapi_Entry *e ); +/* lock to protect both objectclass and schema_dse */ +void slapi_load_schemafile_lock( void ); +void slapi_load_schemafile_unlock( void ); +/* API to validate the schema files */ +int slapi_validate_schema_files(char *schemadir); +/* API to reload the schema files */ +int slapi_reload_schema_files(char *schemadir); /* * schemaparse.c */ void normalize_oc( void ); +void normalize_oc_nolock( void ); /* Note: callers of oc_update_inheritance_nolock() must hold a write lock */ void oc_update_inheritance_nolock( struct objclass *oc ); diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c index cdb8cf12..600c50db 100644 --- a/ldap/servers/slapd/schema.c +++ b/ldap/servers/slapd/schema.c @@ -111,7 +111,7 @@ static int schema_replace_attributes ( Slapi_PBlock *pb, LDAPMod *mod, static int schema_replace_objectclasses ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf, size_t errorbufsize ); static int read_oc_ldif ( const char *input, struct objclass **oc, - char *errorbuf, size_t errorbufsize, int nolock, int is_user_defined, + char *errorbuf, size_t errorbufsize, PRUint32 flags, int is_user_defined, int schema_ds4x_compat ); static int schema_check_name(char *name, PRBool isAttribute, char *errorbuf, size_t errorbufsize ); @@ -122,8 +122,8 @@ static int isExtensibleObjectclass(const char *objectclass); static int strip_oc_options ( struct objclass *poc ); static char *stripOption (char *attr); static int read_at_ldif(const char *input, struct asyntaxinfo **asipp, - char *errorbuf, size_t errorbufsize, int nolock, int is_user_defined, - int schema_ds4x_compat, int is_remote); + char *errorbuf, size_t errorbufsize, PRUint32 flags, + int is_user_defined, int schema_ds4x_compat, int is_remote); static char **parse_qdlist(const char *s, int *n, int strip_options); static void free_qdlist(char **vals, int n); static char **parse_qdescrs(const char *s, int *n); @@ -456,6 +456,7 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e ) int i, oc_count = 0; int unknown_class = 0; char errtext[ BUFSIZ ]; + PRUint32 schema_flags; /* smart referrals are not allowed in Directory Lite */ if ( config_is_slapd_lite() ) { @@ -468,8 +469,10 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e ) * say the schema checked out ok if we're not checking schema at * all, or if this is a replication update. */ - if (pb != NULL) + if (pb != NULL) { slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation); + slapi_pblock_get(pb, SLAPI_SCHEMA_FLAGS, &schema_flags); + } if ( schemacheck == 0 || is_replicated_operation ) { return( 0 ); } @@ -504,7 +507,8 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e ) /* * Need the read lock to create the oc array and while we use it. */ - oc_lock_read(); + if (!(schema_flags & DSE_SCHEMA_LOCKED)) + oc_lock_read(); oc_count = 0; for (i= slapi_attr_first_value(aoc,&v); i != -1; @@ -623,7 +627,8 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e ) out: /* Done with the oc array so can release the lock */ - oc_unlock(); + if (!(schema_flags & DSE_SCHEMA_LOCKED)) + oc_unlock(); slapi_ch_free((void**)&oclist); return( ret ); @@ -686,7 +691,7 @@ oc_check_allowed_sv(Slapi_PBlock *pb, Slapi_Entry *e, const char *type, struct o { struct objclass *oc; int i, j; - int rc = 1; /* failure */ + int rc = 1; /* failure */ /* always allow objectclass and entryid attributes */ /* MFW XXX THESE SHORTCUTS SHOULD NOT BE NECESSARY BUT THEY MASK @@ -704,43 +709,43 @@ oc_check_allowed_sv(Slapi_PBlock *pb, Slapi_Entry *e, const char *type, struct o /* does it require the type? */ for ( j = 0; oc->oc_required && oc->oc_required[j] != NULL; j++ ) { - if ( slapi_attr_type_cmp( oc->oc_required[j], - type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 ) { - rc = 0; - break; - } + if ( slapi_attr_type_cmp( oc->oc_required[j], + type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 ) { + rc = 0; + break; + } } - + if ( 0 != rc ) { - /* does it allow the type? */ - for ( j = 0; oc->oc_allowed && oc->oc_allowed[j] != NULL; j++ ) { - if ( slapi_attr_type_cmp( oc->oc_allowed[j], - type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 || - strcmp( oc->oc_allowed[j],"*" ) == 0 ) { - rc = 0; - break; - } - } - /* maybe the next oc allows it */ + /* does it allow the type? */ + for ( j = 0; oc->oc_allowed && oc->oc_allowed[j] != NULL; j++ ) { + if ( slapi_attr_type_cmp( oc->oc_allowed[j], + type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 || + strcmp( oc->oc_allowed[j],"*" ) == 0 ) { + rc = 0; + break; + } + } + /* maybe the next oc allows it */ } - } + } if ( 0 != rc ) { - char errtext[ BUFSIZ ]; + char errtext[ BUFSIZ ]; char ebuf[ BUFSIZ ]; char ebuf2[ BUFSIZ ]; LDAPDebug( LDAP_DEBUG_ANY, - "Entry \"%s\" -- attribute \"%s\" not allowed\n", - escape_string( slapi_entry_get_dn_const(e), ebuf ), - escape_string( type, ebuf2 ), - 0); - - if (pb) { - PR_snprintf( errtext, sizeof( errtext ), - "attribute \"%s\" not allowed\n", - escape_string( type, ebuf2 ) ); - slapi_pblock_set( pb, SLAPI_PB_RESULT_TEXT, errtext ); - } + "Entry \"%s\" -- attribute \"%s\" not allowed\n", + escape_string( slapi_entry_get_dn_const(e), ebuf ), + escape_string( type, ebuf2 ), + 0); + + if (pb) { + PR_snprintf( errtext, sizeof( errtext ), + "attribute \"%s\" not allowed\n", + escape_string( type, ebuf2 ) ); + slapi_pblock_set( pb, SLAPI_PB_RESULT_TEXT, errtext ); + } } return rc; @@ -922,6 +927,19 @@ oc_delete_nolock (char *ocname) return rc; } +static void +oc_delete_all_nolock( void ) +{ + struct objclass *oc, *pnext; + + oc = g_get_global_oc_nolock(); + for (pnext = oc->oc_next; oc; + oc = pnext, pnext = oc?oc->oc_next:NULL) { + oc_free( &oc ); + } + g_set_global_oc_nolock ( NULL ); +} + /* * Compare two objectclass definitions for equality. Return PR_TRUE if @@ -1411,6 +1429,7 @@ read_schema_dse( struct attr_enum_wrapper aew; struct syntax_enum_wrapper sew; int enquote_sup_oc = config_get_enquote_sup_oc(); + PRUint32 schema_flags = 0; int user_defined_only = 0; char **allowed, **required; char *mr_desc, *mr_name, *oc_description; @@ -1420,7 +1439,8 @@ read_schema_dse( vals[0] = &val; vals[1] = NULL; - slapi_pblock_get(pb, SLAPI_SCHEMA_USER_DEFINED_ONLY, (void*)&user_defined_only); + slapi_pblock_get(pb, SLAPI_SCHEMA_FLAGS, (void*)&schema_flags); + user_defined_only = (schema_flags & DSE_SCHEMA_USER_DEFINED_ONLY) ? 1 : 0; attrlist_delete (&pschema_info_e->e_attrs, "objectclasses"); attrlist_delete (&pschema_info_e->e_attrs, "attributetypes"); @@ -1908,11 +1928,11 @@ dup_global_schema_csn() static int refresh_user_defined_schema( Slapi_PBlock *pb, Slapi_Entry *pschema_info_e, Slapi_Entry *entryAfter, int *returncode, char *returntext, void *arg /* not used */ ) { - int user_defined_only = 1; int rc; Slapi_PBlock *mypbptr = pb; Slapi_PBlock mypb; const CSN *schema_csn; + PRUint32 schema_flags = DSE_SCHEMA_USER_DEFINED_ONLY; pblock_init(&mypb); @@ -1924,7 +1944,7 @@ refresh_user_defined_schema( Slapi_PBlock *pb, Slapi_Entry *pschema_info_e, Slap mypbptr = &mypb; } - slapi_pblock_set(mypbptr, SLAPI_SCHEMA_USER_DEFINED_ONLY, &user_defined_only); + slapi_pblock_set(mypbptr, SLAPI_SCHEMA_FLAGS, &schema_flags); rc = read_schema_dse(mypbptr, pschema_info_e, NULL, returncode, returntext, NULL); schema_csn = g_get_global_schema_csn(); if (NULL != schema_csn) { @@ -2197,7 +2217,7 @@ schema_add_attribute ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf, int status = 0; for (i = 0; LDAP_SUCCESS == status && mod->mod_bvalues[i]; i++) { - int nolock = 0; /* lock global resources during normal operation */ + PRUint32 nolock = 0; /* lock global resources during normal operation */ attr_ldif = (char *) mod->mod_bvalues[i]->bv_val; status = read_at_ldif(attr_ldif, NULL, errorbuf, errorbufsize, @@ -2221,13 +2241,14 @@ schema_add_attribute ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf, */ static int add_oc_internal(struct objclass *pnew_oc, char *errorbuf, size_t errorbufsize, - int schema_ds4x_compat ) + int schema_ds4x_compat, PRUint32 flags ) { struct objclass *oldoc_by_name, *oldoc_by_oid, *psup_oc = NULL; int redefined_oc = 0, rc=0; asyntaxinfo *pasyntaxinfo = 0; - oc_lock_write(); + if (!(flags & DSE_SCHEMA_LOCKED)) + oc_lock_write(); oldoc_by_name = oc_find_nolock (pnew_oc->oc_name); oldoc_by_oid = oc_find_nolock (pnew_oc->oc_oid); @@ -2296,13 +2317,14 @@ add_oc_internal(struct objclass *pnew_oc, char *errorbuf, size_t errorbufsize, } /* check to see if the objectclass name is valid */ - if (!rc && schema_check_name ( pnew_oc->oc_name, PR_FALSE, - errorbuf, errorbufsize ) == 0 ) { + if (!rc && !(flags & DSE_SCHEMA_NO_CHECK) && + schema_check_name ( pnew_oc->oc_name, PR_FALSE, errorbuf, errorbufsize ) + == 0 ) { rc = schema_ds4x_compat ? LDAP_OPERATIONS_ERROR : LDAP_INVALID_SYNTAX; } /* check to see if the oid is valid */ - if (!rc) + if (!rc && !(flags & DSE_SCHEMA_NO_CHECK)) { struct sizedbuffer *psbOcOid, *psbOcName; @@ -2320,8 +2342,9 @@ add_oc_internal(struct objclass *pnew_oc, char *errorbuf, size_t errorbufsize, } /* check to see if the oc's attributes are valid */ - if (!rc && schema_check_oc_attrs ( pnew_oc, errorbuf, errorbufsize, - 0 /* don't strip options */ ) == 0 ) { + if (!rc && !(flags & DSE_SCHEMA_NO_CHECK) && + schema_check_oc_attrs ( pnew_oc, errorbuf, errorbufsize, + 0 /* don't strip options */ ) == 0 ) { rc = schema_ds4x_compat ? LDAP_OPERATIONS_ERROR : LDAP_INVALID_SYNTAX; } /* insert new objectclass exactly where the old one one in the linked list*/ @@ -2338,7 +2361,8 @@ add_oc_internal(struct objclass *pnew_oc, char *errorbuf, size_t errorbufsize, oc_update_inheritance_nolock( pnew_oc ); } - oc_unlock(); + if (!(flags & DSE_SCHEMA_LOCKED)) + oc_unlock(); return rc; } @@ -2470,7 +2494,7 @@ schema_add_objectclass ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf, } if ( LDAP_SUCCESS != (rc = add_oc_internal(pnew_oc, errorbuf, - errorbufsize, schema_ds4x_compat))) { + errorbufsize, schema_ds4x_compat, 0/* no restriction */))) { oc_free( &pnew_oc ); return rc; } @@ -2541,7 +2565,7 @@ schema_replace_objectclasses ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf, struct objclass *addocp = NULL; if ( LDAP_SUCCESS != ( rc = read_oc_ldif( mod->mod_bvalues[i]->bv_val, - &newocp, errorbuf, errorbufsize, 1 /* no locking */, + &newocp, errorbuf, errorbufsize, DSE_SCHEMA_NO_GLOCK, 1 /* user defined */, 0 /* no DS 4.x compat issues */ ))) { rc = LDAP_INVALID_SYNTAX; goto clean_up_and_return; @@ -2695,7 +2719,12 @@ read_oc_ldif_return( int retVal, * oc : pointer write the objectclass to * errorbuf : buffer to write any errors to * is_user_defined : if non-zero, force objectclass to be user defined - * nolock : if non-zero, assume oc_lock_*() has been called. + * schema_flags : Any or none of the following bits could be set + * DSE_SCHEMA_NO_CHECK -- schema won't be checked + * DSE_SCHEMA_NO_GLOCK -- don't lock global resources + * DSE_SCHEMA_LOCKED -- already locked with + * slapi_load_schemafile_lock; + * no further lock needed * schema_ds4x_compat: if non-zero, act like Netscape DS 4.x * * Returns: an LDAP error code @@ -2708,8 +2737,9 @@ read_oc_ldif_return( int retVal, */ static int read_oc_ldif ( const char *input, struct objclass **oc, char *errorbuf, - size_t errorbufsize, int nolock, int is_user_defined, - int schema_ds4x_compat ) { + size_t errorbufsize, PRUint32 schema_flags, int is_user_defined, + int schema_ds4x_compat ) +{ int i, j, num_origins; const char *pstart, *nextinput; struct objclass *pnew_oc, *psup_oc; @@ -2848,7 +2878,7 @@ read_oc_ldif ( const char *input, struct objclass **oc, char *errorbuf, flags |= get_flag_keyword( schema_obsolete_with_spaces, OC_FLAG_OBSOLETE, &nextinput, keyword_strstr_fn ); - if (!nolock) { + if (!(schema_flags & DSE_SCHEMA_NO_GLOCK)) { oc_lock_read(); /* needed because we access the superior oc */ } @@ -3005,7 +3035,7 @@ read_oc_ldif ( const char *input, struct objclass **oc, char *errorbuf, OrigAllowedAttrsArray = charray_dup ( AllowedAttrsArray ); } - if (!nolock) { + if (!(schema_flags & DSE_SCHEMA_NO_GLOCK)) { oc_unlock(); /* we are done accessing superior oc (psup_oc) */ } @@ -3108,9 +3138,14 @@ slapi_check_at_sup_dependency(char *sup, char *oid) * if asipp is NULL, the attribute type is added to the global set of schema. * if asipp is not NULL, the AT is not added but *asipp is set. * - * if nolock is true, locking of global resources is turned off; this saves - * time during initialization since the server operates in single threaded - * mode at that time. + * schema_flags: Any or none of the following bits could be set + * DSE_SCHEMA_NO_CHECK -- schema won't be checked + * DSE_SCHEMA_NO_GLOCK -- locking of global resources is turned off; + * this saves time during initialization since + * the server operates in single threaded mode + * at that time or in slapi_load_schemafile_lock. + * DSE_SCHEMA_LOCKED -- already locked with slapi_load_schemafile_lock; + * no further lock needed * * if is_user_defined is true, force attribute type to be user defined. * @@ -3118,26 +3153,26 @@ slapi_check_at_sup_dependency(char *sup, char *oid) */ static int read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf, - size_t errorbufsize, int nolock, int is_user_defined, - int schema_ds4x_compat, int is_remote) + size_t errorbufsize, PRUint32 schema_flags, int is_user_defined, + int schema_ds4x_compat, int is_remote) { - char *pStart, *pEnd; - char *pOid, *pSyntax, *pSuperior, *pMREquality, *pMROrdering, *pMRSubstring; - const char *nextinput; - struct sizedbuffer *psbAttrName= sizedbuffer_construct(BUFSIZ); - struct sizedbuffer *psbAttrDesc= sizedbuffer_construct(BUFSIZ); - int status = 0; - int syntaxlength; - char **attr_names = NULL; - char *first_attr_name = NULL; - char **attr_origins = NULL; - int num_names = 0; - int num_origins = 0; - unsigned long flags = SLAPI_ATTR_FLAG_OVERRIDE; - const char *ss = 0; - struct asyntaxinfo *tmpasip; - int invalid_syntax_error; - schema_strstr_fn_t keyword_strstr_fn; + char *pStart, *pEnd; + char *pOid, *pSyntax, *pSuperior, *pMREquality, *pMROrdering, *pMRSubstring; + const char *nextinput; + struct sizedbuffer *psbAttrName= sizedbuffer_construct(BUFSIZ); + struct sizedbuffer *psbAttrDesc= sizedbuffer_construct(BUFSIZ); + int status = 0; + int syntaxlength; + char **attr_names = NULL; + char *first_attr_name = NULL; + char **attr_origins = NULL; + int num_names = 0; + int num_origins = 0; + unsigned long flags = SLAPI_ATTR_FLAG_OVERRIDE; + const char *ss = 0; + struct asyntaxinfo *tmpasip; + int invalid_syntax_error; + schema_strstr_fn_t keyword_strstr_fn; /* * From RFC 2252 section 4.2: @@ -3183,174 +3218,174 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf, * 2. use a case-insensitive compare when looking for keywords, e.g., DESC */ - if ( schema_ds4x_compat ) { - keyword_strstr_fn = PL_strcasestr; - invalid_syntax_error = LDAP_OPERATIONS_ERROR; - } else { - keyword_strstr_fn = PL_strstr; - invalid_syntax_error = LDAP_INVALID_SYNTAX; - } + if ( schema_ds4x_compat ) { + keyword_strstr_fn = PL_strcasestr; + invalid_syntax_error = LDAP_OPERATIONS_ERROR; + } else { + keyword_strstr_fn = PL_strstr; + invalid_syntax_error = LDAP_INVALID_SYNTAX; + } - if (nolock) - flags |= SLAPI_ATTR_FLAG_NOLOCKING; + if (schema_flags & DSE_SCHEMA_NO_GLOCK) + flags |= SLAPI_ATTR_FLAG_NOLOCKING; - psbAttrName->buffer[0] = '\0'; - psbAttrDesc->buffer[0] = '\0'; - pOid = pSyntax = pSuperior = NULL; - pMREquality = pMROrdering = pMRSubstring = NULL; + psbAttrName->buffer[0] = '\0'; + psbAttrDesc->buffer[0] = '\0'; + pOid = pSyntax = pSuperior = NULL; + pMREquality = pMROrdering = pMRSubstring = NULL; syntaxlength = SLAPI_SYNTAXLENGTH_NONE; - nextinput = input; + nextinput = input; - /* get the OID */ + /* get the OID */ pOid = get_tagged_oid( "(", &nextinput, keyword_strstr_fn ); - if (NULL == pOid) { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - input, "Missing or invalid OID" ); - status = invalid_syntax_error; - goto done; - } - - if ( schema_ds4x_compat || (strcasecmp(pOid, "NAME") == 0)) - nextinput = input; + if (NULL == pOid) { + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + input, "Missing or invalid OID" ); + status = invalid_syntax_error; + goto done; + } - /* look for the NAME (single or list of names) */ - if ( (pStart = (*keyword_strstr_fn) ( nextinput, "NAME ")) != NULL ) { - pStart += 5; - sizedbuffer_allocate(psbAttrName,strlen(pStart)+1); - strcpy ( psbAttrName->buffer, pStart); - if (*pStart == '(') - pEnd = strchr(psbAttrName->buffer, ')'); - else - pEnd = strchr(psbAttrName->buffer+1, '\''); - if (pEnd) - *(pEnd+1) = 0; - nextinput = pStart + strlen(psbAttrName->buffer) + 1; - attr_names = parse_qdescrs(psbAttrName->buffer, &num_names); - if ( NULL != attr_names ) { - first_attr_name = attr_names[0]; - } else { /* NAME followed by nothing violates syntax */ - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - input, "Missing or invalid attribute name" ); - status = invalid_syntax_error; - goto done; - } - } + if ( schema_ds4x_compat || (strcasecmp(pOid, "NAME") == 0)) + nextinput = input; + + /* look for the NAME (single or list of names) */ + if ( (pStart = (*keyword_strstr_fn) ( nextinput, "NAME ")) != NULL ) { + pStart += 5; + sizedbuffer_allocate(psbAttrName,strlen(pStart)+1); + strcpy ( psbAttrName->buffer, pStart); + if (*pStart == '(') + pEnd = strchr(psbAttrName->buffer, ')'); + else + pEnd = strchr(psbAttrName->buffer+1, '\''); + if (pEnd) + *(pEnd+1) = 0; + nextinput = pStart + strlen(psbAttrName->buffer) + 1; + attr_names = parse_qdescrs(psbAttrName->buffer, &num_names); + if ( NULL != attr_names ) { + first_attr_name = attr_names[0]; + } else { /* NAME followed by nothing violates syntax */ + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + input, "Missing or invalid attribute name" ); + status = invalid_syntax_error; + goto done; + } + } - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; /* - * if the attribute ldif doesn't have an OID, we'll make the oid - * attrname-oid - */ - if ( (strcasecmp ( pOid, "NAME" ) == 0) && (first_attr_name)) { - slapi_ch_free_string( &pOid ); - pOid = slapi_ch_smprintf("%s-oid", first_attr_name ); - } - - /* look for the optional DESCription */ - if ( (pStart = (*keyword_strstr_fn) ( nextinput, "DESC '")) != NULL ) { - pStart += 6; - sizedbuffer_allocate(psbAttrDesc,strlen(pStart)); - strcpy ( psbAttrDesc->buffer, pStart); - if ( (pEnd = strchr (psbAttrDesc->buffer, '\'' )) != NULL ){ - *pEnd ='\0'; - } - nextinput = pStart + strlen(psbAttrDesc->buffer) + 1; - } - - if ( schema_ds4x_compat ) nextinput = input; - - /* look for the optional OBSOLETE marker */ - flags |= get_flag_keyword( schema_obsolete_with_spaces, - SLAPI_ATTR_FLAG_OBSOLETE, &nextinput, keyword_strstr_fn ); - - if ( schema_ds4x_compat ) nextinput = input; - - /* look for the optional SUPerior type */ - pSuperior = get_tagged_oid( "SUP ", &nextinput, keyword_strstr_fn ); - - if ( schema_ds4x_compat ) nextinput = input; + * if the attribute ldif doesn't have an OID, we'll make the oid + * attrname-oid + */ + if ( (strcasecmp ( pOid, "NAME" ) == 0) && (first_attr_name)) { + slapi_ch_free_string( &pOid ); + pOid = slapi_ch_smprintf("%s-oid", first_attr_name ); + } - /* look for the optional matching rules */ - pMREquality = get_tagged_oid( "EQUALITY ", &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; - pMROrdering = get_tagged_oid( "ORDERING ", &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; - pMRSubstring = get_tagged_oid( "SUBSTR ", &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; + /* look for the optional DESCription */ + if ( (pStart = (*keyword_strstr_fn) ( nextinput, "DESC '")) != NULL ) { + pStart += 6; + sizedbuffer_allocate(psbAttrDesc,strlen(pStart)); + strcpy ( psbAttrDesc->buffer, pStart); + if ( (pEnd = strchr (psbAttrDesc->buffer, '\'' )) != NULL ){ + *pEnd ='\0'; + } + nextinput = pStart + strlen(psbAttrDesc->buffer) + 1; + } - /* look for the optional SYNTAX */ - if ( NULL != ( pSyntax = get_tagged_oid( "SYNTAX ", &nextinput, - keyword_strstr_fn ))) { - /* - * Check for an optional {LEN}, which if present indicates a - * suggested maximum size for values of this attribute type. - * - * XXXmcs: we do not enforce length restrictions, but we do read - * and include them in the subschemasubentry. - */ - if ( (pEnd = strchr ( pSyntax, '{')) != NULL /* balance } */ ) { - *pEnd = '\0'; - syntaxlength = atoi( pEnd + 1 ); - } - } + if ( schema_ds4x_compat ) nextinput = input; + + /* look for the optional OBSOLETE marker */ + flags |= get_flag_keyword( schema_obsolete_with_spaces, + SLAPI_ATTR_FLAG_OBSOLETE, &nextinput, keyword_strstr_fn ); + + if ( schema_ds4x_compat ) nextinput = input; + + /* look for the optional SUPerior type */ + pSuperior = get_tagged_oid( "SUP ", &nextinput, keyword_strstr_fn ); + + if ( schema_ds4x_compat ) nextinput = input; + + /* look for the optional matching rules */ + pMREquality = get_tagged_oid( "EQUALITY ", &nextinput, keyword_strstr_fn ); + if ( schema_ds4x_compat ) nextinput = input; + pMROrdering = get_tagged_oid( "ORDERING ", &nextinput, keyword_strstr_fn ); + if ( schema_ds4x_compat ) nextinput = input; + pMRSubstring = get_tagged_oid( "SUBSTR ", &nextinput, keyword_strstr_fn ); + if ( schema_ds4x_compat ) nextinput = input; + + /* look for the optional SYNTAX */ + if ( NULL != ( pSyntax = get_tagged_oid( "SYNTAX ", &nextinput, + keyword_strstr_fn ))) { + /* + * Check for an optional {LEN}, which if present indicates a + * suggested maximum size for values of this attribute type. + * + * XXXmcs: we do not enforce length restrictions, but we do read + * and include them in the subschemasubentry. + */ + if ( (pEnd = strchr ( pSyntax, '{')) != NULL /* balance } */ ) { + *pEnd = '\0'; + syntaxlength = atoi( pEnd + 1 ); + } + } - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; - /* look for the optional SINGLE-VALUE marker */ - flags |= get_flag_keyword( " SINGLE-VALUE ", - SLAPI_ATTR_FLAG_SINGLE, &nextinput, keyword_strstr_fn ); + /* look for the optional SINGLE-VALUE marker */ + flags |= get_flag_keyword( " SINGLE-VALUE ", + SLAPI_ATTR_FLAG_SINGLE, &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; - /* look for the optional COLLECTIVE marker */ - flags |= get_flag_keyword( schema_collective_with_spaces, - SLAPI_ATTR_FLAG_COLLECTIVE, &nextinput, keyword_strstr_fn ); + /* look for the optional COLLECTIVE marker */ + flags |= get_flag_keyword( schema_collective_with_spaces, + SLAPI_ATTR_FLAG_COLLECTIVE, &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; - /* look for the optional NO-USER-MODIFICATION marker */ - flags |= get_flag_keyword( schema_nousermod_with_spaces, - SLAPI_ATTR_FLAG_NOUSERMOD, &nextinput, keyword_strstr_fn ); + /* look for the optional NO-USER-MODIFICATION marker */ + flags |= get_flag_keyword( schema_nousermod_with_spaces, + SLAPI_ATTR_FLAG_NOUSERMOD, &nextinput, keyword_strstr_fn ); - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; - /* look for the optional USAGE */ - if (NULL != (ss = (*keyword_strstr_fn)(nextinput, " USAGE "))) { - ss += 7; - ss = skipWS(ss); - if (ss) { - if ( !PL_strncmp(ss, "directoryOperation", - strlen("directoryOperation"))) { - flags |= SLAPI_ATTR_FLAG_OPATTR; - } - if ( NULL == ( nextinput = strchr( ss, ' ' ))) { - nextinput = ss + strlen(ss); - } - } - } + /* look for the optional USAGE */ + if (NULL != (ss = (*keyword_strstr_fn)(nextinput, " USAGE "))) { + ss += 7; + ss = skipWS(ss); + if (ss) { + if ( !PL_strncmp(ss, "directoryOperation", + strlen("directoryOperation"))) { + flags |= SLAPI_ATTR_FLAG_OPATTR; + } + if ( NULL == ( nextinput = strchr( ss, ' ' ))) { + nextinput = ss + strlen(ss); + } + } + } - if ( schema_ds4x_compat ) nextinput = input; + if ( schema_ds4x_compat ) nextinput = input; - /* X-ORIGIN list */ - attr_origins = parse_origin_list( nextinput, &num_origins, - schema_user_defined_origin ); + /* X-ORIGIN list */ + attr_origins = parse_origin_list( nextinput, &num_origins, + schema_user_defined_origin ); - /* Do some sanity checking to make sure everything was read correctly */ - - if (NULL == pOid) { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - first_attr_name, "Missing OID" ); - status = invalid_syntax_error; - } - if (!status && (!attr_names || !num_names)) { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - first_attr_name, - "Missing name (OID is \"%s\")", pOid ); - status = invalid_syntax_error; - } + /* Do some sanity checking to make sure everything was read correctly */ + + if (NULL == pOid) { + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + first_attr_name, "Missing OID" ); + status = invalid_syntax_error; + } + if (!status && (!attr_names || !num_names)) { + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + first_attr_name, + "Missing name (OID is \"%s\")", pOid ); + status = invalid_syntax_error; + } if (!status && (NULL != pSuperior)) { struct asyntaxinfo *asi_parent; @@ -3369,7 +3404,7 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf, char *pso = plugin_syntax2oid(asi_parent->asi_plugin); if (pso) { - slapi_ch_free ((void **)&pSyntax); + slapi_ch_free ((void **)&pSyntax); pSyntax = slapi_ch_strdup(pso); LDAPDebug (LDAP_DEBUG_TRACE, "Inheriting syntax %s from parent type %s\n", @@ -3380,6 +3415,7 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf, "Missing parent attribute syntax OID"); status = invalid_syntax_error; } + attr_syntax_return( asi_parent ); } } /* @@ -3401,135 +3437,137 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf, } } - if (!status && (NULL == pSyntax)) { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - first_attr_name, "Missing attribute syntax OID"); - status = invalid_syntax_error; + if (!status && (NULL == pSyntax)) { + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + first_attr_name, "Missing attribute syntax OID"); + status = invalid_syntax_error; - } - - if (!status && (plugin_syntax_find ( pSyntax ) == NULL) ) { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - first_attr_name, "Unknown attribute syntax OID \"%s\"", - pSyntax ); - status = invalid_syntax_error; - } - - if (!status) { - struct objclass *poc; - /* check to make sure that the OID isn't being used by an objectclass */ - oc_lock_read(); - poc = oc_find_oid_nolock( pOid ); - if ( poc != NULL) { - schema_create_errormsg( errorbuf, errorbufsize, - schema_errprefix_at, first_attr_name, - "The OID \"%s\" is also used by the object class \"%s\"", - pOid, poc->oc_name); - status = LDAP_TYPE_OR_VALUE_EXISTS; - } - oc_unlock(); - } + } + + if (!status && (plugin_syntax_find ( pSyntax ) == NULL) ) { + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + first_attr_name, "Unknown attribute syntax OID \"%s\"", + pSyntax ); + status = invalid_syntax_error; + } - if (!status && !element_is_user_defined( attr_origins )) { - if ( is_user_defined ) { - /* add missing user defined origin string */ - charray_add( &attr_origins, - slapi_ch_strdup( schema_user_defined_origin[0] )); - ++num_origins; - } else { - flags |= SLAPI_ATTR_FLAG_STD_ATTR; - } - } + if (!status) { + struct objclass *poc; + /* check to make sure that the OID isn't being used by an objectclass */ + if (!(schema_flags & DSE_SCHEMA_LOCKED)) + oc_lock_read(); + poc = oc_find_oid_nolock( pOid ); + if ( poc != NULL) { + schema_create_errormsg( errorbuf, errorbufsize, + schema_errprefix_at, first_attr_name, + "The OID \"%s\" is also used by the object class \"%s\"", + pOid, poc->oc_name); + status = LDAP_TYPE_OR_VALUE_EXISTS; + } + if (!(schema_flags & DSE_SCHEMA_LOCKED)) + oc_unlock(); + } - if (!status) { - int ii; - /* check to see if the attribute name is valid */ - for (ii = 0; !status && (ii < num_names); ++ii) { - if ( schema_check_name(attr_names[ii], PR_TRUE, errorbuf, - errorbufsize) == 0 ) { - status = invalid_syntax_error; - } - else if (!(flags & SLAPI_ATTR_FLAG_OVERRIDE) && - attr_syntax_exists(attr_names[ii])) { - schema_create_errormsg( errorbuf, errorbufsize, - schema_errprefix_at, attr_names[ii], - "Could not be added because it already exists" ); - status = LDAP_TYPE_OR_VALUE_EXISTS; - } - } - } + if (!status && !element_is_user_defined( attr_origins )) { + if ( is_user_defined ) { + /* add missing user defined origin string */ + charray_add( &attr_origins, + slapi_ch_strdup( schema_user_defined_origin[0] )); + ++num_origins; + } else { + flags |= SLAPI_ATTR_FLAG_STD_ATTR; + } + } - if (!status) { - if ( schema_check_oid ( first_attr_name, pOid, PR_TRUE, errorbuf, - errorbufsize ) == 0 ) { - status = invalid_syntax_error; - } - } + if (!(schema_flags & DSE_SCHEMA_NO_CHECK) && !status) { + int ii; + /* check to see if the attribute name is valid */ + for (ii = 0; !status && (ii < num_names); ++ii) { + if ( schema_check_name(attr_names[ii], PR_TRUE, errorbuf, + errorbufsize) == 0 ) { + status = invalid_syntax_error; + } + else if (!(flags & SLAPI_ATTR_FLAG_OVERRIDE) && + attr_syntax_exists(attr_names[ii])) { + schema_create_errormsg( errorbuf, errorbufsize, + schema_errprefix_at, attr_names[ii], + "Could not be added because it already exists" ); + status = LDAP_TYPE_OR_VALUE_EXISTS; + } + } + } - if (!status) { - struct asyntaxinfo *tmpasi; + if (!(schema_flags & DSE_SCHEMA_NO_CHECK) && !status) { + if ( schema_check_oid ( first_attr_name, pOid, PR_TRUE, errorbuf, + errorbufsize ) == 0 ) { + status = invalid_syntax_error; + } + } - if (!(flags & SLAPI_ATTR_FLAG_OVERRIDE) && - ( NULL != ( tmpasi = attr_syntax_get_by_oid(pOid)))) { - schema_create_errormsg( errorbuf, errorbufsize, - schema_errprefix_at, first_attr_name, - "Could not be added because the OID \"%s\" is already in use", - pOid); - status = LDAP_TYPE_OR_VALUE_EXISTS; - attr_syntax_return( tmpasi ); - } - } + if (!status) { + struct asyntaxinfo *tmpasi; - - if (!status) { - status = attr_syntax_create( pOid, attr_names, num_names, - *psbAttrDesc->buffer == '\0' ? NULL : psbAttrDesc->buffer, - pSuperior, - pMREquality, pMROrdering, pMRSubstring, attr_origins, - pSyntax, syntaxlength, flags, &tmpasip ); - } - - if (!status) { - if ( NULL != asipp ) { - *asipp = tmpasip; /* just return it */ - } else { /* add the new attribute to the global store */ - status = attr_syntax_add( tmpasip ); - if ( LDAP_SUCCESS != status ) { - if ( 0 != (flags & SLAPI_ATTR_FLAG_OVERRIDE) && - LDAP_TYPE_OR_VALUE_EXISTS == status ) { - /* - * This can only occur if the name and OID don't match the - * attribute we are trying to override (all other cases of - * "type or value exists" were trapped above). - */ - schema_create_errormsg( errorbuf, errorbufsize, - schema_errprefix_at, first_attr_name, - "Does not match the OID \"%s\". Another attribute" - " type is already using the name or OID.", pOid); - } else { - schema_create_errormsg( errorbuf, errorbufsize, - schema_errprefix_at, first_attr_name, - "Could not be added (OID is \"%s\")", pOid ); - } - attr_syntax_free( tmpasip ); - } - } - } + if (!(flags & SLAPI_ATTR_FLAG_OVERRIDE) && + ( NULL != ( tmpasi = attr_syntax_get_by_oid(pOid)))) { + schema_create_errormsg( errorbuf, errorbufsize, + schema_errprefix_at, first_attr_name, + "Could not be added because the OID \"%s\" is already in use", + pOid); + status = LDAP_TYPE_OR_VALUE_EXISTS; + attr_syntax_return( tmpasi ); + } + } + + + if (!status) { + status = attr_syntax_create( pOid, attr_names, num_names, + *psbAttrDesc->buffer == '\0' ? NULL : psbAttrDesc->buffer, + pSuperior, + pMREquality, pMROrdering, pMRSubstring, attr_origins, + pSyntax, syntaxlength, flags, &tmpasip ); + } + + if (!status) { + if ( NULL != asipp ) { + *asipp = tmpasip; /* just return it */ + } else { /* add the new attribute to the global store */ + status = attr_syntax_add( tmpasip ); + if ( LDAP_SUCCESS != status ) { + if ( 0 != (flags & SLAPI_ATTR_FLAG_OVERRIDE) && + LDAP_TYPE_OR_VALUE_EXISTS == status ) { + /* + * This can only occur if the name and OID don't match the + * attribute we are trying to override (all other cases of + * "type or value exists" were trapped above). + */ + schema_create_errormsg( errorbuf, errorbufsize, + schema_errprefix_at, first_attr_name, + "Does not match the OID \"%s\". Another attribute" + " type is already using the name or OID.", pOid); + } else { + schema_create_errormsg( errorbuf, errorbufsize, + schema_errprefix_at, first_attr_name, + "Could not be added (OID is \"%s\")", pOid ); + } + attr_syntax_free( tmpasip ); + } + } + } done: - /* free everything */ - free_qdlist(attr_names, num_names); - free_qdlist(attr_origins, num_origins); - sizedbuffer_destroy(psbAttrName); - sizedbuffer_destroy(psbAttrDesc); - slapi_ch_free((void **)&pOid); - slapi_ch_free((void **)&pSuperior); - slapi_ch_free((void **)&pMREquality); - slapi_ch_free((void **)&pMROrdering); - slapi_ch_free((void **)&pMRSubstring); - slapi_ch_free((void **)&pSyntax); - - return status; + /* free everything */ + free_qdlist(attr_names, num_names); + free_qdlist(attr_origins, num_origins); + sizedbuffer_destroy(psbAttrName); + sizedbuffer_destroy(psbAttrDesc); + slapi_ch_free((void **)&pOid); + slapi_ch_free((void **)&pSuperior); + slapi_ch_free((void **)&pMREquality); + slapi_ch_free((void **)&pMROrdering); + slapi_ch_free((void **)&pMRSubstring); + slapi_ch_free((void **)&pSyntax); + + return status; } @@ -3911,96 +3949,122 @@ stripOption(char *attr) { * Initialize attributes and objectclasses from the schema * * Note that this function removes all values for `attributetypes' - * and `objectclasses' attributes from the entry `e'. + * and `objectclasses' attributes from the entry `e'. * * returntext is always at least SLAPI_DSE_RETURNTEXT_SIZE bytes in size. */ int load_schema_dse(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *ignored, - int *returncode, char *returntext, void *arg) + int *returncode, char *returntext, void *arg) { - Slapi_Attr *attr = 0; - int nolock = 1; /* don't lock global resources during initialization */ - int primary_file = 0; /* this is the primary (writeable) schema file */ - int schema_ds4x_compat = config_get_ds4_compatible_schema(); + Slapi_Attr *attr = 0; + int primary_file = 0; /* this is the primary (writeable) schema file */ + int schema_ds4x_compat = config_get_ds4_compatible_schema(); + PRUint32 flags = *(PRUint32 *)arg; + flags |= DSE_SCHEMA_NO_GLOCK; /* don't lock global resources + during initialization */ - *returncode = 0; + *returncode = 0; - /* - * Note: there is no need to call schema_lock_write() here because this - * function is only called during server startup. - */ + /* + * Note: there is no need to call schema_lock_write() here because this + * function is only called during server startup. + */ - slapi_pblock_get( pb, SLAPI_DSE_IS_PRIMARY_FILE, &primary_file ); + slapi_pblock_get( pb, SLAPI_DSE_IS_PRIMARY_FILE, &primary_file ); - if (!slapi_entry_attr_find(e, "attributetypes", &attr) && attr) - { - /* enumerate the values in attr */ - Slapi_Value *v = 0; - int index = 0; - for (index = slapi_attr_first_value(attr, &v); - v && (index != -1); - index = slapi_attr_next_value(attr, index, &v)) - { - const char *s = slapi_value_get_string(v); - if (!s) - continue; - if ((*returncode = read_at_ldif(s, NULL, returntext, - SLAPI_DSE_RETURNTEXT_SIZE, nolock, - primary_file /* force user defined? */, - schema_ds4x_compat, 0)) != 0) - break; - } - slapi_entry_attr_delete(e, "attributetypes"); - } + if (!slapi_entry_attr_find(e, "attributetypes", &attr) && attr) + { + /* enumerate the values in attr */ + Slapi_Value *v = 0; + int index = 0; + for (index = slapi_attr_first_value(attr, &v); + v && (index != -1); + index = slapi_attr_next_value(attr, index, &v)) + { + const char *s = slapi_value_get_string(v); + if (!s) + continue; + if (flags & DSE_SCHEMA_NO_LOAD) + { + struct asyntaxinfo *tmpasip = NULL; + if ((*returncode = read_at_ldif(s, &tmpasip, returntext, + SLAPI_DSE_RETURNTEXT_SIZE, flags, + primary_file /* force user defined? */, + schema_ds4x_compat, 0)) != 0) + break; + attr_syntax_free( tmpasip ); /* trash it */ + } + else + { + if ((*returncode = read_at_ldif(s, NULL, returntext, + SLAPI_DSE_RETURNTEXT_SIZE, flags, + primary_file /* force user defined? */, + schema_ds4x_compat, 0)) != 0) + break; + } + } + slapi_entry_attr_delete(e, "attributetypes"); + } - if (*returncode) - return SLAPI_DSE_CALLBACK_ERROR; + if (*returncode) + return SLAPI_DSE_CALLBACK_ERROR; - if (!slapi_entry_attr_find(e, "objectclasses", &attr) && attr) - { - /* enumerate the values in attr */ - Slapi_Value *v = 0; - int index = 0; - for (index = slapi_attr_first_value(attr, &v); - v && (index != -1); - index = slapi_attr_next_value(attr, index, &v)) - { - struct objclass *oc = 0; - const char *s = slapi_value_get_string(v); - if (!s) - continue; - if ( LDAP_SUCCESS != (*returncode = read_oc_ldif(s, &oc, returntext, - SLAPI_DSE_RETURNTEXT_SIZE, nolock, - primary_file /* force user defined? */, - schema_ds4x_compat))) { - break; - } - if ( LDAP_SUCCESS != (*returncode = add_oc_internal(oc, returntext, - SLAPI_DSE_RETURNTEXT_SIZE, schema_ds4x_compat))) { - oc_free( &oc ); - break; - } - } - slapi_entry_attr_delete(e, "objectclasses"); - } + if (!slapi_entry_attr_find(e, "objectclasses", &attr) && attr) + { + /* enumerate the values in attr */ + Slapi_Value *v = 0; + int index = 0; + for (index = slapi_attr_first_value(attr, &v); + v && (index != -1); + index = slapi_attr_next_value(attr, index, &v)) + { + struct objclass *oc = 0; + const char *s = slapi_value_get_string(v); + if (!s) + continue; + if ( LDAP_SUCCESS != (*returncode = read_oc_ldif(s, &oc, returntext, + SLAPI_DSE_RETURNTEXT_SIZE, flags, + primary_file /* force user defined? */, + schema_ds4x_compat))) { + break; + } + if (flags & DSE_SCHEMA_NO_LOAD) + { + /* we don't load the objectclase; free it */ + oc_free( &oc ); + } + else + { + if ( LDAP_SUCCESS != + (*returncode = add_oc_internal(oc, returntext, + SLAPI_DSE_RETURNTEXT_SIZE, schema_ds4x_compat, + flags))) { + oc_free( &oc ); + break; + } + } + } + slapi_entry_attr_delete(e, "objectclasses"); + } - /* Set the schema CSN */ - if (!slapi_entry_attr_find(e, "nsschemacsn", &attr) && attr) - { - Slapi_Value *v = NULL; - slapi_attr_first_value(attr, &v); - if (NULL != v) { - const char *s = slapi_value_get_string(v); - if (NULL != s) { - CSN *csn = csn_new_by_string(s); - g_set_global_schema_csn(csn); - } - } - } + /* Set the schema CSN */ + if (!(flags & DSE_SCHEMA_NO_LOAD) && + !slapi_entry_attr_find(e, "nsschemacsn", &attr) && attr) + { + Slapi_Value *v = NULL; + slapi_attr_first_value(attr, &v); + if (NULL != v) { + const char *s = slapi_value_get_string(v); + if (NULL != s) { + CSN *csn = csn_new_by_string(s); + g_set_global_schema_csn(csn); + } + } + } - return (*returncode == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK - : SLAPI_DSE_CALLBACK_ERROR; + return (*returncode == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK + : SLAPI_DSE_CALLBACK_ERROR; } /* @@ -4010,30 +4074,51 @@ load_schema_dse(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *ignored, * schema entry into it. * * Returns 1 for OK, 0 for Fail. + * + * schema_flags: + * DSE_SCHEMA_NO_LOAD -- schema won't get loaded + * DSE_SCHEMA_NO_CHECK -- schema won't be checked + * DSE_SCHEMA_NO_BACKEND -- don't add as backend + * DSE_SCHEMA_LOCKED -- already locked; no further lock needed + */ -int -init_schema_dse(const char *configdir) +static int +init_schema_dse_ext(char *schemadir, Slapi_Backend *be, + struct dse **local_pschemadse, PRUint32 schema_flags) { - int rc= 1; /* OK */ - char *schemadir = 0; + int rc= 1; /* OK */ char *userschemafile = 0; char *userschematmpfile = 0; char **filelist = 0; + char *myschemadir = NULL; Slapi_DN schema; + if (NULL == local_pschemadse) + { + return 0; /* cannot proceed; return failure */ + } + slapi_sdn_init_dn_byref(&schema,"cn=schema"); - schemadir = config_get_schemadir(); - if (NULL == schemadir) { - /* schemadir info is not configured, let's use the default place */ - schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME); + /* get schemadir if not given */ + if (NULL == schemadir) + { + myschemadir = config_get_schemadir(); + if (NULL == myschemadir) + { + return 0; /* cannot proceed; return failure */ + } + } + else + { + myschemadir = schemadir; } - filelist = get_priority_filelist(schemadir, ".*ldif$"); + filelist = get_priority_filelist(myschemadir, ".*ldif$"); if (!filelist || !*filelist) { slapi_log_error(SLAPI_LOG_FATAL, "schema", - "No schema files were found in the directory %s\n", schemadir); + "No schema files were found in the directory %s\n", myschemadir); free_filelist(filelist); rc = 0; } @@ -4046,21 +4131,26 @@ init_schema_dse(const char *configdir) userschematmpfile = slapi_ch_smprintf("%s.tmp", userschemafile); } - if(rc && (pschemadse==NULL)) - { - pschemadse= dse_new_with_filelist(userschemafile,userschematmpfile, NULL, NULL, - schemadir,filelist); - PR_ASSERT(pschemadse); - if ((rc= (pschemadse!=NULL)) != 0) - dse_register_callback(pschemadse,DSE_OPERATION_READ,DSE_FLAG_PREOP,&schema, - LDAP_SCOPE_BASE,NULL, - load_schema_dse,NULL); - slapi_ch_free((void**)&userschematmpfile); - } - slapi_ch_free((void**)&schemadir); + if(rc) + { + *local_pschemadse = dse_new_with_filelist(userschemafile, + userschematmpfile, NULL, NULL, myschemadir, filelist); + } + PR_ASSERT(*local_pschemadse); + if ((rc = (*local_pschemadse != NULL)) != 0) + { + /* pass schema_flags as arguments */ + dse_register_callback(*local_pschemadse, + DSE_OPERATION_READ, DSE_FLAG_PREOP, &schema, + LDAP_SCOPE_BASE, NULL, + load_schema_dse, (void *)&schema_flags); + } + slapi_ch_free_string(&userschematmpfile); + if (NULL == schemadir) + slapi_ch_free_string(&myschemadir); /* allocated in this function */ - if(rc) - { + if(rc) + { char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0}; int dont_write = 1; int merge = 1; @@ -4073,14 +4163,30 @@ init_schema_dse(const char *configdir) slapi_pblock_set(&pb, SLAPI_DSE_MERGE_WHEN_ADDING, (void*)&merge); /* use the non duplicate checking str2entry */ slapi_pblock_set(&pb, SLAPI_DSE_DONT_CHECK_DUPS, (void*)&dont_dup_check); + /* borrow the task flag space */ + slapi_pblock_set(&pb, SLAPI_SCHEMA_FLAGS, (void*)&schema_flags); /* add the objectclass attribute so we can do some basic schema checking during initialization; this will be overridden when its "real" definition is read from the schema conf files */ - rc = read_at_ldif("attributeTypes: ( 2.5.4.0 NAME 'objectClass' " + if (schema_flags & DSE_SCHEMA_NO_LOAD) + { + struct asyntaxinfo *tmpasip = NULL; + rc = read_at_ldif("attributeTypes: ( 2.5.4.0 NAME 'objectClass' " "DESC 'Standard schema for LDAP' SYNTAX " "1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )", - NULL, errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, 1, 0, 0, 0); + &tmpasip, errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + DSE_SCHEMA_NO_GLOCK|schema_flags, 0, 0, 0); + attr_syntax_free( tmpasip ); /* trash it */ + } + else + { + rc = read_at_ldif("attributeTypes: ( 2.5.4.0 NAME 'objectClass' " + "DESC 'Standard schema for LDAP' SYNTAX " + "1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )", + NULL, errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + DSE_SCHEMA_NO_GLOCK|schema_flags, 0, 0, 0); + } if (rc) { slapi_log_error(SLAPI_LOG_FATAL, "schema", "Could not add" @@ -4088,39 +4194,69 @@ init_schema_dse(const char *configdir) errorbuf); } - rc = dse_read_file(pschemadse, &pb); - } + rc = dse_read_file(*local_pschemadse, &pb); + } - if (rc) + if (rc && !(schema_flags & DSE_SCHEMA_NO_BACKEND)) { /* make sure the schema is normalized */ - normalize_oc(); + if (schema_flags & DSE_SCHEMA_LOCKED) + normalize_oc_nolock(); + else + normalize_oc(); /* register callbacks */ - dse_register_callback(pschemadse,SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,&schema, - LDAP_SCOPE_BASE,NULL,read_schema_dse,NULL); - dse_register_callback(pschemadse,SLAPI_OPERATION_MODIFY,DSE_FLAG_PREOP,&schema, - LDAP_SCOPE_BASE,NULL,modify_schema_dse,NULL); - dse_register_callback(pschemadse,SLAPI_OPERATION_DELETE,DSE_FLAG_PREOP,&schema, - LDAP_SCOPE_BASE,NULL,dont_allow_that,NULL); - dse_register_callback(pschemadse,DSE_OPERATION_WRITE,DSE_FLAG_PREOP,&schema, - LDAP_SCOPE_BASE,NULL,refresh_user_defined_schema, - NULL); + dse_register_callback(*local_pschemadse, SLAPI_OPERATION_SEARCH, + DSE_FLAG_PREOP,&schema, LDAP_SCOPE_BASE, + NULL, read_schema_dse, NULL); + dse_register_callback(*local_pschemadse, SLAPI_OPERATION_MODIFY, + DSE_FLAG_PREOP,&schema, LDAP_SCOPE_BASE, + NULL, modify_schema_dse, NULL); + dse_register_callback(*local_pschemadse, SLAPI_OPERATION_DELETE, + DSE_FLAG_PREOP, &schema, LDAP_SCOPE_BASE, + NULL,dont_allow_that,NULL); + dse_register_callback(*local_pschemadse, DSE_OPERATION_WRITE, + DSE_FLAG_PREOP, &schema, LDAP_SCOPE_BASE, + NULL, refresh_user_defined_schema, NULL); if (rc) { - Slapi_Backend *be; - - /* add as a backend */ - be= be_new_internal(pschemadse,"DSE", "schema-internal"); /* JCM - should be a #define */ - be_addsuffix(be,&schema); + if (NULL == be) { /* be is not given. select it */ + be = slapi_be_select_by_instance_name( DSE_SCHEMA ); + } + if (NULL == be) { /* first time */ + /* add as a backend */ + be = be_new_internal(*local_pschemadse, "DSE", DSE_SCHEMA); + be_addsuffix(be, &schema); + } else { /* schema file reload */ + struct slapdplugin *backend_plugin = NULL; + be_replace_dse_internal(be, *local_pschemadse); + + /* ldbm has some internal attributes to be added */ + backend_plugin = plugin_get_by_name("ldbm database"); + if (backend_plugin) { + (backend_plugin->plg_add_schema)( NULL ); + } + } } } slapi_sdn_done(&schema); - return rc; + return rc; } - +int +init_schema_dse(const char *configdir) +{ + char *schemadir = config_get_schemadir(); + int rc = 0; + if (NULL == schemadir) + { + schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME); + } + rc = init_schema_dse_ext(schemadir, NULL, &pschemadse, 0); + slapi_ch_free_string(&schemadir); + return rc; +} /* * Look for `keyword' within `*inputp' and return the flag_value if found @@ -4713,3 +4849,115 @@ slapi_schema_expand_objectclasses( Slapi_Entry *e ) oc_unlock(); } + +void +schema_expand_objectclasses_nolock( Slapi_Entry *e ) +{ + Slapi_Attr *sa; + Slapi_Value **va; + const char *dn = slapi_entry_get_dn_const( e ); + int i; + + if ( 0 != slapi_entry_attr_find( e, SLAPI_ATTR_OBJECTCLASS, &sa )) { + return; /* no OC values -- nothing to do */ + } + + va = attr_get_present_values( sa ); + + if ( va == NULL || va[0] == NULL ) { + return; /* no OC values -- nothing to do */ + } + + /* + * This loop relies on the fact that bv_expand_one_oc() + * always adds to the end + */ + for ( i = 0; va[i] != NULL; ++i ) { + if ( NULL != slapi_value_get_string(va[i]) ) { + va_expand_one_oc( dn, &va, slapi_value_get_string(va[i]) ); + } + } + + /* top must always be present */ + va_expand_one_oc( dn, &va, "top" ); + + /* + * Reset the present values in the set because we may have realloc'd it. + * Note that this is the counterpart to the attr_get_present_values() + * call we made above... nothing new has been allocated, but sa holds + * a pointer to the original (pre realloc) va. + */ + sa->a_present_values.va = va; +} + +/* lock to protect both objectclass and schema_dse */ +static void +slapi_load_schemafile_lock() +{ + oc_lock_write(); + schema_dse_lock_write(); +} + +static void +slapi_load_schemafile_unlock() +{ + schema_dse_unlock(); + oc_unlock(); +} + +/* API to validate the schema files */ +int +slapi_validate_schema_files(char *schemadir) +{ + struct dse *my_pschemadse = NULL; + int rc = init_schema_dse_ext(schemadir, NULL, &my_pschemadse, + DSE_SCHEMA_NO_LOAD | DSE_SCHEMA_NO_BACKEND); + dse_destroy(my_pschemadse); + if (rc) + return LDAP_SUCCESS; + else { + slapi_log_error( SLAPI_LOG_FATAL, "schema_reload", + "schema file validation failed\n" ); + return LDAP_OBJECT_CLASS_VIOLATION; + } +} + +/* + * API to reload the schema files. + * Rule: this function is called when slapi_validate_schema_files is passed. + * Schema checking is skipped in this function. + */ +int +slapi_reload_schema_files(char *schemadir) +{ + int rc = LDAP_SUCCESS; + struct dse *my_pschemadse = NULL; + /* get be to lock */ + Slapi_Backend *be = slapi_be_select_by_instance_name( DSE_SCHEMA ); + + if (NULL == be) + { + slapi_log_error( SLAPI_LOG_FATAL, "schema_reload", + "schema file reload failed\n" ); + return LDAP_LOCAL_ERROR; + } + slapi_be_Wlock(be); /* be lock must be outer of schemafile lock */ + slapi_load_schemafile_lock(); + attr_syntax_delete_all(); + oc_delete_all_nolock(); + rc = init_schema_dse_ext(schemadir, be, &my_pschemadse, + DSE_SCHEMA_NO_CHECK | DSE_SCHEMA_LOCKED); + if (rc) { + dse_destroy(pschemadse); + pschemadse = my_pschemadse; + slapi_load_schemafile_unlock(); + slapi_be_Unlock(be); + return LDAP_SUCCESS; + } else { + slapi_load_schemafile_unlock(); + slapi_be_Unlock(be); + slapi_log_error( SLAPI_LOG_FATAL, "schema_reload", + "schema file reload failed\n" ); + return LDAP_LOCAL_ERROR; + } +} diff --git a/ldap/servers/slapd/schemaparse.c b/ldap/servers/slapd/schemaparse.c index 3be59a16..b39e4f06 100644 --- a/ldap/servers/slapd/schemaparse.c +++ b/ldap/servers/slapd/schemaparse.c @@ -254,6 +254,24 @@ normalize_oc( void ) oc_unlock(); } +void +normalize_oc_nolock( void ) +{ + struct objclass *oc; + + for ( oc = g_get_global_oc_nolock(); oc != NULL; oc = oc->oc_next ) { + LDAPDebug (LDAP_DEBUG_PARSE, + "normalize_oc: normalizing '%s'\n", oc->oc_name, 0, 0); + /* required attributes */ + normalize_list( oc->oc_required ); + normalize_list( oc->oc_orig_required ); + + /* optional attributes */ + normalize_list( oc->oc_allowed ); + normalize_list( oc->oc_orig_allowed ); + } +} + /* * oc_update_inheritance_nolock: * If an objectclass is redefined, we need to make sure that any objectclasses diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h index 982b9be8..5d8de75b 100644 --- a/ldap/servers/slapd/slap.h +++ b/ldap/servers/slapd/slap.h @@ -776,7 +776,8 @@ struct slapdplugin { IFP plg_un_db_register_oc_callback; /* Register a function to call when a operation is applied to a given ObjectClass */ IFP plg_un_db_init_instance; /* initializes new db instance */ IFP plg_un_db_wire_import; /* fast replica update */ - IFP plg_un_db_verify; /* verify db files */ + IFP plg_un_db_add_schema; /* add schema */ + IFP plg_un_db_verify; /* verify db files */ } plg_un_db; #define plg_bind plg_un.plg_un_db.plg_un_db_bind #define plg_unbind plg_un.plg_un_db.plg_un_db_unbind @@ -808,6 +809,7 @@ struct slapdplugin { #define plg_rmdb plg_un.plg_un_db.plg_un_db_rmdb #define plg_init_instance plg_un.plg_un_db.plg_un_db_init_instance #define plg_wire_import plg_un.plg_un_db.plg_un_db_wire_import +#define plg_add_schema plg_un.plg_un_db.plg_un_db_add_schema /* extended operation plugin structure */ struct plg_un_protocol_extension { @@ -1414,7 +1416,9 @@ typedef struct slapi_pblock { after the schema and syntax and matching rule plugins are running */ int pb_dse_is_primary_file; /* for read callbacks: non-zero for primary file */ - int pb_schema_user_defined_only; /* return user defined schema only */ + int pb_schema_flags; /* schema flags */ + /* . check/load info (schema reload task) */ + /* . refresh user defined schema */ /* NEW in 5.0 for getting back the backend result in frontend */ int pb_result_code; /* operation result code */ diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 8c888f84..26733b1f 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -217,6 +217,7 @@ Slapi_Entry *slapi_str2entry( char *s, int flags ); has the RDN as an attribute of the entry, and has all values for a given attribute type listed contiguously. */ #define SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF 128 +#define SLAPI_STR2ENTRY_NO_SCHEMA_LOCK 256 char *slapi_entry2str_with_options( Slapi_Entry *e, int *len, int options ); /* Options for slapi_entry2str_with_options() */ @@ -1431,7 +1432,7 @@ int slapi_reslimit_get_integer_limit( Slapi_Connection *conn, int handle, #define SLAPI_DSE_IS_PRIMARY_FILE 289 /* internal schema flags */ -#define SLAPI_SCHEMA_USER_DEFINED_ONLY 285 +#define SLAPI_SCHEMA_FLAGS 285 /* urp flags */ #define SLAPI_URP_NAMING_COLLISION_DN 286 diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index 1225e8d5..20116a2c 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -648,6 +648,8 @@ typedef struct index_config void be_set_sizelimit(Slapi_Backend * be, int sizelimit); void be_set_timelimit(Slapi_Backend * be, int timelimit); +int be_isdeleted( const Slapi_Backend *be ); + /* used by mapping tree to delay sending of result code when several * backend are parsed @@ -857,6 +859,7 @@ int valuearray_find(const Slapi_Attr *a, Slapi_Value **va, const Slapi_Value *v) #define SLAPI_PLUGIN_DB_WIRE_IMPORT_FN 234 #define SLAPI_PLUGIN_DB_UPGRADEDB_FN 235 #define SLAPI_PLUGIN_DB_DBVERIFY_FN 236 +#define SLAPI_PLUGIN_DB_ADD_SCHEMA_FN 237 /* database plugin-specific parameters */ #define SLAPI_PLUGIN_DB_NO_ACL 250 #define SLAPI_PLUGIN_DB_RMDB_FN 280 @@ -1073,6 +1076,17 @@ int slapi_uniqueIDGenerateFromNameString(char **uId, int slapi_config_register_callback(int operation, int flags, const char *base, int scope, const char *filter, dseCallbackFn fn, void *fn_arg); int slapi_config_remove_callback(int operation, int flags, const char *base, int scope, const char *filter, dseCallbackFn fn); int config_is_slapd_lite( void ); +void schema_expand_objectclasses_nolock( Slapi_Entry *e ); + +#define DSE_SCHEMA_NO_LOAD 0x0001 /* schema won't get loaded */ +#define DSE_SCHEMA_NO_CHECK 0x0002 /* schema won't be checked */ +#define DSE_SCHEMA_NO_BACKEND 0x0004 /* don't add as backend */ + +#define DSE_SCHEMA_NO_GLOCK 0x0010 /* don't lock global resources */ +#define DSE_SCHEMA_LOCKED 0x0020 /* already locked with + * slapi_load_schemafile_lock; + * no further lock needed */ +#define DSE_SCHEMA_USER_DEFINED_ONLY 0x0100 /* refresh user defined schema */ #define SLAPI_RTN_BIT_FETCH_EXISTING_DN_ENTRY 0 #define SLAPI_RTN_BIT_FETCH_PARENT_ENTRY 1 @@ -1,8 +1,8 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify @@ -43,22 +43,14 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.24 -TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)" - -# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' +VERSION=1.5.22 +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh # Check that we have a working $echo. if test "X$1" = X--no-reexec; then @@ -113,14 +105,12 @@ esac # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). # We save the old values to restore during execute mode. -for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - fi" -done +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi # Make sure IFS has a sensible default lt_nl=' @@ -146,8 +136,6 @@ duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 ##################################### # Shell function definitions: @@ -208,13 +196,7 @@ func_win32_libid () if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{ - / I /{ - s,.*,import, - p - q - } - }'` + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; @@ -345,17 +327,7 @@ func_extract_archives () *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - extracted_serial=`expr $extracted_serial + 1` - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" + my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" @@ -482,12 +454,11 @@ do ;; --version) - echo "\ -$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP - -Copyright (C) 2007 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; @@ -784,10 +755,9 @@ if test -z "$show_help"; then *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; - *.[fF][09]?) xform=[fF][09]. ;; + *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; - *.obj) xform=obj ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` @@ -1168,9 +1138,8 @@ EOF for arg do case $arg in - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) + -all-static | -static) + if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi @@ -1178,20 +1147,12 @@ EOF dlopen_self=$dlopen_self_static fi prefer_static_libs=yes - ;; - -static) + else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac + fi build_libtool_libs=no build_old_libs=yes break @@ -1639,7 +1600,7 @@ EOF continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" @@ -1659,11 +1620,10 @@ EOF # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin + # -pg pass through profiling flag for GCC # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. @@ -1691,9 +1651,9 @@ EOF -no-install) case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. + # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no @@ -1752,7 +1712,7 @@ EOF continue ;; - -static | -static-libtool-libs) + -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects @@ -2134,7 +2094,7 @@ EOF lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" @@ -2530,9 +2490,7 @@ EOF if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. @@ -3228,7 +3186,7 @@ EOF # which has an extra 1 added just for fun # case $version_type in - darwin|linux|osf|windows|none) + darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" @@ -3239,10 +3197,9 @@ EOF age="0" ;; irix|nonstopux) - current=`expr $number_major + $number_minor` + current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" - lt_irix_increment=no ;; esac ;; @@ -3301,8 +3258,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -3316,11 +3272,8 @@ EOF ;; irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - major=`expr $current - $age` - else - major=`expr $current - $age + 1` - fi + major=`expr $current - $age + 1` + case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; @@ -3457,11 +3410,11 @@ EOF fi # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - #done + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. @@ -3562,12 +3515,13 @@ EOF int main() { return 0; } EOF $rm conftest - if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then + if test "$name" != "" && test "$name" -ne "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) @@ -3606,7 +3560,9 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then $rm conftest - if $LTCC $LTCFLAGS -o conftest conftest.c $i; then + $LTCC $LTCFLAGS -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in @@ -3638,7 +3594,7 @@ EOF droppeddeps=yes $echo $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" + $echo "*** make it link in! You will probably need to install it or some" $echo "*** library that it depends on before this library will be fully" $echo "*** functional. Installing it before continuing would be even better." fi @@ -3924,10 +3880,7 @@ EOF test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then - case $archive_cmds in - *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; - *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; - esac + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi @@ -4286,14 +4239,12 @@ EOF reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. + # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" @@ -4741,16 +4692,16 @@ static const void *lt_preloaded_setup() { case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; @@ -4765,13 +4716,13 @@ static const void *lt_preloaded_setup() { # really was required. # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. @@ -4858,7 +4809,7 @@ static const void *lt_preloaded_setup() { if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -4895,7 +4846,7 @@ static const void *lt_preloaded_setup() { fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. @@ -5302,20 +5253,6 @@ EOF Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' -# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH @@ -5458,7 +5395,7 @@ else ;; esac $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \$*\" + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else @@ -5644,7 +5581,7 @@ fi\ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -5989,9 +5926,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -6200,7 +6137,7 @@ relink_command=\"$relink_command\"" file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : @@ -6411,10 +6348,8 @@ relink_command=\"$relink_command\"" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else - if test ! -f "$dir/$dlname"; then - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE fi ;; @@ -6478,12 +6413,12 @@ relink_command=\"$relink_command\"" fi # Restore saved environment variables - for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - fi" - done + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" @@ -6840,9 +6775,9 @@ The following components of LINK-COMMAND are treated specially: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE + try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX - try to export only the symbols matching REGEX + try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened @@ -6856,11 +6791,9 @@ The following components of LINK-COMMAND are treated specially: -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries + -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] + specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. |