From 6317b8320d90bbdf3834ba210202abff7b6a3844 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 20 May 2016 18:00:11 +0200 Subject: [ad] Mount-cifs: Try different mount options (smb3 etc) --- data/ad/mountscript | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'data') diff --git a/data/ad/mountscript b/data/ad/mountscript index 95048af..d7ae209 100644 --- a/data/ad/mountscript +++ b/data/ad/mountscript @@ -39,26 +39,24 @@ if ! grep -q "^${PAM_USER}:" "/etc/passwd"; then fi if [ -n "${VOLUME}" ]; then - MOUNT_OPTS="-v -t cifs -o uid=${USER_UID},gid=${USER_GID},forceuid,forcegid,sec=ntlm,nounix,file_mode=0700,dir_mode=0700" - SIGNAL="/tmp/signal.${RANDOM}.${RANDOM}.${PAM_USER}.${RANDOM}" export USER="${REAL_ACCOUNT}" export PASSWD="${PAM_AUTHTOK}" - ( mount ${MOUNT_OPTS} "${VOLUME}" "${PERSISTENT_HOME_DIR}" > "${RESULT}" 2>&1 || touch "${SIGNAL}" ) & - MOUNT_PID=$! - for COUNTER in 1 2 4 4; do - kill -0 "${MOUNT_PID}" 2>/dev/null || break - sleep "${COUNTER}" + echo '' > "${RESULT}" + for opt in "vers=1.0,sec=ntlm" "vers=3.0,sec=ntlm" "vers=1.0,sec=ntlmv2" "vers=3.0,sec=ntlmv2"; do + MOUNT_OPTS="-v -t cifs -o uid=${USER_UID},gid=${USER_GID},forceuid,forcegid,${opt},nounix,file_mode=0700,dir_mode=0700" + /opt/openslx/bin/timeout -t 8 -s 9 /opt/openslx/bin/timeout -t 7 -s 15 mount ${MOUNT_OPTS} "${VOLUME}" "${PERSISTENT_HOME_DIR}" >> "${RESULT}" 2>&1 + RETVAL=$? + [ "$RETVAL" = "0" ] && break done - if [ -e "${SIGNAL}" ]; then - slxlog "pam-ad-mount" "Mount of '${VOLUME}' to '${PERSISTENT_HOME_DIR}' failed. (Args: ${MOUNT_OPTS})" "${RESULT}" - WAIT=1 - rm -f -- "${SIGNAL}" - elif kill -9 "${MOUNT_PID}" 2>/dev/null; then + if [ "$RETVAL" = "124" ] || [ "$RETVAL" = "137" ] || [ "$RETVAL" = "143" ]; then slxlog "pam-ad-mount" "Mount of '${VOLUME}' to '${PERSISTENT_HOME_DIR}' timed out. (Args: ${MOUNT_OPTS})" "${RESULT}" WAIT=1 + elif [ "$RETVAL" != "0" ]; then + slxlog "pam-ad-mount" "Mount of '${VOLUME}' to '${PERSISTENT_HOME_DIR}' failed. (Exit code: ${RETVAL}, Args: ${MOUNT_OPTS})" "${RESULT}" + WAIT=1 else PERSISTENT_OK=yes chmod -R u+rwX "${PERSISTENT_HOME_DIR}" 2>/dev/null -- cgit v1.2.3-55-g7522