[pmg-devel] applied: [PATCH pmg-api v3] Fix setresuid to 'postgres' error handling

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Apr 18 14:02:29 CEST 2019


Am 4/17/19 um 10:55 AM schrieb Stoiko Ivanov:
> PMG::DBTools::postgres_admin_cmd switches the euid to postgres. The error
> handling expected that the setresuid (2) call failed if $! was != 0, without
> explicitly setting it to 0 beforehand. This lead to a false positive if errno
> was set from a previous library call.
> 
> This patch changes the code to explicitly call the setresuid syscall (exposed
> via a separate patch to pve-common) and check for an error.
> 
> Steps to reproduce:
> * install nscd on a system
> * try installing pmg-api (the postinst script invokes `pmgdb init`)
> 
> The issue was further discussed in [0].
> 
> [0] https://pve.proxmox.com/pipermail/pmg-devel/2019-April/000362.html
> 
> Reported-By: Patrick Fogarty <patrick.fogarty at patanne.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> NOTE: this patch requires a bump to the versioned dependency on
> libpve-common-perl (to a version containing PVE::Syscall::setresuid)!
> Changes v2 -> v3:
> * use the added PVE::Tools::setresuid sub
> 
> Changes v1 -> v2:
> * basically incorporated Thomas' feedback - Thanks!
> * changed from a local override of $> (EUID) to 2 explicit calls of setresuid.
>  PMG/DBTools.pm | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 

applied, thanks!



More information about the pmg-devel mailing list