- Make bash completions work when regular users run sudo commands
Change-Id: I7d3d8967febc8a81e8cda08907946fc92b2e713e
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/17688
Tested-by: gerrit-photon <photon-checkins@vmware.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,78 +0,0 @@ |
| 1 |
-diff -Naur bash-4.4.18.orig/config.h.in bash-4.4.18/config.h.in |
|
| 2 |
-+++ bash-4.4.18/config.h.in 2020-02-06 14:12:36.615748334 +0530 |
|
| 3 |
-@@ -797,6 +797,14 @@ |
|
| 4 |
- #undef HAVE_SETREGID |
|
| 5 |
- #undef HAVE_DECL_SETREGID |
|
| 6 |
- |
|
| 7 |
-+/* Define if you have the setregid function. */ |
|
| 8 |
-+#undef HAVE_SETRESGID |
|
| 9 |
-+#undef HAVE_DECL_SETRESGID |
|
| 10 |
-+ |
|
| 11 |
-+/* Define if you have the setresuid function. */ |
|
| 12 |
-+#undef HAVE_SETRESUID |
|
| 13 |
-+#undef HAVE_DECL_SETRESUID |
|
| 14 |
-+ |
|
| 15 |
- /* Define if you have the setvbuf function. */ |
|
| 16 |
- #undef HAVE_SETVBUF |
|
| 17 |
- |
|
| 18 |
-diff -Naur bash-4.4.18.orig/configure bash-4.4.18/configure |
|
| 19 |
-+++ bash-4.4.18/configure 2020-02-06 14:13:40.215751387 +0530 |
|
| 20 |
-@@ -10241,6 +10241,17 @@ |
|
| 21 |
- #define HAVE_DECL_STRSIGNAL $ac_have_decl |
|
| 22 |
- _ACEOF |
|
| 23 |
- |
|
| 24 |
-+for ac_func in setresuid setresgid |
|
| 25 |
-+do : |
|
| 26 |
-+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` |
|
| 27 |
-+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" |
|
| 28 |
-+if eval test \"x\$"$as_ac_var"\" = x"yes"; then : |
|
| 29 |
-+ cat >>confdefs.h <<_ACEOF |
|
| 30 |
-+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 |
|
| 31 |
-+_ACEOF |
|
| 32 |
-+ |
|
| 33 |
-+fi |
|
| 34 |
-+done |
|
| 35 |
- |
|
| 36 |
- ac_fn_c_check_decl "$LINENO" "strtold" "ac_cv_have_decl_strtold" "$ac_includes_default" |
|
| 37 |
- if test "x$ac_cv_have_decl_strtold" = xyes; then : |
|
| 38 |
-diff -Naur bash-4.4.18.orig/configure.ac bash-4.4.18/configure.ac |
|
| 39 |
-+++ bash-4.4.18/configure.ac 2020-02-06 14:14:55.927755022 +0530 |
|
| 40 |
-@@ -799,6 +799,8 @@ |
|
| 41 |
- AC_CHECK_DECLS([printf]) |
|
| 42 |
- AC_CHECK_DECLS([sbrk]) |
|
| 43 |
- AC_CHECK_DECLS([setregid]) |
|
| 44 |
-+dnl AC_CHECK_DECLS[(setresuid]) |
|
| 45 |
-+dnl AC_CHECK_DECLS[(setresgid]) |
|
| 46 |
- AC_CHECK_DECLS([strcpy]) |
|
| 47 |
- AC_CHECK_DECLS([strsignal]) |
|
| 48 |
- |
|
| 49 |
-diff -Naur bash-4.4.18.orig/shell.c bash-4.4.18/shell.c |
|
| 50 |
-+++ bash-4.4.18/shell.c 2020-02-06 14:17:12.947761601 +0530 |
|
| 51 |
-@@ -1276,7 +1276,11 @@ |
|
| 52 |
- {
|
|
| 53 |
- int e; |
|
| 54 |
- |
|
| 55 |
-+#if HAVE_SETRESUID |
|
| 56 |
-+ if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0) |
|
| 57 |
-+#else |
|
| 58 |
- if (setuid (current_user.uid) < 0) |
|
| 59 |
-+#endif |
|
| 60 |
- {
|
|
| 61 |
- e = errno; |
|
| 62 |
- sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
|
|
| 63 |
-@@ -1285,7 +1289,11 @@ |
|
| 64 |
- exit (e); |
|
| 65 |
- #endif |
|
| 66 |
- } |
|
| 67 |
-+#if HAVE_SETRESGID |
|
| 68 |
-+ if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0) |
|
| 69 |
-+#else |
|
| 70 |
- if (setgid (current_user.gid) < 0) |
|
| 71 |
-+#endif |
|
| 72 |
- sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
|
|
| 73 |
- |
|
| 74 |
- current_user.euid = current_user.uid; |
| 75 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,21 +0,0 @@ |
| 1 |
-diff -dupr a/config-top.h b/config-top.h |
|
| 2 |
-+++ b/config-top.h 2017-01-13 19:48:28.940934708 -0800 |
|
| 3 |
-@@ -87,7 +87,7 @@ |
|
| 4 |
- #define DEFAULT_BASHRC "~/.bashrc" |
|
| 5 |
- |
|
| 6 |
- /* System-wide .bashrc file for interactive shells. */ |
|
| 7 |
--/* #define SYS_BASHRC "/etc/bash.bashrc" */ |
|
| 8 |
-+#define SYS_BASHRC "/etc/bash.bashrc" |
|
| 9 |
- |
|
| 10 |
- /* System-wide .bash_logout for login shells. */ |
|
| 11 |
- /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */ |
|
| 12 |
-@@ -100,7 +100,7 @@ |
|
| 13 |
- sshd and source the .bashrc if so (like the rshd behavior). This checks |
|
| 14 |
- for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment, |
|
| 15 |
- which can be fooled under certain not-uncommon circumstances. */ |
|
| 16 |
--/* #define SSH_SOURCE_BASHRC */ |
|
| 17 |
-+#define SSH_SOURCE_BASHRC |
|
| 18 |
- |
|
| 19 |
- /* Define if you want the case-capitalizing operators (~[~]) and the |
|
| 20 |
- `capcase' variable attribute (declare -c). */ |
| ... | ... |
@@ -1,30 +1,30 @@ |
| 1 | 1 |
Summary: Bourne-Again SHell |
| 2 | 2 |
Name: bash |
| 3 |
-Version: 5.0 |
|
| 4 |
-Release: 3%{?dist}
|
|
| 3 |
+Version: 5.1.16 |
|
| 4 |
+Release: 1%{?dist}
|
|
| 5 | 5 |
License: GPLv3 |
| 6 | 6 |
URL: http://www.gnu.org/software/bash |
| 7 | 7 |
Group: System Environment/Base |
| 8 | 8 |
Vendor: VMware, Inc. |
| 9 | 9 |
Distribution: Photon |
| 10 | 10 |
|
| 11 |
-Source0: http://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
|
|
| 12 |
-%define sha512 %{name}=bb4519f06e278f271d08722b531e49d2e842cc3e0b02a6b3eee422e2efcb5b6226111af43f5e5eae56beb85ac8bfebcd6a4aacbabb8f609e529aa4d571890864
|
|
| 13 |
-Source1: bash_completion |
|
| 11 |
+Source0: https://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
|
|
| 12 |
+%define sha512 %{name}=a32a343b6dde9a18eb6217602655f72c4098b0d90f04cf4e686fb21b81fc4ef26ade30f7226929fbb7c207cde34617dbad2c44f6103161d1141122bb31dc6c80
|
|
| 14 | 13 |
|
| 15 |
-Patch0: bash-4.4.patch |
|
| 16 |
-Patch1: CVE-2019-18276.patch |
|
| 14 |
+Source1: bash_completion |
|
| 17 | 15 |
|
| 18 |
-Provides: /bin/sh |
|
| 19 |
-Provides: /bin/bash |
|
| 16 |
+Patch0: enable-SYS_BASHRC-SSH_SOURCE_BASHRC.patch |
|
| 17 |
+ |
|
| 18 |
+Provides: /bin/sh |
|
| 19 |
+Provides: /bin/bash |
|
| 20 | 20 |
|
| 21 | 21 |
BuildRequires: readline |
| 22 | 22 |
|
| 23 |
-Requires: readline |
|
| 24 |
-Requires(post): /bin/grep |
|
| 25 |
-Requires(post): /usr/bin/cp |
|
| 26 |
-Requires(postun): /bin/grep |
|
| 27 |
-Requires(postun): /usr/bin/mv |
|
| 23 |
+Requires: readline |
|
| 24 |
+Requires(post): /bin/grep |
|
| 25 |
+Requires(post): /usr/bin/cp |
|
| 26 |
+Requires(postun): /bin/grep |
|
| 27 |
+Requires(postun): /usr/bin/mv |
|
| 28 | 28 |
|
| 29 | 29 |
%description |
| 30 | 30 |
The package contains the Bourne-Again SHell |
| ... | ... |
@@ -151,14 +151,13 @@ cat > %{buildroot}%{_sysconfdir}/profile.d/bash_completion.sh << "EOF"
|
| 151 | 151 |
# check for interactive bash and only bash |
| 152 | 152 |
if [ -n "$BASH_VERSION" -a -n "$PS1" ]; then |
| 153 | 153 |
|
| 154 |
-# enable bash completion in interactive shells |
|
| 155 |
-if ! shopt -oq posix; then |
|
| 156 |
- if [ -f %{_datadir}/bash-completion/bash_completion ]; then
|
|
| 157 |
- . %{_datadir}/bash-completion/bash_completion
|
|
| 154 |
+ # enable bash completion in interactive shells |
|
| 155 |
+ if ! shopt -oq posix; then |
|
| 156 |
+ if [ -f %{_datadir}/bash-completion/bash_completion ]; then
|
|
| 157 |
+ . %{_datadir}/bash-completion/bash_completion
|
|
| 158 |
+ fi |
|
| 158 | 159 |
fi |
| 159 | 160 |
fi |
| 160 |
- |
|
| 161 |
-fi |
|
| 162 | 161 |
EOF |
| 163 | 162 |
|
| 164 | 163 |
cat > %{buildroot}%{_sysconfdir}/bash.bashrc << "EOF"
|
| ... | ... |
@@ -191,7 +190,7 @@ fi |
| 191 | 191 |
NORMAL="\[\e[0m\]" |
| 192 | 192 |
RED="\[\e[1;31m\]" |
| 193 | 193 |
GREEN="\[\e[1;32m\]" |
| 194 |
-if [[ $EUID == 0 ]]; then |
|
| 194 |
+if [[ $EUID = 0 ]]; then |
|
| 195 | 195 |
PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" |
| 196 | 196 |
else |
| 197 | 197 |
PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" |
| ... | ... |
@@ -200,8 +199,9 @@ fi |
| 200 | 200 |
unset RED GREEN NORMAL |
| 201 | 201 |
|
| 202 | 202 |
if test -n "$SSH_CONNECTION" -a -z "$PROFILEREAD"; then |
| 203 |
- . %{_sysconfdir}/profile > /dev/null 2>&1
|
|
| 203 |
+ . %{_sysconfdir}/profile > /dev/null 2>&1
|
|
| 204 | 204 |
fi |
| 205 |
+ |
|
| 205 | 206 |
# End /etc/bash.bashrc |
| 206 | 207 |
EOF |
| 207 | 208 |
|
| ... | ... |
@@ -273,25 +273,25 @@ make NON_ROOT_USERNAME=nobody %{?_smp_mflags} check
|
| 273 | 273 |
|
| 274 | 274 |
%post |
| 275 | 275 |
if [ $1 -eq 1 ]; then |
| 276 |
-if [ ! -f "/root/.bash_logout" ]; then |
|
| 277 |
- cp %{_sysconfdir}/skel/.bash_logout /root/.bash_logout
|
|
| 278 |
-fi |
|
| 276 |
+ if [ ! -f "/root/.bash_logout" ]; then |
|
| 277 |
+ cp %{_sysconfdir}/skel/.bash_logout /root/.bash_logout
|
|
| 278 |
+ fi |
|
| 279 | 279 |
|
| 280 |
-if [ ! -f %{_sysconfdir}/shells ]; then
|
|
| 281 |
- echo "/bin/sh" >> %{_sysconfdir}/shells
|
|
| 282 |
- echo "/bin/bash" >> %{_sysconfdir}/shells
|
|
| 283 |
- echo "%{_bindir}/sh" >> %{_sysconfdir}/shells
|
|
| 284 |
- echo "%{_bindir}/bash" >> %{_sysconfdir}/shells
|
|
| 285 |
-else |
|
| 286 |
- grep -q '^/bin/sh$' %{_sysconfdir}/shells || \
|
|
| 287 |
- echo "/bin/sh" >> %{_sysconfdir}/shells
|
|
| 288 |
- grep -q '^/bin/bash$' %{_sysconfdir}/shells || \
|
|
| 289 |
- echo "/bin/bash" >> %{_sysconfdir}/shells
|
|
| 290 |
- grep -q '^%{_bindir}/sh$' %{_sysconfdir}/shells || \
|
|
| 291 |
- echo "%{_bindir}/sh" >> %{_sysconfdir}/shells
|
|
| 292 |
- grep -q '^%{_bindir}/bash$' %{_sysconfdir}/shells || \
|
|
| 293 |
- echo "%{_bindir}/bash" >> %{_sysconfdir}/shells
|
|
| 294 |
-fi |
|
| 280 |
+ if [ ! -f %{_sysconfdir}/shells ]; then
|
|
| 281 |
+ echo "/bin/sh" >> %{_sysconfdir}/shells
|
|
| 282 |
+ echo "/bin/bash" >> %{_sysconfdir}/shells
|
|
| 283 |
+ echo "%{_bindir}/sh" >> %{_sysconfdir}/shells
|
|
| 284 |
+ echo "%{_bindir}/bash" >> %{_sysconfdir}/shells
|
|
| 285 |
+ else |
|
| 286 |
+ grep -q '^/bin/sh$' %{_sysconfdir}/shells || \
|
|
| 287 |
+ echo "/bin/sh" >> %{_sysconfdir}/shells
|
|
| 288 |
+ grep -q '^/bin/bash$' %{_sysconfdir}/shells || \
|
|
| 289 |
+ echo "/bin/bash" >> %{_sysconfdir}/shells
|
|
| 290 |
+ grep -q '^%{_bindir}/sh$' %{_sysconfdir}/shells || \
|
|
| 291 |
+ echo "%{_bindir}/sh" >> %{_sysconfdir}/shells
|
|
| 292 |
+ grep -q '^%{_bindir}/bash$' %{_sysconfdir}/shells || \
|
|
| 293 |
+ echo "%{_bindir}/bash" >> %{_sysconfdir}/shells
|
|
| 294 |
+ fi |
|
| 295 | 295 |
fi |
| 296 | 296 |
|
| 297 | 297 |
%postun |
| ... | ... |
@@ -301,23 +301,23 @@ if [ $1 -eq 0 ]; then |
| 301 | 301 |
fi |
| 302 | 302 |
if [ ! -x /bin/sh ]; then |
| 303 | 303 |
grep -v '^/bin/sh$' %{_sysconfdir}/shells | \
|
| 304 |
- grep -v '^/bin/sh$' > %{_sysconfdir}/shells.rpm && \
|
|
| 305 |
- mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 304 |
+ grep -v '^/bin/sh$' > %{_sysconfdir}/shells.rpm && \
|
|
| 305 |
+ mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 306 | 306 |
fi |
| 307 | 307 |
if [ ! -x /bin/bash ]; then |
| 308 | 308 |
grep -v '^/bin/bash$' %{_sysconfdir}/shells | \
|
| 309 |
- grep -v '^/bin/bash$' > %{_sysconfdir}/shells.rpm && \
|
|
| 310 |
- mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 309 |
+ grep -v '^/bin/bash$' > %{_sysconfdir}/shells.rpm && \
|
|
| 310 |
+ mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 311 | 311 |
fi |
| 312 | 312 |
if [ ! -x %{_bindir}/sh ]; then
|
| 313 | 313 |
grep -v '^%{_bindir}/sh$' %{_sysconfdir}/shells | \
|
| 314 |
- grep -v '^%{_bindir}/sh$' > %{_sysconfdir}/shells.rpm && \
|
|
| 315 |
- mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 314 |
+ grep -v '^%{_bindir}/sh$' > %{_sysconfdir}/shells.rpm && \
|
|
| 315 |
+ mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 316 | 316 |
fi |
| 317 | 317 |
if [ ! -x %{_bindir}/bash ]; then
|
| 318 | 318 |
grep -v '^%{_bindir}/bash$' %{_sysconfdir}/shells | \
|
| 319 |
- grep -v '^%{_bindir}/bash$' > %{_sysconfdir}/shells.rpm && \
|
|
| 320 |
- mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 319 |
+ grep -v '^%{_bindir}/bash$' > %{_sysconfdir}/shells.rpm && \
|
|
| 320 |
+ mv %{_sysconfdir}/shells.rpm %{_sysconfdir}/shells
|
|
| 321 | 321 |
fi |
| 322 | 322 |
fi |
| 323 | 323 |
|
| ... | ... |
@@ -342,6 +342,8 @@ fi |
| 342 | 342 |
%{_mandir}/*/*
|
| 343 | 343 |
|
| 344 | 344 |
%changelog |
| 345 |
+* Wed Aug 24 2022 Shreenidhi Shedi <sshedi@vmware.com> 5.1.16-1 |
|
| 346 |
+- Upgrade to v5.1.16 |
|
| 345 | 347 |
* Wed Feb 23 2022 Shreenidhi Shedi <sshedi@vmware.com> 5.0-3 |
| 346 | 348 |
- Fix binary path |
| 347 | 349 |
* Fri Feb 19 2021 Satya Naga Vasamsetty <svasamsetty@vmware.com> 5.0-2 |
| ... | ... |
@@ -1753,7 +1753,7 @@ _root_command() |
| 1753 | 1753 |
local root_command=$1 |
| 1754 | 1754 |
_command |
| 1755 | 1755 |
} |
| 1756 |
-complete -F _root_command fakeroot gksu gksudo kdesudo really |
|
| 1756 |
+complete -F _root_command fakeroot gksu gksudo kdesudo really sudo |
|
| 1757 | 1757 |
|
| 1758 | 1758 |
# Return true if the completion should be treated as running as root |
| 1759 | 1759 |
_complete_as_root() |
| 1760 | 1760 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,35 @@ |
| 0 |
+From 036216b03d55db0396a9e1bb246503ad58398088 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Shreenidhi Shedi <sshedi@vmware.com> |
|
| 2 |
+Date: Wed, 24 Aug 2022 15:39:59 +0530 |
|
| 3 |
+Subject: [PATCH] config-top.h: enable SYS_BASHRC & SSH_SOURCE_BASHRC |
|
| 4 |
+ |
|
| 5 |
+Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com> |
|
| 6 |
+--- |
|
| 7 |
+ config-top.h | 4 ++-- |
|
| 8 |
+ 1 file changed, 2 insertions(+), 2 deletions(-) |
|
| 9 |
+ |
|
| 10 |
+diff --git a/config-top.h b/config-top.h |
|
| 11 |
+index 735f75e..5934fe5 100644 |
|
| 12 |
+--- a/config-top.h |
|
| 13 |
+@@ -91,7 +91,7 @@ |
|
| 14 |
+ #define DEFAULT_BASHRC "~/.bashrc" |
|
| 15 |
+ |
|
| 16 |
+ /* System-wide .bashrc file for interactive shells. */ |
|
| 17 |
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */ |
|
| 18 |
++#define SYS_BASHRC "/etc/bash.bashrc" |
|
| 19 |
+ |
|
| 20 |
+ /* System-wide .bash_logout for login shells. */ |
|
| 21 |
+ /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */ |
|
| 22 |
+@@ -104,7 +104,7 @@ |
|
| 23 |
+ sshd and source the .bashrc if so (like the rshd behavior). This checks |
|
| 24 |
+ for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment, |
|
| 25 |
+ which can be fooled under certain not-uncommon circumstances. */ |
|
| 26 |
+-/* #define SSH_SOURCE_BASHRC */ |
|
| 27 |
++#define SSH_SOURCE_BASHRC |
|
| 28 |
+ |
|
| 29 |
+ /* Define if you want the case-toggling operators (~[~]) and the |
|
| 30 |
+ `capcase' variable attribute (declare -c). */ |
|
| 31 |
+-- |
|
| 32 |
+2.25.1 |
|
| 33 |
+ |