This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /****************************************************************** |
||
3 | mod_xmlrpc.php Muze Ariadne |
||
4 | ------------------------------------------------------------------ |
||
5 | Author: Wouter Commandeur (Muze) ([email protected]) |
||
6 | Date: 05 februari 2003 |
||
7 | |||
8 | Copyright 2003 Muze |
||
9 | |||
10 | This file is part of Ariadne. |
||
11 | |||
12 | Ariadne is free software; you can redistribute it and/or modify |
||
13 | it under the terms of the GNU General Public License as published |
||
14 | by the Free Software Foundation; either version 2 of the License, |
||
15 | or (at your option) any later version. |
||
16 | |||
17 | Ariadne is distributed in the hope that it will be useful, |
||
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
20 | GNU General Public License for more details. |
||
21 | |||
22 | You should have received a copy of the GNU General Public License |
||
23 | along with Ariadne; if not, write to the Free Software |
||
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
||
25 | 02111-1307 USA |
||
26 | |||
27 | ------------------------------------------------------------------- |
||
28 | |||
29 | Description: |
||
30 | |||
31 | Wrapper module to the Pear XMLRPC library. |
||
32 | |||
33 | ******************************************************************/ |
||
34 | |||
35 | include_once("XML/RPC.php"); |
||
36 | |||
37 | class XMLRPC { |
||
38 | |||
39 | /* parse the given array and return a valid xmlrpc encoded array */ |
||
40 | |||
41 | function array_encode( $arguments=array(), $in_struct = 0 ) { |
||
42 | |||
43 | $result = array(); |
||
44 | |||
45 | if( is_array( $arguments ) && (sizeof($arguments) > 0) ) { |
||
46 | while( list($key,$value) = each( $arguments ) ) { |
||
47 | if( is_int($key) ) { |
||
48 | View Code Duplication | switch (gettype($value)) { |
|
49 | case ("array"): |
||
50 | $nest_array = XMLRPC::array_encode($value); |
||
51 | array_push($result, new XML_RPC_Value($nest_array,"array")); |
||
52 | break; |
||
53 | case ("integer"): |
||
54 | array_push($result, new XML_RPC_Value($value,"int")); |
||
55 | break; |
||
56 | case ("string"): |
||
57 | array_push($result, new XML_RPC_Value($value,"string")); |
||
58 | break; |
||
59 | default: |
||
60 | array_push($result, new XML_RPC_Value($value)); |
||
61 | break; |
||
62 | } |
||
63 | } else { |
||
64 | $pieces = explode(":",$key); |
||
65 | if( is_array($pieces) && ( sizeof($pieces) == 1) ) { // name |
||
66 | View Code Duplication | switch( gettype($value) ) { |
|
67 | case ("array"): |
||
68 | $nest_array = XMLRPC::array_encode($value); |
||
69 | array_push($result, new XML_RPC_Value($nest_array,"array")); |
||
70 | break; |
||
71 | case ("integer"): |
||
72 | array_push($result, new XML_RPC_Value($value,"int")); |
||
73 | break; |
||
74 | case ("string"): |
||
75 | array_push($result, new XML_RPC_Value($value,"string")); |
||
76 | break; |
||
77 | default: |
||
78 | array_push($result, new XML_RPC_Value($value)); |
||
79 | break; |
||
80 | } |
||
81 | } elseif( is_array($pieces) ) { // type:name |
||
82 | $type = $pieces[0]; |
||
83 | $name = $pieces[1]; |
||
84 | switch( $type ) { |
||
85 | View Code Duplication | case ("struct"): |
|
86 | $nest = XMLRPC::array_encode($value,1); |
||
87 | if( $name == "" || $in_struct == 0 ) { |
||
88 | array_push($result, new XML_RPC_Value($nest,$type)); |
||
89 | } else { |
||
90 | $result[$name] = new XML_RPC_Value($nest,$type); |
||
91 | } |
||
92 | break; |
||
93 | View Code Duplication | case ("array"): |
|
94 | $nest = XMLRPC::array_encode($value); |
||
95 | if( $name == "" || $in_struct == 0 ) { |
||
96 | array_push($result, new XML_RPC_Value($nest,$type)); |
||
97 | } else { |
||
98 | $result[$name] = new XML_RPC_Value($nest,$type); |
||
99 | } |
||
100 | break; |
||
101 | case ("datetime"): |
||
102 | if( is_int($value) ) { |
||
103 | $datetime = XML_RPC_iso8601_encode($value); |
||
104 | } else { |
||
105 | $datetime = $value; |
||
106 | } |
||
107 | if( $name == "" || $in_struct == 0 ) { |
||
108 | array_push($result, new XML_RPC_Value($datetime,"dateTime.iso8601")); |
||
109 | } else { |
||
110 | $result[$name] = new XML_RPC_Value($datetime,$type); |
||
111 | } |
||
112 | break; |
||
113 | case ("i4"): |
||
114 | case ("int"): |
||
115 | case ("double"): |
||
116 | case ("base64"): |
||
117 | case ("string"): |
||
118 | case ("boolean"): |
||
119 | default: |
||
120 | if( $name == "" || $in_struct == 0) { |
||
121 | array_push($result, new XML_RPC_Value($value, $type)); |
||
122 | } else { |
||
123 | $result[$name] = new XML_RPC_Value($value, $type); |
||
124 | } |
||
125 | break; |
||
126 | break; |
||
127 | } |
||
128 | } |
||
129 | } |
||
130 | } |
||
131 | } |
||
132 | return $result; |
||
133 | } |
||
134 | |||
135 | function call( $url="",$function="",$arguments=array() ) { |
||
136 | $arguments = XMLRPC::array_encode($arguments); |
||
137 | |||
138 | $myResult = XMLRPC::call_raw($url,$function,$arguments); |
||
139 | |||
140 | if( !$myResult ) { |
||
141 | $result = "XMLRPC::Error ErrNo: ".$myClient->errno." ErrStr: ".$myClient->errstr; |
||
0 ignored issues
–
show
|
|||
142 | } else { |
||
143 | if( $myResult->faultCode() ) { |
||
144 | $result = "XMLRPC::ResultError Code: ".$myResult->faultCode()." Reason: ".$myResult->faultString(); |
||
145 | } else { |
||
146 | // We have a valid response |
||
147 | $result = array( XML_RPC_Decode( $myResult->Value() ) ); |
||
148 | } |
||
149 | } |
||
150 | return $result; |
||
151 | } |
||
152 | |||
153 | function call_raw( $url="", $function="", $arguments=array() ) { |
||
154 | |||
155 | // parse the given url find: server, path, port |
||
156 | // http://host:port/path/ |
||
157 | |||
158 | preg_match("/^([htps]*:\/\/)?([^\/:]+)(:[^\/]+)?(.*)/i", $url, $matches); |
||
159 | |||
160 | $myHost = $matches[2]; |
||
161 | $myPort = substr($matches[3],1); |
||
162 | if( !$matches[3] ) { |
||
163 | $myPort = 80; |
||
164 | } |
||
165 | $myPath = $matches[4]; |
||
166 | |||
167 | $myFunction = $function; |
||
168 | |||
169 | $myArguments = $arguments; |
||
170 | |||
171 | $myClient = new XML_RPC_Client($myPath, $myHost, $myPort); |
||
172 | |||
173 | $myMessage = new XML_RPC_Message($myFunction, $myArguments); |
||
174 | |||
175 | $myResult = $myClient->send($myMessage); |
||
176 | |||
177 | return $myResult; |
||
178 | } |
||
179 | } |
||
180 | |||
181 | class pinp_XMLRPC extends XMLRPC { |
||
182 | |||
183 | function _call( $url="", $function="", $arguments=array() ) { |
||
184 | return $this->call( $url, $function, $arguments ); |
||
185 | } |
||
186 | } |
||
187 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.