Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 0fcc5f0

Browse files
committed
Meta.mount: set the "use 32 result code as success" via option (default true for non-regression). Close #824
1 parent 481e176 commit 0fcc5f0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/src/plugins/meta.mount/class.FilesystemMounter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,20 @@ public function mountFS()
143143
if($this->getOption("MOUNT_ENV_PASSWD") === true){
144144
putenv("PASSWD=");
145145
}
146+
$resultsOptions = str_replace(" ", "", $this->getOption("MOUNT_RESULT_SUCCESS"));
147+
$acceptedResults = array(0);
148+
if(!empty($resultsOptions)){
149+
$acceptedResults = array_merge($acceptedResults, array_map("intval", explode(",", $resultsOptions)));
150+
}
151+
146152
if($res === null){
147153
// Check it is correctly mounted now!
148154
// Could not get the output return code
149155
$cmd1 = ($MOUNT_SUDO?"sudo":"")." mount | grep ".escapeshellarg($MOUNT_POINT);
150156
$output = shell_exec($cmd1);
151157
$success = !empty($output);
152158
}else{
153-
$success = ($res == 0 || $res == 32);
159+
$success = (in_array($res, $acceptedResults));
154160
}
155161
if (!$success) {
156162
throw new Exception("Error while mounting file system!");

core/src/plugins/meta.mount/manifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<param name="MOUNT_POINT" type="string" label="CONF_MESSAGE[Mount Point]" description="CONF_MESSAGE[Mount Path, use AJXP_USER]" mandatory="true" default=""/>
1010
<param name="MOUNT_OPTIONS" type="string" label="CONF_MESSAGE[Mount Options]" description="CONF_MESSAGE[Used with the -o command option, use AJXP_USER, AJXP_PASS, AJXP_SERVER_UID, AJXP_SERVER_GID]" mandatory="false" default="user=AJXP_USER,pass=AJXP_PASS,uid=AJXP_SERVER_UID,gid=AJXP_SERVER_GID"/>
1111
<param name="MOUNT_ENV_PASSWD" type="boolean" label="CONF_MESSAGE[Pass Password via environment instead of command line]" description="CONF_MESSAGE[Instead of setting password through the AJXP_PASS variable in mount options, pass it through the environment variables. Sudo file must be changed accordingly.]" mandatory="false" default="false"/>
12+
<param name="MOUNT_RESULT_SUCCESS" type="string" label="CONF_MESSAGE[Additional result codes to accept as success]" description="CONF_MESSAGE[On some setup result code 32 is often an already mounted code and we want to consider this as a success. Add comma-separated list of codes.]" mandatory="false" default="32"/>
1213
<param name="REMOVE_MOUNTPOINT_ON_UNMOUNT" type="boolean" label="CONF_MESSAGE[Remove mount point on unmount]" description="CONF_MESSAGE[Delete mount folder on unmount. Can be required for security reasons.]" mandatory="false" default="false"/>
1314
</server_settings>
1415
<client_settings>

0 commit comments

Comments
 (0)