En federal domare i USA:s huvudstad Washington DC ger tidningen The New York Times rätt och tvingar Pentagon att ändra sina pressregler.