Zend Guard Binary Wrappers Quick Fix

Follow

Applies to:
Zend Guard CLI Tools Wrappers
Supported Linux Operating Systems

Summary

When running the command line (CLI) wrappers under ZendGuard/bin directory, they will pass the command line parameters to the actual binaries which resides in an internal "Plugins" directory (plugins to the Zend Guard GUI, but completely executable by themselves as CLI).

Problem

When you run a command line with double quoted path, which includes a space, the wrapper scripts will drop the path components to individual parameters, losing the original path context.

Example:

zendenc_sign "/tmp/my_app_license.zl" "/users/george/my files/private keys/d335gr23t.key"

This will break to:

zendenc_sign "/tmp/my_app_license.zl" "/users/george/my" "files/private" "keys/d335gr23t.key"

Which is not an expected input, thus creating an error on execution.

Solution 1 (Easy)

Simply place the target binaries directory in the user / system $PATH, instead of the wrapper scripts. It will call the CLI tools directly, with any parameter quoting in place.

Target CLI tools resides under: /PATH/TO/ZendGuard/plugins/com.zend.guard.core.resources.linux_7.0.0.201503261229/resources/

Solution 2 (Editing files)

By modifying the parameter encapsulation in the wrapper scripts, you can include quoted path with space without losing the parameter. You still need to place the /path/to/ZendGuard/bin directory in your $PATH, so this is a good solution ONLY if you need to use the /bin directory for any reason.

Original command line calls in the binary wrappers:

GuardEngine:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/GuardEngine" $*
zendenc55:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc55" $*
zendenc56:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc56" $*
zendenc_sign:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc_sign" $*
zendid:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendid" $*

Replace the $* encapsulation with "$@" on each wrapper script, so they have these lines:

GuardEngine:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/GuardEngine" "$@"
zendenc55:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc55" "$@"
zendenc56:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc56" "$@"
zendenc_sign:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendenc_sign" "$@"
zendid:LD_LIBRARY_PATH="$PLUGIN_DIR:$LD_LIBRARY_PATH" "$PLUGIN_DIR/zendid" "$@"

Once you have the modified wrappers, you can use them with paths with/without spaces, passing the correct params to the CLI tools binaries (under Plugins directory).

More info

http://files.zend.com/help/Zend-Guard/content/command_line.htm

 

Have more questions? Submit a request

Comments

Powered by Zendesk