[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Shell backend: read_and_send_results



Dmitriy Kirhlarov writes:
> We find problem. Return code must be LAST string in backend output

Yes.  As 'man slapd-shell' says: "The search RESULT should be preceded
by the entries in LDIF format, each entry followed by a blank line."
Maybe that needs to be clarified - if so, what should it say?

However, the test case Timur sent already does that, so I don't see how
it's relevant.  Unless he sent you a different test program than he sent
openldap-software?

> and this string must be without \n on the end.

Timur's test program works for me, even if I insert multiple newlines
at the end.

I'm wondering if it could have something to do with how different shells
treat backslashes and double quotes, so "\n" isn't preserved.

Also Timur's program should return an error for unsupported operations,
and it would fail if it was modified to return a DN which included a
'%'.  '%s' and '\n' should be in the printf format string, the value in
the argument to the format string.

I'd write the shell script as attached.
The slapd.conf used to test it is also attached.

-- 
Hallvard
#!/bin/sh
log=/tmp/slapd-shdb.log
op=`basename $0`

output() {
    printf '(%s)\n' "$*" >> ${log}
    printf '%s\n' "$*"
}

echo `date`: $0 ${op} $* >>${log}
echo DEBUG: `date`: $0 ${op} $*

case ${op} in
    search)
        output "dn: cn=Boris Norris,o=oilspace-shell"
        output "cn: Boris Norris"
        output ""
        output "RESULT"
        output "code: 0"
        exit 0
    ;;
    unbind)
        exit 0
    ;;
    *)
        output "RESULT"
        output "code: 80"
        exit 0
    ;;
esac
include /hbf/scratch/ldap/install/head/etc/openldap/schema/core.schema

database shell
suffix o=oilspace-shell
search /tmp/search