Hello,
I have been working on this ticket[1] to allow selection of file paths
for alternate passwd and group files to be used with the files provider.
First, just to make sure I am not completely on the wrong track I would
like to ask for someone to take a quick look at the current
work-in-progress code I have here in my SSSD fork to validate that it
matches up with the expected implementation.
https://github.com/SSSD/sssd/compare/master...justin-stephenson:jstephen-...
Second, assuming I am not completely off track I would appreciate any
help on a code problem I am having here when sf_init() gets called to
setup watches on the passwd_files and group_files lists, the list values
are corrupted or inaccessible. I started off with the code from the
function files_init_alt_files() inside sssm_files_init() directly and
everything works as expected, the problem started when I moved the code
into this separate function.
The list values are retrieved from the new alt_passwd_files and
alt_group_files options or default to /etc/passwd and /etc/group files.
Inside sssm_files_init() I am able to access the correct values of each
string element in the list but when sf_init() is called the list is
corrupt or I am performing some undefined behavior that I cannot determine.
The debug log look something like this in my testing when three
different files are provided to the new conf options.
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found passwd file: [/etc/passwd].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found passwd file: [/opt/testpasswd].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found passwd file: [/usr/passwd].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found group file: [/etc/group].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found group file: [/opt/testgroup].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sssm_files_init] (0x0400):
Found group file: [/usr/group].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up passwd watch on [/etc/passwd].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 17
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 2
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [_snotify_create] (0x0400):
Added a watch for /etc/passwd with inotify flags 0xD88 internal flags
0x1 using function fn after delay 0.0
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up passwd watch on [`<DE><F6>^]hU].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 18
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch -1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [_snotify_create] (0x0400):
Added a watch for `<DE><F6>^]hU with inotify flags 0xD88 internal flags
0x1 using function fn after delay 0.0
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up passwd watch on [/etc/passwd].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 19
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 2
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [_snotify_create] (0x0400):
Added a watch for /etc/passwd with inotify flags 0xD88 internal flags
0x1 using function fn after delay 0.0
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up group watch on [/etc/group].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 20
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 2
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [_snotify_create] (0x0400):
Added a watch for /etc/group with inotify flags 0xD88 internal flags 0x1
using function fn after delay 0.0
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up group watch on [^Q].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 21
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch -1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [_snotify_create] (0x0400):
Added a watch for ^Q with inotify flags 0xD88 internal flags 0x1 using
function fn after delay 0.0
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [sf_init] (0x0400): Setting
up group watch on [/usr/group].
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened inotify fd 22
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened file watch 1
(Wed Dec 20 10:02:48 2017) [sssd[be[files]]] [snotify_watch] (0x2000):
Opened directory watch 2
Lastly, if there are other considerations I have missed here regarding
files provider logic please let me know and i'll work on it.
Any input is much appreciated, thank you.
[1]
https://pagure.io/SSSD/sssd/issue/3402
Kind regards,
Justin Stephenson