diff options
author | Steve French <sfrench@samba.org> | 2007-02-07 20:16:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:48 -0500 |
commit | d1bb9b161fcfa0cfa4687d285706d6f15b6abcdd (patch) | |
tree | c24c69d099ee3ef5b143515bc870c22ff5965696 /source3 | |
parent | 255177d2b9c1ad358728ac15626523b5bb0ac244 (diff) | |
download | samba-d1bb9b161fcfa0cfa4687d285706d6f15b6abcdd.tar.gz samba-d1bb9b161fcfa0cfa4687d285706d6f15b6abcdd.tar.bz2 samba-d1bb9b161fcfa0cfa4687d285706d6f15b6abcdd.zip |
r21224: Initial checkin of cifs_host_name resolver helper script
(needed by /sbin keyctl utils to finish the upcall)
(This used to be commit 738d29dbcc6eae44ea91bdcf59a38c423dad1e29)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/cifs_resolver.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/client/cifs_resolver.sh b/source3/client/cifs_resolver.sh new file mode 100644 index 0000000000..aaf28a50c9 --- /dev/null +++ b/source3/client/cifs_resolver.sh @@ -0,0 +1,51 @@ +#!/bin/sh +############################################################################### +# +# Written by Igor Mammedov (niallain@gmail.com) +# Modified by Steve French <sfrench@samba.org> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +############################################################################### +# +# linux-cifs-client dns name resolver helper +# called by cifs kernel module upcall to key API to resolve server name +# to IP when module connects to DFS link. We may eventually make this +# C code, but this is a good starting point. +# You should have appropriate kernel and keyutils installed. +# CIFS DFS Support will require Linux kernel module +# cifs.ko version 1.48 or later. +# +# Consult the CIFS client users guide for more details +# http://www.samba.org/samba/ftp/cifs-cvs/linux-cifs-client-guide.pdf +# +# Put the following string in /etc/request-key.conf without comment sign :) +# create cifs_resolver * * /sbin/cifs_resolver.sh %k %d %S +# +# Put this script into /sbin directory +# Call: /sbin/cifs_resolver.sh <keyid> <desc> <session-keyring> +# +# <desc> - is server name to resolve +# + +status=0 +{ + echo "cifs_resolver: resolving: $2" + + DATAA=`/usr/bin/host $2` + status=$? + + if [ "x$status" != "x0" ]; then + echo "cifs_resolver: failed to resolve: $2" + exit $status + else + DATAA=`echo "$DATAA" | sed 's/.*has address //'` + echo "cifs_resolver: resolved: $2 to $DATAA" + keyctl instantiate $1 "$DATAA" $3 || exit 1 + fi + +} >&/dev/ttyS0 +exit $status |