diff options
author | Simon Rettberg | 2018-03-10 15:55:33 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-03-10 15:55:33 +0100 |
commit | 216903a3f988ca97249e4227b6b8996c9a7b22ab (patch) | |
tree | 5e57c9fdbb8a7d97f32912ed2968234368934291 | |
parent | [pam/runvirt/..] Move .account and .home into .openslx subdirectory (diff) | |
download | mltk-216903a3f988ca97249e4227b6b8996c9a7b22ab.tar.gz mltk-216903a3f988ca97249e4227b6b8996c9a7b22ab.tar.xz mltk-216903a3f988ca97249e4227b6b8996c9a7b22ab.zip |
[pam-slx-plug/run-virt] Create a usable shares file for run-virt
Global /opt/openslx/inc/shares is legacy fallback only
3 files changed, 18 insertions, 3 deletions
diff --git a/core/modules/pam-slx-plug/data/opt/openslx/pam/auth-source.d/99-slx-ldap b/core/modules/pam-slx-plug/data/opt/openslx/pam/auth-source.d/99-slx-ldap index 7fcf1383..e4f2704e 100644 --- a/core/modules/pam-slx-plug/data/opt/openslx/pam/auth-source.d/99-slx-ldap +++ b/core/modules/pam-slx-plug/data/opt/openslx/pam/auth-source.d/99-slx-ldap @@ -158,6 +158,7 @@ run_auth() { } TEMPFILES_LDAP= +SLX_LDAP_FILE= for s_file in /opt/openslx/pam/slx-ldap.d/*; do unset_ldap_vars @@ -167,7 +168,10 @@ for s_file in /opt/openslx/pam/slx-ldap.d/*; do slxlog --echo "pam-slxldap-empty" "LDAP config '$s_file' is missing URI or BASE" continue fi - run_auth && break + if run_auth; then + SLX_LDAP_FILE="$s_file" + break + fi done if [ -z "$USER_UID" ]; then diff --git a/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials b/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials index c1761d2d..61df37f8 100644 --- a/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials +++ b/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials @@ -70,5 +70,13 @@ if [ -n "$TEMP_HOME_DIR" ]; then fi fi +# Now copy all the share mount options over from the current ldap plugin +if [ -n "$SLX_LDAP_FILE" ] && [ -s "$SLX_LDAP_FILE" ]; then + grep '^SHARE_' "$SLX_LDAP_FILE" + if [ -n "$USER_DN" ] && [ "$(echo "$USER_DN" | wc -l)" = 1 ]; then + set | grep '^USER_DN=' + fi +fi > "${TEMP_HOME_DIR}/.openslx/shares" + true diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc index 605668c9..c7f30072 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc @@ -39,8 +39,11 @@ setup_virtual_floppy() { chmod 0600 "${SLX_FLOPPY_IMG}" mkfs.fat "${SLX_FLOPPY_IMG}" || mkfs.vfat "${SLX_FLOPPY_IMG}" || mkdosfs "${SLX_FLOPPY_IMG}" - # Create file with resolution information etc. - $(safesource "/opt/openslx/inc/shares") + if [ -s "${TMPHOME}/.openslx/shares" ]; then + $(safesource "${TMPHOME}/.openslx/shares") + else + $(safesource "/opt/openslx/inc/shares") + fi if notempty SHARE_REMAP_MODE; then local SHARE_REMAP_MODE_INI="$SHARE_REMAP_MODE" |