Revision 425ba708
Added by Ermal LUÇI about 14 years ago
etc/inc/dyndns.class | ||
---|---|---|
202 | 202 |
if($this->_dnsPort) |
203 | 203 |
$port = ":" . $this->_dnsPort; |
204 | 204 |
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); |
205 |
$data = curl_exec($ch); |
|
206 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
207 |
curl_close($ch); |
|
208 |
$this->_checkStatus($data); |
|
209 | 205 |
break; |
210 | 206 |
case 'dhs': |
211 | 207 |
$needsIP = TRUE; |
... | ... | |
233 | 229 |
curl_setopt($ch, CURLOPT_URL, '{$server}{$port}'); |
234 | 230 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); |
235 | 231 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
236 |
$data = curl_exec($ch); |
|
237 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
238 |
curl_close($ch); |
|
239 |
$this->_checkStatus($data); |
|
240 | 232 |
break; |
241 | 233 |
case 'noip': |
242 | 234 |
$needsIP = TRUE; |
... | ... | |
248 | 240 |
if($this->_dnsPort) |
249 | 241 |
$port = ":" . $this->_dnsPort; |
250 | 242 |
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost.'&ip=' . $this->_dnsIP); |
251 |
$data = curl_exec($ch); |
|
252 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
253 |
curl_close($ch); |
|
254 |
$this->_checkStatus($data); |
|
255 | 243 |
break; |
256 | 244 |
case 'easydns': |
257 | 245 |
$needsIP = TRUE; |
... | ... | |
264 | 252 |
if($this->_dnsPort) |
265 | 253 |
$port = ":" . $this->_dnsPort; |
266 | 254 |
curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=' . $this->_dnsBackMX); |
267 |
$data = curl_exec($ch); |
|
268 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
269 |
curl_close($ch); |
|
270 |
$this->_checkStatus($data); |
|
271 | 255 |
break; |
272 | 256 |
case 'hn': |
273 | 257 |
$needsIP = TRUE; |
... | ... | |
280 | 264 |
if($this->_dnsPort) |
281 | 265 |
$port = ":" . $this->_dnsPort; |
282 | 266 |
curl_setopt($ch, CURLOPT_URL, $server . $port . '?ver=1&IP=' . $this->_dnsIP); |
283 |
$data = curl_exec($ch); |
|
284 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
285 |
curl_close($ch); |
|
286 |
$this->_checkStatus($data); |
|
287 | 267 |
break; |
288 | 268 |
case 'zoneedit': |
289 | 269 |
$needsIP = FALSE; |
... | ... | |
298 | 278 |
if($this->_dnsPort) |
299 | 279 |
$port = ":" . $this->_dnsPort; |
300 | 280 |
curl_setopt($ch, CURLOPT_URL, "{$server}{$port}?host=" .$this->_dnsHost); |
301 |
|
|
302 |
$data = curl_exec($ch); |
|
303 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
304 |
curl_close($ch); |
|
305 |
$this->_checkStatus($data); |
|
306 | 281 |
break; |
307 | 282 |
case 'dyns': |
308 | 283 |
$needsIP = FALSE; |
... | ... | |
313 | 288 |
if($this->_dnsPort) |
314 | 289 |
$port = ":" . $this->_dnsPort; |
315 | 290 |
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&password=' . $this->_dnsPass . '&host=' . $this->_dnsHost); |
316 |
$data = curl_exec($ch); |
|
317 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
318 |
curl_close($ch); |
|
319 |
$this->_checkStatus($data); |
|
320 | 291 |
break; |
321 | 292 |
case 'ods': |
322 | 293 |
$needsIP = FALSE; |
... | ... | |
354 | 325 |
break; |
355 | 326 |
} |
356 | 327 |
} |
357 |
$this->_checkStatus($code); |
|
328 |
$this->_checkStatus(0, $code);
|
|
358 | 329 |
break; |
359 | 330 |
case 'freedns': |
360 | 331 |
$needIP = FALSE; |
361 | 332 |
curl_setopt($ch, CURLOPT_URL, 'http://freedns.afraid.org/dynamic/update.php?' . $this->_dnsPass); |
362 |
$data = curl_exec($ch); |
|
363 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
364 |
curl_close($ch); |
|
365 |
$this->_checkStatus($data); |
|
366 | 333 |
break; |
367 | 334 |
case 'dnsexit': |
368 | 335 |
$needsIP = TRUE; |
369 | 336 |
curl_setopt($ch, CURLOPT_URL, 'http://www.dnsexit.com/RemoteUpdate.sv?login='.$this->_dnsUser. '&password='.$this->_dnsPass.'&host='.$this->_dnsHost.'&myip='.$this->_dnsIP); |
370 |
$data = curl_exec($ch); |
|
371 |
if (@curl_error($ch)) log_error("Curl error occurred:" . curl_error($ch)); |
|
372 |
curl_close($ch); |
|
373 |
$this->_checkStatus($data); |
|
374 | 337 |
break; |
375 | 338 |
case 'loopia': |
376 | 339 |
$needsIP = TRUE; |
377 | 340 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
378 | 341 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); |
379 | 342 |
curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP); |
380 |
$data = curl_exec($ch); |
|
381 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
382 |
curl_close($ch); |
|
383 |
$this->_checkStatus($data); |
|
384 | 343 |
break; |
385 | 344 |
case 'opendns': |
386 | 345 |
$needsIP = FALSE; |
... | ... | |
394 | 353 |
if($this->_dnsPort) |
395 | 354 |
$port = ":" . $this->_dnsPort; |
396 | 355 |
curl_setopt($ch, CURLOPT_URL, $server .$port); |
397 |
$data = curl_exec($ch); |
|
398 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
399 |
curl_close($ch); |
|
400 |
$this->_checkStatus($data); |
|
401 | 356 |
break; |
402 | 357 |
|
403 | 358 |
case 'staticcling': |
404 | 359 |
$needsIP = FALSE; |
405 | 360 |
curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass); |
406 |
$data = curl_exec($ch); |
|
407 |
if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch)); |
|
408 |
curl_close($ch); |
|
409 |
$this->_checkStatus($data); |
|
410 | 361 |
break; |
411 | 362 |
case 'dnsomatic': |
412 | 363 |
/* Example syntax |
... | ... | |
423 | 374 |
if($this->_dnsPort) |
424 | 375 |
$port = ":" . $this->_dnsPort; |
425 | 376 |
curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG'); |
426 |
$data = curl_exec($ch); |
|
427 |
if (@curl_error($ch)) log_error("Request completed. DNS-O-Matic reported: " . curl_error($ch)); |
|
428 |
curl_close($ch); |
|
429 |
$this->_checkStatus($data); |
|
430 | 377 |
break; |
431 | 378 |
case 'namecheap': |
432 | 379 |
/* Example: |
... | ... | |
438 | 385 |
list($hostname, $domain) = explode(".", $this->_dnsHost, 2); |
439 | 386 |
$server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}"; |
440 | 387 |
curl_setopt($ch, CURLOPT_URL, $server); |
441 |
$data = curl_exec($ch); |
|
442 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
443 |
curl_close($ch); |
|
444 |
$this->_checkStatus($data); |
|
445 | 388 |
break; |
446 | 389 |
case 'he-net': |
447 | 390 |
$needsIP = FALSE; |
... | ... | |
450 | 393 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
451 | 394 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsHost . ':' . $this->_dnsPass); |
452 | 395 |
curl_setopt($ch, CURLOPT_URL, $server . 'hostname=' . $this->_dnsHost); |
453 |
$data = curl_exec($ch); |
|
454 |
if(@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
455 |
curl_close($ch); |
|
456 |
$this->_checkStatus($data); |
|
457 | 396 |
break; |
458 | 397 |
default: |
459 | 398 |
break; |
460 | 399 |
} |
400 |
if ($this->_dnsService != 'ods') { |
|
401 |
$data = curl_exec($ch); |
|
402 |
$this->_checkStatus($ch, $data); |
|
403 |
@curl_close($ch); |
|
404 |
} |
|
461 | 405 |
} |
462 | 406 |
|
463 | 407 |
/* |
... | ... | |
468 | 412 |
log_error("DynDns: DynDns _checkStatus() starting."); |
469 | 413 |
log_error("DynDns: Current Service: {$this->_dnsService}"); |
470 | 414 |
$successful_update = false; |
415 |
if ($this->_dnsService != 'ods' && @curl_error($ch)) { |
|
416 |
$status = "Curl error occurred: " . curl_error($ch); |
|
417 |
log_error($status); |
|
418 |
$this->status = $status; |
|
419 |
return; |
|
420 |
} |
|
471 | 421 |
switch ($this->_dnsService) { |
472 | 422 |
case 'dnsomatic': |
473 | 423 |
if (preg_match('/badauth/i', $data)) { |
Also available in: Unified diff
Ticket #1545. Take into account curl errors during dyndns service checks otherwise will just mark some updates as successful even though they are not.