RIO DE JANEIRO — Police and Brazilian Army soldiers, struggling to take control of a second huge slum complex here, were fired on by drug gangs on Friday, but by nightfall they had managed to trap the traffickers inside, a military spokesman said.