summaryrefslogtreecommitdiffstats
path: root/source/ap/ash/patches/ash-freebsd.patch
blob: b0b1144705a68369368c1935c18faadc4446d170 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff -ur ash-0.4.0/bltin/echo.c ash-0.4.0+free/bltin/echo.c
--- ash-0.4.0/bltin/echo.c	Tue Apr 24 02:03:56 2001
+++ ash-0.4.0+free/bltin/echo.c	Tue Apr 24 01:43:15 2001
@@ -89,6 +89,7 @@
 				case 'a':  c = '\007'; break;
 				case 'b':  c = '\b';  break;
 				case 'c':  return 0;		/* exit */
+				case 'e':  c = '\033';  break;
 				case 'f':  c = '\f';  break;
 				case 'n':  c = '\n';  break;
 				case 'r':  c = '\r';  break;
diff -ur ash-0.4.0/cd.c ash-0.4.0+free/cd.c
--- ash-0.4.0/cd.c	Tue Apr 24 02:03:56 2001
+++ ash-0.4.0+free/cd.c	Tue Apr 24 01:43:57 2001
@@ -244,6 +244,7 @@
 		curdir = NULL;
 		getpwd();
 		setvar("PWD", curdir, VEXPORT|VTEXTFIXED);
+		setvar("OLDPWD", prevdir, VEXPORT|VTEXTFIXED);
 		INTON;
 		return;
 	}
@@ -275,6 +276,7 @@
 	prevdir = curdir;
 	curdir = savestr(stackblock());
 	setvar("PWD", curdir, VEXPORT|VTEXTFIXED);
+	setvar("OLDPWD", prevdir, VEXPORT|VTEXTFIXED);
 	INTON;
 }
 
diff -ur ash-0.4.0/main.c ash-0.4.0+free/main.c
--- ash-0.4.0/main.c	Tue Apr 24 02:03:57 2001
+++ ash-0.4.0+free/main.c	Tue Apr 24 02:03:26 2001
@@ -115,6 +115,9 @@
 	struct stackmark smark;
 	volatile int state;
 	char *shinit;
+	int priviliged;
+
+	priviliged = getuid() != geteuid() || getgid() != getegid();
 
 #if PROFILE
 	monitor(4, etext, profile_buf, sizeof profile_buf, 50);
@@ -188,11 +191,14 @@
 		read_profile("/etc/profile");
 state1:
 		state = 2;
-		read_profile(".profile");
+		if (priviliged == 0)
+			read_profile(".profile");
+		else
+			read_profile("/etc/suid_profile");
 	}
 state2:
 	state = 3;
-	if (getuid() == geteuid() && getgid() == getegid()) {
+	if (iflag && !priviliged) {
 		if ((shinit = lookupvar("ENV")) != NULL && *shinit != '\0') {
 			state = 3;
 			read_profile(shinit);