File: socat

package info (click to toggle)
authbind 2.2.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 88 kB
  • sloc: ansic: 489; makefile: 79; sh: 25
file content (32 lines) | stat: -rwxr-xr-x 542 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
#!/bin/bash
set -ex

if [ "x$AUTOPKGTEST_NORMAL_USER" = x ]; then
    exit 77
fi

user=$AUTOPKGTEST_NORMAL_USER

port=7
addr='[::1]'
token=cQFoveQKSgwPdcKQ
 
touch /etc/authbind/byport/7
chmod 544 /etc/authbind/byport/7
chown "$user" /etc/authbind/byport/7

really -u $user \
authbind \
socat "TCP6-LISTEN:$port,bind=$addr" "exec:echo $token" &

pid=$!

# Ideally we'd wait for socat to get its act together, but that's hard.
sleep 5

token_got=$(socat "TCP6:$addr:$port" STDIO </dev/null)

test "x$token_got" = "x$token"
wait $pid

echo ok.