20150623 fix for bug in opendj ldap toolkit 2 6 0 on windows - plembo/onemoretech GitHub Wiki

title: Fix for bug in opendj-ldap-toolkit-2.6.0 on Windows link: https://onemoretech.wordpress.com/2015/06/23/fix-for-bug-in-opendj-ldap-toolkit-2-6-0-on-windows/ author: phil2nc description: post_id: 9856 created: 2015/06/23 16:55:23 created_gmt: 2015/06/23 20:55:23 comment_status: closed post_name: fix-for-bug-in-opendj-ldap-toolkit-2-6-0-on-windows status: publish post_type: post

Fix for bug in opendj-ldap-toolkit-2.6.0 on Windows

There's a bug in one of the Windows batch files for ForgeRock's OpenDJ LDAP Toolkit 2.6.0 that causes all of the utilities in the package to fail with the error: "The system cannot find the batch label specified - check". This was fixed in OpenDJ 2.6.1, but that's only available under subscription, so here's the fix for the rest of us.

There are newer versions of the the OpenDJ LDAP Toolkit. The latest nightly for 3.0.0 works just fine as far as I can tell, but I'm not fond of running nightlies in production, so I've continued using 2.6.0 on my Linux servers and workstations, where it has replaced the OpenLDAP tools that are otherwise standard with most distributions.

Just recently I was trimming the software on my work laptop which runs Windows 7 Professional. On that particular machine I'd been running for 2.6.0 version of the full OpenDJ server for a few years. I decided to delete the server install and replace it with the toolkit (the batch file that shipped with the OpenDJ server 2.6.0 utilities did not have the bug in question).

Installation of the toolkit on Windows was as simple as unzipping the downloaded distribution file to my preferred location, C:\apps\opendj. I then added C:\apps\opendj\bat to the system PATH, as this is where the batch files that launch the Java based OpenDJ utilities reside.

After getting the error noted above I searched around the Internet a bit and found OPENDJ-877, which complained about this condition existing in the 2.6.0 version of the tookit and SDK.

The fix was simple, changing a single line (185) that erroneously called a "check" condition that wasn't defined anywhere else in the _script_util.bat script under $INSTALLDIR\lib (in my case C:\apps\opendj\lib) to instead use "end".

This is what the line in question looked like before the change:

:isVersionOrHelp
if [%1] == [] goto check
if [%1] == [--help] goto end
if [%1] == [-H] goto end
if [%1] == [--version] goto end
if [%1] == [-V] goto end
if [%1] == [--fullversion] goto end
if [%1] == [-F] goto end
shift
goto isVersionOrHelp

Here it is with the fix in place:

:isVersionOrHelp
if [%1] == [] goto end
if [%1] == [--help] goto end
if [%1] == [-H] goto end

Copyright 2004-2019 Phil Lembo