Bug 13583 - MMC displays Unix user root against "Accessed By" rather than the domain user
Summary: MMC displays Unix user root against "Accessed By" rather than the domain user
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.7.8
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2018-08-20 18:48 UTC by Partha
Modified: 2018-08-20 18:48 UTC (History)
0 users

See Also:

MMC accessed by root (280.58 KB, image/png)
2018-08-20 18:48 UTC, Partha
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Partha 2018-08-20 18:48:58 UTC
Created attachment 14440 [details]
MMC accessed by root

Environment SAMBA 4.7.6 joined to the Microsoft AD as a member server.

The MMC browser for open files lists as unix user "root" against "Accessed By" filed.  

Users lists against "Admin user" config parameter are the one who interpreted as "root" because the UID is being set as 0 to those users and which is being entered in the share mode entry. 

attached the image where you can see the "root" for the Accessed By" field in MMC. 

I hope we should also have the actual UID in sharemode entry to derive its domain user name. 

static int enum_file_fn(const struct share_mode_entry *e,
                        const struct file_id *id,
                        const char *sharepath,
                        const char *fname,
                        const char *sname,
                        void *private_data)
        struct file_enum_count *fenum =
                (struct file_enum_count *)private_data;

        struct srvsvc_NetFileInfo3 *f;
        int i = fenum->ctr3->count;
        files_struct fsp;
        struct byte_range_lock *brl;
        int num_locks = 0;
        char *fullpath = NULL;
        uint32_t permissions;
        const char *username;

        /* If the pid was not found delete the entry from connections.tdb */

        if ( !process_exists(e->pid) ) {
                return 0;

        username = uidtoname(e->uid);

        if ((fenum->username != NULL)
            && !strequal(username, fenum->username)) {
                return 0;