static char *do_get_passwd(void) { static char pwd[LINE_MAX]; char pwd2[LINE_MAX]; int tries = MAX_PASSWD_CHANGE_TRIES; *pwd = 0; *pwd2 = 0; again: printf("Password: "******"\nEnter it again: "); fflush(stdout); disable_echo(); if (fgets(pwd2, (int) (sizeof pwd2 - 1U), stdin) == NULL) { enable_echo(); return NULL; } strip_lf(pwd2); puts(""); if (strcmp(pwd, pwd2) != 0) { if (*pwd2 != 0) { memset(pwd2, 0, strlen(pwd2)); } if (*pwd != 0) { memset(pwd, 0, strlen(pwd)); } puts("You didn't enter the same password"); if (--tries > 0) { goto again; } enable_echo(); return NULL; } if (*pwd2 != 0) { memset(pwd2, 0, strlen(pwd2)); } enable_echo(); return pwd; }
int get_password(char *pwd, size_t max_len, const char *prompt) { int ret; disable_echo(); ret = get_line(pwd, max_len, prompt); enable_echo(); return ret; }
void console_black() { int i, j; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { setCharAtOff(i, j, ' '); setAttrAtOff(i, j, 0x0F); } } setCursor(0, 0); enable_echo(); enable_buf(); }
void exit_graphics(){ munmap(addr, map_size); close(fd); enable_echo(); }