The Secretary is directed to promptly issue patents to all persons who have made a lawful entry on the public lands in compliance with the public land laws for the purpose of gaining title to homesteads, headquarters sites, trade and manufacturing sites, or small tract sites (
43 U.S.C.
682 ), and who have fulfilled all requirements of the law prerequisite to obtaining a patent. Any person who has made a lawful entry prior to August 31, 1971, for any of the foregoing purposes shall be protected in his right of use and occupancy until all the requirements of law for a patent have been met even though the lands involved have been reserved or withdrawn in accordance with Public Land Order 4582, as amended, or the withdrawal provisions of this chapter: Provided, That occupancy must have been maintained in accordance with the appropriate public land law: Provided further, That any person who entered on public lands in violation of Public Land Order 4582, as amended, shall gain no rights.