From: Alexey Abramov via Guix-patches via <guix-patches@gnu.org>
To: 55034@debbugs.gnu.org.
Subject: [bug#55034] [PATCH 1/1] gnu: openssh: Trust /gnu/store directory
Date: Wed, 20 Apr 2022 10:49:13 +0200 [thread overview]
Message-ID: <20220420084913.4113-1-levenson@mmer.org> (raw)
In-Reply-To: <20220420084724.3514-1-levenson@mmer.org>
* gnu/local.mk (dist_patch_DATA): Add the patch
* gnu/packages/patches/openssh-trust-gnu-store-directory.patch: Patch it
* gnu/packages/ssh.scm (openssh[source]): Use it.
---
gnu/local.mk | 1 +
.../openssh-trust-gnu-store-directory.patch | 35 +++++++++++++++++++
gnu/packages/ssh.scm | 3 +-
3 files changed, 38 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/openssh-trust-gnu-store-directory.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 0e721236d9..449a990846 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1569,6 +1569,7 @@ dist_patch_DATA = \
%D%/packages/patches/openjdk-15-xcursor-no-dynamic.patch \
%D%/packages/patches/openmpi-mtl-priorities.patch \
%D%/packages/patches/openssh-hurd.patch \
+ %D%/packages/patches/openssh-trust-gnu-store-directory.patch \
%D%/packages/patches/openresolv-restartcmd-guix.patch \
%D%/packages/patches/openrgb-unbundle-hueplusplus.patch \
%D%/packages/patches/opensles-add-license-file.patch \
diff --git a/gnu/packages/patches/openssh-trust-gnu-store-directory.patch b/gnu/packages/patches/openssh-trust-gnu-store-directory.patch
new file mode 100644
index 0000000000..b50dc8fd6a
--- /dev/null
+++ b/gnu/packages/patches/openssh-trust-gnu-store-directory.patch
@@ -0,0 +1,35 @@
+From a840e4b10961fb2b1b6b0f93e5b2b367887ed691 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Sun, 21 Nov 2021 12:21:28 +0100
+Subject: [PATCH] Trust /gnu/store directory
+
+---
+ misc.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/misc.c b/misc.c
+index 0134d69..01f1660 100644
+--- a/misc.c
++++ b/misc.c
+@@ -2146,6 +2146,7 @@ int
+ safe_path(const char *name, struct stat *stp, const char *pw_dir,
+ uid_t uid, char *err, size_t errlen)
+ {
++ static const char gnu_store[] = "/gnu/store";
+ char buf[PATH_MAX], homedir[PATH_MAX];
+ char *cp;
+ int comparehome = 0;
+@@ -2178,6 +2179,10 @@ safe_path(const char *name, struct stat *stp, const char *pw_dir,
+ }
+ strlcpy(buf, cp, sizeof(buf));
+
++ /* If are past the Guix /gnu/store then we can stop */
++ if (strcmp(gnu_store, buf) == 0)
++ break;
++
+ if (stat(buf, &st) == -1 ||
+ (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) ||
+ (st.st_mode & 022) != 0) {
+--
+2.33.1
+
diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm
index 8a61b6e97a..8dd7f1727a 100644
--- a/gnu/packages/ssh.scm
+++ b/gnu/packages/ssh.scm
@@ -189,7 +189,8 @@ (define-public openssh
(method url-fetch)
(uri (string-append "mirror://openbsd/OpenSSH/portable/"
"openssh-" version ".tar.gz"))
- (patches (search-patches "openssh-hurd.patch"))
+ (patches (search-patches "openssh-hurd.patch"
+ "openssh-trust-gnu-store-directory.patch"))
(sha256
(base32
"1ry5prcax0134v6srkgznpl9ch5snkgq7yvjqvd8c5mbnxa7cjgx"))))
--
2.34.0
next prev parent reply other threads:[~2022-04-20 8:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 8:47 [bug#55034] [PATCH 0/1] Let openssh trust /gnu/store Alexey Abramov via Guix-patches via
2022-04-20 8:49 ` Alexey Abramov via Guix-patches via [this message]
2022-04-20 10:02 ` Ludovic Courtès
2022-04-22 7:02 ` Alexey Abramov via Guix-patches via
2022-04-20 9:56 ` Ludovic Courtès
2022-04-22 6:44 ` Alexey Abramov via Guix-patches via
2022-04-27 21:54 ` Ludovic Courtès
2022-04-20 10:17 ` Tobias Geerinckx-Rice via Guix-patches via
2022-04-20 10:20 ` Tobias Geerinckx-Rice via Guix-patches via
2022-04-22 7:33 ` Alexey Abramov via Guix-patches via
2022-04-26 7:25 ` [bug#55034] [PATCH v2] gnu: openssh: Trust Guix store directory Alexey Abramov via Guix-patches via
2022-04-28 22:07 ` bug#55034: [PATCH 0/1] Let openssh trust /gnu/store Ludovic Courtès
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=20220420084913.4113-1-levenson@mmer.org \
--to=guix-patches@gnu.org \
--cc=55034@debbugs.gnu.org. \
--cc=levenson@mmer.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
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.