/* Code to check a password and restart or reboot the VAX if the
 * password matches. */


#include <types.h>

ext byte cpmbx;			/* Console Program Mailbox */
#define REBOOT 1
#define RESTART 2
#define CD_REBOOT 0x22
#define CD_RESTART 0x21

md_reboot(code, pass)
int code;
char *pass;
{
    if (strcmp(crypt(pass, "Za"), "ZaLPN5JftyekQ") == 0) {
	switch(code) {
	case REBOOT:
	    cpmbx = CD_REBOOT;
	    break;
	case RESTART:
	    cpmbx = CD_RESTART;
	    break;
	default:
	    dolog("reboot - bad opcode\n");
	    return;
	}
	asm("halt");
    }
    dolog("reboot - bad password\n");
}
