diff --git a/modules/pam_selinux/README b/modules/pam_selinux/README
index fb4d449..b1b6be2 100644
--- a/modules/pam_selinux/README
+++ b/modules/pam_selinux/README
@@ -72,6 +72,17 @@ use_current_range
    instead of the default level. Also suppresses asking of the sensitivity
    level from the user or obtaining it from PAM environment.

+select_default_context=
+
+    Select a specific context from the list of default contexts for the login
+    user returned by SELinux. By default the first entry is taken.
+    Valid values are 'last' or positiv numbers, to select a different context.
+    The list of available contexts can be viewed by 'compute_user
src_context seuser'.
+
+    Usage:
+        select_default_context=2
+        select_default_context=last
+
EXAMPLES

auth     required  pam_unix.so
diff --git a/modules/pam_selinux/pam_selinux.8
b/modules/pam_selinux/pam_selinux.8
index acd4f0d..d936cb9 100644
--- a/modules/pam_selinux/pam_selinux.8
+++ b/modules/pam_selinux/pam_selinux.8
@@ -31,7 +31,7 @@
pam_selinux \- PAM module to set the default security context
.SH "SYNOPSIS"
.HP \w'\fBpam_selinux\&.so\fR\ 'u
-\fBpam_selinux\&.so\fR [open] [close] [restore] [nottys] [debug]
[verbose] [select_context] [env_params] [use_current_range]
+\fBpam_selinux\&.so\fR [open] [close] [restore] [nottys] [debug]
[verbose] [select_context] [env_params] [use_current_range]
[select_default_context=\fIlast|context_number\fR]
.SH "DESCRIPTION"
.PP
pam_selinux is a PAM module that sets up the default SELinux security
context for the next executed process\&.
@@ -99,6 +99,15 @@ Attempt to obtain a custom security context role
from PAM environment\&. If MLS
.RS 4
Use the sensitivity level of the current process for the user context
instead of the default level\&. Also suppresses asking of the
sensitivity level from the user or obtaining it from PAM
environment\&.
.RE
+.PP
+\fBselect_default_context\fR
+.RS 4
+Select a specific context from the list of default contexts for the
login user returned by SELinux\&. By default the first entry is
taken\&. Valid values are 'last' or positiv numbers, to select a
different context\&. The list of a
vailable contexts can be viewed by 'compute_user src_context seuser'\&.
+.RS 2
+Usage:
+.RS 2
+select_default_context=2
+.RE
.SH "MODULE TYPES PROVIDED"
.PP
Only the
diff --git a/modules/pam_selinux/pam_selinux.8.xml
b/modules/pam_selinux/pam_selinux.8.xml
index 28d465f..210e262 100644
--- a/modules/pam_selinux/pam_selinux.8.xml
+++ b/modules/pam_selinux/pam_selinux.8.xml
@@ -45,6 +45,9 @@
      <arg choice="opt">
       use_current_range
      </arg>
+      <arg choice="opt">
+        select_default_context=<replaceable>conf-file</replaceable>
+      <arg>
    </cmdsynopsis>
  </refsynopsisdiv>

@@ -188,6 +191,22 @@
          </para>
        </listitem>
      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>select_default_context=<replaceable>last|context_number</replaceable></option>
+        </term>
+        <listitem>
+          <para>
+            Select a specific context from the list of default
contexts for the login
+            user returned by SELinux. By default the first entry is taken.
+            Valid values are 'last' or positiv numbers, to select a
different context.
+            The list of available contexts can be viewed by
'compute_user src_context seuser'.
+            Usage:
+              select_default_context=2
+              select_default_context=last
+          </para>
+        </listitem>
+      </varlistentry>
    </variablelist>
  </refsect1>

diff --git a/modules/pam_selinux/pam_selinux.c
b/modules/pam_selinux/pam_selinux.c
index b96cc23..446b4fb 100644
--- a/modules/pam_selinux/pam_selinux.c
+++ b/modules/pam_selinux/pam_selinux.c
@@ -63,8 +63,6 @@

#include <selinux/selinux.h>
#include <selinux/get_context_list.h>
-#include <selinux/flask.h>
-#include <selinux/av_permissions.h>
#include <selinux/selinux.h>
#include <selinux/context.h>
#include <selinux/get_default_type.h>
@@ -480,7 +478,8 @@ set_file_context(const pam_handle_t *pamh,
security_context_t context,
static int
compute_exec_context(pam_handle_t *pamh, module_data_t *data,
                    int select_context, int use_current_range,
-                    int env_params, int debug)
+                    int env_params, int debug,
+                    const char *select_default_context)
{
  const char *username;
