mirror of https://github.com/MISP/MISP
Further work on the previous patch
parent
97eba22b46
commit
cf3809ef74
|
@ -491,10 +491,13 @@ class Attribute extends AppModel {
|
|||
|
||||
public function validateAttributeValue($fields) {
|
||||
$value = $fields['value'];
|
||||
return $this->runValidation($value, $this->data['Attribute']['type']);
|
||||
}
|
||||
|
||||
public function runValidation($value, $type) {
|
||||
$returnValue = false;
|
||||
|
||||
// check data validation
|
||||
switch($this->data['Attribute']['type']) {
|
||||
switch($type) {
|
||||
case 'md5':
|
||||
if (preg_match("#^[0-9a-f]{32}$#", $value)) {
|
||||
$returnValue = true;
|
||||
|
|
|
@ -394,7 +394,8 @@ class ShadowAttribute extends AppModel {
|
|||
}
|
||||
|
||||
public function validateAttributeValue($fields) {
|
||||
return $this->Event->Attribute->validateAttributeValue($fields);
|
||||
$value = $fields['value'];
|
||||
return $this->Event->Attribute->runValidation($value, $this->data['ShadowAttribute']['type']);
|
||||
}
|
||||
|
||||
public function getCompositeTypes() {
|
||||
|
|
Loading…
Reference in New Issue