Revision e7de40d5
Added by Viktor Gurov over 3 years ago
src/etc/inc/dyndns.class | ||
---|---|---|
456 | 456 |
case 'spdyn-v6': |
457 | 457 |
case 'staticcling': |
458 | 458 |
case 'strato': |
459 |
case 'onecom': |
|
460 |
case 'onecom-v6': |
|
459 | 461 |
case 'yandex': |
460 | 462 |
case 'yandex-v6': |
461 | 463 |
case 'zoneedit': |
... | ... | |
1233 | 1235 |
break; |
1234 | 1236 |
case 'onecom': |
1235 | 1237 |
case 'onecom-v6': |
1236 |
// see https://redmine.pfsense.org/issues/11293 |
|
1238 |
/* see https://redmine.pfsense.org/issues/11293 |
|
1239 |
* and https://redmine.pfsense.org/issues/12352 */ |
|
1240 |
|
|
1241 |
curl_setopt($ch, CURLOPT_URL, "https://www.one.com/admin/"); |
|
1242 |
curl_setopt($ch, CURLOPT_HEADER, 1); //return the full headers to extract the cookies |
|
1243 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
1244 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
|
1245 |
$output = curl_exec($ch); |
|
1246 |
$last_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); |
|
1247 |
|
|
1248 |
// extract the cookies |
|
1249 |
preg_match_all("/^Set-cookie: (.*?);/ism", $output, $cookies); |
|
1250 |
if (count($cookies[1]) > 0) { |
|
1251 |
$cookie_data = implode("; ", $cookies[1]); |
|
1252 |
} |
|
1237 | 1253 |
|
1238 | 1254 |
// login in |
1239 |
$post_data['displayUsername'] = $this->_dnsUser; |
|
1240 | 1255 |
$post_data['username'] = $this->_dnsUser; |
1241 |
$post_data['password1'] = $this->_dnsPass; |
|
1242 |
$post_data['loginDomain'] = True; |
|
1243 |
$post_data['loginTarget'] = ''; |
|
1244 |
$post_data['targetDomain'] = ''; |
|
1256 |
$post_data['password'] = $this->_dnsPass; |
|
1257 |
$post_data['credentialId'] = ''; |
|
1245 | 1258 |
|
1246 | 1259 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
1247 |
curl_setopt($ch, CURLOPT_URL, "https://www.one.com/admin/login.do"); |
|
1260 |
curl_setopt($ch, CURLOPT_URL, $last_url); |
|
1261 |
curl_setopt($ch, CURLOPT_COOKIE, $cookie_data); |
|
1248 | 1262 |
curl_setopt($ch, CURLOPT_HEADER, 1); //return the full headers to extract the cookies |
1263 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
|
1249 | 1264 |
$output = curl_exec($ch); |
1250 | 1265 |
|
1251 | 1266 |
// extract the cookies |
1252 | 1267 |
preg_match_all("/^Set-cookie: (.*?);/ism", $output, $cookies); |
1253 |
if( count($cookies[1]) > 0 ){
|
|
1254 |
$cookie_data = implode("; ",$cookies[1]); |
|
1268 |
if (count($cookies[1]) > 0) {
|
|
1269 |
$cookie_data = implode("; ", $cookies[1]);
|
|
1255 | 1270 |
} |
1256 | 1271 |
|
1257 | 1272 |
// gets all DNS records of the domain. |
... | ... | |
1262 | 1277 |
curl_setopt($ch, CURLOPT_HEADER, 0); |
1263 | 1278 |
curl_setopt($ch, CURLOPT_URL, $url); |
1264 | 1279 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); |
1280 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
|
1265 | 1281 |
$output = curl_exec($ch); |
1266 | 1282 |
$result = json_decode($output, true); |
1267 | 1283 |
$records = $result['result']['data']; |
... | ... | |
1299 | 1315 |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); |
1300 | 1316 |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($tosend)); |
1301 | 1317 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); |
1318 |
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); |
|
1302 | 1319 |
break; |
1303 | 1320 |
case 'dreamhost': |
1304 | 1321 |
case 'dreamhost-v6': |
Also available in: Unified diff
One.com DDNS update. Issue #12352
(cherry picked from commit 9a84d3b0b5e4709a5bde99d3edf4f8e89524b602)