- Timestamp:
- 2009-02-10T16:02:02+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/common-src/src/getpw/getpw.cpp
r2999 r18493 71 71 int main (int argc, char *argv[]) { 72 72 73 int password_ok = 0; 73 74 char c[10]; 74 while (1) { 75 int i; 76 77 for (i=0; i<3; i++) { 75 78 char *a = getpass("Enter password:"); 76 79 int len = strlen (a); 77 if (len < 3 || len > 8) {78 cerr << "Password must be between 3 and 8 characters long. Try again\n";80 if (len < 3 || len > 128) { 81 cerr << "Password must be between 3 and 128 characters long. Try again\n"; 79 82 continue; 80 83 } 84 81 85 strcpy (c, a); 86 82 87 char *b = getpass("Re-enter password:"); 83 if ((strcmp (c, b)) == 0) break; 84 else cerr << "Passwords didn't match. Try again.\n"; 88 89 if ((strcmp (c, b)) == 0) { 90 password_ok = 1; 91 break; 92 } 93 else { 94 cerr << "Passwords didn't match. Try again.\n"; 95 } 96 } 97 98 if (!password_ok) { 99 cerr << "Failed to capture password." << endl; 100 return -1; 85 101 } 86 102
Note:
See TracChangeset
for help on using the changeset viewer.