avoid chrono dependency, depend on proxmox 0.3.8

- remove chrono dependency

- depend on proxmox 0.3.8

- remove epoch_now, epoch_now_u64 and epoch_now_f64

- remove tm_editor (moved to proxmox crate)

- use new helpers from proxmox 0.3.8
  * epoch_i64 and epoch_f64
  * parse_rfc3339
  * epoch_to_rfc3339_utc
  * strftime_local

- BackupDir changes:
  * store epoch and rfc3339 string instead of DateTime
  * backup_time_to_string now return a Result
  * remove unnecessary TryFrom<(BackupGroup, i64)> for BackupDir

- DynamicIndexHeader: change ctime to i64

- FixedIndexHeader: change ctime to i64
This commit is contained in:
Dietmar Maurer
2020-09-12 15:10:47 +02:00
parent 58169da46a
commit 6a7be83efe
37 changed files with 198 additions and 380 deletions

View File

@ -11,7 +11,6 @@ use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
use proxmox::try_block;
use crate::api2::types::Userid;
use crate::tools::epoch_now_u64;
fn compute_csrf_secret_digest(
timestamp: i64,
@ -32,7 +31,7 @@ pub fn assemble_csrf_prevention_token(
userid: &Userid,
) -> String {
let epoch = epoch_now_u64().unwrap() as i64;
let epoch = proxmox::tools::time::epoch_i64();
let digest = compute_csrf_secret_digest(epoch, secret, userid);
@ -69,7 +68,7 @@ pub fn verify_csrf_prevention_token(
bail!("invalid signature.");
}
let now = epoch_now_u64()? as i64;
let now = proxmox::tools::time::epoch_i64();
let age = now - ttime;
if age < min_age {