dirsrvtests/create_test.py
by Mark Reynolds
dirsrvtests/create_test.py | 131 +++++++++++++++++++--------------------------
1 file changed, 58 insertions(+), 73 deletions(-)
New commits:
commit 70ccd9bcaa66133d71654c11d3aac53764d32901
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Aug 12 11:54:37 2015 -0400
Ticket 48242 - Improve dirsrvtests/create_test.py script
From: Simon Pichugin <spichugi(a)redhat.com>
Date: Fri, 7 Aug 2015 14:00:39 +0200
Description: Refactor docstrings, now they match the PEP 0257 standard
Refactor script, depends on the pytest mechanic(finalizers,
fixtures and main function)
https://fedorahosted.org/389/ticket/48242
Reviewed by: mreynolds
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 941e922..ad9e5aa 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -5,20 +5,19 @@
# All rights reserved.
#
# License: GPL (version 3 or any later version).
-# See LICENSE for details.
+# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
import sys
import optparse
-'''
- This script generates a template test script that handles the
- non-interesting parts of a test script:
- topology,
- test (to be completed by the user),
- final,
- and run-isolated functions
-'''
+"""This script generates a template test script that handles the
+non-interesting parts of a test script:
+- topology,
+- test (to be completed by the user),
+- final,
+- and run-isolated function
+"""
def displayUsage():
@@ -33,6 +32,34 @@ def displayUsage():
'There is a maximum of 10 masters, 10 hubs, and 10 consumers.')
exit(1)
+
+def writeFinalizer():
+ """Write the finalizer function - delete each instance"""
+
+ TEST.write(' # Delete each instance in the end\n')
+ TEST.write(' def fin():\n')
+ if repl_deployment:
+ for idx in range(masters):
+ idx += 1
+ TEST.write(' master' + str(idx) + '.delete()\n')
+ for idx in range(hubs):
+ idx += 1
+ TEST.write(' hub' + str(idx) + '.delete()\n')
+ for idx in range(consumers):
+ idx += 1
+ TEST.write(' consumer' + str(idx) + '.delete()\n')
+ else:
+ for idx in range(instances):
+ idx += 1
+ if idx == 1:
+ idx = ''
+ else:
+ idx = str(idx)
+ TEST.write(' standalone' + idx + '.delete()\n')
+ TEST.write(' request.addfinalizer(fin)')
+ TEST.write('\n\n')
+
+
desc = 'Script to generate an initial lib389 test script. ' + \
'This generates the topology, test, final, and run-isolated functions.'
@@ -435,6 +462,8 @@ if len(sys.argv) > 0:
TEST.write(' assert False\n')
TEST.write('\n')
+ writeFinalizer()
+
#
# Write the finals steps for replication
#
@@ -483,9 +512,12 @@ if len(sys.argv) > 0:
TEST.write(' standalone' + idx + '.create()\n')
TEST.write(' standalone' + idx + '.open()\n\n')
+ writeFinalizer()
+
TEST.write(' # Clear out the tmp dir\n')
TEST.write(' standalone.clearTmpDir(__file__)\n')
TEST.write('\n')
+
TEST.write(' return TopologyStandalone(standalone')
for idx in range(instances):
idx += 1
@@ -501,82 +533,35 @@ if len(sys.argv) > 0:
#
if ticket:
TEST.write('def test_ticket' + ticket + '(topology):\n')
- TEST.write(" '''\n")
if repl_deployment:
- TEST.write(' Write your replication testcase here.\n\n')
+ TEST.write(' """Write your replication testcase here.\n\n')
TEST.write(' To access each DirSrv instance use: topology.master1, topology.master2,\n' +
- ' ..., topology.hub1, ..., topology.consumer1, ...\n')
+ ' ..., topology.hub1, ..., topology.consumer1, ...\n\n')
+ TEST.write(' Also, if you need any testcase initialization,\n')
+ TEST.write(' please, write additional fixture for that(include finalizer).\n')
else:
- TEST.write(' Write your testcase here...\n')
- TEST.write(" '''\n\n")
+ TEST.write(' """Write your testcase here...\n\n')
+ TEST.write(' Also, if you need any testcase initialization,\n')
+ TEST.write(' please, write additional fixture for that(include finalizer).\n')
+ TEST.write(' """\n\n')
TEST.write(" log.info('Test complete')\n")
- TEST.write("\n\n")
+ TEST.write('\n\n')
else:
- # For suite we start with an init function
- TEST.write('def test_' + suite + '_init(topology):\n')
- TEST.write(" '''\n")
- TEST.write(' Write any test suite initialization here(if needed)\n')
- TEST.write(" '''\n\n return\n\n\n")
-
# Write the first initial empty test function
TEST.write('def test_' + suite + '_#####(topology):\n')
- TEST.write(" '''\n")
- TEST.write(' Write a single test here...\n')
- TEST.write(" '''\n\n return\n\n\n")
-
- #
- # Write the final function here - delete each instance
- #
- if ticket:
- TEST.write('def test_ticket' + ticket + '_final(topology):\n')
- else:
- # suite
- TEST.write('def test_' + suite + '_final(topology):\n')
- if repl_deployment:
- for idx in range(masters):
- idx += 1
- TEST.write(' topology.master' + str(idx) + '.delete()\n')
- for idx in range(hubs):
- idx += 1
- TEST.write(' topology.hub' + str(idx) + '.delete()\n')
- for idx in range(consumers):
- idx += 1
- TEST.write(' topology.consumer' + str(idx) + '.delete()\n')
- else:
- for idx in range(instances):
- idx += 1
- if idx == 1:
- idx = ''
- else:
- idx = str(idx)
- TEST.write(' topology.standalone' + idx + '.delete()\n')
-
- if ticket:
- TEST.write(" log.info('Testcase PASSED')\n")
- else:
- # suite
- TEST.write(" log.info('" + suite + " test suite PASSED')\n")
- TEST.write('\n\n')
+ TEST.write(' """Write a single test here...\n\n')
+ TEST.write(' Also, if you need any test suite initialization,\n')
+ TEST.write(' please, write additional fixture for that(include finalizer).\n')
+ TEST.write(' """\n\n return\n\n\n')
#
# Write the main function
#
- TEST.write('def run_isolated():\n')
- TEST.write(' global installation1_prefix\n')
- TEST.write(' installation1_prefix = None\n\n')
- TEST.write(' topo = topology(True)\n')
- if ticket:
- TEST.write(' test_ticket' + ticket + '(topo)\n')
- TEST.write(' test_ticket' + ticket + '_final(topo)\n')
- else:
- # suite
- TEST.write(' test_' + suite + '_init(topo)\n')
- TEST.write(' test_' + suite + '_#####(topo)\n')
- TEST.write(' test_' + suite + '_final(topo)\n')
- TEST.write('\n\n')
-
TEST.write("if __name__ == '__main__':\n")
- TEST.write(' run_isolated()\n\n')
+ TEST.write(' # Run isolated\n')
+ TEST.write(' # -s for DEBUG mode\n')
+ TEST.write(' CURRENT_FILE = os.path.realpath(__file__)\n')
+ TEST.write(' pytest.main("-s %s" % CURRENT_FILE)')
#
# Done, close things up
8 years, 8 months
Changes to 'refs/tags/389-console-1.1.13'
by Noriko Hosoi
Changes since the dawn of time:
Mark Reynolds (3):
Ticket 97 - 389-console should provide man page
Ticket 47604 - 389-console: remove versioned jars from %{_javadir}
Bump version to 1.1.8
Nathan Kinder (3):
Initial import of fedora-idm-console
Resolves: 183962
Resolves: 393461
Noriko Hosoi (6):
Ticket 97 - 389-console should provide man page
Bump version to 1.1.9
version 1.1.10
version 1.1.11
version 1.1.12
version 1.1.13
Rich Megginson (33):
initial commit of Fedora Console for Windows - has no UI
added UI and graphics
package is not noarch
support for JAVA with spaces in the pathname
added license
updated spec for Fedora DS 1.1 release
Resolves: bug 428352
Resolves: bug 480631
Reviewed by: nkinder (Thanks!)
Resolves: bug 476095
bump version to 1.1.3 to sync with CVS tag
added unzip.vbs ; cleaned up/simplified Makefile
update idm console version to 20090310
update for 1.1.3
fix typo in Makefile
Initial commit of renaming to 389
Forgot to add provides and obsoletes for fedora-idm-console
added .gitignore
added need_libdir flag to control where libdir is needed to find jss
fix spelling error
Add 64-bit support - Use replaceable parameters for names, guids
Remove old package during upgrade
Remove old shortcuts must ignore All Users folders
Force shortcuts to be removed - removeoldpkg must run asyncNoWait
Bump version to 1.1.4
Changed version to 1.1.4.a1
make sure bitsadmin.exe path is quoted
update to version 1.1.4 rc1
update to version 1.1.4
update for nspr 4.8.4, nss 3.12.6, and idm console framework 1.1.5
Bug 592120 - console for 64bit Window2008 can not be installed
allow building without the script - bump version to 1.1.7
port to wix 3.0 from mozilla-build - use idm console 1.1.7
8 years, 8 months
build.properties win/Makefile win/VERSION.mak
by Noriko Hosoi
build.properties | 2 +-
win/Makefile | 3 +++
win/VERSION.mak | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 94583251602a6c09ca0f521aac773b022b09bdcc
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Aug 11 14:13:32 2015 -0700
version 1.1.13
- Generates $(FILEPREF)-console-ipv4.bat on the fly with the java
option "-Djava.net.preferIPv4Stack=true"
diff --git a/build.properties b/build.properties
index b34dc8d..3b83aac 100644
--- a/build.properties
+++ b/build.properties
@@ -23,7 +23,7 @@ lang=en
console.root=.
console.version=11
-console.dotversion=1.1.12
+console.dotversion=1.1.13
console.dotgenversion=1.1
theme.core=389-console
diff --git a/win/Makefile b/win/Makefile
index dd994b7..53694b2 100644
--- a/win/Makefile
+++ b/win/Makefile
@@ -89,6 +89,7 @@ MOZILLABUILDDIR=c:\mozilla-build
#UZCMD=cscript //nologo unzip.vbs
UZCMD=$(MOZILLABUILDDIR)\info-zip\unzip.exe -q -o
+SED=$(MOZILLABUILDDIR)\msys\bin\sed.exe
NSPRVER=4.8.4
NSSVER=3_12_6
@@ -197,6 +198,8 @@ LAYOUT : $(PKGDIR) $(NSPRLIBDIR)\nspr4.dll $(NSSLIBDIR)\nss3.dll $(JSSDIR)\jss4.
# directory should already contain the bat file, icon, and bitmaps
@(echo @echo off&echo set FILEPREF=$(FILEPREF)) > header
copy /Y header+template.bat $(PKGDIR)\$(FILEPREF)-console.bat
+ copy /Y header+template.bat $(PKGDIR)\$(FILEPREF)-console-ipv4.bat
+ $(SED) -i -e "s/com.netscape.management.client.console.Console/-Djava.net.preferIPv4Stack=true &/" $(PKGDIR)\$(FILEPREF)-console-ipv4.bat
del header
copy /Y $(ICONDIR)\*.ico $(PKGDIR)
copy /Y $(BITMAPDIR)\* $(PKGDIR)\Bitmaps\*
diff --git a/win/VERSION.mak b/win/VERSION.mak
index 7e58e64..c09d2ca 100644
--- a/win/VERSION.mak
+++ b/win/VERSION.mak
@@ -7,7 +7,7 @@ BRANDNOSPACE=389
# this is the vendor or manufacturer
VENDOR=389 Project
# the version
-VERSION=1.1.12
+VERSION=1.1.13
# the name of the product - this is used in the title of the
# installer, in the name of the folder, and in the name
# of the shortcuts
8 years, 8 months
Branch '389-ds-base-1.2.11' - ldap/admin man/man8
by Noriko Hosoi
ldap/admin/src/scripts/remove-ds.pl.in | 5 +++--
man/man8/remove-ds.pl.8 | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
New commits:
commit 992541f1cadeed0a3e87ef7b2728429939b841ff
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Aug 11 10:23:21 2015 -0700
Ticket #48245 - Man pages and help for remove-ds.pl doesn't display "-a" option
Description: Adding the description for "-a" to the man page and the help usage.
https://fedorahosted.org/389/ticket/48245
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit a2dbb56ec5ad468972a41a500e1cdbb4ced01cb0)
(cherry picked from commit 06dafdfed1528ea6724f61492f4c93977a3ce809)
(cherry picked from commit b482c9fa2e4dc0d2280675a95e0a71af052f4fd8)
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in b/ldap/admin/src/scripts/remove-ds.pl.in
index 5f42615..0e7dd0d 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -34,8 +34,9 @@ Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
my $res = new Resource("@propertydir(a)/setup-ds.res");
sub usage {
- print(STDERR "Usage: $0 [-f] [-d -d ... -d] -i instance\n\n");
- print(STDERR " Opts: -f - force removal\n");
+ print(STDERR "Usage: $0 [-a] [-f] [-d -d ... -d] -i instance\n\n");
+ print(STDERR " Opts: -a - remove all\n");
+ print(STDERR " -f - force removal\n");
print(STDERR " -i instance - instance name to remove (e.g. - slapd-example)\n");
print(STDERR " -d - turn on debugging output\n");
}
diff --git a/man/man8/remove-ds.pl.8 b/man/man8/remove-ds.pl.8
index 3bcf1e0..bb38c46 100644
--- a/man/man8/remove-ds.pl.8
+++ b/man/man8/remove-ds.pl.8
@@ -19,7 +19,7 @@
remove\-ds.pl \- Remove an instance of Directory Server
.SH SYNOPSIS
.B remove-ds.pl
-[\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
+[\-a] [\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
.SH DESCRIPTION
Removes a Directory Server instance from the system. The instance
will be shutdown and the files will be removed. The certificate
@@ -33,6 +33,9 @@ will contain the retained certificate database files.
.SH OPTIONS
A summary of options is included below:
.TP
+.B \fB\-a\fR
+Removes all files and directories belonging to the instance
+.TP
.B \fB\-f\fR
Force removal
.TP
8 years, 8 months
Branch '389-ds-base-1.3.3' - ldap/admin man/man8
by Noriko Hosoi
ldap/admin/src/scripts/remove-ds.pl.in | 5 +++--
man/man8/remove-ds.pl.8 | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
New commits:
commit b482c9fa2e4dc0d2280675a95e0a71af052f4fd8
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Aug 11 10:23:21 2015 -0700
Ticket #48245 - Man pages and help for remove-ds.pl doesn't display "-a" option
Description: Adding the description for "-a" to the man page and the help usage.
https://fedorahosted.org/389/ticket/48245
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit a2dbb56ec5ad468972a41a500e1cdbb4ced01cb0)
(cherry picked from commit 06dafdfed1528ea6724f61492f4c93977a3ce809)
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in b/ldap/admin/src/scripts/remove-ds.pl.in
index be3d903..82f825d 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -30,8 +30,9 @@ Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
my $res = new Resource("@propertydir(a)/setup-ds.res");
sub usage {
- print(STDERR "Usage: $0 [-f] [-d -d ... -d] -i instance\n\n");
- print(STDERR " Opts: -f - force removal\n");
+ print(STDERR "Usage: $0 [-a] [-f] [-d -d ... -d] -i instance\n\n");
+ print(STDERR " Opts: -a - remove all\n");
+ print(STDERR " -f - force removal\n");
print(STDERR " -i instance - instance name to remove (e.g. - slapd-example)\n");
print(STDERR " -d - turn on debugging output\n");
}
diff --git a/man/man8/remove-ds.pl.8 b/man/man8/remove-ds.pl.8
index 8c7c118..0568ff8 100644
--- a/man/man8/remove-ds.pl.8
+++ b/man/man8/remove-ds.pl.8
@@ -19,7 +19,7 @@
remove\-ds.pl \- Remove an instance of Directory Server
.SH SYNOPSIS
.B remove-ds.pl
-[\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
+[\-a] [\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
.SH DESCRIPTION
Removes a Directory Server instance from the system. The instance
will be shutdown and the files will be removed. The certificate
@@ -33,6 +33,9 @@ will contain the retained certificate database files.
.SH OPTIONS
A summary of options is included below:
.TP
+.B \fB\-a\fR
+Removes all files and directories belonging to the instance
+.TP
.B \fB\-f\fR
Force removal
.TP
8 years, 8 months
Branch '389-ds-base-1.3.4' - ldap/admin man/man8
by Noriko Hosoi
ldap/admin/src/scripts/remove-ds.pl.in | 5 +++--
man/man8/remove-ds.pl.8 | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
New commits:
commit 06dafdfed1528ea6724f61492f4c93977a3ce809
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Aug 11 10:23:21 2015 -0700
Ticket #48245 - Man pages and help for remove-ds.pl doesn't display "-a" option
Description: Adding the description for "-a" to the man page and the help usage.
https://fedorahosted.org/389/ticket/48245
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit a2dbb56ec5ad468972a41a500e1cdbb4ced01cb0)
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in b/ldap/admin/src/scripts/remove-ds.pl.in
index e7eb591..b35ae32 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -21,8 +21,9 @@ Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
my $res = new Resource("@propertydir(a)/setup-ds.res");
sub usage {
- print(STDERR "Usage: $0 [-f] [-d -d ... -d] -i instance\n\n");
- print(STDERR " Opts: -f - force removal\n");
+ print(STDERR "Usage: $0 [-a] [-f] [-d -d ... -d] -i instance\n\n");
+ print(STDERR " Opts: -a - remove all\n");
+ print(STDERR " -f - force removal\n");
print(STDERR " -i instance - instance name to remove (e.g. - slapd-example)\n");
print(STDERR " -d - turn on debugging output\n");
}
diff --git a/man/man8/remove-ds.pl.8 b/man/man8/remove-ds.pl.8
index 8c7c118..0568ff8 100644
--- a/man/man8/remove-ds.pl.8
+++ b/man/man8/remove-ds.pl.8
@@ -19,7 +19,7 @@
remove\-ds.pl \- Remove an instance of Directory Server
.SH SYNOPSIS
.B remove-ds.pl
-[\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
+[\-a] [\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
.SH DESCRIPTION
Removes a Directory Server instance from the system. The instance
will be shutdown and the files will be removed. The certificate
@@ -33,6 +33,9 @@ will contain the retained certificate database files.
.SH OPTIONS
A summary of options is included below:
.TP
+.B \fB\-a\fR
+Removes all files and directories belonging to the instance
+.TP
.B \fB\-f\fR
Force removal
.TP
8 years, 8 months
ldap/admin man/man8
by Noriko Hosoi
ldap/admin/src/scripts/remove-ds.pl.in | 5 +++--
man/man8/remove-ds.pl.8 | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
New commits:
commit a2dbb56ec5ad468972a41a500e1cdbb4ced01cb0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Aug 11 10:23:21 2015 -0700
Ticket #48245 - Man pages and help for remove-ds.pl doesn't display "-a" option
Description: Adding the description for "-a" to the man page and the help usage.
https://fedorahosted.org/389/ticket/48245
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in b/ldap/admin/src/scripts/remove-ds.pl.in
index e7eb591..b35ae32 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -21,8 +21,9 @@ Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
my $res = new Resource("@propertydir(a)/setup-ds.res");
sub usage {
- print(STDERR "Usage: $0 [-f] [-d -d ... -d] -i instance\n\n");
- print(STDERR " Opts: -f - force removal\n");
+ print(STDERR "Usage: $0 [-a] [-f] [-d -d ... -d] -i instance\n\n");
+ print(STDERR " Opts: -a - remove all\n");
+ print(STDERR " -f - force removal\n");
print(STDERR " -i instance - instance name to remove (e.g. - slapd-example)\n");
print(STDERR " -d - turn on debugging output\n");
}
diff --git a/man/man8/remove-ds.pl.8 b/man/man8/remove-ds.pl.8
index 8c7c118..0568ff8 100644
--- a/man/man8/remove-ds.pl.8
+++ b/man/man8/remove-ds.pl.8
@@ -19,7 +19,7 @@
remove\-ds.pl \- Remove an instance of Directory Server
.SH SYNOPSIS
.B remove-ds.pl
-[\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
+[\-a] [\-f] [\-d \-d ... \-d] \-i \fIinstance\fR
.SH DESCRIPTION
Removes a Directory Server instance from the system. The instance
will be shutdown and the files will be removed. The certificate
@@ -33,6 +33,9 @@ will contain the retained certificate database files.
.SH OPTIONS
A summary of options is included below:
.TP
+.B \fB\-a\fR
+Removes all files and directories belonging to the instance
+.TP
.B \fB\-f\fR
Force removal
.TP
8 years, 8 months
Branch '389-ds-base-1.3.4' - ldap/admin rpm/389-ds-base-git.sh rpm/add_patches.sh rpm/rpmverrel.sh wrappers/initscript.in wrappers/ldap-agent-initscript.in
by Noriko Hosoi
ldap/admin/src/initconfig.in | 4 -
ldap/admin/src/scripts/DSSharedLib.in | 92 ++++++++++++++----------------
ldap/admin/src/scripts/bak2db.in | 23 ++++---
ldap/admin/src/scripts/db2bak.in | 7 --
ldap/admin/src/scripts/db2index.in | 4 -
ldap/admin/src/scripts/db2ldif.in | 22 +++----
ldap/admin/src/scripts/dbverify.in | 6 -
ldap/admin/src/scripts/dn2rdn.in | 4 -
ldap/admin/src/scripts/ldif2db.in | 4 -
ldap/admin/src/scripts/ldif2ldap.in | 46 +++++++--------
ldap/admin/src/scripts/monitor.in | 44 +++++++-------
ldap/admin/src/scripts/restart-dirsrv.in | 2
ldap/admin/src/scripts/restoreconfig.in | 4 -
ldap/admin/src/scripts/saveconfig.in | 6 -
ldap/admin/src/scripts/start-dirsrv.in | 16 ++---
ldap/admin/src/scripts/stop-dirsrv.in | 14 ++--
ldap/admin/src/scripts/suffix2instance.in | 6 -
ldap/admin/src/scripts/upgradedb.in | 4 -
ldap/admin/src/scripts/upgradednformat.in | 6 -
ldap/admin/src/scripts/vlvindex.in | 4 -
rpm/389-ds-base-git.sh | 2
rpm/add_patches.sh | 4 -
rpm/rpmverrel.sh | 2
wrappers/initscript.in | 26 ++------
wrappers/ldap-agent-initscript.in | 28 +++------
25 files changed, 181 insertions(+), 199 deletions(-)
New commits:
commit 49245911410cdd04bc53b00d8973c26defa5a37b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Aug 10 17:04:25 2015 -0700
Ticket #47511 - bashisms in 389-ds-base admin scripts
Description by mvocu (Thank you):
The shell scripts in 389-ds-base/ldap/admin/src/scripts use 'source'
to source common scripts; the 'source' keyword is bash-specific (or
c-shell, if memory serves). The interpreter is set to /bin/sh, which
is not guaranteed to be bash (and at least on Debian 7.1 it is dash).
The 'source' keyword can be replaced by '.', which should work.
The patch was provided by tjaalton(a)ubuntu.com (Thank you, Timo!).
https://fedorahosted.org/389/ticket/47511
Reviewed and tested by nhosoi(a)redhat.com.
(cherry picked from commit 2ce7a7334bcb89e47c0f5c544144aec37010a5b9)
diff --git a/ldap/admin/src/initconfig.in b/ldap/admin/src/initconfig.in
index 134e82c..7afa315 100644
--- a/ldap/admin/src/initconfig.in
+++ b/ldap/admin/src/initconfig.in
@@ -2,11 +2,11 @@
OS=`uname -s`
# use the new mt slab memory allocator on Solaris
# this requires Solaris 9 update 3 or later
-if [ "$OS" = "SunOS" -a -f /usr/lib/libumem.so ] ; then
+if [ "$OS" = "SunOS" ] && [ -f /usr/lib/libumem.so ] ; then
LD_PRELOAD=/usr/lib/libumem.so
export LD_PRELOAD
fi
-if [ "$OS" = "SunOS" -a -f /usr/lib/64/libumem.so ] ; then
+if [ "$OS" = "SunOS" ] && [ -f /usr/lib/64/libumem.so ] ; then
LD_PRELOAD_64=/usr/lib/64/libumem.so
export LD_PRELOAD_64
fi
diff --git a/ldap/admin/src/scripts/DSSharedLib.in b/ldap/admin/src/scripts/DSSharedLib.in
index 3683696..8317c58 100644
--- a/ldap/admin/src/scripts/DSSharedLib.in
+++ b/ldap/admin/src/scripts/DSSharedLib.in
@@ -98,13 +98,13 @@ get_init_file()
do
inst_count=`expr $inst_count + 1`
id=`normalize_server_id $configfile`
- if [ -n "$servid" -a "$id" = "$servid" ]
+ if [ -n "$servid" ] && [ "$id" = "$servid" ]
then
# found it
echo $configfile
exit 0
fi
- if [ $first == "yes" ]
+ if [ $first = "yes" ]
then
instances=$id
first="no"
@@ -114,7 +114,7 @@ get_init_file()
done
# server id not provided, check if there is only one instance
- if [ -z "$servid" -a $inst_count -eq 1 ]
+ if [ -z "$servid" ] && [ $inst_count -eq 1 ]
then
# return the file
echo $configfile
@@ -135,48 +135,44 @@ process_dse ()
configdir=$1
pid=$2
file="$configdir/dse.ldif"
- shopt -s nocasematch
- OLD_IFC=$IFC
+ OLD_IFS=$IFS
IFS=""
while read -r LINE
do
- if [[ $LINE != \ * ]] && [ "$output" != "" ]
+ case $LINE in
+ ' '*)
+ ;;
+ *)
+ if [ -n "$output" ]
+ then
+ echo "$output" >> /tmp/DSSharedLib.$pid
+ output=""
+ fi
+ ;;
+ esac
+ if [ -n "$output" ]
then
- echo "$output" >> /tmp/DSSharedLib.$pid
- output=""
- fi
- if [ "$output" != "" ] && [[ $LINE == \ * ]]
- then
- # continuation line, strip the space and append it
- LINE=`echo "$LINE" | sed -e 's/^ //'`
- output=$output$LINE
- elif [[ $LINE == nsslapd-port* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-localhost* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-securePort* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-security* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapilisten* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapifilepath* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-rootdn* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapiautobind* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-certdir* ]]
- then
- output=$LINE;
+ case $LINE in
+ ' '*)
+ # continuation line, strip the space and append it
+ LINE=`echo "$LINE" | sed -e 's/^ //'`
+ output=$output$LINE
+ ;;
+ esac
+ else
+ case $LINE in
+ nsslapd-certdir*|\
+ nsslapd-ldapiautobind*|\
+ nsslapd-ldapilisten*|\
+ nsslapd-ldapifilepath*|\
+ nsslapd-localhost*|\
+ nsslapd-port*|\
+ nsslapd-rootdn*|\
+ nsslapd-securePort*|\
+ nsslapd-security*)
+ output=$LINE
+ ;;
+ esac
fi
done < $file
@@ -194,19 +190,19 @@ check_protocol ()
ldapi=$3
openldap=$4
- if [ "$protocol" == "LDAPI" ] && [ "$openldap" != "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] && [ "$openldap" != "yes" ]; then
echo ""
exit
- elif [ "$protocol" == "LDAPI" ] && [ "$ldapi" == "off" ]; then
+ elif [ "$protocol" = "LDAPI" ] && [ "$ldapi" = "off" ]; then
echo ""
exit
- elif [ "$protocol" == "STARTTLS" ]; then
- if [ "$security" == "" ] || [ "$security" == "off" ]; then
+ elif [ "$protocol" = "STARTTLS" ]; then
+ if [ -z "$security" ] || [ "$security" = "off" ]; then
echo ""
exit
fi
- elif [ "$protocol" == "LDAPS" ]; then
- if [ "$security" == "" ] || [ "$security" == "off" ]; then
+ elif [ "$protocol" = "LDAPS" ]; then
+ if [ -z "$security" ] || [ "$security" = "off" ]; then
echo ""
exit
fi
@@ -224,4 +220,4 @@ check_protocol ()
fi
echo "$protocol"
-}
\ No newline at end of file
+}
diff --git a/ldap/admin/src/scripts/bak2db.in b/ldap/admin/src/scripts/bak2db.in
index f0cede4..a2e54cc 100755
--- a/ldap/admin/src/scripts/bak2db.in
+++ b/ldap/admin/src/scripts/bak2db.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -26,15 +26,18 @@ if [ $# -lt 1 ] || [ $# -gt 7 ]
then
usage
exit 1
-elif [[ $1 == -* ]]
-then
- usage
- exit 1
-else
- archivedir=$1
- shift
fi
-
+case $1 in
+ -*)
+ usage
+ exit 1
+ ;;
+ *)
+ archivedir=$1
+ shift
+ ;;
+esac
+
while getopts "hn:Z:qd:vi:a:SD:" flag
do
case $flag in
@@ -55,7 +58,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/db2bak.in b/ldap/admin/src/scripts/db2bak.in
index dacd7b0..1896c19 100755
--- a/ldap/admin/src/scripts/db2bak.in
+++ b/ldap/admin/src/scripts/db2bak.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -26,7 +26,6 @@ then
usage
exit 1
fi
-
if [ "$#" -gt 0 ]
then
if [[ $1 != -* ]]
@@ -56,7 +55,7 @@ done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -67,7 +66,7 @@ fi
servid=`normalize_server_id $initfile`
. $initfile
-if [ -z $bak_dir ]
+if [ -z "$bak_dir" ]
then
bak_dir=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/$servid-`date +%Y_%m_%d_%H_%M_%S`
fi
diff --git a/ldap/admin/src/scripts/db2index.in b/ldap/admin/src/scripts/db2index.in
index a1321ea..2b76cd1 100755
--- a/ldap/admin/src/scripts/db2index.in
+++ b/ldap/admin/src/scripts/db2index.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -59,7 +59,7 @@ then
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/db2ldif.in b/ldap/admin/src/scripts/db2ldif.in
index d7e0ff0..fcf73a0 100755
--- a/ldap/admin/src/scripts/db2ldif.in
+++ b/ldap/admin/src/scripts/db2ldif.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -39,7 +39,7 @@ make_ldiffile()
be=""
while [ "$1" != "" ]
do
- if [ "$1" = "-a" ]; then
+ if [ "x$1" = "x-a" ]; then
shift
if [ `expr "$1" : "/.*"` -gt 0 ]; then
if [ `expr "$1" : "/.*"` -gt 0 ]; then
@@ -56,17 +56,17 @@ make_ldiffile()
shift
return 0
fi
- elif [ "$1" = "-n" ]; then
+ elif [ "x$1" = "x-n" ]; then
shift
- if [ "$be" = "" ]; then
+ if [ -z "$be" ]; then
be="$1"
else
tmpbe="$be"
be="${tmpbe}-$1"
fi
- elif [ "$1" = "-s" ]; then
+ elif [ "x$1" = "x-s" ]; then
shift
- if [ "$1" != "" ]; then
+ if [ -n "$1" ]; then
rdn=`echo $1 | awk -F, '{print $1}'`
rdnval=`echo $rdn | awk -F= '{print $2}'`
if [ "$be" = "" ]; then
@@ -76,15 +76,15 @@ make_ldiffile()
be="${tmpbe}-$rdnval"
fi
fi
- elif [ "$1" = "-M" ]; then
+ elif [ "x$1" = "x-M" ]; then
be=""
fi
- if [ "$1" != "" ]; then
+ if [ -n "$1" ]; then
shift
fi
done
- if [ "$be" = "" ]; then
+ if [ -z "$be" ]; then
echo @localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/ldif/$servid-`date +%Y_%m_%d_%H%M%S`.ldif
else
echo @localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/ldif/$servid-${be}-`date +%Y_%m_%d_%H%M%S`.ldif
@@ -92,7 +92,7 @@ make_ldiffile()
return 0
}
-if [ "$#" -lt 2 ];
+if [ $# -lt 2 ];
then
usage
exit 1
@@ -137,7 +137,7 @@ then
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/dbverify.in b/ldap/admin/src/scripts/dbverify.in
index 461cc16..bbacc17 100755
--- a/ldap/admin/src/scripts/dbverify.in
+++ b/ldap/admin/src/scripts/dbverify.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -47,7 +47,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -58,7 +58,7 @@ fi
. $initfile
@sbindir@/ns-slapd dbverify -D $CONFIG_DIR $args
-if [ $display_version == "yes" ]; then
+if [ $display_version = "yes" ]; then
exit 0
fi
if [ $? -eq 0 ]; then
diff --git a/ldap/admin/src/scripts/dn2rdn.in b/ldap/admin/src/scripts/dn2rdn.in
index 32a70c8..616969a 100755
--- a/ldap/admin/src/scripts/dn2rdn.in
+++ b/ldap/admin/src/scripts/dn2rdn.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -39,7 +39,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/ldif2db.in b/ldap/admin/src/scripts/ldif2db.in
index ce15349..a34241a 100755
--- a/ldap/admin/src/scripts/ldif2db.in
+++ b/ldap/admin/src/scripts/ldif2db.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -82,7 +82,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/ldif2ldap.in b/ldap/admin/src/scripts/ldif2ldap.in
index 874b1bb..1e871be 100755
--- a/ldap/admin/src/scripts/ldif2ldap.in
+++ b/ldap/admin/src/scripts/ldif2ldap.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@ldapsdk_libdir@"
libpath_add "@libdir@"
@@ -40,14 +40,14 @@ do
esac
done
-if [ "$input_file" == "" ]
+if [ -z "$input_file" ]
then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -67,13 +67,13 @@ ldapi=$(grep -i 'nsslapd-ldapilisten' $file | awk '{print $2}' )
ldapiURL=$(grep -i 'nsslapd-ldapifilepath' $file | awk '{print $2}' )
certdir=$(grep -i 'nsslapd-certdir' $file | awk '{print $2}' )
autobind=$(grep -i 'nsslapd-ldapiautobind' $file | awk '{print $2}' )
-if [ "$rootdn" == "" ]; then
+if [ -z "$rootdn" ]; then
value=$(grep -i 'nsslapd-rootdn' $file)
rootdn=`echo "$value" | sed -e 's/nsslapd-rootdn: //i'`
fi
rm $file
-if [ "$ldapiURL" != "" ]; then
+if [ -n "$ldapiURL" ]; then
ldapiURL=`echo "$ldapiURL" | sed -e 's/\//%2f/g'`
ldapiURL="ldapi://"$ldapiURL
fi
@@ -86,7 +86,7 @@ then
export LDAPTLS_CACERTDIR=$certdir
fi
-if [ -z $security ]; then
+if [ -z "$security" ]; then
security="off"
fi
revised_protocol=$(check_protocol $protocol $security $ldapi $openldap)
@@ -99,12 +99,12 @@ protocol=$revised_protocol
#
# STARTTLS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "STARTTLS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "STARTTLS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(STARTTLS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -ZZ -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -ZZZ -P $certdir -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
@@ -116,12 +116,12 @@ fi
#
# LDAPS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "LDAPS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "LDAPS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -H "ldaps://$host:$secure_port" -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -Z -P $certdir -p $secure_port -h $host -D $rootdn -w $passwd -a -f $input_file
@@ -133,21 +133,21 @@ fi
#
# LDAPI
#
-if [ "$ldapi" == "on" ] && [ "$openldap" == "yes" ]; then
- if [ "$protocol" == "LDAPI" ] || [ "$protocol" == "" ]; then
- if [ "$(id -u)" == "0" ] && [ "$autobind" == "on" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$ldapi" = "on" ] && [ "$openldap" = "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] || [ -z "$protocol" ]; then
+ if [ $(id -u) -eq 0 ] && [ "$autobind" = "on" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI/AUTOBIND)"
fi
ldapmodify -H $ldapiURL -Y EXTERNAL -a -f $input_file 2>/dev/null
else
- if [ "$error" == "yes" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI)"
fi
ldapmodify -x -H $ldapiURL -D $rootdn -w $passwd -a -f $input_file
fi
rc=$?
- if [ $rc != 0 ]
+ if [ $rc -ne 0 ]
then
echo "Operation failed (error $rc)"
fi
@@ -158,11 +158,11 @@ fi
#
# LDAP
#
-if [ "$protocol" == "LDAP" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$protocol" = "LDAP" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAP)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
diff --git a/ldap/admin/src/scripts/monitor.in b/ldap/admin/src/scripts/monitor.in
index 7b2058b..36a2fc9 100755
--- a/ldap/admin/src/scripts/monitor.in
+++ b/ldap/admin/src/scripts/monitor.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@ldapsdk_libdir@"
@@ -41,7 +41,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -66,17 +66,17 @@ ldapi=$(grep -i 'nsslapd-ldapilisten' $file | awk '{print $2}' )
ldapiURL=$(grep -i 'nsslapd-ldapifilepath' $file | awk '{print $2}' )
certdir=$(grep -i 'nsslapd-certdir' $file | awk '{print $2}' )
autobind=$(grep -i 'nsslapd-ldapiautobind' $file | awk '{print $2}' )
-if [ "$rootdn" == "" ]; then
+if [ -z "$rootdn" ]; then
value=$(grep -i 'nsslapd-rootdn' $file)
rootdn=`echo "$value" | sed -e 's/nsslapd-rootdn: //i'`
fi
rm $file
-if [ "$passwd" != "" ]; then
+if [ -n "$passwd" ]; then
dn="-D $rootdn"
passwd="-w$passwd"
fi
-if [ "$ldapiURL" != "" ]
+if [ -n "$ldapiURL" ]
then
ldapiURL=`echo "$ldapiURL" | sed -e 's/\//%2f/g'`
ldapiURL="ldapi://"$ldapiURL
@@ -103,12 +103,12 @@ protocol=$revised_protocol
#
# STARTTLS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "STARTTLS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "STARTTLS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(STARTTLS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -ZZ -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -ZZZ -P $certdir -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -120,12 +120,12 @@ fi
#
# LDAPS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "LDAPS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "LDAPS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -H "ldaps://$host:$secure_port" -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -Z -P $certdir -p $secure_port -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -137,15 +137,15 @@ fi
#
# LDAPI
#
-if [ "$ldapi" == "on" ] && [ "$openldap" == "yes" ]; then
- if [ "$protocol" == "LDAPI" ] || [ "$protocol" == "" ]; then
- if [ "$(id -u)" == "0" ] && [ "$autobind" == "on" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$ldapi" = "on" ] && [ "$openldap" = "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] || [ -z "$protocol" ]; then
+ if [ $(id -u) -eq 0 ] && [ "$autobind" = "on" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI/AUTOBIND)"
fi
ldapsearch -LLL -H "$ldapiURL" -b "$MDN" -s base -Y EXTERNAL "objectClass=*" 2>/dev/null
else
- if [ "$error" == "yes" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI)"
fi
ldapsearch -x -LLL -H "$ldapiURL" -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -157,14 +157,14 @@ fi
#
# LDAP
#
-if [ "$protocol" == "LDAP" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$protocol" = "LDAP" ] || [ "$protocol" = "" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAP)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
- fi
+ fi
exit $?
fi
diff --git a/ldap/admin/src/scripts/restart-dirsrv.in b/ldap/admin/src/scripts/restart-dirsrv.in
index 130e06e..e86a24c 100644
--- a/ldap/admin/src/scripts/restart-dirsrv.in
+++ b/ldap/admin/src/scripts/restart-dirsrv.in
@@ -7,7 +7,7 @@
# 2: Server started successfully (was not running)
# 3: Server could not be stopped
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
restart_instance() {
SERV_ID=$1
diff --git a/ldap/admin/src/scripts/restoreconfig.in b/ldap/admin/src/scripts/restoreconfig.in
index 9bb1acf..56c9e43 100755
--- a/ldap/admin/src/scripts/restoreconfig.in
+++ b/ldap/admin/src/scripts/restoreconfig.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -31,7 +31,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/saveconfig.in b/ldap/admin/src/scripts/saveconfig.in
index 65d80f3..16e3efc 100755
--- a/ldap/admin/src/scripts/saveconfig.in
+++ b/ldap/admin/src/scripts/saveconfig.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -31,7 +31,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -45,7 +45,7 @@ servid=`normalize_server_id $initfile`
echo saving configuration...
conf_ldif=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/$servid-`date +%Y_%m_%d_%H%M%S`.ldif
@sbindir@/ns-slapd db2ldif -N -D $CONFIG_DIR -s "o=NetscapeRoot" -a $conf_ldif -n NetscapeRoot 2>&1
-if [ "$?" -ge 1 ]
+if [ $? -ge 1 ]
then
echo Error occurred while saving configuration
exit 1
diff --git a/ldap/admin/src/scripts/start-dirsrv.in b/ldap/admin/src/scripts/start-dirsrv.in
index 481797d..458f0e8 100755
--- a/ldap/admin/src/scripts/start-dirsrv.in
+++ b/ldap/admin/src/scripts/start-dirsrv.in
@@ -6,7 +6,7 @@
# 1: Server could not be started
# 2: Server already running
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
# Starts a single instance
start_instance() {
@@ -44,7 +44,7 @@ start_instance() {
STARTPIDFILE=$RUN_DIR/$PRODUCT_NAME-$SERV_ID.startpid
if test -f $STARTPIDFILE ; then
PID=`cat $STARTPIDFILE`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd process already running: $PID
return 2;
else
@@ -53,7 +53,7 @@ start_instance() {
fi
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd running: $PID
return 2;
else
@@ -64,7 +64,7 @@ start_instance() {
# Use systemctl if available and running as root,
# otherwise start the instance the old way.
#
- if [ -d "@systemdsystemunitdir@" ] && [ "$(id -u)" == "0" ];then
+ if [ -d "@systemdsystemunitdir@" ] && [ $(id -u) -eq 0 ];then
@bindir@/systemctl start @package_name@(a)$SERV_ID.service
if [ $? -ne 0 ]; then
return 1
@@ -96,7 +96,7 @@ start_instance() {
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $PIDFILE ; then
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
sleep 1
else
echo Server failed to start !!! Please check errors log for problems
@@ -123,12 +123,12 @@ do
done
shift $(($OPTIND-1))
-if [ "$initconfig_dir" = "" ]; then
+if [ -z "$initconfig_dir" ]; then
initconfig_dir=@initconfigdir@
fi
found=0
-if [ "$#" -eq 0 ]; then
+if [ $# -eq 0 ]; then
# We're starting all instances.
ret=0
initfiles=`get_initconfig_files $initconfig_dir` || { echo No instances found in $initconfig_dir ; exit 1 ; }
@@ -137,7 +137,7 @@ if [ "$#" -eq 0 ]; then
echo Starting instance \"$inst\"
start_instance $inst
rv=$?
- if [ "$rv" -ne 0 ]; then
+ if [ $rv -ne 0 ]; then
ret=$rv
fi
done
diff --git a/ldap/admin/src/scripts/stop-dirsrv.in b/ldap/admin/src/scripts/stop-dirsrv.in
index 3f02e78..72e2b85 100755
--- a/ldap/admin/src/scripts/stop-dirsrv.in
+++ b/ldap/admin/src/scripts/stop-dirsrv.in
@@ -6,7 +6,7 @@
# 1: Server could not be stopped
# 2: Server was not running
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
stop_instance() {
SERV_ID=$1
@@ -28,7 +28,7 @@ stop_instance() {
fi
PID=`cat $PIDFILE`
# see if the server is already stopped
- kill -0 $PID > /dev/null 2>&1 || {
+ kill -s 0 $PID > /dev/null 2>&1 || {
echo Server not running
if test -f $PIDFILE ; then
rm -f $PIDFILE
@@ -39,7 +39,7 @@ stop_instance() {
#
# use systemctl if running as root
#
- if [ -d "@systemdsystemunitdir@" ] && [ "$(id -u)" == "0" ];then
+ if [ -d "@systemdsystemunitdir@" ] && [ $(id -u) -eq 0 ];then
#
# Now, check if systemctl is aware of this running instance
#
@@ -65,7 +65,7 @@ stop_instance() {
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
sleep 1;
else
if test -f $PIDFILE ; then
@@ -88,11 +88,11 @@ do
done
shift $(($OPTIND-1))
-if [ "$initconfig_dir" = "" ]; then
+if [ -z "$initconfig_dir" ]; then
initconfig_dir=@initconfigdir@
fi
-if [ "$#" -eq 0 ]; then
+if [ $# -eq 0 ]; then
# We're stopping all instances.
ret=0
initfiles=`get_initconfig_files $initconfig_dir` || { echo No instances found in $initconfig_dir ; exit 1 ; }
@@ -105,7 +105,7 @@ if [ "$#" -eq 0 ]; then
echo Stopping instance \"$inst\"
stop_instance $inst
rv=$?
- if [ "$rv" -ne 0 ]; then
+ if [ $rv -ne 0 ]; then
ret=$rv
fi
done
diff --git a/ldap/admin/src/scripts/suffix2instance.in b/ldap/admin/src/scripts/suffix2instance.in
index e2f73c3..7774148 100755
--- a/ldap/admin/src/scripts/suffix2instance.in
+++ b/ldap/admin/src/scripts/suffix2instance.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -32,14 +32,14 @@ do
esac
done
-if [ "$args" == "" ]
+if [ -z "$args" ]
then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/upgradedb.in b/ldap/admin/src/scripts/upgradedb.in
index 211bdce..bf600dd 100755
--- a/ldap/admin/src/scripts/upgradedb.in
+++ b/ldap/admin/src/scripts/upgradedb.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -39,7 +39,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
echo "Available instances: $initfile"
diff --git a/ldap/admin/src/scripts/upgradednformat.in b/ldap/admin/src/scripts/upgradednformat.in
index e9d8cab..51585ae 100755
--- a/ldap/admin/src/scripts/upgradednformat.in
+++ b/ldap/admin/src/scripts/upgradednformat.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
# upgradednformat -- upgrade DN format to the new style (RFC 4514)
# Usgae: upgradednformat [-N] -n backend_instance -a db_instance_directory
@@ -49,13 +49,13 @@ do
esac
done
-if [ "$be" = "" ] || [ "$dir" = "" ]; then
+if [ -z "$be" ] || [ -z "$dir" ]; then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/vlvindex.in b/ldap/admin/src/scripts/vlvindex.in
index 0b46b27..365e32f 100755
--- a/ldap/admin/src/scripts/vlvindex.in
+++ b/ldap/admin/src/scripts/vlvindex.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -45,7 +45,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/rpm/389-ds-base-git.sh b/rpm/389-ds-base-git.sh
index e5aaa8a..1a38da1 100644
--- a/rpm/389-ds-base-git.sh
+++ b/rpm/389-ds-base-git.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
DATE=`date +%Y%m%d`
# use a real tag name here
diff --git a/rpm/add_patches.sh b/rpm/add_patches.sh
index 690d0b2..31823d5 100755
--- a/rpm/add_patches.sh
+++ b/rpm/add_patches.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-function usage()
+usage()
{
echo "Adds patches to a specfile"
echo ""
@@ -51,5 +51,5 @@ for p in $patches; do
sed -i -e "/${prefix}/a Patch${i}: ${p}" -e "/$prepprefix/a %patch${i} -p1" $specfile
prefix="Patch${i}:"
prepprefix="%patch${i}"
- i=$(($i+1))
+ i=`expr $i + 1`
done
diff --git a/rpm/rpmverrel.sh b/rpm/rpmverrel.sh
index 86b808e..06e97c7 100755
--- a/rpm/rpmverrel.sh
+++ b/rpm/rpmverrel.sh
@@ -6,7 +6,7 @@ srcdir=`pwd`
# Source VERSION.sh to set the version
# and release environment variables.
-source ./VERSION.sh
+. ./VERSION.sh
if [ "$1" = "version" ]; then
echo $RPM_VERSION
diff --git a/wrappers/initscript.in b/wrappers/initscript.in
index ad4ea2b..fa79dbd 100644
--- a/wrappers/initscript.in
+++ b/wrappers/initscript.in
@@ -32,28 +32,20 @@ then
fi
fi
-# figure out which echo we're using
-ECHO_N=`echo -n`
-
-# some shells echo cannot use -n - linux echo by default cannot use \c
echo_n()
{
- if [ "$ECHO_N" = '-n' ] ; then
- echo "$*\c"
- else
- echo -n "$*"
- fi
+ printf '%s' "$*"
}
# failure and success are not defined on some platforms
-type failure > /dev/null 2>&1 || {
+which failure > /dev/null 2>&1 || {
failure()
{
echo_n " FAILED"
}
}
-type success > /dev/null 2>&1 || {
+which success > /dev/null 2>&1 || {
success()
{
echo_n " SUCCESS"
@@ -178,7 +170,7 @@ start() {
pid=`cat $pidfile`
instlockfile="@localstatedir@/lock/@package_name@/slapd-$instance/server/$pid"
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "ns-slapd" ]; then
+ if kill -s 0 $pid && [ $name = "ns-slapd" ]; then
echo_n " already running"
success; echo
successes=`expr $successes + 1`
@@ -239,7 +231,7 @@ start() {
while test $loop_counter -le $max_count ; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $pidfile ; then
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
break
@@ -249,7 +241,7 @@ start() {
break
fi
done
- if kill -0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
+ if kill -s 0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
success; echo
successes=`expr $successes + 1`
else
@@ -278,7 +270,7 @@ stop() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
server_stopped=0
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
kill $pid
if [ $? -eq 0 ]; then
server_stopped=1
@@ -297,7 +289,7 @@ stop() {
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
if test -f $pidfile ; then
@@ -339,7 +331,7 @@ status() {
for instance in $INSTANCES; do
if [ -f $piddir/slapd-$instance.pid ]; then
pid=`cat $piddir/slapd-$instance.pid`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
echo "$prog $instance (pid $pid) is running..."
else
echo "$prog $instance dead but pid file exists"
diff --git a/wrappers/ldap-agent-initscript.in b/wrappers/ldap-agent-initscript.in
index dd8ee97..b7aa4fe 100644
--- a/wrappers/ldap-agent-initscript.in
+++ b/wrappers/ldap-agent-initscript.in
@@ -31,28 +31,20 @@ then
fi
fi
-# figure out which echo we're using
-ECHO_N=`echo -n`
-
-# some shells echo cannot use -n - linux echo by default cannot use \c
echo_n()
{
- if [ "$ECHO_N" = '-n' ] ; then
- echo "$*\c"
- else
- echo -n "$*"
- fi
+ printf '%s' "$*"
}
# failure and success are not defined on some platforms
-type failure > /dev/null 2>&1 || {
+which failure > /dev/null 2>&1 || {
failure()
{
echo_n " FAILED"
}
}
-type success > /dev/null 2>&1 || {
+which success > /dev/null 2>&1 || {
success()
{
echo_n " SUCCESS"
@@ -92,7 +84,7 @@ start() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "$processname" ]; then
+ if kill -s 0 $pid && [ $name = "$processname" ]; then
echo_n " already running"
success; echo
subagent_running=1
@@ -121,7 +113,7 @@ start() {
while test $loop_counter -le $max_count ; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $pidfile ; then
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
break
@@ -131,7 +123,7 @@ start() {
break
fi
done
- if kill -0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
+ if kill -s 0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
success; echo
else
failure; echo
@@ -147,7 +139,7 @@ stop() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
subagent_stopped=0
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
kill $pid
if [ $? -eq 0 ]; then
subagent_stopped=1
@@ -164,7 +156,7 @@ stop() {
max_count=10
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
if test -f $pidfile ; then
@@ -200,7 +192,7 @@ condrestart() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "$processname" ]; then
+ if kill -s 0 $pid && [ $name = "$processname" ]; then
restart
fi
fi
@@ -210,7 +202,7 @@ status() {
ret=0
if [ -f $pidfile ]; then
pid=`cat $pidfile`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
echo "$prog (pid $pid) is running..."
else
echo "$prog dead but pid file exists"
8 years, 8 months
ldap/admin rpm/389-ds-base-git.sh rpm/add_patches.sh rpm/rpmverrel.sh wrappers/initscript.in wrappers/ldap-agent-initscript.in
by Noriko Hosoi
ldap/admin/src/initconfig.in | 4 -
ldap/admin/src/scripts/DSSharedLib.in | 92 ++++++++++++++----------------
ldap/admin/src/scripts/bak2db.in | 23 ++++---
ldap/admin/src/scripts/db2bak.in | 7 --
ldap/admin/src/scripts/db2index.in | 4 -
ldap/admin/src/scripts/db2ldif.in | 22 +++----
ldap/admin/src/scripts/dbverify.in | 6 -
ldap/admin/src/scripts/dn2rdn.in | 4 -
ldap/admin/src/scripts/ldif2db.in | 4 -
ldap/admin/src/scripts/ldif2ldap.in | 46 +++++++--------
ldap/admin/src/scripts/monitor.in | 44 +++++++-------
ldap/admin/src/scripts/restart-dirsrv.in | 2
ldap/admin/src/scripts/restoreconfig.in | 4 -
ldap/admin/src/scripts/saveconfig.in | 6 -
ldap/admin/src/scripts/start-dirsrv.in | 16 ++---
ldap/admin/src/scripts/stop-dirsrv.in | 14 ++--
ldap/admin/src/scripts/suffix2instance.in | 6 -
ldap/admin/src/scripts/upgradedb.in | 4 -
ldap/admin/src/scripts/upgradednformat.in | 6 -
ldap/admin/src/scripts/vlvindex.in | 4 -
rpm/389-ds-base-git.sh | 2
rpm/add_patches.sh | 4 -
rpm/rpmverrel.sh | 2
wrappers/initscript.in | 26 ++------
wrappers/ldap-agent-initscript.in | 28 +++------
25 files changed, 181 insertions(+), 199 deletions(-)
New commits:
commit 2ce7a7334bcb89e47c0f5c544144aec37010a5b9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Aug 10 17:04:25 2015 -0700
Ticket #47511 - bashisms in 389-ds-base admin scripts
Description by mvocu (Thank you):
The shell scripts in 389-ds-base/ldap/admin/src/scripts use 'source'
to source common scripts; the 'source' keyword is bash-specific (or
c-shell, if memory serves). The interpreter is set to /bin/sh, which
is not guaranteed to be bash (and at least on Debian 7.1 it is dash).
The 'source' keyword can be replaced by '.', which should work.
The patch was provided by tjaalton(a)ubuntu.com (Thank you, Timo!).
https://fedorahosted.org/389/ticket/47511
Reviewed and tested by nhosoi(a)redhat.com.
diff --git a/ldap/admin/src/initconfig.in b/ldap/admin/src/initconfig.in
index 134e82c..7afa315 100644
--- a/ldap/admin/src/initconfig.in
+++ b/ldap/admin/src/initconfig.in
@@ -2,11 +2,11 @@
OS=`uname -s`
# use the new mt slab memory allocator on Solaris
# this requires Solaris 9 update 3 or later
-if [ "$OS" = "SunOS" -a -f /usr/lib/libumem.so ] ; then
+if [ "$OS" = "SunOS" ] && [ -f /usr/lib/libumem.so ] ; then
LD_PRELOAD=/usr/lib/libumem.so
export LD_PRELOAD
fi
-if [ "$OS" = "SunOS" -a -f /usr/lib/64/libumem.so ] ; then
+if [ "$OS" = "SunOS" ] && [ -f /usr/lib/64/libumem.so ] ; then
LD_PRELOAD_64=/usr/lib/64/libumem.so
export LD_PRELOAD_64
fi
diff --git a/ldap/admin/src/scripts/DSSharedLib.in b/ldap/admin/src/scripts/DSSharedLib.in
index 3683696..8317c58 100644
--- a/ldap/admin/src/scripts/DSSharedLib.in
+++ b/ldap/admin/src/scripts/DSSharedLib.in
@@ -98,13 +98,13 @@ get_init_file()
do
inst_count=`expr $inst_count + 1`
id=`normalize_server_id $configfile`
- if [ -n "$servid" -a "$id" = "$servid" ]
+ if [ -n "$servid" ] && [ "$id" = "$servid" ]
then
# found it
echo $configfile
exit 0
fi
- if [ $first == "yes" ]
+ if [ $first = "yes" ]
then
instances=$id
first="no"
@@ -114,7 +114,7 @@ get_init_file()
done
# server id not provided, check if there is only one instance
- if [ -z "$servid" -a $inst_count -eq 1 ]
+ if [ -z "$servid" ] && [ $inst_count -eq 1 ]
then
# return the file
echo $configfile
@@ -135,48 +135,44 @@ process_dse ()
configdir=$1
pid=$2
file="$configdir/dse.ldif"
- shopt -s nocasematch
- OLD_IFC=$IFC
+ OLD_IFS=$IFS
IFS=""
while read -r LINE
do
- if [[ $LINE != \ * ]] && [ "$output" != "" ]
+ case $LINE in
+ ' '*)
+ ;;
+ *)
+ if [ -n "$output" ]
+ then
+ echo "$output" >> /tmp/DSSharedLib.$pid
+ output=""
+ fi
+ ;;
+ esac
+ if [ -n "$output" ]
then
- echo "$output" >> /tmp/DSSharedLib.$pid
- output=""
- fi
- if [ "$output" != "" ] && [[ $LINE == \ * ]]
- then
- # continuation line, strip the space and append it
- LINE=`echo "$LINE" | sed -e 's/^ //'`
- output=$output$LINE
- elif [[ $LINE == nsslapd-port* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-localhost* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-securePort* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-security* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapilisten* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapifilepath* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-rootdn* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-ldapiautobind* ]]
- then
- output=$LINE;
- elif [[ $LINE == nsslapd-certdir* ]]
- then
- output=$LINE;
+ case $LINE in
+ ' '*)
+ # continuation line, strip the space and append it
+ LINE=`echo "$LINE" | sed -e 's/^ //'`
+ output=$output$LINE
+ ;;
+ esac
+ else
+ case $LINE in
+ nsslapd-certdir*|\
+ nsslapd-ldapiautobind*|\
+ nsslapd-ldapilisten*|\
+ nsslapd-ldapifilepath*|\
+ nsslapd-localhost*|\
+ nsslapd-port*|\
+ nsslapd-rootdn*|\
+ nsslapd-securePort*|\
+ nsslapd-security*)
+ output=$LINE
+ ;;
+ esac
fi
done < $file
@@ -194,19 +190,19 @@ check_protocol ()
ldapi=$3
openldap=$4
- if [ "$protocol" == "LDAPI" ] && [ "$openldap" != "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] && [ "$openldap" != "yes" ]; then
echo ""
exit
- elif [ "$protocol" == "LDAPI" ] && [ "$ldapi" == "off" ]; then
+ elif [ "$protocol" = "LDAPI" ] && [ "$ldapi" = "off" ]; then
echo ""
exit
- elif [ "$protocol" == "STARTTLS" ]; then
- if [ "$security" == "" ] || [ "$security" == "off" ]; then
+ elif [ "$protocol" = "STARTTLS" ]; then
+ if [ -z "$security" ] || [ "$security" = "off" ]; then
echo ""
exit
fi
- elif [ "$protocol" == "LDAPS" ]; then
- if [ "$security" == "" ] || [ "$security" == "off" ]; then
+ elif [ "$protocol" = "LDAPS" ]; then
+ if [ -z "$security" ] || [ "$security" = "off" ]; then
echo ""
exit
fi
@@ -224,4 +220,4 @@ check_protocol ()
fi
echo "$protocol"
-}
\ No newline at end of file
+}
diff --git a/ldap/admin/src/scripts/bak2db.in b/ldap/admin/src/scripts/bak2db.in
index f0cede4..a2e54cc 100755
--- a/ldap/admin/src/scripts/bak2db.in
+++ b/ldap/admin/src/scripts/bak2db.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -26,15 +26,18 @@ if [ $# -lt 1 ] || [ $# -gt 7 ]
then
usage
exit 1
-elif [[ $1 == -* ]]
-then
- usage
- exit 1
-else
- archivedir=$1
- shift
fi
-
+case $1 in
+ -*)
+ usage
+ exit 1
+ ;;
+ *)
+ archivedir=$1
+ shift
+ ;;
+esac
+
while getopts "hn:Z:qd:vi:a:SD:" flag
do
case $flag in
@@ -55,7 +58,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/db2bak.in b/ldap/admin/src/scripts/db2bak.in
index dacd7b0..1896c19 100755
--- a/ldap/admin/src/scripts/db2bak.in
+++ b/ldap/admin/src/scripts/db2bak.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -26,7 +26,6 @@ then
usage
exit 1
fi
-
if [ "$#" -gt 0 ]
then
if [[ $1 != -* ]]
@@ -56,7 +55,7 @@ done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -67,7 +66,7 @@ fi
servid=`normalize_server_id $initfile`
. $initfile
-if [ -z $bak_dir ]
+if [ -z "$bak_dir" ]
then
bak_dir=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/$servid-`date +%Y_%m_%d_%H_%M_%S`
fi
diff --git a/ldap/admin/src/scripts/db2index.in b/ldap/admin/src/scripts/db2index.in
index a1321ea..2b76cd1 100755
--- a/ldap/admin/src/scripts/db2index.in
+++ b/ldap/admin/src/scripts/db2index.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -59,7 +59,7 @@ then
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/db2ldif.in b/ldap/admin/src/scripts/db2ldif.in
index d7e0ff0..fcf73a0 100755
--- a/ldap/admin/src/scripts/db2ldif.in
+++ b/ldap/admin/src/scripts/db2ldif.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -39,7 +39,7 @@ make_ldiffile()
be=""
while [ "$1" != "" ]
do
- if [ "$1" = "-a" ]; then
+ if [ "x$1" = "x-a" ]; then
shift
if [ `expr "$1" : "/.*"` -gt 0 ]; then
if [ `expr "$1" : "/.*"` -gt 0 ]; then
@@ -56,17 +56,17 @@ make_ldiffile()
shift
return 0
fi
- elif [ "$1" = "-n" ]; then
+ elif [ "x$1" = "x-n" ]; then
shift
- if [ "$be" = "" ]; then
+ if [ -z "$be" ]; then
be="$1"
else
tmpbe="$be"
be="${tmpbe}-$1"
fi
- elif [ "$1" = "-s" ]; then
+ elif [ "x$1" = "x-s" ]; then
shift
- if [ "$1" != "" ]; then
+ if [ -n "$1" ]; then
rdn=`echo $1 | awk -F, '{print $1}'`
rdnval=`echo $rdn | awk -F= '{print $2}'`
if [ "$be" = "" ]; then
@@ -76,15 +76,15 @@ make_ldiffile()
be="${tmpbe}-$rdnval"
fi
fi
- elif [ "$1" = "-M" ]; then
+ elif [ "x$1" = "x-M" ]; then
be=""
fi
- if [ "$1" != "" ]; then
+ if [ -n "$1" ]; then
shift
fi
done
- if [ "$be" = "" ]; then
+ if [ -z "$be" ]; then
echo @localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/ldif/$servid-`date +%Y_%m_%d_%H%M%S`.ldif
else
echo @localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/ldif/$servid-${be}-`date +%Y_%m_%d_%H%M%S`.ldif
@@ -92,7 +92,7 @@ make_ldiffile()
return 0
}
-if [ "$#" -lt 2 ];
+if [ $# -lt 2 ];
then
usage
exit 1
@@ -137,7 +137,7 @@ then
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/dbverify.in b/ldap/admin/src/scripts/dbverify.in
index 461cc16..bbacc17 100755
--- a/ldap/admin/src/scripts/dbverify.in
+++ b/ldap/admin/src/scripts/dbverify.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -47,7 +47,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -58,7 +58,7 @@ fi
. $initfile
@sbindir@/ns-slapd dbverify -D $CONFIG_DIR $args
-if [ $display_version == "yes" ]; then
+if [ $display_version = "yes" ]; then
exit 0
fi
if [ $? -eq 0 ]; then
diff --git a/ldap/admin/src/scripts/dn2rdn.in b/ldap/admin/src/scripts/dn2rdn.in
index 32a70c8..616969a 100755
--- a/ldap/admin/src/scripts/dn2rdn.in
+++ b/ldap/admin/src/scripts/dn2rdn.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -39,7 +39,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/ldif2db.in b/ldap/admin/src/scripts/ldif2db.in
index ce15349..a34241a 100755
--- a/ldap/admin/src/scripts/ldif2db.in
+++ b/ldap/admin/src/scripts/ldif2db.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -82,7 +82,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/ldif2ldap.in b/ldap/admin/src/scripts/ldif2ldap.in
index 874b1bb..1e871be 100755
--- a/ldap/admin/src/scripts/ldif2ldap.in
+++ b/ldap/admin/src/scripts/ldif2ldap.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@ldapsdk_libdir@"
libpath_add "@libdir@"
@@ -40,14 +40,14 @@ do
esac
done
-if [ "$input_file" == "" ]
+if [ -z "$input_file" ]
then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -67,13 +67,13 @@ ldapi=$(grep -i 'nsslapd-ldapilisten' $file | awk '{print $2}' )
ldapiURL=$(grep -i 'nsslapd-ldapifilepath' $file | awk '{print $2}' )
certdir=$(grep -i 'nsslapd-certdir' $file | awk '{print $2}' )
autobind=$(grep -i 'nsslapd-ldapiautobind' $file | awk '{print $2}' )
-if [ "$rootdn" == "" ]; then
+if [ -z "$rootdn" ]; then
value=$(grep -i 'nsslapd-rootdn' $file)
rootdn=`echo "$value" | sed -e 's/nsslapd-rootdn: //i'`
fi
rm $file
-if [ "$ldapiURL" != "" ]; then
+if [ -n "$ldapiURL" ]; then
ldapiURL=`echo "$ldapiURL" | sed -e 's/\//%2f/g'`
ldapiURL="ldapi://"$ldapiURL
fi
@@ -86,7 +86,7 @@ then
export LDAPTLS_CACERTDIR=$certdir
fi
-if [ -z $security ]; then
+if [ -z "$security" ]; then
security="off"
fi
revised_protocol=$(check_protocol $protocol $security $ldapi $openldap)
@@ -99,12 +99,12 @@ protocol=$revised_protocol
#
# STARTTLS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "STARTTLS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "STARTTLS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(STARTTLS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -ZZ -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -ZZZ -P $certdir -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
@@ -116,12 +116,12 @@ fi
#
# LDAPS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "LDAPS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "LDAPS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -H "ldaps://$host:$secure_port" -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -Z -P $certdir -p $secure_port -h $host -D $rootdn -w $passwd -a -f $input_file
@@ -133,21 +133,21 @@ fi
#
# LDAPI
#
-if [ "$ldapi" == "on" ] && [ "$openldap" == "yes" ]; then
- if [ "$protocol" == "LDAPI" ] || [ "$protocol" == "" ]; then
- if [ "$(id -u)" == "0" ] && [ "$autobind" == "on" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$ldapi" = "on" ] && [ "$openldap" = "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] || [ -z "$protocol" ]; then
+ if [ $(id -u) -eq 0 ] && [ "$autobind" = "on" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI/AUTOBIND)"
fi
ldapmodify -H $ldapiURL -Y EXTERNAL -a -f $input_file 2>/dev/null
else
- if [ "$error" == "yes" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI)"
fi
ldapmodify -x -H $ldapiURL -D $rootdn -w $passwd -a -f $input_file
fi
rc=$?
- if [ $rc != 0 ]
+ if [ $rc -ne 0 ]
then
echo "Operation failed (error $rc)"
fi
@@ -158,11 +158,11 @@ fi
#
# LDAP
#
-if [ "$protocol" == "LDAP" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$protocol" = "LDAP" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAP)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapmodify -x -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
else
ldapmodify -p $port -h $host -D $rootdn -w $passwd -a -f $input_file
diff --git a/ldap/admin/src/scripts/monitor.in b/ldap/admin/src/scripts/monitor.in
index 7b2058b..36a2fc9 100755
--- a/ldap/admin/src/scripts/monitor.in
+++ b/ldap/admin/src/scripts/monitor.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@ldapsdk_libdir@"
@@ -41,7 +41,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -66,17 +66,17 @@ ldapi=$(grep -i 'nsslapd-ldapilisten' $file | awk '{print $2}' )
ldapiURL=$(grep -i 'nsslapd-ldapifilepath' $file | awk '{print $2}' )
certdir=$(grep -i 'nsslapd-certdir' $file | awk '{print $2}' )
autobind=$(grep -i 'nsslapd-ldapiautobind' $file | awk '{print $2}' )
-if [ "$rootdn" == "" ]; then
+if [ -z "$rootdn" ]; then
value=$(grep -i 'nsslapd-rootdn' $file)
rootdn=`echo "$value" | sed -e 's/nsslapd-rootdn: //i'`
fi
rm $file
-if [ "$passwd" != "" ]; then
+if [ -n "$passwd" ]; then
dn="-D $rootdn"
passwd="-w$passwd"
fi
-if [ "$ldapiURL" != "" ]
+if [ -n "$ldapiURL" ]
then
ldapiURL=`echo "$ldapiURL" | sed -e 's/\//%2f/g'`
ldapiURL="ldapi://"$ldapiURL
@@ -103,12 +103,12 @@ protocol=$revised_protocol
#
# STARTTLS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "STARTTLS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "STARTTLS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(STARTTLS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -ZZ -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -ZZZ -P $certdir -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -120,12 +120,12 @@ fi
#
# LDAPS
#
-if [ "$security" == "on" ]; then
- if [ "$protocol" == "LDAPS" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$security" = "on" ]; then
+ if [ "$protocol" = "LDAPS" ] || [ -z "$protocol" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPS)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -H "ldaps://$host:$secure_port" -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -Z -P $certdir -p $secure_port -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -137,15 +137,15 @@ fi
#
# LDAPI
#
-if [ "$ldapi" == "on" ] && [ "$openldap" == "yes" ]; then
- if [ "$protocol" == "LDAPI" ] || [ "$protocol" == "" ]; then
- if [ "$(id -u)" == "0" ] && [ "$autobind" == "on" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$ldapi" = "on" ] && [ "$openldap" = "yes" ]; then
+ if [ "$protocol" = "LDAPI" ] || [ -z "$protocol" ]; then
+ if [ $(id -u) -eq 0 ] && [ "$autobind" = "on" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI/AUTOBIND)"
fi
ldapsearch -LLL -H "$ldapiURL" -b "$MDN" -s base -Y EXTERNAL "objectClass=*" 2>/dev/null
else
- if [ "$error" == "yes" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAPI)"
fi
ldapsearch -x -LLL -H "$ldapiURL" -b "$MDN" -s base $dn $passwd "objectClass=*"
@@ -157,14 +157,14 @@ fi
#
# LDAP
#
-if [ "$protocol" == "LDAP" ] || [ "$protocol" == "" ]; then
- if [ "$error" == "yes" ]; then
+if [ "$protocol" = "LDAP" ] || [ "$protocol" = "" ]; then
+ if [ "$error" = "yes" ]; then
echo "Using the next most secure protocol(LDAP)"
fi
- if [ "$openldap" == "yes" ]; then
+ if [ "$openldap" = "yes" ]; then
ldapsearch -x -LLL -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
else
ldapsearch -h $host -p $port -b "$MDN" -s base $dn $passwd "objectClass=*"
- fi
+ fi
exit $?
fi
diff --git a/ldap/admin/src/scripts/restart-dirsrv.in b/ldap/admin/src/scripts/restart-dirsrv.in
index 130e06e..e86a24c 100644
--- a/ldap/admin/src/scripts/restart-dirsrv.in
+++ b/ldap/admin/src/scripts/restart-dirsrv.in
@@ -7,7 +7,7 @@
# 2: Server started successfully (was not running)
# 3: Server could not be stopped
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
restart_instance() {
SERV_ID=$1
diff --git a/ldap/admin/src/scripts/restoreconfig.in b/ldap/admin/src/scripts/restoreconfig.in
index 9bb1acf..56c9e43 100755
--- a/ldap/admin/src/scripts/restoreconfig.in
+++ b/ldap/admin/src/scripts/restoreconfig.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@nss_libdir@"
@@ -31,7 +31,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/saveconfig.in b/ldap/admin/src/scripts/saveconfig.in
index 65d80f3..16e3efc 100755
--- a/ldap/admin/src/scripts/saveconfig.in
+++ b/ldap/admin/src/scripts/saveconfig.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -31,7 +31,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
@@ -45,7 +45,7 @@ servid=`normalize_server_id $initfile`
echo saving configuration...
conf_ldif=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/$servid-`date +%Y_%m_%d_%H%M%S`.ldif
@sbindir@/ns-slapd db2ldif -N -D $CONFIG_DIR -s "o=NetscapeRoot" -a $conf_ldif -n NetscapeRoot 2>&1
-if [ "$?" -ge 1 ]
+if [ $? -ge 1 ]
then
echo Error occurred while saving configuration
exit 1
diff --git a/ldap/admin/src/scripts/start-dirsrv.in b/ldap/admin/src/scripts/start-dirsrv.in
index 481797d..458f0e8 100755
--- a/ldap/admin/src/scripts/start-dirsrv.in
+++ b/ldap/admin/src/scripts/start-dirsrv.in
@@ -6,7 +6,7 @@
# 1: Server could not be started
# 2: Server already running
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
# Starts a single instance
start_instance() {
@@ -44,7 +44,7 @@ start_instance() {
STARTPIDFILE=$RUN_DIR/$PRODUCT_NAME-$SERV_ID.startpid
if test -f $STARTPIDFILE ; then
PID=`cat $STARTPIDFILE`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd process already running: $PID
return 2;
else
@@ -53,7 +53,7 @@ start_instance() {
fi
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd running: $PID
return 2;
else
@@ -64,7 +64,7 @@ start_instance() {
# Use systemctl if available and running as root,
# otherwise start the instance the old way.
#
- if [ -d "@systemdsystemunitdir@" ] && [ "$(id -u)" == "0" ];then
+ if [ -d "@systemdsystemunitdir@" ] && [ $(id -u) -eq 0 ];then
@bindir@/systemctl start @package_name@(a)$SERV_ID.service
if [ $? -ne 0 ]; then
return 1
@@ -96,7 +96,7 @@ start_instance() {
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $PIDFILE ; then
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
sleep 1
else
echo Server failed to start !!! Please check errors log for problems
@@ -123,12 +123,12 @@ do
done
shift $(($OPTIND-1))
-if [ "$initconfig_dir" = "" ]; then
+if [ -z "$initconfig_dir" ]; then
initconfig_dir=@initconfigdir@
fi
found=0
-if [ "$#" -eq 0 ]; then
+if [ $# -eq 0 ]; then
# We're starting all instances.
ret=0
initfiles=`get_initconfig_files $initconfig_dir` || { echo No instances found in $initconfig_dir ; exit 1 ; }
@@ -137,7 +137,7 @@ if [ "$#" -eq 0 ]; then
echo Starting instance \"$inst\"
start_instance $inst
rv=$?
- if [ "$rv" -ne 0 ]; then
+ if [ $rv -ne 0 ]; then
ret=$rv
fi
done
diff --git a/ldap/admin/src/scripts/stop-dirsrv.in b/ldap/admin/src/scripts/stop-dirsrv.in
index 3f02e78..72e2b85 100755
--- a/ldap/admin/src/scripts/stop-dirsrv.in
+++ b/ldap/admin/src/scripts/stop-dirsrv.in
@@ -6,7 +6,7 @@
# 1: Server could not be stopped
# 2: Server was not running
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
stop_instance() {
SERV_ID=$1
@@ -28,7 +28,7 @@ stop_instance() {
fi
PID=`cat $PIDFILE`
# see if the server is already stopped
- kill -0 $PID > /dev/null 2>&1 || {
+ kill -s 0 $PID > /dev/null 2>&1 || {
echo Server not running
if test -f $PIDFILE ; then
rm -f $PIDFILE
@@ -39,7 +39,7 @@ stop_instance() {
#
# use systemctl if running as root
#
- if [ -d "@systemdsystemunitdir@" ] && [ "$(id -u)" == "0" ];then
+ if [ -d "@systemdsystemunitdir@" ] && [ $(id -u) -eq 0 ];then
#
# Now, check if systemctl is aware of this running instance
#
@@ -65,7 +65,7 @@ stop_instance() {
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $PID > /dev/null 2>&1 ; then
+ if kill -s 0 $PID > /dev/null 2>&1 ; then
sleep 1;
else
if test -f $PIDFILE ; then
@@ -88,11 +88,11 @@ do
done
shift $(($OPTIND-1))
-if [ "$initconfig_dir" = "" ]; then
+if [ -z "$initconfig_dir" ]; then
initconfig_dir=@initconfigdir@
fi
-if [ "$#" -eq 0 ]; then
+if [ $# -eq 0 ]; then
# We're stopping all instances.
ret=0
initfiles=`get_initconfig_files $initconfig_dir` || { echo No instances found in $initconfig_dir ; exit 1 ; }
@@ -105,7 +105,7 @@ if [ "$#" -eq 0 ]; then
echo Stopping instance \"$inst\"
stop_instance $inst
rv=$?
- if [ "$rv" -ne 0 ]; then
+ if [ $rv -ne 0 ]; then
ret=$rv
fi
done
diff --git a/ldap/admin/src/scripts/suffix2instance.in b/ldap/admin/src/scripts/suffix2instance.in
index e2f73c3..7774148 100755
--- a/ldap/admin/src/scripts/suffix2instance.in
+++ b/ldap/admin/src/scripts/suffix2instance.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -32,14 +32,14 @@ do
esac
done
-if [ "$args" == "" ]
+if [ -z "$args" ]
then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/upgradedb.in b/ldap/admin/src/scripts/upgradedb.in
index 211bdce..bf600dd 100755
--- a/ldap/admin/src/scripts/upgradedb.in
+++ b/ldap/admin/src/scripts/upgradedb.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -39,7 +39,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
echo "Available instances: $initfile"
diff --git a/ldap/admin/src/scripts/upgradednformat.in b/ldap/admin/src/scripts/upgradednformat.in
index e9d8cab..51585ae 100755
--- a/ldap/admin/src/scripts/upgradednformat.in
+++ b/ldap/admin/src/scripts/upgradednformat.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
# upgradednformat -- upgrade DN format to the new style (RFC 4514)
# Usgae: upgradednformat [-N] -n backend_instance -a db_instance_directory
@@ -49,13 +49,13 @@ do
esac
done
-if [ "$be" = "" ] || [ "$dir" = "" ]; then
+if [ -z "$be" ] || [ -z "$dir" ]; then
usage
exit 1
fi
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/ldap/admin/src/scripts/vlvindex.in b/ldap/admin/src/scripts/vlvindex.in
index 0b46b27..365e32f 100755
--- a/ldap/admin/src/scripts/vlvindex.in
+++ b/ldap/admin/src/scripts/vlvindex.in
@@ -1,6 +1,6 @@
#!/bin/sh
-source @datadir@/@package_name@/data/DSSharedLib
+. @datadir@/@package_name@/data/DSSharedLib
libpath_add "@libdir@/@package_name@/"
libpath_add "@libdir@"
@@ -45,7 +45,7 @@ do
done
initfile=$(get_init_file "@initconfigdir@" $servid)
-if [ $? == 1 ]
+if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
diff --git a/rpm/389-ds-base-git.sh b/rpm/389-ds-base-git.sh
index e5aaa8a..1a38da1 100644
--- a/rpm/389-ds-base-git.sh
+++ b/rpm/389-ds-base-git.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
DATE=`date +%Y%m%d`
# use a real tag name here
diff --git a/rpm/add_patches.sh b/rpm/add_patches.sh
index 690d0b2..31823d5 100755
--- a/rpm/add_patches.sh
+++ b/rpm/add_patches.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-function usage()
+usage()
{
echo "Adds patches to a specfile"
echo ""
@@ -51,5 +51,5 @@ for p in $patches; do
sed -i -e "/${prefix}/a Patch${i}: ${p}" -e "/$prepprefix/a %patch${i} -p1" $specfile
prefix="Patch${i}:"
prepprefix="%patch${i}"
- i=$(($i+1))
+ i=`expr $i + 1`
done
diff --git a/rpm/rpmverrel.sh b/rpm/rpmverrel.sh
index 86b808e..06e97c7 100755
--- a/rpm/rpmverrel.sh
+++ b/rpm/rpmverrel.sh
@@ -6,7 +6,7 @@ srcdir=`pwd`
# Source VERSION.sh to set the version
# and release environment variables.
-source ./VERSION.sh
+. ./VERSION.sh
if [ "$1" = "version" ]; then
echo $RPM_VERSION
diff --git a/wrappers/initscript.in b/wrappers/initscript.in
index ad4ea2b..fa79dbd 100644
--- a/wrappers/initscript.in
+++ b/wrappers/initscript.in
@@ -32,28 +32,20 @@ then
fi
fi
-# figure out which echo we're using
-ECHO_N=`echo -n`
-
-# some shells echo cannot use -n - linux echo by default cannot use \c
echo_n()
{
- if [ "$ECHO_N" = '-n' ] ; then
- echo "$*\c"
- else
- echo -n "$*"
- fi
+ printf '%s' "$*"
}
# failure and success are not defined on some platforms
-type failure > /dev/null 2>&1 || {
+which failure > /dev/null 2>&1 || {
failure()
{
echo_n " FAILED"
}
}
-type success > /dev/null 2>&1 || {
+which success > /dev/null 2>&1 || {
success()
{
echo_n " SUCCESS"
@@ -178,7 +170,7 @@ start() {
pid=`cat $pidfile`
instlockfile="@localstatedir@/lock/@package_name@/slapd-$instance/server/$pid"
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "ns-slapd" ]; then
+ if kill -s 0 $pid && [ $name = "ns-slapd" ]; then
echo_n " already running"
success; echo
successes=`expr $successes + 1`
@@ -239,7 +231,7 @@ start() {
while test $loop_counter -le $max_count ; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $pidfile ; then
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
break
@@ -249,7 +241,7 @@ start() {
break
fi
done
- if kill -0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
+ if kill -s 0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
success; echo
successes=`expr $successes + 1`
else
@@ -278,7 +270,7 @@ stop() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
server_stopped=0
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
kill $pid
if [ $? -eq 0 ]; then
server_stopped=1
@@ -297,7 +289,7 @@ stop() {
max_count=600
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
if test -f $pidfile ; then
@@ -339,7 +331,7 @@ status() {
for instance in $INSTANCES; do
if [ -f $piddir/slapd-$instance.pid ]; then
pid=`cat $piddir/slapd-$instance.pid`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
echo "$prog $instance (pid $pid) is running..."
else
echo "$prog $instance dead but pid file exists"
diff --git a/wrappers/ldap-agent-initscript.in b/wrappers/ldap-agent-initscript.in
index dd8ee97..b7aa4fe 100644
--- a/wrappers/ldap-agent-initscript.in
+++ b/wrappers/ldap-agent-initscript.in
@@ -31,28 +31,20 @@ then
fi
fi
-# figure out which echo we're using
-ECHO_N=`echo -n`
-
-# some shells echo cannot use -n - linux echo by default cannot use \c
echo_n()
{
- if [ "$ECHO_N" = '-n' ] ; then
- echo "$*\c"
- else
- echo -n "$*"
- fi
+ printf '%s' "$*"
}
# failure and success are not defined on some platforms
-type failure > /dev/null 2>&1 || {
+which failure > /dev/null 2>&1 || {
failure()
{
echo_n " FAILED"
}
}
-type success > /dev/null 2>&1 || {
+which success > /dev/null 2>&1 || {
success()
{
echo_n " SUCCESS"
@@ -92,7 +84,7 @@ start() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "$processname" ]; then
+ if kill -s 0 $pid && [ $name = "$processname" ]; then
echo_n " already running"
success; echo
subagent_running=1
@@ -121,7 +113,7 @@ start() {
while test $loop_counter -le $max_count ; do
loop_counter=`expr $loop_counter + 1`
if test ! -f $pidfile ; then
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
break
@@ -131,7 +123,7 @@ start() {
break
fi
done
- if kill -0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
+ if kill -s 0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
success; echo
else
failure; echo
@@ -147,7 +139,7 @@ stop() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
subagent_stopped=0
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
kill $pid
if [ $? -eq 0 ]; then
subagent_stopped=1
@@ -164,7 +156,7 @@ stop() {
max_count=10
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
sleep 1
else
if test -f $pidfile ; then
@@ -200,7 +192,7 @@ condrestart() {
if [ -f $pidfile ]; then
pid=`cat $pidfile`
name=`ps -p $pid | tail -1 | awk '{ print $4 }'`
- if kill -0 $pid && [ $name = "$processname" ]; then
+ if kill -s 0 $pid && [ $name = "$processname" ]; then
restart
fi
fi
@@ -210,7 +202,7 @@ status() {
ret=0
if [ -f $pidfile ]; then
pid=`cat $pidfile`
- if kill -0 $pid > /dev/null 2>&1 ; then
+ if kill -s 0 $pid > /dev/null 2>&1 ; then
echo "$prog (pid $pid) is running..."
else
echo "$prog dead but pid file exists"
8 years, 8 months
Branch '389-ds-base-1.3.3' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/memberof/memberof_config.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit e6343e66aa2e4537388b386c055b7ca8044f8f34
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Aug 10 10:42:40 2015 -0400
Ticket 47931 - Fix coverity issues
Description: Fix coverity issues in memberof_config.c
13316 - double free
13315 - Dereference after null check
13314 - Dereference after null check
13313 - copy/paste error
https://fedorahosted.org/389/ticket/47931
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 5daea973e4526584ee41d7b9f4b1b4993b4de6f1)
(cherry picked from commit 9a0047ef75f6dbeb1980ac77fab5d62865c77e6a)
diff --git a/ldap/servers/plugins/memberof/memberof_config.c b/ldap/servers/plugins/memberof/memberof_config.c
index 9db3b39..e718f8d 100644
--- a/ldap/servers/plugins/memberof/memberof_config.c
+++ b/ldap/servers/plugins/memberof/memberof_config.c
@@ -345,6 +345,7 @@ memberof_validate_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
"%s: Invalid DN (%s) for include suffix.",
MEMBEROF_PLUGIN_SUBSYSTEM, entry_scopes[i]);
slapi_ch_array_free(entry_scopes);
+ entry_scopes = NULL;
theConfig.entryScopeCount = 0;
*returncode = LDAP_UNWILLING_TO_PERFORM;
goto done;
@@ -370,8 +371,9 @@ memberof_validate_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
/* invalid dn syntax */
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
"%s: Invalid DN (%s) for exclude suffix.",
- MEMBEROF_PLUGIN_SUBSYSTEM, entry_scopes[i]);
+ MEMBEROF_PLUGIN_SUBSYSTEM, entry_exclude_scopes[i]);
slapi_ch_array_free(entry_exclude_scopes);
+ entry_exclude_scopes = NULL;
*returncode = LDAP_UNWILLING_TO_PERFORM;
goto done;
}
@@ -770,7 +772,7 @@ memberof_copy_config(MemberOfConfig *dest, MemberOfConfig *src)
int num_vals = 0;
dest->entryScopeExcludeSubtrees = (Slapi_DN **)slapi_ch_calloc(sizeof(Slapi_DN *),src->entryExcludeScopeCount+1);
- for(num_vals = 0; src->entryScopes[num_vals]; num_vals++){
+ for(num_vals = 0; src->entryScopeExcludeSubtrees[num_vals]; num_vals++){
dest->entryScopeExcludeSubtrees[num_vals] = slapi_sdn_dup(src->entryScopeExcludeSubtrees[num_vals]);
}
}
8 years, 8 months