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

(ITS#7060) Bad compare results with back-sock (and I suspect back-shell)



Full_Name: Maurice Perry
Version: 2.4.26
OS: Linux (debian)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (160.53.250.126)


The result code returned for the COMPARE operation with back-sock.

The problem is due to a bug (two actually) in function str2result in
servers/slapd/result.c:

    while ( isspace( (unsigned char) next[ 0 ] ) ) next++;
    if ( next[ 0 ] != '\0' ) {
        Debug( LDAP_DEBUG_ANY, "str2result (%s) extra cruft after value\n",
               s, 0, 0 );
        rc = -1;
        continue;
    }

    /* FIXME: what if it's larger that max int? */
    *code = (int)retcode;

The code is not set properly if the code is not the last line of the result. I
corrected the issue as follows:

    while ( isspace( (unsigned char) next[ 0 ] ) && next[ 0 ] != '\n' ) next++;
    if ( next[ 0 ] != '\0' && next[ 0 ] != '\n' ) {
        Debug( LDAP_DEBUG_ANY, "str2result (%s) extra cruft after value\n",
               s, 0, 0 );
        rc = -1;
        continue;
    }

    /* FIXME: what if it's larger that max int? */
    *code = (int)retcode;