File: rbash-login-shell.dpatch

package info (click to toggle)
bash 2.05b-2-26
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,336 kB
  • ctags: 50
  • sloc: sh: 45,451; makefile: 446; ansic: 268
file content (40 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download
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
#! /bin/sh -e

if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

# DP: Fixed a bug that caused a leading `-' in the shell's name to cause it to
# DP: not be recognized as a restricted shell.

--- bash-2.05b/shell.c.ORI	2003-01-16 12:23:56.000000000 +0100
+++ bash-2.05b/shell.c	2003-01-16 12:25:52.000000000 +0100
@@ -1065,7 +1065,7 @@
   if (restricted)
     return 1;
   temp = base_pathname (name);
-  return (STREQ (temp, RESTRICTED_SHELL_NAME));
+  return ( (STREQ (temp, RESTRICTED_SHELL_NAME)) || (STREQ (temp, ("-"RESTRICTED_SHELL_NAME))) );
 }
 
 /* Perhaps make this shell a `restricted' one, based on NAME.  If the
@@ -1082,7 +1082,7 @@
   char *temp;
 
   temp = base_pathname (name);
-  if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME)))
+  if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME)) || (STREQ (temp, ("-"RESTRICTED_SHELL_NAME))) )
     {
       set_var_read_only ("PATH");
       set_var_read_only ("SHELL");