-
- //Get the UUID of the Pool
- $poolname = OMVModuleZFSUtil::getPoolname($params['name']);
- $pooluuid = OMVModuleZFSUtil::getUUIDbyName($poolname);
-
- //Get the mntent object and fetch it's uuid.
- $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "']";
- $mountpoint = $xmlConfig->get($xpath);
- $mntentref = $mountpoint['uuid'];
-
+ // Validate the parameters of the RPC service method.
+ $this->validateMethodParams($params, '{
+ "type":"object",
+ "properties":{
+ "name":{"type":"string"},
+ "type":{"type":"string","enum":["Filesystem","Clone"]},
+ "sharename":{'.$GLOBALS['OMV_JSONSCHEMA_SHARENAME'].'},
+ "comment":{"type":"string"},
+ "mode":{"type":"string","enum":["700","750","755",'.
+ '"770","775","777"],"optional":true},
+ "mountpoint":{"type":"string"}
+ }
+ }');
+
+ // The field 'reldirpath' may not contain the characters '..'. This
+ // is because of security reasons: the given canonicalized absolute
+ // path MUST be below the given mount point.
+ if(1 == preg_match("/\.\./", $params['mountpoint'])) {
+ throw new OMVException(OMVErrorMsg::E_RPC_SERVICE_METHOD_INVALID_PARAMS,
+ sprintf(gettext("The field '%s' contains forbidden two-dot symbols"), "mountpoint"));
+ }
+