Skip to content

Commit

Permalink
[busybox] Suppot loading $ENV when using SSH. JB#50984
Browse files Browse the repository at this point in the history
Also use %autosetup instead of applying patches manually.
  • Loading branch information
Thaodan committed Sep 7, 2020
1 parent 767a404 commit efcfdc7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
@@ -0,0 +1,32 @@
From d192ebbee237f3a89f1fe50f092e4b43c1dd6ac5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@jolla.com>
Date: Thu, 3 Sep 2020 16:00:07 +0300
Subject: [PATCH] ash: Load $ENV file also if $SSH_CLIENT/SSH2_CLIENT is preset
in env
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This emulates the behavior of bash loading .bashrc when $SSH_CLIENT or $SSH2_CLIENT is preset in env.

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
---
shell/ash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell/ash.c b/shell/ash.c
index ecb9b132b..797763187 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -14467,7 +14467,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
#ifndef linux
getuid() == geteuid() && getgid() == getegid() &&
#endif
- iflag
+ iflag || ( minusc && ( lookupvar("SSH_CLIENT") != NULL || lookupvar("SSH2_CLIENT") != NULL)) && rootshell
) {
const char *shinit = lookupvar("ENV");
if (shinit != NULL && *shinit != '\0')
--
2.28.0

6 changes: 2 additions & 4 deletions rpm/busybox.spec
Expand Up @@ -11,6 +11,7 @@ Source4: set_ps1.sh
Patch0: 0001-Copy-extended-attributes-if-p-flag-is-provided-to-cp.patch
Patch1: 0002-applets-Busybox-in-usr-bin-instead-of-bin.patch
Patch2: 0003-applets-watch-in-usr-bin.patch
Patch3: 0001-ash-Load-ENV-file-also-if-SSH_CLIENT-SSH2_CLIENT-is-.patch
URL: https://git.sailfishos.org/mer-core/busybox
BuildRequires: glibc-static
BuildRequires: libselinux-static libsepol-static
Expand Down Expand Up @@ -181,10 +182,7 @@ Obsoletes: ncurses < 6.1+git2
%{summary} as symlinks.

%prep
%setup -q -n %{name}-%{version}/upstream
%patch0 -p1
%patch1 -p1
%patch2 -p1
%autosetup -p1 -q -n %{name}-%{version}/upstream

%build
# TODO: This config should be synced with the dynamic config at some point
Expand Down

0 comments on commit efcfdc7

Please sign in to comment.