netcmd/ldapcmp: avoid modifying data while looping on dict