§ 1501. Who may maintain an action. 1. Where a person claims an estate or interest in real property; or where he claims such estate or interest as executor or administrator of a deceased person; or where a municipal corporation has purchased an estate or interest in real property at a sale conducted by it for unpaid taxes against the property and the time within which redemption from such sale may be made has expired and such municipal corporation claims it; such person or municipal corporation, as the case may be, may maintain an action against any other person, known or unknown, including one under disability as hereinafter specified, to compel the determination of any claim adverse to that of the plaintiff which the defendant makes, or which it appears from the public records, or from the allegations of the complaint, the defendant might make; provided, however, that where the estate or interest claimed by the plaintiff is for a term of years, the action may not be maintained unless the balance remaining of such term of years is not less than five.
2. Such action may be maintained, even though the defendant's claim appears to be invalid on its face, or the court may have to determine the death of a person, or any statutory limitation of time, or any other question of fact or law upon which an adjudication of the adverse claims of the parties may depend.
3. An action against a woman who claims a right of dower in the whole or a part of the property cannot be commenced until the expiration of four months after the death of defendant's husband.
4. Where the period allowed by the applicable statute of limitation for the commencement of an action to foreclose a mortgage, or to enforce a vendor's lien, has expired, any person having an estate or interest in the real property subject to such encumbrance may maintain an action against any other person or persons, known or unknown, including one under disability as hereinafter specified, to secure the cancellation and discharge of record of such encumbrance, and to adjudge the estate or interest of the plaintiff in such real property to be free therefrom; provided, however, that no such action shall be maintainable in any case where the mortgagee, holder of the vendor's lien, or the successor of either of them shall be in possession of the affected real property at the time of the commencement of the action. In any action brought under this section it shall be immaterial whether the debt upon which the mortgage or lien was based has, or has not, been paid; and also whether the mortgage in question was, or was not, given to secure a part of the purchase price.
5. The interest had by any mortgagee or contract vendee of real property or by any successor in interest of either of them, is an "interest in real property" as that phrase is used in this article of the real property actions and proceedings law.