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

sssd: fix faulty program detection inside is_running_sssd #7661

Closed
wants to merge 1 commit into from

Conversation

jengelh
Copy link
Contributor

@jengelh jengelh commented Oct 18, 2024

The is_running_sssd function erroneously returns false even though the program binary is called sssd. This is because it looks at the wrong portion of the filename.

Observed:

…
(gdb) r
…
is_running_sssd () at src/util/sss_ini.c:156
156         const char *s = NULL;
(gdb) n
158         ret = readlink("/proc/self/exe", exe, sizeof(exe) - 1);
159         if ((ret > 0) && (ret < 1024)) {
160             exe[ret] = 0;
161             s = strstr(exe, debug_prg_name);
(gdb) p exe
$6 = "/home/ej/repos/sssd/.libs/sssd", '\000' <repeats 993 times>
(gdb) p debug_prg_name
$7 = 0x7ffff77fc110 "sssd"
(gdb) p s
$8 = 0x7ffff7fa72cf <exe+15> "sssd/.libs/sssd"

Expected:

(gdb) p s
$8 = 0x7ffff7fa72da <exe+26> "sssd"

Fixes: 2.9.0-453-g9fbaf6d74

@alexey-tikhonov
Copy link
Member

Thank you, ACK.

@alexey-tikhonov
Copy link
Member

Function is_running_sssd() might become obsolete, 'll see.

The ``is_running_sssd`` function erroneously returns false even
though the program binary is called ``sssd``. This is because it
looks at the wrong portion of the filename.

Observed:

```
…
(gdb) r
…
is_running_sssd () at src/util/sss_ini.c:156
156         const char *s = NULL;
(gdb) n
158         ret = readlink("/proc/self/exe", exe, sizeof(exe) - 1);
159         if ((ret > 0) && (ret < 1024)) {
160             exe[ret] = 0;
161             s = strstr(exe, debug_prg_name);
(gdb) p exe
$6 = "/home/ej/repos/sssd/.libs/sssd", '\000' <repeats 993 times>
(gdb) p debug_prg_name
$7 = 0x7ffff77fc110 "sssd"
(gdb) p s
$8 = 0x7ffff7fa72cf <exe+15> "sssd/.libs/sssd"
```

Expected:

```
(gdb) p s
$8 = 0x7ffff7fa72da <exe+26> "sssd"
```

Fixes: 2.9.0-453-g9fbaf6d74
@alexey-tikhonov alexey-tikhonov added superseded This PR is superseded in favor if a different one and removed Deferred labels Nov 1, 2024
@alexey-tikhonov
Copy link
Member

Superseded by #7667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: sssd-2-10 superseded This PR is superseded in favor if a different one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants