diff options
Diffstat (limited to 'contrib/cvs/src/login.c')
-rw-r--r-- | contrib/cvs/src/login.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/contrib/cvs/src/login.c b/contrib/cvs/src/login.c index 4d395dd..49622e8 100644 --- a/contrib/cvs/src/login.c +++ b/contrib/cvs/src/login.c @@ -12,12 +12,6 @@ #ifdef AUTH_CLIENT_SUPPORT /* This covers the rest of the file. */ -#ifdef HAVE_GETPASSPHRASE -#define GETPASS getpassphrase -#else -#define GETPASS getpass -#endif - /* There seems to be very little agreement on which system header getpass is declared in. With a lot of fancy autoconfiscation, we could perhaps detect this, but for now we'll just rely on @@ -25,9 +19,6 @@ declaration won't work (some Crays declare the 2#$@% thing as varadic, believe it or not). On Cray, getpass will be declared in either stdlib.h or unistd.h. */ -#ifndef _CRAY -extern char *GETPASS (); -#endif #ifndef CVS_PASSWORD_FILE #define CVS_PASSWORD_FILE ".cvspass" @@ -229,8 +220,10 @@ password_entry_parseline (cvsroot_canonical, warn, linenumber, linebuf) * * Mode Action * password_entry_lookup Return the password - * password_entry_delete Delete the entry from the file, if it exists - * password_entry_add Replace the line with the new one, else append it + * password_entry_delete Delete the entry from the file, if it + * exists. + * password_entry_add Replace the line with the new one, else + * append it. * * Because the user might be accessing multiple repositories, with * different passwords for each one, the format of ~/.cvspass is: @@ -291,7 +284,7 @@ password_entry_operation (operation, root, newpassword) char *cvsroot_canonical = NULL; char *password = NULL; int line_length; - long line; + long line = -1; char *linebuf = NULL; size_t linebuf_len; char *p; @@ -299,7 +292,8 @@ password_entry_operation (operation, root, newpassword) if (root->method != pserver_method) { - error (0, 0, "internal error: can only call password_entry_operation with pserver method"); + error (0, 0, "\ +internal error: can only call password_entry_operation with pserver method"); error (1, 0, "CVSROOT: %s", root->original); } @@ -323,7 +317,8 @@ password_entry_operation (operation, root, newpassword) while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0) { line++; - password = password_entry_parseline(cvsroot_canonical, 1, line, linebuf); + password = password_entry_parseline (cvsroot_canonical, 1, line, + linebuf); if (password != NULL) /* this is it! break out and deal with linebuf */ break; @@ -373,7 +368,8 @@ process: * add */ if (!noexec && password != NULL && (operation == password_entry_delete - || (operation == password_entry_add && strcmp (password, newpassword)))) + || (operation == password_entry_add + && strcmp (password, newpassword)))) { long found_at = line; char *tmp_name; @@ -394,7 +390,8 @@ process: line++; if (line < found_at || (line != found_at - && !password_entry_parseline(cvsroot_canonical, 0, line, linebuf))) + && !password_entry_parseline (cvsroot_canonical, 0, line, + linebuf))) { if (fprintf (tmp_fp, "%s", linebuf) == EOF) { @@ -541,7 +538,7 @@ login (argc, argv) else { char *tmp; - tmp = GETPASS ("CVS password: "); + tmp = getpass ("CVS password: "); /* Must deal with a NULL return value here. I haven't managed to * disconnect the CVS process from the tty and force a NULL return * in sanity.sh, but the Linux version of getpass is documented @@ -560,7 +557,8 @@ login (argc, argv) connect_to_pserver (current_parsed_root, NULL, NULL, 1, 0); - password_entry_operation (password_entry_add, current_parsed_root, typed_password); + password_entry_operation (password_entry_add, current_parsed_root, + typed_password); memset (typed_password, 0, strlen (typed_password)); free (typed_password); @@ -572,6 +570,8 @@ login (argc, argv) return 0; } + + /* Returns the _scrambled_ password. The server must descramble before hashing and comparing. If password file not found, or password not found in the file, just return NULL. */ @@ -579,7 +579,7 @@ char * get_cvs_password () { if (current_parsed_root->password) - return (scramble(current_parsed_root->password)); + return scramble (current_parsed_root->password); /* If someone (i.e., login()) is calling connect_to_pserver() out of context, then assume they have supplied the correct, scrambled @@ -607,9 +607,12 @@ get_cvs_password () error (1, 0, "CVSROOT: %s", current_parsed_root->original); } - return password_entry_operation (password_entry_lookup, current_parsed_root, NULL); + return password_entry_operation (password_entry_lookup, + current_parsed_root, NULL); } + + static const char *const logout_usage[] = { "Usage: %s %s\n", |