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
13 13
bipmkpw converts a password into the double-hash used by bip. Copy the
14 14
generated output from bipmkpw into bip config file.
15 15

  
16
Password cannot contain spaces.
17

  
16 18
.SH SEE ALSO
17 19

  
18 20
bip.conf
src/bipmkpw.c
51 51
	write(ttyfd, "Password: ", 10);
52 52

  
53 53
	int idx = 0;
54
	int valid = 1;
54 55
	while (idx < buflen) {
55 56
		read(ttyfd, buffer+idx, 1);
56 57
		if (buffer[idx] == '\n') {
57 58
			buffer[idx] = 0;
58 59
			break;
60
		} else if (buffer[idx] == ' ') {
61
			valid = 0;
59 62
		}
60 63
		idx++;
61 64
	}
......
64 67

  
65 68
	tcsetattr(ttyfd, TCSANOW, &ttback);
66 69
	close(ttyfd);
70

  
71
	if (!valid) {
72
		fprintf(stderr, "Password cannot contain spaces.\n");
73
		exit(1);
74
	}
67 75
}
68 76

  
69 77
int main(void)
70
- 
(2-2/2)