fix bug #2870: use updated tickets

This commit is contained in:
Dietmar Maurer 2020-11-04 08:20:36 +01:00
parent c53797f627
commit 0081903f7c
2 changed files with 8 additions and 1 deletions

View File

@ -405,6 +405,9 @@ impl HttpClient {
/// ///
/// Login is done on demand, so this is only required if you need /// Login is done on demand, so this is only required if you need
/// access to authentication data in 'AuthInfo'. /// access to authentication data in 'AuthInfo'.
///
/// Note: tickets a periodially re-newed, so one can use this
/// to query changed ticket.
pub async fn login(&self) -> Result<AuthInfo, Error> { pub async fn login(&self) -> Result<AuthInfo, Error> {
if let Some(future) = &self.first_auth { if let Some(future) = &self.first_auth {
future.listen().await?; future.listen().await?;

View File

@ -410,7 +410,8 @@ pub async fn pull_group(
list.sort_unstable_by(|a, b| a.backup_time.cmp(&b.backup_time)); list.sort_unstable_by(|a, b| a.backup_time.cmp(&b.backup_time));
let auth_info = client.login().await?; client.login().await?; // make sure auth is complete
let fingerprint = client.fingerprint(); let fingerprint = client.fingerprint();
let last_sync = tgt_store.last_successful_backup(group)?; let last_sync = tgt_store.last_successful_backup(group)?;
@ -447,6 +448,9 @@ pub async fn pull_group(
if last_sync_time > backup_time { continue; } if last_sync_time > backup_time { continue; }
} }
// get updated auth_info (new tickets)
let auth_info = client.login().await?;
let options = HttpClientOptions::new() let options = HttpClientOptions::new()
.password(Some(auth_info.ticket.clone())) .password(Some(auth_info.ticket.clone()))
.fingerprint(fingerprint.clone()); .fingerprint(fingerprint.clone());