[pbs-devel] [PATCH proxmox-backup 2/2] openid: conditionally disable api endpoint

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jul 1 14:58:33 CEST 2021


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 at 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






More information about the pbs-devel mailing list