~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/config/util/mkdirhier.sh

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# $Xorg: mkdirhier.sh,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
 
3
# Courtesy of Paul Eggert
 
4
 
 
5
newline='
 
6
'
 
7
IFS=$newline
 
8
 
 
9
case ${1--} in
 
10
-*) echo >&2 "mkdirhier: usage: mkdirhier directory ..."; exit 1
 
11
esac
 
12
 
 
13
status=
 
14
 
 
15
for directory
 
16
do
 
17
        case $directory in
 
18
        '')
 
19
                echo >&2 "mkdirhier: empty directory name"
 
20
                status=1
 
21
                continue;;
 
22
        *"$newline"*)
 
23
                echo >&2 "mkdirhier: directory name contains a newline: \`\`$directory''"
 
24
                status=1
 
25
                continue;;
 
26
        ///*) prefix=/;; # See Posix 2.3 "path".
 
27
        //*) prefix=//;;
 
28
        /*) prefix=/;;
 
29
        -*) prefix=./;;
 
30
        *) prefix=
 
31
        esac
 
32
 
 
33
        IFS=/
 
34
        set x $directory
 
35
        case $2 in
 
36
            */*)        # IFS parsing is broken
 
37
                IFS=' '
 
38
                set x `echo $directory | tr / ' '`
 
39
                ;;
 
40
        esac
 
41
        IFS=$newline
 
42
        shift
 
43
 
 
44
        for filename
 
45
        do
 
46
                path=$prefix$filename
 
47
                prefix=$path/
 
48
                shift
 
49
 
 
50
                test -d "$path" || {
 
51
                        paths=$path
 
52
                        for filename
 
53
                        do
 
54
                                if [ -n "$filename" -a "$filename" != "." ]; then
 
55
                                        path=$path/$filename
 
56
                                        paths=$paths$newline$path
 
57
                                fi
 
58
                        done
 
59
 
 
60
                        mkdir $paths || status=$?
 
61
 
 
62
                        break
 
63
                }
 
64
        done
 
65
  done
 
66
 
 
67
exit $status