Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Issues with users.conf #34

Merged
merged 2 commits into from
Jan 20, 2025
Merged

fix: Issues with users.conf #34

merged 2 commits into from
Jan 20, 2025

Conversation

HanLiQL
Copy link
Contributor

@HanLiQL HanLiQL commented Jan 20, 2025

#28
I finally found the root cause of the issue:
1.smb.conf and users.conf should be LF files, but if they are CRLF files, the previous bash script would treat the \r before the \n at the end of the line as part of the password. I have added logic to remove the \r character in the latest code, and it is now working properly. However, it is still recommended to use the LF format.
2.Some users have users.conf files that don't have a newline or a blank line at the end, causing the last line's configuration to be unrecognized. This issue was fixed in the last commit, and now all content can be correctly recognized.
3.I noticed that my log output was abnormal. Restarting Docker would output logs showing that the Samba user from the first line of users.conf was being added again. I have also fixed this issue in this update.

1.Previously, when processing users.conf files in CRLF format, the Bash script treated the '\r' at the end of lines as part of the password. This caused incorrect passwords and login failures.
2.This issue has now been fixed by removing all '\r' characters, enhancing compatibility.
3.It is still recommended to use LF format for both smb.conf and users.conf files.
1.Use pdb_output to first capture the result of pdbedit -s "$cfg" -L, and then check if the user exists in the output. Without this step, the first user loaded may be incorrectly identified as not existing, causing it to be re-added and triggering the log output: "User $username has been added to Samba and password set."
@kroese kroese changed the title Fixing Issues with users.conf fix: Issues with users.conf Jan 20, 2025
@kroese kroese merged commit 3661aef into dockur:master Jan 20, 2025
1 check 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.

2 participants