Commit 47505bf1 authored by Natanael Copa's avatar Natanael Copa
Browse files

main/bash: fix setuid bug

ref #2990
fixes #2994

(cherry picked from commit 15eb9878)
parent f1fc43ca
......@@ -4,7 +4,7 @@ pkgver=4.3.011
_patchlevel=${pkgver##*.}
_myver=${pkgver%.*}
_patchbase=${_myver%.*}${_myver#*.}
pkgrel=1
pkgrel=2
pkgdesc="The GNU Bourne Again shell"
url="http://www.gnu.org/software/bash/bash.html"
arch="all"
......@@ -14,6 +14,7 @@ depends=""
subpackages="$pkgname-doc"
source="http://ftp.gnu.org/gnu/bash/bash-${_myver}.tar.gz
bash-noinfo.patch
bash_4.3-fix-setuid.patch
"
# generate url's to patches. note: no forks allowed!
_i=1
......@@ -65,6 +66,7 @@ package() {
md5sums="81348932d5da294953e15d4814c74dd1 bash-4.3.tar.gz
80fec5f3d60a63756a4999c877e31a8e bash-noinfo.patch
c87b8d9e12d628eac829dc08f4607a20 bash_4.3-fix-setuid.patch
1ab682b4e36afa4cf1b426aa7ac81c0d bash43-001
8fc22cf50ec85da00f6af3d66f7ddc1b bash43-002
a41728eca78858758e26b5dea64ae506 bash43-003
......@@ -78,6 +80,7 @@ a275463d21735bb6d7161f9fbd320d8f bash43-010
c17103ee20420d77e46b224c8d3fceda bash43-011"
sha256sums="afc687a28e0e24dc21b988fa159ff9dbcf6b7caa92ade8645cc6d5605cd024d4 bash-4.3.tar.gz
363bc919d98cadbfca27660be0d1d4bb6cfe1c5f86a7830966e456df36e46792 bash-noinfo.patch
3deb20a2ad093ad318a0aac7a2b69674ba325a59c9e5d2dc67f852d40a6cc177 bash_4.3-fix-setuid.patch
ecb3dff2648667513e31554b3ad054ccd89fce38e33367c9459ac3a285153742 bash43-001
eee7cd7062ab29a9e4f02924d9c367264dcb8b162703f74ff6eb8f175a91502b bash43-002
000e6eac50cd9053ce0630db01239dcdead04a2c2c351c47e2b51dac1ac1087d bash43-003
......@@ -91,6 +94,7 @@ ce05799c0137314c70c7b6ea0477c90e1ac1d52e113344be8e32fa5a55c9f0b7 bash43-010
7c63402cdbc004a210f6c1c527b63b13d8bb9ec9c5a43d5c464a9010ff6f7f3b bash43-011"
sha512sums="a852b8e46ee55568dce9d23a30a9dbd1c770c2d2a4bc91e1c3177d723b31b32c5d69d19704a93f165891b409b9dd2cc65723372044e2bd0ee49ed59a11512651 bash-4.3.tar.gz
74d51550cc03410f22ffea13f6452350d1e5564bff619fb07a5bbef14ca565fbe03770a2c0041292732cda16e8944b33ccbd0dfe29a606a068fedabe277cd6ae bash-noinfo.patch
b9e035f6a781dd4bb3c58f4de9922e7a3c68a0e38c1538f351c638469b70b031fe019e7f1d626e8db8239a13809f0c8dfa291caf930ed206345a80fa3cff3f80 bash_4.3-fix-setuid.patch
a1011392652180a28f9837af4a341a80beb929c1458e2384e282f0007713c5fe8d0b315abf1340b3707748d3caed322135dee87b59eeb7612ee5130f87d79888 bash43-001
e3178c85f553522d5d1c5fd39e76f015b680a8ccc84836a5e10283b2aed6e5b7cc3d23af0e67a270b7622dce0abf35dd8a95afa9bb6f89b73a9439f7435175a4 bash43-002
dc2c5fad8d357d1301e419afd959dfaf015a63172857080c11f77ab1bb7d1d737f411eb0e70a861f98a36bed1b19edb7217a4fa9f4773e21706b62dc56ec3464 bash43-003
......
diff --git shell.c shell.c
index bbc8a66..5bfd466 100644
--- shell.c
+++ shell.c
@@ -1226,8 +1226,12 @@ uidget ()
void
disable_priv_mode ()
{
- setuid (current_user.uid);
- setgid (current_user.gid);
+
+ if( (setuid (current_user.uid) !=0) || (setgid (current_user.gid) != 0) ){
+ report_error("Drop privileges failed!!\n");
+ exit(EX_DROPFAIL);
+ }
+
current_user.euid = current_user.uid;
current_user.egid = current_user.gid;
}
diff --git shell.h shell.h
index 243e467..c3625be 100644
--- shell.h
+++ shell.h
@@ -72,6 +72,7 @@ extern int EOF_Reached;
#define EX_REDIRFAIL 259 /* redirection failed */
#define EX_BADASSIGN 260 /* variable assignment error */
#define EX_EXPFAIL 261 /* word expansion failed */
+#define EX_DROPFAIL 262 /* Drop privileges failed */
/* Flag values that control parameter pattern substitution. */
#define MATCH_ANY 0x000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment