-rw-r--r-- | share/opie-login/pre-session | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/share/opie-login/pre-session b/share/opie-login/pre-session index 8219f94..6bf9e4c 100644 --- a/share/opie-login/pre-session +++ b/share/opie-login/pre-session | |||
@@ -2,6 +2,38 @@ | |||
2 | 2 | ||
3 | USER=$1 | 3 | USER=$1 |
4 | 4 | ||
5 | # NOTE about permissions in OpenZaurus | ||
6 | # The devices in question here by default | ||
7 | #are accessible to everyone in the group in | ||
8 | #question. We wish to ensure that, as a policy | ||
9 | #choice, a login to opie makes access to these | ||
10 | #devices exclusive by 1) changing device ownership | ||
11 | #to the user, and 2) removing group access. | ||
12 | # | ||
13 | #A better implementation would probably be to store | ||
14 | #existing device permissions at load time, and restore | ||
15 | #them at exit, rather than making assumptions about | ||
16 | #user/group ownership, or permissions. | ||
17 | |||
18 | permin () | ||
19 | { | ||
20 | if [ -e $1 ] | ||
21 | then | ||
22 | |||
23 | chown $USER $1 | ||
24 | chmod g-rw $1 | ||
25 | |||
26 | else | ||
27 | return 1 | ||
28 | fi | ||
29 | } | ||
30 | |||
31 | permout () | ||
32 | { | ||
33 | [ -e $1 ]&& chown root $1 | ||
34 | [ -e $1 ]&& chmod g+rw $1 | ||
35 | } | ||
36 | |||
5 | if [ -e /proc/hal/model ]; then | 37 | if [ -e /proc/hal/model ]; then |
6 | 38 | ||
7 | # fix for misconfigured devfsd | 39 | # fix for misconfigured devfsd |
@@ -12,5 +44,13 @@ if [ -e /proc/hal/model ]; then | |||
12 | [ -e /dev/touchscreen/0 ] && chown $USER /dev/touchscreen/0 | 44 | [ -e /dev/touchscreen/0 ] && chown $USER /dev/touchscreen/0 |
13 | [ -e /dev/fb/0 ] && chown $USER /dev/fb/0 | 45 | [ -e /dev/fb/0 ] && chown $USER /dev/fb/0 |
14 | [ -e /dev/vc/0 ] && chown $USER /dev/vc/0 | 46 | [ -e /dev/vc/0 ] && chown $USER /dev/vc/0 |
15 | fi | ||
16 | 47 | ||
48 | else | ||
49 | |||
50 | for dev in /dev/dsp /dev/dsp1 /dev/mixer \ | ||
51 | /dev/ts /dev/fb0 | ||
52 | do | ||
53 | permin( $dev ) | ||
54 | done | ||
55 | |||
56 | fi | ||