summaryrefslogtreecommitdiffstats
path: root/rdesktop
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-01 15:01:05 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-01 15:01:05 +0100
commit25cc202572c97bcb7dc3046a06790a9dd1d3d517 (patch)
tree3807d30f7761e475929b1ce1283a5e697a3f384e /rdesktop
parent732d5cce49f7213c5957c59bc0e72a483aaad500 (diff)
downloadbin-25cc202572c97bcb7dc3046a06790a9dd1d3d517.zip
bin-25cc202572c97bcb7dc3046a06790a9dd1d3d517.tar.gz
rdesktop: use smb credential files
Diffstat (limited to 'rdesktop')
-rwxr-xr-xrdesktop29
1 files changed, 23 insertions, 6 deletions
diff --git a/rdesktop b/rdesktop
index 750f433..9769d0d 100755
--- a/rdesktop
+++ b/rdesktop
@@ -1,11 +1,28 @@
#! /bin/sh
+
[ $# -lt 1 ] && echo "missing hostname" && exit 1
-if [ $# -eq 2 ]; then
- host=$2
- user=$1
+
+OPTS="-0 -g 1280x1024 -k fr-ch"
+host="$1"
+
+if [ $# -gt 1 ]; then
+ f="$HOME/.smb/$2.auth"
else
- host=$1
- user="$1\Administrator"
+ f="$HOME/.smb/$1.auth"
fi
-/usr/bin/rdesktop -0 -g 1280x1024 -u $user $host
+
+if [ -r "$f" ];then
+ username=$(cat $f | sed -ne 's/username=\(.*\)/\1/p; s/\n//g')
+ password=$(cat $f | sed -ne 's/password=\(.*\)/\1/p; s/\n//g')
+ domain=$(cat $f | sed -ne 's/domain=\(.*\)/\1/p; s/\n//g')
+else
+ echo "$f is not readable" && exit 1
+fi
+
+[ -z "$d" ] && domain="$1"
+[ -z "$password" ] || password="-p $password"
+
+OPTS="$OPTS -d $domain -u $username $password $host"
+
+/usr/bin/rdesktop $OPTS