public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix #4346: pbs-client: don't fail silently when storing ticket
@ 2022-12-12 14:10 Christoph Heiss
  2022-12-13 13:39 ` [pbs-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2022-12-12 14:10 UTC (permalink / raw)
  To: pbs-devel

Instead, report an error if storing the ticket info failed, so that the
user is informed that something went wrong and follow-up commands might
require authentication again.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 pbs-client/src/http_client.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
index c78d08f3..256b3cfa 100644
--- a/pbs-client/src/http_client.rs
+++ b/pbs-client/src/http_client.rs
@@ -452,13 +452,15 @@ impl HttpClient {
                 {
                     Ok(auth) => {
                         if use_ticket_cache && prefix2.is_some() {
-                            let _ = store_ticket_info(
+                            if let Err(err) = store_ticket_info(
                                 prefix2.as_ref().unwrap(),
                                 &server2,
                                 &auth.auth_id.to_string(),
                                 &auth.ticket,
                                 &auth.token,
-                            );
+                            ) {
+                                log::error!("storing login ticket failed: {}", err);
+                            }
                         }
                         *auth2.write().unwrap() = auth;
                     }
@@ -486,13 +488,15 @@ impl HttpClient {
 
             move |auth| {
                 if use_ticket_cache && prefix.is_some() {
-                    let _ = store_ticket_info(
+                    if let Err(err) = store_ticket_info(
                         prefix.as_ref().unwrap(),
                         &server,
                         &auth.auth_id.to_string(),
                         &auth.ticket,
                         &auth.token,
-                    );
+                    ) {
+                        log::error!("storing login ticket failed: {}", err);
+                    }
                 }
                 *authinfo.write().unwrap() = auth;
                 tokio::spawn(renewal_future);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] fix #4346: pbs-client: don't fail silently when storing ticket
  2022-12-12 14:10 [pbs-devel] [PATCH proxmox-backup] fix #4346: pbs-client: don't fail silently when storing ticket Christoph Heiss
@ 2022-12-13 13:39 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2022-12-13 13:39 UTC (permalink / raw)
  To: Christoph Heiss; +Cc: pbs-devel

applied, thanks

On Mon, Dec 12, 2022 at 03:10:56PM +0100, Christoph Heiss wrote:
> Instead, report an error if storing the ticket info failed, so that the
> user is informed that something went wrong and follow-up commands might
> require authentication again.
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>  pbs-client/src/http_client.rs | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
> index c78d08f3..256b3cfa 100644
> --- a/pbs-client/src/http_client.rs
> +++ b/pbs-client/src/http_client.rs
> @@ -452,13 +452,15 @@ impl HttpClient {
>                  {
>                      Ok(auth) => {
>                          if use_ticket_cache && prefix2.is_some() {
> -                            let _ = store_ticket_info(
> +                            if let Err(err) = store_ticket_info(
>                                  prefix2.as_ref().unwrap(),
>                                  &server2,
>                                  &auth.auth_id.to_string(),
>                                  &auth.ticket,
>                                  &auth.token,
> -                            );
> +                            ) {
> +                                log::error!("storing login ticket failed: {}", err);
> +                            }
>                          }
>                          *auth2.write().unwrap() = auth;
>                      }
> @@ -486,13 +488,15 @@ impl HttpClient {
>  
>              move |auth| {
>                  if use_ticket_cache && prefix.is_some() {
> -                    let _ = store_ticket_info(
> +                    if let Err(err) = store_ticket_info(
>                          prefix.as_ref().unwrap(),
>                          &server,
>                          &auth.auth_id.to_string(),
>                          &auth.ticket,
>                          &auth.token,
> -                    );
> +                    ) {
> +                        log::error!("storing login ticket failed: {}", err);
> +                    }
>                  }
>                  *authinfo.write().unwrap() = auth;
>                  tokio::spawn(renewal_future);
> -- 
> 2.30.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-13 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 14:10 [pbs-devel] [PATCH proxmox-backup] fix #4346: pbs-client: don't fail silently when storing ticket Christoph Heiss
2022-12-13 13:39 ` [pbs-devel] applied: " Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal