Bug 212801 - (remote) uids mapped to local names
Summary: (remote) uids mapped to local names
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: Samba (show other bugs)
Version: 18.04.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
: 302596 (view as bug list)
Depends on:
Reported: 2009-11-02 21:03 UTC by Jeffrey
Modified: 2020-02-13 11:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:

Inaccurate file permissions (126.95 KB, image/png)
2009-11-02 21:10 UTC, Jeffrey

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey 2009-11-02 21:03:19 UTC
Version:            (using KDE 4.3.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

When I connect to our local Samba server using Dolphin, there are a few issues:

1.  Files created by anyone appear to be owned by me, rather than an unknown username or UID number

2.  Files created by me appear to be owned by me in Dolphin,  but on the server they appear to be owned by UID 99 (account 'nobody').  Files created with smbclient 

I will attach a screenshot of Yakuake showing one set of permissions (accurate) and Dolphin showing completely inaccurate file permissions for the same share.

This happens with the Samba server's smb.conf 'global' section both with 'unix extensions = off' and without that line present at all (not tested with 'unix extensions = on' at all).  Useraccounts are authenticated via LDAP.

Logging in with smbclient uses the correct user permissions when I put a file there.

Samba service is from RHEL:
Name       : samba                                                      
Arch       : i386                                                       
Version    : 3.0.33                                                     
Release    : 3.7.el5_3.1

Local Debian package for libsmbclient:
Package: libsmbclient
State: installed
Automatically installed: yes
Version: 2:3.4.2-1
Comment 1 Jeffrey 2009-11-02 21:10:26 UTC
Created attachment 38039 [details]
Inaccurate file permissions

This seems to be a pretty important issue.

Files are reporting permissions incorrectly in Dolphin and are creating files with incorrect permissions on the Samba server.
Comment 2 Jeffrey 2009-11-02 21:23:32 UTC
my mistake, it should be 'unix extensions = no' and not '= off'.

However, it doesn't correct the way that this functions.
Comment 3 Nate Graham 2018-06-28 18:15:05 UTC
Confirmed with KDE Frameworks 5.47.
Comment 4 Nate Graham 2018-06-28 18:19:33 UTC
*** Bug 302596 has been marked as a duplicate of this bug. ***
Comment 5 Harald Sitter 2020-02-06 14:11:11 UTC
Probably related https://bugzilla.samba.org/show_bug.cgi?id=14101

This is in general all unrelated to us and happens inside libsmbclient respectively server-side. All we do to determine ownership is call smbc_stat, if that gives out wrong UIDs we probably can't do much about that. As I understand it posix ownership reporting in general only works with the unix extensions enabled, so perhaps in the interest of portability it'd make sense to not report a known owner/group at all.

There's however one defect that needs addressing on our end: uids are being mapped to local user names. That's an assumption that isn't portable. e.g. on the server a file is owned by uid 1000 and the local user name with uid 1000 is called john, so we'd report the owner as john. That's obviously silly and we should just report the uid.
Comment 6 Harald Sitter 2020-02-13 11:27:24 UTC
Git commit 25a02064dbeea618e22dc2c0ba853b609f124f2c by Harald Sitter.
Committed on 13/02/2020 at 11:16.
Pushed by sitter into branch 'master'.

smb: do not map uid and gid

libsmbc returns the uid/gid of the process, not of the file, the data
is entirely useless to us. do not list it.
currently there is no way to get the actual uid/gid of a dirent. internally
there seems to be tech available that uses the samba unix extension but
that doesn't have any public API.

in short: we can't determine ownership client-side

Test Plan: no longer shows current user as owner. in particular when that is not true!

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D27293

M  +4    -16   smb/kio_smb_browse.cpp