A short overview of the function: unsigned int i; ... i gets a value ret = ldb_next_start_trans(data->partitions[i]->module); if (ret != LDB_SUCCESS) { for (i--; i >= 0; i--) { .. do something with i } } Since i is unsigned, the condition "i >= 0" is always true. The attached patch fixes this bug.
Created attachment 9549 [details] patch
yes, this seems correct.
Volker also noticed it. Fixed by 8686da231d434bb35333654277a029271e147257 in master for Samba 4.7. Thanks for the report!