Project

General

Profile

Bug #265 » 0001-Password-cannot-contain-spaces.-Fix-265.patch

Pierre-Louis Bonicoli, 2012-01-07 12:35

View differences:

bipmkpw.1
bipmkpw converts a password into the double-hash used by bip. Copy the
generated output from bipmkpw into bip config file.
Password cannot contain spaces.
.SH SEE ALSO
bip.conf
src/bipmkpw.c
write(ttyfd, "Password: ", 10);
int idx = 0;
int valid = 1;
while (idx < buflen) {
read(ttyfd, buffer+idx, 1);
if (buffer[idx] == '\n') {
buffer[idx] = 0;
break;
} else if (buffer[idx] == ' ') {
valid = 0;
}
idx++;
}
......
tcsetattr(ttyfd, TCSANOW, &ttback);
close(ttyfd);
if (!valid) {
fprintf(stderr, "Password cannot contain spaces.\n");
exit(1);
}
}
int main(void)
(2-2/2)