Skip to content

auth: read only the first password-file line - #1137

Merged
steadytao merged 2 commits into
RsyncProject:masterfrom
sairex53:fix-1134-password-first-line
Oct 23, 2026
Merged

steadytao merged 2 commits into
RsyncProject:masterfrom
sairex53:fix-1134-password-first-line

Conversation

@sairex53

Copy link
Copy Markdown
Contributor

getpassf() used strtok(), which skips leading CR/LF delimiters. An empty first line could therefore make rsync use a later password, contrary to the documented first-line behavior.

Stop at the first CR/LF without skipping it. This keeps an empty first line empty and makes password-file and stdin handling consistent. The regression test covers LF, CRLF, empty input, an empty first line followed by a password, and a final line without a newline for both input sources.

Fixes #1134.

Testing on Fedora 44 ARM64:

  • make -j4 check — 274 passed, 99 skipped, 0 failed
  • Password and daemon-auth tests — 3 passed, 3 skipped, 0 failed
  • git diff --check

strtok() skips leading delimiters, so an empty first line followed by a
password was interpreted as that password. Stop at the first CR/LF
instead, keeping an empty first line empty and making file and stdin
behavior consistent.

Add daemon-auth regression coverage for LF, CRLF, empty input, an empty
first line, and a final line without a newline for both input sources.

Fixes RsyncProject#1134.

Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
@sairex53
sairex53 force-pushed the fix-1134-password-first-line branch from f4107e9 to 1ea8f84 Compare October 21, 2026 10:00
Comment thread testsuite/password-file-first-line_test.py Outdated
Supply the valid daemon password through RSYNC_PASSWORD in negative
cases, then require exit status 1 and the password read diagnostic.

Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR

@steadytao
steadytao merged commit be12460 into RsyncProject:master Oct 23, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getpassf reads a later password line when the first line is empty

2 participants