Bug 463067 - The plugin doesn't see already created Samba users when trying to create a share
Summary: The plugin doesn't see already created Samba users when trying to create a share
Status: CONFIRMED
Alias: None
Product: kdenetwork-filesharing
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 463066 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-12-15 12:01 UTC by schM0ggi
Modified: 2023-07-20 23:33 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schM0ggi 2022-12-15 12:01:00 UTC
When trying to create a share via Dolphin with the help of the kdenetwork-filesharing plugin, it asks for creating/setting a Samba user/password, despite a Samba user is already present.

How it looks:
https://i.imgur.com/E9au5N7.png
https://i.imgur.com/4LXkdcV.png
https://i.imgur.com/wdRONLK.png

STEPS TO REPRODUCE
1. install kdenetwork-filesharing plugin 
2. install samba-usershares package
3. add your user to the group "usershares", which was created via the "samba-usershares" package
4. create a Samba user for your Linux user and set a password
5. restart
6. create a directory in your home directory
7. set the right SELinux context for the share
sudo semanage fcontext --add --type "samba_share_t" "/home/my_user_name/name_of_directory(/.*)?"
sudo restorecon -R ~/name_of_directory
8. open properties of the directory. Go to "Share" tab

OBSERVED RESULT
There is a button to create/set a Samba user/password, despite a Samba user beeing already present. 

EXPECTED RESULT
It should not ask for this if a Samba user is already present.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 37 KDE Spin , everything is up to date

ADDITIONAL INFORMATION
As seen here https://bugzilla.redhat.com/show_bug.cgi?id=2096405 and here https://pagure.io/fedora-kde/SIG/issue/109

there exists a "samba-usershares" package in the Fedora repo which creates the directory "/var/lib/samba/usershares" and a "/etc/samba/usershares.conf" file. 

The "/etc/samba/smb.conf" file has the following line:
https://i.imgur.com/93FYiaj.png
which includes, as I understand, the additional configuration from "/etc/samba/usershares.conf", created by the samba-usershares package. The "/etc/samba/usershares.conf" file holds this:
https://i.imgur.com/Sr87uKz.png
Comment 1 Nate Graham 2022-12-15 19:17:02 UTC
What is the name of the samba user? I think the system looks for one with an identical name as your user account. It shouldn't be necessary to create one manually since the system is supposed to do it for you.
Comment 2 schM0ggi 2022-12-15 20:13:33 UTC
(In reply to Nate Graham from comment #1)
> What is the name of the samba user? I think the system looks for one with an
> identical name as your user account. It shouldn't be necessary to create one
> manually since the system is supposed to do it for you.

The name of my Samba user is the same as my Linux user.
Linux = schM0ggi
Samba = schM0ggi

I've created a Samba user beforehand because it's the first time I'm using Samba and I've tested a share combined with a second Windows pc. I've followed the documentation of Fedora, specifically the part "Sharing a directory inside /home".
https://docs.fedoraproject.org/en-US/quick-docs/samba/

I've also deleted my Samba user and tested if the plugin creates a new one when answering the dialogue. It does not.
I've checked with the command "sudo pdbedit -L"
Comment 3 Nate Graham 2022-12-25 03:12:43 UTC
*** Bug 463066 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2022-12-25 03:28:47 UTC
Thanks for the info. Will investigate.
Comment 5 Nate Graham 2022-12-25 18:52:31 UTC
User::inSamba() is returning false here when it should be true, triggering the "create a Samba user" page to inappropriately appear.

In User::resolve(), there's code to check for existing Samba users, so I guess for your your setup, it isn't working, or isn't being run.
Comment 6 schM0ggi 2023-03-14 09:34:36 UTC
Hi.
I wanted to ask if there is any light in the tunnel for this bug?
Comment 7 tux 2023-07-20 23:33:25 UTC
I'm having the same bug on Arch Linux. Only on my laptop though, for some reason it works fine on my desktop.
And I know this isn't a proper fix, but just adding "true || " to the first line of User::resolve() works:
> if (true || !qobject_cast<UserManager *>(parent())->canManageSamba() || m_name == everyoneUserName) {