r22519: convert libnet_DomainOpenSamr function from state-handling routine