diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 13efe1ba1..873fea97c 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -31,6 +31,14 @@

Correct archive-get-queue-max to be size type.

+ + + + + +

Add error message when current user uid/gid does not map to a name.

+
+

Error when --target-action=shutdown specified for < 9.5.

diff --git a/lib/pgBackRest/Restore.pm b/lib/pgBackRest/Restore.pm index 200f63e3c..c01a60dfb 100644 --- a/lib/pgBackRest/Restore.pm +++ b/lib/pgBackRest/Restore.pm @@ -101,6 +101,11 @@ sub manifestOwnershipCheck else { $oOwnerTypeHash{&MANIFEST_SUBKEY_USER} = getpwuid($<); + + if (!defined($oOwnerTypeHash{&MANIFEST_SUBKEY_USER})) + { + confess &log(ERROR_USER_MISSING, 'current user uid does not map to a name'); + } } if ($oManifest->test(MANIFEST_SECTION_TARGET_PATH, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_GROUP) && @@ -112,6 +117,11 @@ sub manifestOwnershipCheck else { $oOwnerTypeHash{&MANIFEST_SUBKEY_GROUP} = getgrgid($(); + + if (!defined($oOwnerTypeHash{&MANIFEST_SUBKEY_GROUP})) + { + confess &log(ERROR_GROUP_MISSING, 'current user gid does not map to a name'); + } } # Loop through owner types (user, group) diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index c66650e7c..7514c0c49 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -15736,6 +15736,11 @@ static const EmbeddedModule embeddedModule[] = "else\n" "{\n" "$oOwnerTypeHash{&MANIFEST_SUBKEY_USER} = getpwuid($<);\n" + "\n" + "if (!defined($oOwnerTypeHash{&MANIFEST_SUBKEY_USER}))\n" + "{\n" + "confess &log(ERROR_USER_MISSING, 'current user uid does not map to a name');\n" + "}\n" "}\n" "\n" "if ($oManifest->test(MANIFEST_SECTION_TARGET_PATH, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_GROUP) &&\n" @@ -15747,6 +15752,11 @@ static const EmbeddedModule embeddedModule[] = "else\n" "{\n" "$oOwnerTypeHash{&MANIFEST_SUBKEY_GROUP} = getgrgid($();\n" + "\n" + "if (!defined($oOwnerTypeHash{&MANIFEST_SUBKEY_GROUP}))\n" + "{\n" + "confess &log(ERROR_GROUP_MISSING, 'current user gid does not map to a name');\n" + "}\n" "}\n" "\n\n" "foreach my $strOwnerType (sort (keys %oOwnerTypeHash))\n"