Gunid testing added.
This commit is contained in:
parent
a9e52421d9
commit
8ae91afd94
4 changed files with 25 additions and 18 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -48,7 +48,7 @@ require_once "Transport.php";
|
||||||
* Core of LiveSupport file storage module
|
* Core of LiveSupport file storage module
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.5 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
class BasicStor extends Alib{
|
class BasicStor extends Alib{
|
||||||
|
@ -388,24 +388,25 @@ class BasicStor extends Alib{
|
||||||
{
|
{
|
||||||
if(!$this->bsCheckToken($token, 'put')){
|
if(!$this->bsCheckToken($token, 'put')){
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
'BasicStor::bsClosePut: invalid token ($token)'
|
"BasicStor::bsClosePut: invalid token ($token)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$chsum = $this->dbc->getOne("
|
$chsum = $this->dbc->getOne("
|
||||||
SELECT chsum FROM {$this->accessTable}
|
SELECT chsum FROM {$this->accessTable}
|
||||||
WHERE token=x'{$token}'::bigint
|
WHERE token=x'{$token}'::bigint
|
||||||
");
|
");
|
||||||
$fname = "{$this->accessDir}/$token";
|
|
||||||
$md5sum = md5_file($fname);
|
|
||||||
if($chsum != $md5sum){
|
|
||||||
return PEAR::raiseError(
|
|
||||||
'BasicStor::bsClosePut: md5sum does not match (token=$token)'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$res = $this->dbc->query("
|
$res = $this->dbc->query("
|
||||||
DELETE FROM {$this->accessTable} WHERE token=x'$token'::bigint
|
DELETE FROM {$this->accessTable} WHERE token=x'$token'::bigint
|
||||||
");
|
");
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
|
$fname = "{$this->accessDir}/$token";
|
||||||
|
$md5sum = md5_file($fname);
|
||||||
|
if($chsum != $md5sum){
|
||||||
|
if(file_exists($fname)) @unlink($fname);
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"BasicStor::bsClosePut: md5sum does not match (token=$token)"
|
||||||
|
);
|
||||||
|
}
|
||||||
return $fname;
|
return $fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -49,6 +49,11 @@ class LocStor extends GreenBox{
|
||||||
function storeAudioClipOpen($sessid, $gunid, $metadata, $chsum)
|
function storeAudioClipOpen($sessid, $gunid, $metadata, $chsum)
|
||||||
{
|
{
|
||||||
// test if specified gunid exists:
|
// test if specified gunid exists:
|
||||||
|
if(!preg_match("|^[0-9a-fA-F]{16}$|", $gunid)){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"LocStor.php: storeAudioClipOpen: Wrong gunid ($gunid)"
|
||||||
|
);
|
||||||
|
}
|
||||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||||
if(!PEAR::isError($ac)){
|
if(!PEAR::isError($ac)){
|
||||||
// gunid exists - do replace
|
// gunid exists - do replace
|
||||||
|
@ -57,7 +62,7 @@ class LocStor extends GreenBox{
|
||||||
)) !== TRUE) return $res;
|
)) !== TRUE) return $res;
|
||||||
if($ac->isAccessed()){
|
if($ac->isAccessed()){
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
'LocStor.php: storeAudioClip: is accessed'
|
'LocStor.php: storeAudioClipOpen: is accessed'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res = $ac->replace(
|
$res = $ac->replace(
|
||||||
|
@ -98,8 +103,9 @@ class LocStor extends GreenBox{
|
||||||
function storeAudioClipClose($sessid, $token)
|
function storeAudioClipClose($sessid, $token)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByToken(&$this, $token);
|
$ac =& StoredFile::recallByToken(&$this, $token);
|
||||||
$fname = $this->bsClosePut($token);
|
|
||||||
if(PEAR::isError($ac)){ return $ac; }
|
if(PEAR::isError($ac)){ return $ac; }
|
||||||
|
$fname = $this->bsClosePut($token);
|
||||||
|
if(PEAR::isError($fname)){ return $fname; }
|
||||||
$res = $ac->replaceRawMediaData($fname);
|
$res = $ac->replaceRawMediaData($fname);
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
@unlink($fname);
|
@unlink($fname);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/put.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/put.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,7 +71,7 @@ function http_error($code, $err){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match("|^[0-9a-f]{16}$|", $_REQUEST['token'])){
|
if(preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['token'])){
|
||||||
$token = $_REQUEST['token'];
|
$token = $_REQUEST['token'];
|
||||||
}else{
|
}else{
|
||||||
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,12 +71,12 @@ function http_error($code, $err){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match("|^[0-9a-f]{32}$|", $_REQUEST['sessid'])){
|
if(preg_match("|^[0-9a-fA-F]{32}$|", $_REQUEST['sessid'])){
|
||||||
$sessid = $_REQUEST['sessid'];
|
$sessid = $_REQUEST['sessid'];
|
||||||
}else{
|
}else{
|
||||||
http_error(400, "Error on sessid parameter. ({$_REQUEST['sessid']})");
|
http_error(400, "Error on sessid parameter. ({$_REQUEST['sessid']})");
|
||||||
}
|
}
|
||||||
if(preg_match("|^[0-9a-f]{16}$|", $_REQUEST['id'])){
|
if(preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['id'])){
|
||||||
$gunid = $_REQUEST['id'];
|
$gunid = $_REQUEST['id'];
|
||||||
}else{
|
}else{
|
||||||
http_error(400, "Error on id parameter. ({$_REQUEST['id']})");
|
http_error(400, "Error on id parameter. ({$_REQUEST['id']})");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue