[EMAIL PROTECTED] wrote:
Update of /repo/OpenLDAP/pkg/ldap/tests/progs

Modified Files:
        slapd-addel.c  1.39 -> 1.40
        slapd-bind.c  1.15 -> 1.16
        slapd-modify.c  1.17 -> 1.18
        slapd-modrdn.c  1.20 -> 1.21
        slapd-read.c  1.31 -> 1.32
        slapd-search.c  1.35 -> 1.36
        slapd-tester.c  1.39 -> 1.40

rev 1.12 of slapd-bind.c introduced this chunk of code:
@@ -279,20 +298,33 @@
#endif

       if ( nrdns == 0 ) {
-               fprintf( stderr, "No RDNs.\n" );
+               tester_error( "No RDNs" );
               return 1;
       }

       /* Ok, got list of RDNs, now start binding to each */
       for (i=0; i<maxloop; i++) {
               char dn[BUFSIZ], *ptr;
-               int j = rand() % nrdns;
-               ptr = lutil_strcopy(dn, rdns[j]);
-               *ptr++ = ',';
-               strcpy(ptr, base);
-               if ( do_bind( uri, dn, pass, 1, force ) && !force )
+               int j, k;
+
+               for ( k = 0; k < nrdns; k++) {
+                       j = rand() % nrdns;
+ if ( base->bv_len + rdns[j].bv_len < sizeof( dn ) ) {
+                               break;
+                       }
+               }
+
+               if ( k == nrdns ) {
+
+               }
+
+               ptr = lutil_strcopy(dn, rdns[j].bv_val);
+               strcpy(ptr, base->bv_val);
+ if ( do_bind( uri, dn, pass, 1, force, noinit, &ld ) && !force ) {
                       break;
+               }
       }
+
#ifdef _WIN32
       end = GetTickCount();
       end -= beg;


There's no explanation for the empty "if (k == nrdns) {" block. What's going on here? Also coverity complains about j being used uninitialized, but I see that's false.

--
 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/

Reply via email to