all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node
Date: Thu, 27 Feb 2025 12:04:39 +0100	[thread overview]
Message-ID: <20250227110439.660459-1-s.ivanov@proxmox.com> (raw)

PMG::RESTEnvironment->check_node_is_master() dies if called on a
secondary node.
It is called in an eval that results in a sensible error-message being
presented to the user.

Reported-by: Lukas Wagner <l.wagner@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/API2/OIDC.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PMG/API2/OIDC.pm b/src/PMG/API2/OIDC.pm
index 2d016f6..c256014 100644
--- a/src/PMG/API2/OIDC.pm
+++ b/src/PMG/API2/OIDC.pm
@@ -192,6 +192,7 @@ __PACKAGE__->register_method ({
 	    # first, check if $username respects our naming conventions
 	    PMG::Utils::verify_username($username);
 	    if ($config->{'autocreate'} && !$rpcenv->check_user_exist($username, 1)) {
+		$rpcenv->check_node_is_master();
 		my $code = sub {
 		    my $usercfg = PMG::UserConfig->new();
 
-- 
2.39.5



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


             reply	other threads:[~2025-02-27 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 11:04 Stoiko Ivanov [this message]
2025-02-27 11:06 ` Mira Limbeck
2025-02-27 11:09 ` [pmg-devel] applied: " 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=20250227110439.660459-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal