public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] openid: conditionally disable api endpoint
Date: Thu,  1 Jul 2021 14:58:33 +0200	[thread overview]
Message-ID: <20210701125833.2773190-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20210701125833.2773190-1-f.gruenbichler@proxmox.com>

since it pulls in lots of additional linked libraries for all binaries
compiled as part of proxmox-backup. it can easily be re-enabled with
`--cfg openid` added to the RUSTFLAGS env variable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    to be reverted as part of splitting client/server/lib crates next week, but
    this is currently breaking file-restore builds for PVE 7.
    
    alternatively, a feature could be employed for the same effect, but since this
    is just a temporary measure a 'cfg' flag causes less churn/noise.
    
    the difference is quite big (ldd $bin | wc -l)
    
    usr/sbin/proxmox-backup-manager: 53 vs 28
    usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd: 41 vs 12
    usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update: 48 vs 23
    usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy: 54 vs 29
    usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner: 6 vs 6 (doesn't use proxmox_backup at all!)
    usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api: 54 vs 29
    usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore/proxmox-restore-daemon: 39 vs 10
    usr/bin/proxmox-tape: 43 vs 14
    usr/bin/pmtx: 40 vs 11
    usr/bin/pmt: 40 vs 11
    usr/bin/proxmox-file-restore: 43 vs 14
    usr/bin/pxar: 40 vs 11
    usr/bin/proxmox-backup-client: 43 vs 14

 src/api2/access.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/api2/access.rs b/src/api2/access.rs
index e5430f62..1cd772d6 100644
--- a/src/api2/access.rs
+++ b/src/api2/access.rs
@@ -26,6 +26,8 @@ pub mod domain;
 pub mod role;
 pub mod tfa;
 pub mod user;
+
+#[cfg(openid)]
 pub mod openid;
 
 #[allow(clippy::large_enum_variant)]
@@ -415,6 +417,12 @@ pub fn list_permissions(
     Ok(map)
 }
 
+#[cfg(openid)]
+const OPENID_ROUTER: &Router = &openid::ROUTER;
+
+#[cfg(not(openid))]
+const OPENID_ROUTER: &Router = &Router::new();
+
 #[sortable]
 const SUBDIRS: SubdirMap = &sorted!([
     ("acl", &acl::ROUTER),
@@ -424,7 +432,7 @@ const SUBDIRS: SubdirMap = &sorted!([
         &Router::new().get(&API_METHOD_LIST_PERMISSIONS)
     ),
     ("ticket", &Router::new().post(&API_METHOD_CREATE_TICKET)),
-    ("openid", &openid::ROUTER),
+    ("openid", &OPENID_ROUTER),
     ("domains", &domain::ROUTER),
     ("roles", &role::ROUTER),
     ("users", &user::ROUTER),
-- 
2.30.2





  reply	other threads:[~2021-07-01 12:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 12:58 [pbs-devel] [PATCH proxmox-backup 1/2] openid: move helper from config to api2 Fabian Grünbichler
2021-07-01 12:58 ` Fabian Grünbichler [this message]
2021-07-05  6:11 ` [pbs-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210701125833.2773190-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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