--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2004 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+#
+# Strip comments
+#
+egrep -iv '^#' | awk -f $LDIFSORT
LDIFFILTER=$SRCDIR/scripts/acfilter.sh
CONFFILTER=$SRCDIR/scripts/conf.sh
+LDIFFILTERSORT=$SRCDIR/scripts/acfiltersort.sh
+LDIFSORT=$SRCDIR/scripts/ldifsort.awk
SLAPADD="../servers/slapd/slapd -Ta $LDAP_VERBOSE"
SLAPCAT="../servers/slapd/slapd -Tc $LDAP_VERBOSE"
--- /dev/null
+# Parses LDIF files, eliminating contnuations, and sorts
+# Author: Pierangelo Masarati <ando@sys-net.it>
+
+func parse_line( line ) {
+ getline;
+
+ while ($0 != "") {
+ c = substr($0, 1, 1);
+ if (c == "#") {
+ continue;
+ }
+ if (c != " ") {
+ break;
+ }
+
+ line = line substr($0, 2, length($0));
+
+ getline;
+ }
+
+ return line;
+}
+
+/^dn: / {
+ /* FIXME: works only if DN is on one line... */
+ dn = $0;
+ dn = parse_line(dn);
+
+ while (1) {
+ if ($0 == "") {
+ break;
+ }
+ line = $0;
+ line = parse_line(line);
+ attrs[line] = line
+ }
+
+ entry[dn] = dn "\n";
+ n = asort(attrs);
+ for (i = 1; i <= n; i++) {
+ entry[dn] = entry[dn] attrs[i] "\n"
+ }
+ delete attrs
+}
+
+END {
+ n = asort(entry);
+ for (i = 1; i <= n; i++) {
+ print entry[i];
+ }
+}
fi
echo "Filtering ldapsearch results..."
- . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+ . $LDIFFILTERSORT < $SEARCHOUT > $SEARCHFLT
echo "Filtering modified ldif..."
- . $LDIFFILTER < $SQLWRITE > $LDIFFLT
+ . $LDIFFILTERSORT < $SQLWRITE > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT