(b) If a sale or mortgage of any real property of any such society has been heretofore or shall be hereafter made and a conveyance or mortgage executed and delivered without the authority of a court of competent jurisdiction, obtained as required by law, or not in accordance with its directions, the court may, thereafter, upon the application of the corporation, or of the grantee or mortgagee in any such conveyance or mortgage or of any person claiming through or under any such grantee or mortgagee upon such notice to such corporation, or its successor, and such other person or persons as may be interested in such property, as the court may prescribe, confirm said previously executed conveyance or mortgage, and order and direct the execution and delivery of a confirmatory deed or mortgage, or the recording of such confirmatory order in the office where deeds and mortgages are recorded in the county in which the property is located; and upon compliance with the said order such original conveyance or mortgage shall be as valid and of the same force and effect as if it has been executed and delivered after due proceedings had in accordance with the statute and the direction of the court.
(c) The provisions of this section shall not apply to real property heretofore or hereafter acquired on a sale in an action or proceeding for the foreclosure of a mortgage owned by a society or held by a trustee for or in behalf of a society or to real property heretofore or hereafter acquired by a society or held by a trustee for or in behalf of a society by deed in lieu of the foreclosure of a mortgage owned, either in whole or in part, whether in certificate form or otherwise, by a society.