The validity of corporate action may not be challenged on the ground that the corporation lacks or lacked power to act. However, a corporation's power to act may be challenged in the following proceedings:
In a shareholder's proceeding under subdivision (1) to enjoin an unauthorized corporate act, the court may enjoin or set aside the act, if equitable and if all affected persons are parties to the proceeding, and may award damages for loss, other than anticipated profits, suffered by the corporation or another party because of enjoining the unauthorized act.
SDCL 47-1A-304