Hi all, I'm running openldap-2.3.20 from FreeBSD 6.1-prerelease ports. The slapd server is configured to run my backend shell script. But the server fails to parse my output.
It seems the problem is in trailing whitespace in every line except the first (the one with RESULT) which I can see in debugging output from the read_and_send_results function in back-shell/result.c. The script itself does not append the whitespace (I duplicate its output in a separate log file). The slapd log looks like this: Apr 13 13:53:17 fbsd slapd[71478]: shell search reading line (DEBUG: Thu Apr 13 13:53:17 UTC 2006: /var/db/openldap-data/bin/modify modify ) Apr 13 13:53:17 fbsd slapd[71478]: shell search reading line (RESULT ) Apr 13 13:53:17 fbsd slapd[71478]: shell search reading line (code: 0 ) Apr 13 13:53:17 fbsd slapd[71478]: shell: fgets failed: Unknown error (0) Apr 13 13:53:17 fbsd slapd[71478]: str2result (code: 0 ) unknown My script is attached. It is symlinked to be called for any operation. I skimmed the source code to investigate the issue. I'm not sure but maybe the problem is in the way the function walks through the output stream. Any ideas? Does anybody know how to fix this? Any help is appreciated. Thanks in advance, -- Timur Izhbulatov OILspace, 26 Leninskaya sloboda, bld. 2, 2nd floor, 115280 Moscow, Russia P:+7 495 105 7245 + ext.205 F:+7 495 105 7246 E:[EMAIL PROTECTED] Building Successful Supply Chains - One Solution At A Time. www.oilspace.com
#!/bin/sh log=/var/db/openldap-data/slapd-shdb.log op=`basename $0` output() { printf "($*)" >> ${log} printf "$*" } echo `date`: $0 ${op} $* >>${log} echo DEBUG: `date`: $0 ${op} $* case ${op} in search) output "dn: cn=Boris Norris,o=oilspace-shell\n" output "cn: Boris Norris\n" output "\n" output "RESULT\n" output "code: 0\n" exit 0 ;; unbind) exit 0 ;; *) output "RESULT\n" output "code: 0\n" exit 0 ;; esac exit 0