This file is indexed.

/usr/bin/ica-launcher is in italc-client 1:1.0.13-0ubuntu4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
#!/bin/sh
# iTalc client launcher using avahi
# Written by Stéphane Graber <stgraber@ubuntu.com>

find_free_port() {
# $1 = requested port
# $2 = sorted list of ports in use
# Basic logic: if the distance between two used ports A and B is greater than 1,
# then port A+1 is free.
    req_port=$1
    used_ports="$2 65536"
    candidate=$req_port
    for p in $used_ports
    do
        if [ $p -lt $req_port ]
        then # Pass the ports lower than the requested one
            continue
        elif [ $p -gt $candidate ]
        then
            echo $candidate
            return 0
        else
            candidate=$(($p+1))
        fi
    done
    return 1
}

ICA_LTSP=`xprop -root ica_ltsp | sed 's/^.* //' 2> /dev/zero`
if [ "$ICA_LTSP" = "1" ]
then
    echo "ICA already running on the thin client."
    exit 0
fi

# Provide a configuration file to enable switching off client autodetection
# and/or specifying user-defined ports.
if [ -f /etc/italc/italc.conf ]
then
    . /etc/italc/italc.conf
fi

PUBLISH_CLIENT=${PUBLISH_CLIENT:-True}
ISDPORT=${ISDPORT:-5800}
IVSPORT=${IVSPORT:-5900}
HOSTNAME=`hostname`
MD5_3=`md5sum /etc/italc/keys/public/teacher/key | awk '{print \$1}'`
MD5_2=`md5sum /etc/italc/keys/public/admin/key | awk '{print \$1}'`
MD5_1=`md5sum /etc/italc/keys/public/supporter/key | awk '{print \$1}'`

if [ -n "$1" ]; then
    ROLE=$1
else
    ROLE="other"
fi

if [ -n "$LTSP_CLIENT" ]
then
    echo LTSP environement detected
    PORT=`echo $LTSP_CLIENT | awk -F . '{print \$4}'`
# Not much point in using the ports from /etc/italc/italc.conf for thin clients
    ISDPORT=$((11000 + $PORT))
    IVSPORT=$((10000 + $PORT))
    HOSTNAME=${LTSP_CLIENT_HOSTNAME:-$HOSTNAME}
fi

USED_PORTS=$(netstat -nap 2>/dev/null | grep -v TIME_WAIT | sed -n 's/unix[^0-9]*[0-9]*[^0-9]*\([0-9]*\).*/\1/p;s/tcp[^:]*:\([0-9]*\).*/\1/p;s/udp[^:]*:\([0-9]*\).*/\1/p' | sort -n)
ISDPORT=`find_free_port $ISDPORT "$USED_PORTS"`
USED_PORTS=$(echo "$USED_PORTS
$ISDPORT" | sort -n)
IVSPORT=`find_free_port $IVSPORT "$USED_PORTS"`

RUNNING_ICA=`ps -C ica -o pid,command | sed -n 's/^ *\([0-9]*\) *ica.*/\1/p'`
if [ -n "$RUNNING_ICA" ]
then
    for processus in $RUNNING_ICA
    do
        kill $processus
    done
    echo ICA already running, killing it.
    sleep 1s
fi

if [ "$PUBLISH_CLIENT" = "True" ] && [ -f /usr/bin/avahi-publish-service ] && [ ! -f /etc/ltsp/getltscfg-cluster.conf ]
then
    echo Announce the service on avahi
    avahi-publish-service "italc $USER" _italc._tcp $IVSPORT $MD5_1 $MD5_2 $MD5_3 "$HOSTNAME" > /dev/zero &
fi

echo Starting ICA
# Store the port in an xprop, for italc-launcher to find it
xprop -root -f ICA_PORT 16c -set ICA_PORT $ISDPORT
ica -noshm -isdport $ISDPORT -ivsport $IVSPORT -role $ROLE 2> /dev/zero
xprop -root -remove ICA_PORT

if [ "$PUBLISH_CLIENT" = "True" ] && [ -f /usr/bin/avahi-publish-service ] && [ ! -f /etc/ltsp/getltscfg-cluster.conf ]
then
    echo Stopping avahi
    kill `ps -C "avahi-publish-service italc $USER _italc._tcp $IVSPORT" -o pid=`
fi