| 346 | } |
| 347 | |
| 348 | void auth_client(int fd, const char *user, const char *challenge) |
| 349 | { |
| 350 | const char *pass; |
| 351 | char pass2[MAX_DIGEST_LEN*2]; |
| 352 | |
| 353 | if (!user || !*user) |
| 354 | user = "nobody"; |
| 355 | negotiate_daemon_auth(-1, 1); |
| 356 | |
| 357 | if (!(pass = getpassf(password_file)) |
| 358 | && !(pass = getenv("RSYNC_PASSWORD"))) { |
| 359 | /* XXX: cyeoh says that getpass is deprecated, because |
| 360 | * it may return a truncated password on some systems, |
| 361 | * and it is not in the LSB. |
| 362 | * |
| 363 | * Andrew Klein says that getpassphrase() is present |
| 364 | * on Solaris and reads up to 256 characters. |
| 365 | * |
| 366 | * OpenBSD has a readpassphrase() that might be more suitable. |
| 367 | */ |
| 368 | pass = getpass("Password: "); |
| 369 | } |
| 370 | |
| 371 | if (!pass) |
| 372 | pass = ""; |
| 373 | |
| 374 | generate_hash(pass, challenge, pass2); |
| 375 | io_printf(fd, "%s %s\n", user, pass2); |
| 376 | } |
no test coverage detected