Skip to content

Commit dfaa6a9

Browse files
committed
Changed logging routines so that newpw is also blanked in the logging
1 parent e858d57 commit dfaa6a9

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

Protocols/EPP/eppConnection.php

+25-18
Original file line numberDiff line numberDiff line change
@@ -1061,24 +1061,16 @@ private function showLog() {
10611061

10621062
protected function writeLog($text,$action) {
10631063
if ($this->logging) {
1064-
// Hiding userid in the logging
1065-
if (($start = strpos($text,'<clID>')) !== false) {
1066-
if (($end = strpos($text,'</clID>')) !== false) {
1067-
$text = substr($text,0,$start+6).'XXXXXXXXXXXXXXXX'.substr($text,$end,99999);
1068-
}
1069-
}
1070-
// Hiding password in the logging
1071-
if (($start = strpos($text,'<pw><![CDATA[')) !== false) {
1072-
if (($end = strpos($text,']]></pw>')) !== false) {
1073-
$text = substr($text,0,$start+4).'XXXXXXXXXXXXXXXX'.substr($text,$end+3,99999);
1074-
}
1075-
}
1076-
// Hiding password in the logging
1077-
if (($start = strpos($text,'<pw>')) !== false) {
1078-
if (($end = strpos($text,'</pw>')) !== false) {
1079-
$text = substr($text,0,$start+4).'XXXXXXXXXXXXXXXX'.substr($text,$end,99999);
1080-
}
1081-
}
1064+
// Hide userid in the logging
1065+
$text = $this->hideTextBetween($text,'<clID>','</clID>');
1066+
// Hide password in the logging
1067+
$text = $this->hideTextBetween($text,'<pw>','</pw>');
1068+
// Hide password in the logging
1069+
$text = $this->hideTextBetween($text,'<pw><![CDATA[',']]></pw>');
1070+
// Hide new password in the logging
1071+
$text = $this->hideTextBetween($text,'<newPW>','</newPW>');
1072+
// Hide new password in the logging
1073+
$text = $this->hideTextBetween($text,'<newPW><![CDATA[',']]></newPW>');
10821074
//echo "-----".date("Y-m-d H:i:s")."-----".$text."-----end-----\n";
10831075
$log = "-----" . $action . "-----" . date("Y-m-d H:i:s") . "-----\n" . $text . "\n-----END-----" . date("Y-m-d H:i:s") . "-----\n";
10841076
$this->logentries[] = $log;
@@ -1088,6 +1080,21 @@ protected function writeLog($text,$action) {
10881080
}
10891081
}
10901082

1083+
/**
1084+
* @param $text
1085+
* @param $start
1086+
* @param $end
1087+
* @return string
1088+
*/
1089+
protected function hideTextBetween($text, $start, $end) {
1090+
if (($startpos = strpos(strtolower($text),strtolower($start))) !== false) {
1091+
if (($endpos = strpos(strtolower($text),strtolower($end))) !== false) {
1092+
$text = substr($text,0,$startpos+strlen($start)).'XXXXXXXXXXXXXXXX'.substr($text,$endpos,99999);
1093+
}
1094+
}
1095+
return $text;
1096+
}
1097+
10911098
/**
10921099
* @param null|string $connectionComment
10931100
* @return eppConnection

0 commit comments

Comments
 (0)