|
@@ -278,53 +278,6 @@ class Zm_Auth
|
|
|
}
|
|
}
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * preauth
|
|
|
|
|
- *
|
|
|
|
|
- * Use this method to login to a Zimbra server after you create an instance of this class
|
|
|
|
|
- *
|
|
|
|
|
- * Login parameters must be specified when calling the constructor
|
|
|
|
|
- */
|
|
|
|
|
- function preauth($key)
|
|
|
|
|
- {
|
|
|
|
|
- $result = null;
|
|
|
|
|
-
|
|
|
|
|
- $n = 0;
|
|
|
|
|
- while (true)
|
|
|
|
|
- {
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- $this->setSoapHeader();
|
|
|
|
|
-
|
|
|
|
|
- $result = $this->client->__soapCall("AuthRequest", $this->params, null, $this->getSoapHeader());
|
|
|
|
|
- // $result = $this->client->__getLastResponse();
|
|
|
|
|
- // print_var($result);
|
|
|
|
|
- // Save the soapHeader with token
|
|
|
|
|
- $this->setSoapHeader($result['authToken']);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- catch (SoapFault $exception)
|
|
|
|
|
- {
|
|
|
|
|
- // if $retryAttempts>0 retry after a random time using exponential backoff
|
|
|
|
|
- // for user logins retries just once
|
|
|
|
|
- $n++;
|
|
|
|
|
- if ($this->retryAttempts > 0 &&
|
|
|
|
|
- $n <= $this->retryAttempts && ($this->context == "admin" || $n == 1) ) {
|
|
|
|
|
- $minT = 1+$n*1000000/10;
|
|
|
|
|
- $maxT = pow(2, $n-1)*1000000;
|
|
|
|
|
- $waitT = rand($minT, $maxT);
|
|
|
|
|
- // wait times are shorter on login
|
|
|
|
|
- $waitT = $waitT/5;
|
|
|
|
|
- usleep($waitT);
|
|
|
|
|
- } else {
|
|
|
|
|
- $result = $exception;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return $result;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|