From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 81FFA615CD for ; Wed, 21 Oct 2020 08:44:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 764C914F12 for ; Wed, 21 Oct 2020 08:44:09 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id D25D614F02 for ; Wed, 21 Oct 2020 08:44:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9C48E45E98 for ; Wed, 21 Oct 2020 08:44:07 +0200 (CEST) Date: Wed, 21 Oct 2020 08:43:43 +0200 (CEST) From: Dietmar Maurer To: Proxmox Backup Server development discussion , Dylan Whyte Message-ID: <48157714.325.1603262623854@webmail.proxmox.com> In-Reply-To: <20201020092916.11547-1-d.whyte@proxmox.com> References: <20201020092916.11547-1-d.whyte@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.4-Rev11 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.060 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pbs-devel] [PATCH proxmox-backup] fix #3038: check user before renewing ticket X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2020 06:44:09 -0000 This fix is not really correct. I applied it wit a followup patch. Please can you test my fix? comments inline: > On 10/20/2020 11:29 AM Dylan Whyte wrote: > > > Fixes a bug in which the userid of the ticket cache is updated, > when a user connects, but the ticket itself is not. > This means a newly connected user has a previously connected > user's ticket and thus, cannot do anything, as the client will > attempt to use the invalid ticket. > > e.g. if john@pbs connected to the server first, followed by > mike@pbs, the following would be stored in the ticket cache. > > { > "localhost": { > "mike@pbs": { > "ticket": "PBS:john@pbs:AAAA", > "timestamp": 1601039326, > "token": "BBBB" > } > } > } > > Signed-off-by: Dylan Whyte > --- > src/client/http_client.rs | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/client/http_client.rs b/src/client/http_client.rs > index e3d18604..02a58c2d 100644 > --- a/src/client/http_client.rs > +++ b/src/client/http_client.rs > @@ -219,11 +219,13 @@ fn store_ticket_info(prefix: &str, server: &str, username: &str, ticket: &str, t > > let empty = serde_json::map::Map::new(); > for (server, info) in data.as_object().unwrap_or(&empty) { > - for (_user, uinfo) in info.as_object().unwrap_or(&empty) { > - if let Some(timestamp) = uinfo["timestamp"].as_i64() { > - let age = now - timestamp; > - if age < ticket_lifetime { > - new_data[server][username] = uinfo.clone(); > + for (user, uinfo) in info.as_object().unwrap_or(&empty) { > + if user == username { not needed > + if let Some(timestamp) = uinfo["timestamp"].as_i64() { > + let age = now - timestamp; > + if age < ticket_lifetime { > + new_data[server][username] = uinfo.clone(); new_data[server][user] = uinfo.clone(); > + } > } > } > } > -- > 2.20.1 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel