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

Fix session list processing #3103

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

matt335672
Copy link
Member

Fixes #3095

The get_sorted_session_displays() is broken in that it doesn't produce a sorted list of displays.

The problem is the qsort comparison function which has 2 errors in 4 lines:-

  1. The test is the wrong way round (i.e. arg1 < arg2 produces a positive result instead of negative)
  2. Subtracting two unsigned ints in C will never return < 0

The broken function has been masked by other display checks which mean that it is only visible in a few situations:-

  1. Starting two sessions very closely to each other may allocate the same display to both sessions.
  2. If /tmp is namespaced, the other display checks do not work, and more than two sessions cannot be started - see xrdp-sesman namespace login error #3095

The get_sorted_session_displays() is broken in that it
doesn't produce a sorted list of displays.

The problem is the qsort comparison function which has 2 errors in 4 lines:-
1) The test is the wrong way round (i.e. arg1 < arg2 produces a +ve
   result instead of -ve)
2) Subtracting two unsigned ints in C will never return < 0

The broken function has been masked by other display checks which mean
that it is only visible in a few situations:-
1) Starting two sessions very closely to each other may allocate the
   same display to both sessions.
2) If /tmp is namespaced, the other display checks do not work, and
   more than two sessions cannot be started.
@matt335672 matt335672 merged commit c982897 into neutrinolabs:devel Jun 3, 2024
14 checks passed
@matt335672 matt335672 deleted the fix_display_list branch June 3, 2024 08:42
@Nexarian
Copy link
Contributor

Nexarian commented Jun 3, 2024

Awesome fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xrdp-sesman namespace login error
2 participants