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

back-sql/search.c bug?



Hi 

  I am using latest cvs copy on redhat 7.1.

  I am testing out the openldap's back-sql with
  mysql as backend.

  I think I might have found a bug in back-sql/search.c 
  around line #426, 
  after adding couple of print statement,

    if (bsi->bi->has_ldapinfo_dn_ru) {
fprintf(stderr,"XXX here1 bsi->base_dn(%s)\n", bsi->base_dn);
       temp_base_dn[0] = '\0';
       for ((i=0, j=strlen(bsi->base_dn)-1); j >= 0; (i++, j--)) {
fprintf(stderr,"XXX (%c), i(%d), j(%d)\n", *(bsi->base_dn+j),i,j);
         *(temp_base_dn+i) = toupper(*(bsi->base_dn+j)); <<<<<<<----------
       }
       *(temp_base_dn+i) = '%';
       *(temp_base_dn+i+1) = '\0';
    }
    else {
        strcpy(temp_base_dn, "%");
        for (i = 0; *(bsi->base_dn+i); i++) {
          *(temp_base_dn+i+1) = toupper(*(bsi->base_dn+i));
        }
        *(temp_base_dn+i+1) = '\0';
    }
fprintf(stderr,"XXX temp_base_dn (%s)\n", temp_base_dn);

  I got these,

XXX here1 bsi->base_dn(O=SQL,C=RU)^M
XXX (U), i(0), j(9)^M
XXX (R), i(1), j(8)^M
XXX (=), i(2), j(7)^M
XXX (C), i(3), j(6)^M
XXX (,), i(4), j(5)^M
XXX (L), i(5), j(4)^M
XXX (Q), i(6), j(3)^M
XXX (S), i(7), j(2)^M
XXX (=), i(8), j(1)^M
XXX (O), i(9), j(0)^M
XXX temp_base_dn (O=SQL,C=RU%)^M
dn 'O=SQL,C=RU%'^M

  dn got reversed. changing "<<<<<-----" to i instead of j fixes this
  problem.


mei