Commit 9054cc31 authored by Vitaly Lipatov's avatar Vitaly Lipatov Committed by Automatic Converter

1.50c-alt4

- fix build on Fedora 8 (2.6.18-53)
parent 08a10117
tar.bz2: cifs-bld-tmp name=cifs-@version@ base=cifs-bld-tmp
tar.bz2: new-cifs-backport name=cifs-@version@ base=new-cifs-backport
tar.bz2: linux-cifs
# Etersoft (c) 2007
# Etersoft (c) 2007, 2008
# Multiplatform spec for autobuild system
# in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx
......@@ -12,8 +12,8 @@
# kernel-source-XXXX for Slackware / MOPSLinux
Name: linux-cifs
Version: 1.48a
%define relnum 7
Version: 1.50c
Release: alt4
Summary: Advanced Common Internet File System for Linux with Etersoft extension
......@@ -26,27 +26,19 @@ Url: http://linux-cifs.samba.org/
Source: ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft/sources/tarball/%name-%version.tar.bz2
Source1: http://pserver.samba.org/samba/ftp/cifs-cvs/cifs-%version.tar.bz2
BuildRequires: rpm-build-compat >= 0.97
# Spec part for ALT Linux
%if %_vendor == "alt"
Release: alt%relnum
BuildRequires: rpm-build-compat >= 0.7
BuildRequires: kernel-build-tools
BuildRequires: kernel-headers-modules-std-smp kernel-headers-modules-wks-smp kernel-headers-modules-ovz-smp
BuildRequires: kernel-headers-modules-std-smp kernel-headers-modules-ovz-smp kernel-headers-modules-std-def
# do not work?
%ifarch x86_64
# Don't know if ifnarch exist
BuildRequires: kernel-headers-modules-std-smp
%else
BuildRequires: kernel-headers-modules-std-pae
%endif
%else
Release: eter%relnum%_vendor
BuildRequires: rpm-build-altlinux-compat >= 0.7
%endif
# FIXME: ifndef broken in Ubuntu
#ifndef buildroot
%if %{undefined buildroot}
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%endif
%if %_vendor == "suse"
......@@ -82,32 +74,56 @@ though.
This package has Etersoft's patches for WINE@Etersoft sharing access support.
#cifs-bld-tmp/fs/cifs
%define intdir new-cifs-backport
%prep
%setup -q
tar xfj %SOURCE1
patch -s -p1 -d cifs-bld-tmp/fs/cifs <%name-shared.patch
patch -s -p1 -d %intdir <%name-shared-%version.patch
%install
#export KBUILD_VERBOSE=1
MAN_DIR=%buildroot%_mandir/ INIT_DIR=%buildroot%_initdir/ SBIN_DIR=%buildroot%_sbindir/ INSTALL_MOD_PATH=%buildroot%module_dir ./build.sh
MAN_DIR=%buildroot%_mandir/ INIT_DIR=%buildroot%_initdir/ SBIN_DIR=%buildroot%_sbindir/ \
INSTALL_MOD_PATH=%buildroot/lib/modules BUILDDIR=`pwd`/%intdir \
DESTDIR=%buildroot SRC_DIR=%_usrsrc/%name-%version ./build.sh
# Debian, Suse, Slackware do not have command service
# start service if first time install
%post
%post_service %name
[ "$1" = "1" ] && %_initdir/%name start || :
%start_service %name
%preun
%preun_service %name
%files
%defattr(-,root,root)
%_initdir/%name
%_initdir/%name.outformat
%module_dir/
/usr/src/%name/
/lib/modules/*
%_usrsrc/%name-%version/
%changelog
* Thu Jan 31 2008 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt4
- fix build on Fedora 8 (2.6.18-53)
* Sun Jan 27 2008 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt3
- move modules placement
- move src files to name-version for dkms compatibility
- change module name to etercifs.ko
* Fri Dec 28 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt2
- add fix for SLED10 kernel 2.6.16.46
- fix warnings, add missed access setting in reopen file func
* Tue Nov 06 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt1
- update version
- fix spec according to Korinf build system
* Fri Oct 12 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50-alt1
- update version
* Fri Sep 14 2007 Sergey Lebedev <barabashka@altlinux.ru> 1.50-alt0
- new version cifs 1.50
* Fri Jul 27 2007 Vitaly Lipatov <lav@altlinux.ru> 1.48a-alt7
- fix build on 2.6.22 kernels
- fix scripts for Debian/Ubuntu
......
/functions.sh/1.1/Sat Jun 9 18:28:40 2007//
/kernel_src.list/1.1/Fri Jun 8 11:05:01 2007//
/linux-cifs_depmod.sh/1.1/Fri Mar 16 18:14:13 2007//
/buildmodule.sh/1.13/Sat Jun 23 07:18:55 2007//
D/gentoo////
/build.sh/1.23/Tue Jul 3 06:26:08 2007//
/TODO/1.6/Tue Jul 3 06:12:36 2007//
/linux-cifs.outformat/1.3/Fri Jul 27 11:55:53 2007//
/linux-cifs-shared.patch/1.29/Fri Jul 27 16:25:24 2007//
/linux-cifs.spec/1.21/Fri Jul 27 16:41:33 2007//
/linux-cifs.init/1.27/Fri Aug 31 18:21:27 2007//
/linux-cifs.release.sh/1.2/Fri Jul 27 11:58:40 2007//
/linux-cifs-shared-1.50.patch/1.1/Fri Sep 14 12:11:33 2007//
/kernel_src.list/1.2/Fri Dec 7 14:19:41 2007//
/TODO/1.8/Sun Jan 27 15:46:44 2008//
/build.sh/1.26/Sun Jan 27 16:54:11 2008//
/linux-cifs.release.sh/1.4/Sun Jan 27 16:44:57 2008//
/buildmodule.sh/1.15/Sun Jan 27 17:45:53 2008//
/dkms-linux-cifs.spec/1.2/Sun Jan 27 17:58:57 2008//
/linux-cifs.init/1.36/Sun Jan 27 18:00:59 2008//
/linux-cifs-shared-1.50c.patch/1.8/Thu Jan 31 10:49:35 2008//
/linux-cifs.spec/1.29/Thu Jan 31 10:50:25 2008//
/var/local/cvsroot
:ext:cvs.etersoft/var/local/cvsroot
[12:51:54] <Lav> LinuxExtensions UNIX-, ģ
[12:52:23] <lebedev.sv> ?
[12:52:37] <Lav> nounix,
[12:53:14] <lebedev.sv> ? ?
[12:53:54] <lebedev.sv> , lin to win , mount -o nounix
LinuxExtensions ( unix) ?
ݣ , , - ?
+ gcc
+ ?
wine, - ?
Что делать с -e - посмотреть, как устроено в Ubuntu
+ -e - , Ubuntu
/proc
#!/bin/sh
# 2006, 2007 (c) Etersoft http://etersoft.ru
# 2006, 2007, 2008 (c) Etersoft http://etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# GNU Public License
......@@ -7,18 +7,21 @@
. ./functions.sh
echo "All kernel build script. (c) 2007 Etersoft. $Id: build.sh,v 1.23 2007/07/03 06:26:08 lav Exp $"
echo "All kernel build script. (c) 2007, 2008 Etersoft. $Id: build.sh,v 1.26 2008/01/27 16:54:11 lav Exp $"
PACKNAME=linux-cifs
MODULENAME=etercifs
get_src_dir || fatal "Distro $($DISTR_VENDOR -e) is not supported yet"
BUILDDIR=`pwd`/cifs-bld-tmp/fs/cifs
[ -n "$BUILDDIR" ] || BUILDDIR=`pwd`/new-cifs-backport
BUILTLIST=
# SMP build
[ -z "$RPM_BUILD_NCPUS" ] && RPM_BUILD_NCPUS=`/usr/bin/getconf _NPROCESSORS_ONLN`
[ "$RPM_BUILD_NCPUS" -gt 1 ] && MAKESMP="-j$RPM_BUILD_NCPUS" || MAKESMP=""
# Heuristic
detect_kernel()
{
# Detect kernel version
......@@ -41,10 +44,11 @@ detect_kernel()
fi
}
echo "Install sources to $SBIN_DIR/../src/linux-cifs/"
install -m755 -d $SBIN_DIR/../src/linux-cifs/
install -m644 $BUILDDIR/* $SBIN_DIR/../src/linux-cifs/ || exit 1
install -m644 buildmodule.sh $SBIN_DIR/../src/linux-cifs/ || exit 1
[ -z "$DESTDIR$SRC_DIR" ] && exit 1
echo "Install sources to $DESTDIR/$SRC_DIR"
install -m755 -d $DESTDIR/$SRC_DIR
install -m644 $BUILDDIR/* $DESTDIR/$SRC_DIR || exit 1
install -m644 buildmodule.sh $DESTDIR/$SRC_DIR || exit 1
for KERNEL_SOURCE in `echo $BASE_KERNEL_SOURCES_DIR` ; do
[ -L $KERNEL_SOURCE ] && [ `basename $KERNEL_SOURCE` != "build" ] && continue
......@@ -69,15 +73,14 @@ for KERNEL_SOURCE in `echo $BASE_KERNEL_SOURCES_DIR` ; do
# Clean, build and check
make $USEGCC -C $KERNEL_SOURCE here=$BUILDDIR SUBDIRS=$BUILDDIR clean
make $USEGCC -C $KERNEL_SOURCE here=$BUILDDIR SUBDIRS=$BUILDDIR modules $MAKESMP
MODULENAME=cifs
#[ "$KERVER" = "2.4" ] && MODULENAME=$(echo $MODULENAME.o) || MODULENAME=$(echo $MODULENAME.?o)
[ "$KERVER" = "2.4" ] && MODULENAME=$MODULENAME.o || MODULENAME=$MODULENAME.ko
test -r "$BUILDDIR/$MODULENAME" || { echo "can't locate built module $MODULENAME, continue" ; continue ; }
[ "$KERVER" = "2.4" ] && MODULEFILENAME=$MODULEFILENAME.o || MODULEFILENAME=$MODULENAME.ko
test -r "$BUILDDIR/$MODULEFILENAME" || { echo "can't locate built module $MODULEFILENAME, continue" ; continue ; }
#echo "$KERNELVERSION $MODULENAME to $INSTALL_MOD_PATH"
strip --strip-debug --discard-all $BUILDDIR/$MODULENAME
strip --strip-debug --discard-all $BUILDDIR/$MODULEFILENAME
mkdir -p $INSTALL_MOD_PATH/$KERNELVERSION/ || fatal "broken path"
cp -fv $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/$KERNELVERSION/ || fatal "copy error"
mkdir -p $INSTALL_MOD_PATH/$KERNELVERSION/kernel/fs/cifs || fatal "broken path"
cp -fv $BUILDDIR/$MODULEFILENAME $INSTALL_MOD_PATH/$KERNELVERSION/kernel/fs/cifs || fatal "copy error"
# copy last as default
#cp -f $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/$PACKNAME/
#make -C $KERNEL_SOURCE here=`pwd`/ SUBDIRS=`pwd`/ modules_install
......@@ -94,7 +97,8 @@ echo
mkdir -p $SBIN_DIR $INIT_DIR
#install -m755 linux-cifs_depmod.sh $INSTALL_MOD_PATH/$PACKNAME/
install -m755 -D $PACKNAME.init $INIT_DIR/$PACKNAME
sed -e "s|@SRC_DIR@|$SRC_DIR|g" < $PACKNAME.init > $PACKNAME.init.repl
install -m755 -D $PACKNAME.init.repl $INIT_DIR/$PACKNAME
install -m755 $PACKNAME.outformat $INIT_DIR/
......
......@@ -5,8 +5,8 @@
# Build kernel module in installed system
MODULENAME=cifs.ko
BUILDDIR=/usr/src/linux-cifs
MODULEFILENAME=etercifs.ko
BUILDDIR=$(pwd)
KERNELVERSION=$(uname -r)
# SMP build
......@@ -19,8 +19,8 @@ if [ -z "$KERNSRC" ]; then
KERNSRC=/lib/modules/$KERNELVERSION/build
fi
if [ -z "$INSTALL_MOD_PATH" ]; then
#INSTALL_MOD_PATH=/lib/modules/$KERNELVERSION/kernel/extra
INSTALL_MOD_PATH=/lib/modules/linux-cifs
INSTALL_MOD_PATH=/lib/modules/$KERNELVERSION/kernel/fs/cifs
#INSTALL_MOD_PATH=/lib/modules/linux-cifs
fi
echo
......@@ -32,7 +32,7 @@ Error: no kernel headers found at $KERNSRC
Please install package
kernel-headers-modules-XXXX for ALT Linux
kernel-XXXX-devel for FCx / ASP Linux
kernel-source-stripped-XXXX for Mandriva 2007
dkms-linux-cifs for Mandriva 2008
linux-headers-XXXX for Debian / Ubuntu
kernel-source-XXXX for SuSe
kernel-source-XXXX for Slackware / MOPSLinux
......@@ -58,17 +58,17 @@ if ! which $GCCNAME ; then
fi
# Clean, build and check
rm -f $BUILDDIR/$MODULENAME
rm -f $BUILDDIR/$MODULEFILENAME
make $USEGCC -C $KERNSRC here=$BUILDDIR SUBDIRS=$BUILDDIR clean
make $USEGCC -C $KERNSRC here=$BUILDDIR SUBDIRS=$BUILDDIR modules $MAKESMP
#[ "$KERVER" = "2.4" ] && MODULENAME=$MODULENAME.o || MODULENAME=$MODULENAME.ko
test -r "$BUILDDIR/$MODULENAME" || { echo "can't locate built module $MODULENAME, continue" ; exit 1 ; }
strip --strip-debug --discard-all $BUILDDIR/$MODULENAME
test -r "$BUILDDIR/$MODULEFILENAME" || { echo "can't locate built module $MODULEFILENAME, continue" ; exit 1 ; }
strip --strip-debug --discard-all $BUILDDIR/$MODULEFILENAME
echo "Copying built module to $INSTALL_MOD_PATH"
mkdir -p $INSTALL_MOD_PATH
install -m 644 -o root -g root $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/ || exit 1
#depmod -ae || exit 1
install -m 644 -o root -g root $BUILDDIR/$MODULEFILENAME $INSTALL_MOD_PATH/ || exit 1
depmod -ae || exit 1
#echo "$MODULENAME build correctly"
exit 0
%define modname linux-cifs
Name: dkms-linux-cifs
Version: 1.50c
Release: alt1
Summary: DKMS-ready CIFS Linux kernel module with Etersoft extensions
License: GPL
Packager: Vitaly Lipatov <lav@altlinux.ru>
#Source: ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft/sources/tarball/%name-%version.tar.bz2
Group: Development/Kernel
Requires(preun): dkms
Requires(post): dkms
Requires: linux-cifs
Buildarch: noarch
%description
The CIFS VFS is a virtual file system for Linux to allow access to
servers and storage appliances compliant with the SNIA CIFS Specification
version 1.0 or later.
This package contains DKMS-ready CIFS Linux kernel module with Etersoft extensions.
%prep
%setup -c -T -n %name-%version
%install
mkdir -p %buildroot%_usrsrc/%modname-%version/
cat > %buildroot%_usrsrc/%modname-%version/dkms.conf <<EOF
# DKMS file for Linux CIFS with Etersoft's extensions
PACKAGE_NAME="%modname"
PACKAGE_VERSION="%version"
BUILT_MODULE_NAME[0]="etercifs"
DEST_MODULE_LOCATION[0]="/kernel/fs/cifs/"
REMAKE_INITRD="no"
AUTOINSTALL="YES"
EOF
%post
if [ "$1" == 1 ]
then
dkms add -m %modname -v %version --rpm_safe_upgrade
fi
dkms build -m %modname -v %version --rpm_safe_upgrade
dkms install -m %modname -v %version --rpm_safe_upgrade
%preun
if [ "$1" == 0 ]
then
dkms remove -m %modname -v %version --rpm_safe_upgrade --all
fi
%files
%_usrsrc/%modname-%version/dkms.conf
%changelog
* Sat Jan 26 2008 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt1
- initial build for Korinf project
/var/local/cvsroot
:ext:cvs.etersoft/var/local/cvsroot
/linux-cifs-1.48a.ebuild/1.5/Wed Jun 27 18:06:00 2007//
/linux-cifs-1.50c.ebuild/1.3/Sun Jan 27 16:02:09 2008//
D
/var/local/cvsroot
:ext:cvs.etersoft/var/local/cvsroot
......@@ -5,13 +5,13 @@ inherit eutils flag-o-matic multilib
DESCRIPTION="Advanced Common Internet File System for Linux with Etersoft extension"
HOMEPAGE="http://etersoft.ru/wine"
CIFSVER=1.48a
WINENUMVERSION=current
CIFSVER=1.50c
WINENUMVERSION=1.0.8
SRC_URI="ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft-$WINENUMVERSION/sources/tarball/${P}.tar.bz2
ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft-$WINENUMVERSION/sources/tarball/cifs-$CIFSVER.tar.bz2"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
KEYWORDS="-* amd64 x86"
IUSE=""
RESTRICT="test" #72375
......@@ -23,8 +23,8 @@ RDEPEND=">=sys-kernel/linux-headers-2.6"
src_unpack() {
unpack ${A}
cd "${WORKDIR}/${P}" || die
mv ../cifs-bld-tmp ./ || die
patch -s -p1 -d cifs-bld-tmp/fs/cifs <linux-cifs-shared.patch || die
mv ../new-cifs-backport ./ || die
patch -p1 -d new-cifs-backport/ <linux-cifs-shared-1.50c.patch || die
}
config_cache() {
......@@ -46,7 +46,7 @@ src_compile() {
}
src_install() {
MAN_DIR=${D}/usr/man/ INIT_DIR=${D}/etc/init.d/ SBIN_DIR=${D}/usr/sbin/ INSTALL_MOD_PATH=${D}/lib/modules/ ./build.sh || die
MAN_DIR=${D}/usr/man/ INIT_DIR=${D}/etc/init.d/ SBIN_DIR=${D}/usr/sbin/ INSTALL_MOD_PATH=${D}/lib/modules/ DESTDIR=${D} SRC_DIR=/usr/src/${P} ./build.sh || die
true
}
......
......@@ -4,6 +4,7 @@ ASPLinux /usr/src/kernels/*
ASPLinux/10 /lib/modules/*/build
RedHat /usr/src/kernels/*
RHEL /usr/src/kernels/*
CentOS /usr/src/kernels/*
LinuxXP /usr/src/kernels/*
Scientific /usr/src/kernels/*
FedoraCore /usr/src/kernels/*
......
#!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2006, 2007 Public domain
# 2006, 2007, 2008 Public domain
# Multiplatform init script
# linux-cifs - CIFS support for Linux kernel
#
......@@ -9,14 +9,15 @@
#
# modulename: cifs
#
RMMOD=/sbin/rmmod
MODPROBE=/sbin/modprobe
INSMOD=/sbin/insmod
MODULENAME=cifs
ORIGMODULENAME=cifs
MODULENAME=etercifs
# current module or manually built
DEFMODULEPATH=/lib/modules/linux-cifs/$(uname -r)/$MODULENAME.ko
MANMODULEPATH=/lib/modules/linux-cifs/$MODULENAME.ko
# use manually build if exists
[ -r "$MANMODULEPATH" ] && DEFMODULEPATH=$MANMODULEPATH
#MODULEPATH=`echo /lib/modules/$(uname -r)/kernel/fs/cifs/$MODULENAME.*`
OUTFORMAT=/etc/init.d/outformat
[ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/linux-cifs.outformat
......@@ -71,17 +72,23 @@ get_pid()
else
dpid="$(ps axh | grep $1 | grep -v grep | sed -e 's/ *\(.*\)/\1/' -e 's/ \+/ /g' | grep -v " /bin/sh " | grep -v "^$$ " | cut -f1 -d\ | head -1)"
fi
return $dpid
}
is_loaded()
{
get_pid $1
test -n "$dpid"
get_pid $1
test -n "$dpid"
}
is_moduled()
{
lsmod | grep $MODULENAME > /dev/null
lsmod | grep "^$MODULENAME" > /dev/null
}
is_origmoduled()
{
lsmod | grep "^$ORIGMODULENAME" > /dev/null
}
umount_cifs()
......@@ -91,34 +98,37 @@ umount_cifs()
WASCIFS=1
fi
echo -n "Unmounting CIFS resources... "
umount -t cifs -a || { failure ; return ; }
umount -t cifs -a || { failure ; return 1; }
success
}
mount_cifs()
{
echo -n "Mounting CIFS resources... "
mount -t cifs -a || { failure ; return ; }
mount -t cifs -a || { failure ; return 1; }
success
}
load_module()
{
local i
if is_moduled ; then
if is_origmoduled ; then
#test -r /proc/fs/cifs/Etersoft && { passed ; return ; }
umount_cifs
echo -n "Removing CIFS kernel module... "
rmmod $MODULENAME || { failure ; return ; }
$RMMOD $ORIGMODULENAME || { failure ; return ; }
fi
# Preload module dependencies
modprobe nls_base 2>/dev/null
#$MODPROBE nls_base 2>/dev/null
# kernel depends
# || { echo -n "nls_base is not loaded" ; failure ; }
echo -n "Loading CIFS kernel module... "
if [ -r "$DEFMODULEPATH" ] ; then
insmod $DEFMODULEPATH && { echo ; echo -n " insmod $DEFMODULEPATH" ; success ; return ; }
echo -n "Incorrect module. Your system: " ; uname -a ; dmesg | tail -n2
fi
$MODPROBE $MODULENAME && { success ; return ; }
#if [ -r "$MODULEPATH" ] ; then
# $INSMOD $MODULEPATH && { echo ; echo -n " insmod $MODULEPATH" ; success ; return ; }
# echo -n "Incorrect module. Your system: " ; uname -a ; dmesg | tail -n2
#fi
echo -n "$MODULENAME from Etersoft is not found,"
echo -n "you can try compile it with 'service linux-cifs build' command."
failure
......@@ -133,7 +143,7 @@ start()
echo 1 > /proc/fs/cifs/Etersoft && success || failure
echo -n "Disable Linux extensions for CIFS..."
echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled && success || failure
test -n "$WASCIFS" && mount_cifs
test -n "$WASCIFS" && mount_cifs || :
else
failure
fi
......@@ -141,10 +151,10 @@ start()
stop()
{
echo -n "Unloading CIFS kernel module... "
umount_cifs
echo -n "Unloading CIFS kernel module... "
is_moduled || { passed ; return ; }
rmmod $MODULENAME || { failure ; echo "You have to umount all CIFS resources."; return ; }
$RMMOD $MODULENAME || { failure ; echo "You have to umount all CIFS resources."; return ; }
success
}
......@@ -159,6 +169,9 @@ status()
#else
# PRECOMP="precompiled"
#fi
if is_origmoduled ; then
echo " origin kernel module $ORIGMODULENAME loaded, Etersoft extensions missed"
fi
if is_moduled ; then
#echo " kernel module $MODULENAME is loaded ($PRECOMP)"
test -d /proc/fs/cifs/ 2>/dev/null || { echo -n "Can't locale /proc/fs/cifs... " ; failure ; }
......@@ -168,10 +181,23 @@ status()
echo -n "Unix extensions for CIFS disabled..."
test "`cat /proc/fs/cifs/LinuxExtensionsEnabled 2>/dev/null`" = "1" && failure || success
else
echo " kernel module $MODULENAME is not loaded ($PRECOMP)"
echo " kernel module $MODULENAME is not loaded"
fi
}
build_module()
{
#DKMS=/sbin/dkms
# && [ -x $DKMS ]
# Need name-version for it
if [ -r @SRC_DIR/dkms.conf ] ; then
echo "TODO: use dkms build/install for build"
else
cd @SRC_DIR@
sh buildmodule.sh
fi
}
case "$1" in
start)
start
......@@ -184,15 +210,14 @@ case "$1" in
start
;;
build)
cd /usr/src/linux-cifs
sh buildmodule.sh
build_module
;;
status)
status
;;
condrestart)
# remove manual built module
rm -f $MANMODULEPATH
# rm -f $MANMODULEPATH
if [ "`cat /proc/fs/cifs/Etersoft 2>/dev/null`" = "1" ] ; then
stop
start
......@@ -201,6 +226,6 @@ case "$1" in
fi
;;
*)
echo "Usage: linux-cifs {start|stop|restart|condrestart|condstop|status}"
echo "Usage: linux-cifs {start|stop|restart|build|condrestart|condstop|status}"
esac
......@@ -18,17 +18,19 @@ update_from_cvs
SPECNAME=linux-cifs.spec
prepare_tarball
echo "build_srpm"
build_rpms_name $SPECNAME
test -z "$BASENAME" && fatal "BASENAME is empty"
#NAMEVER=$BASENAME-$VERSION
#rpmbb $SPECNAME || fatal "Can't build"
if [ -n "$WINEPUB_PATH" -a $USER = "lav" ] ; then
if [ -n "$WINEPUB_PATH" ] ; then
#-a $USER = "lav" ] ; then
# Path to local publishing
ETERDESTSRPM=$WINEPUB_PATH/sources
cp -f $RPMSOURCEDIR/$TARNAME $ETERDESTSRPM/tarball/
echo "publish_srpm"
publish_srpm
fi
......@@ -43,3 +45,20 @@ fi
#cd gentoo
#./release_port.sh
#cd -
SPECNAME=dkms-linux-cifs.spec
prepare_tarball
echo "build_srpm"
build_rpms_name $SPECNAME
test -z "$BASENAME" && fatal "BASENAME is empty"
if [ -n "$WINEPUB_PATH" ] ; then
# Path to local publishing
ETERDESTSRPM=$WINEPUB_PATH/sources
cp -f $RPMSOURCEDIR/$TARNAME $ETERDESTSRPM/tarball/
echo "publish_srpm"
publish_srpm
fi
# Etersoft (c) 2007
# Etersoft (c) 2007, 2008
# Multiplatform spec for autobuild system
# in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx
......@@ -12,8 +12,8 @@
# kernel-source-XXXX for Slackware / MOPSLinux
Name: linux-cifs
Version: 1.48a
%define relnum 7
Version: 1.50c
Release: alt4
Summary: Advanced Common Internet File System for Linux with Etersoft extension
......@@ -26,27 +26,19 @@ Url: http://linux-cifs.samba.org/
Source: ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft/sources/tarball/%name-%version.tar.bz2
Source1: http://pserver.samba.org/samba/ftp/cifs-cvs/cifs-%version.tar.bz2
BuildRequires: rpm-build-compat >= 0.97
# Spec part for ALT Linux
%if %_vendor == "alt"
Release: alt%relnum
BuildRequires: rpm-build-compat >= 0.7
BuildRequires: kernel-build-tools
BuildRequires: kernel-headers-modules-std-smp kernel-headers-modules-wks-smp kernel-headers-modules-ovz-smp
# do not work?
%ifarch x86_64
# Don't know if ifnarch exist
BuildRequires: kernel-headers-modules-std-smp
%else
BuildRequires: kernel-headers-modules-std-pae
%endif
%else
Release: eter%relnum%_vendor
BuildRequires: rpm-build-altlinux-compat >= 0.7
%endif
# FIXME: ifndef broken in Ubuntu
#ifndef buildroot
%if %{undefined buildroot}
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%endif
%if %_vendor == "suse"
......@@ -82,32 +74,56 @@ though.
This package has Etersoft's patches for WINE@Etersoft sharing access support.
#cifs-bld-tmp/fs/cifs
%define intdir new-cifs-backport
%prep
%setup -q
tar xfj %SOURCE1
patch -s -p1 -d cifs-bld-tmp/fs/cifs <%name-shared.patch
patch -s -p1 -d %intdir <%name-shared-%version.patch
%install
#export KBUILD_VERBOSE=1
MAN_DIR=%buildroot%_mandir/ INIT_DIR=%buildroot%_initdir/ SBIN_DIR=%buildroot%_sbindir/ INSTALL_MOD_PATH=%buildroot%module_dir ./build.sh
MAN_DIR=%buildroot%_mandir/ INIT_DIR=%buildroot%_initdir/ SBIN_DIR=%buildroot%_sbindir/ \
INSTALL_MOD_PATH=%buildroot/lib/modules BUILDDIR=`pwd`/%intdir \
DESTDIR=%buildroot SRC_DIR=%_usrsrc/%name-%version ./build.sh
# Debian, Suse, Slackware do not have command service
# start service if first time install
%post
%post_service %name
[ "$1" = "1" ] && %_initdir/%name start || :
%start_service %name
%preun
%preun_service %name
%files
%defattr(-,root,root)
%_initdir/%name
%_initdir/%name.outformat
%module_dir/
/usr/src/%name/
/lib/modules/*
%_usrsrc/%name-%version/
%changelog
* Thu Jan 31 2008 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt4
- fix build on Fedora 8 (2.6.18-53)
* Sun Jan 27 2008 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt3
- move modules placement
- move src files to name-version for dkms compatibility
- change module name to etercifs.ko
* Fri Dec 28 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt2
- add fix for SLED10 kernel 2.6.16.46
- fix warnings, add missed access setting in reopen file func
* Tue Nov 06 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50c-alt1
- update version
- fix spec according to Korinf build system
* Fri Oct 12 2007 Vitaly Lipatov <lav@altlinux.ru> 1.50-alt1
- update version
* Fri Sep 14 2007 Sergey Lebedev <barabashka@altlinux.ru> 1.50-alt0
- new version cifs 1.50
* Fri Jul 27 2007 Vitaly Lipatov <lav@altlinux.ru> 1.48a-alt7
- fix build on 2.6.22 kernels
- fix scripts for Debian/Ubuntu
......
Verison 1.48
Version 1.50
------------
Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
done with "serverino" mount option). Add support for POSIX Unlink
(helps with certain sharing violation cases when server such as
Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix"
mount option to allow disabling the CIFS Unix Extensions for just
that mount. Fix hang on spinlock in find_writable_file (race when
reopening file after session crash). Byte range unlock request to
windows server could unlock more bytes (on server copy of file)
than intended if start of unlock request is well before start of
a previous byte range lock that we issued.
Version 1.49
------------
IPv6 support. Enable ipv6 addresses to be passed on mount (put the ipv6
address after the "ip=" mount option, at least until mount.cifs is fixed to
handle DNS host to ipv6 name translation). Accept override of uid or gid
on mount even when Unix Extensions are negotiated (it used to be ignored
when Unix Extensions were ignored). This allows users to override the
default uid and gid for files when they are certain that the uids or
gids on the server do not match those of the client. Make "sec=none"
mount override username (so that null user connection is attempted)
to match what documentation said. Support for very large reads, over 127K,
available to some newer servers (such as Samba 3.0.26 and later but
note that it also requires setting CIFSMaxBufSize at module install
time to a larger value which may hurt performance in some cases).
Make sign option force signing (or fail if server does not support it).
Version 1.48
------------
Fix mtime bouncing around from local idea of last write times to remote time.
Fix hang (in i_size_read) when simultaneous size update of same remote file
......@@ -9,7 +38,13 @@ from read-only back to read-write, reflect this change in default file mode
(we had been leaving a file's mode read-only until the inode were reloaded).
Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
when archive dos attribute not set and we are changing mode back to writeable
on server which does not support the Unix Extensions).
on server which does not support the Unix Extensions). Remove read only dos
attribute on chmod when adding any write permission (ie on any of
user/group/other (not all of user/group/other ie 0222) when
mounted to windows. Add support for POSIX MkDir (slight performance
enhancement and eliminates the network race between the mkdir and set
path info of the mode).
Version 1.47
------------
......@@ -17,7 +52,12 @@ Fix oops in list_del during mount caused by unaligned string.
Fix file corruption which could occur on some large file
copies caused by writepages page i/o completion bug.
Seek to SEEK_END forces check for update of file size for non-cached
files.
files. Allow file size to be updated on remote extend of locally open,
non-cached file. Fix reconnect to newer Samba servers (or other servers
which support the CIFS Unix/POSIX extensions) so that we again tell the
server the Unix/POSIX cifs capabilities which we support (SetFSInfo).
Add experimental support for new POSIX Open/Mkdir (which returns
stat information on the open, and allows setting the mode).
Version 1.46
------------
......@@ -246,7 +286,7 @@ improperly zeroed buffer in CIFS Unix extensions set times call.
Version 1.25
------------
Fix internationalization problem in cifs readdir with filenames that map to
longer UTF8 strings than the string on the wire was in Unicode. Add workaround
longer UTF-8 strings than the string on the wire was in Unicode. Add workaround
for readdir to netapp servers. Fix search rewind (seek into readdir to return
non-consecutive entries). Do not do readdir when server negotiates
buffer size to small to fit filename. Add support for reading POSIX ACLs from
......
......@@ -257,19 +257,25 @@ A partial list of the supported mount options follows:
mount.
domain Set the SMB/CIFS workgroup name prepended to the
username during CIFS session establishment
uid If CIFS Unix extensions are not supported by the server
this overrides the default uid for inodes. For mounts to
servers which do support the CIFS Unix extensions, such
as a properly configured Samba server, the server provides
the uid, gid and mode. For servers which do not support
the Unix extensions, the default uid (and gid) returned on
lookup of existing files is the uid (gid) of the person
uid Set the default uid for inodes. For mounts to servers
which do support the CIFS Unix extensions, such as a
properly configured Samba server, the server provides
the uid, gid and mode so this parameter should not be
specified unless the server and clients uid and gid
numbering differ. If the server and client are in the
same domain (e.g. running winbind or nss_ldap) and
the server supports the Unix Extensions then the uid
and gid can be retrieved from the server (and uid
and gid would not have to be specifed on the mount.
For servers which do not support the CIFS Unix
extensions, the default uid (and gid) returned on lookup
of existing files will be the uid (gid) of the person
who executed the mount (root, except when mount.cifs
is configured setuid for user mounts) unless the "uid="
(gid) mount option is specified. For the uid (gid) of newly
created files and directories, ie files created since
the last mount of the server share, the expected uid
(gid) is cached as as long as the inode remains in
(gid) is cached as long as the inode remains in
memory on the client. Also note that permission
checks (authorization checks) on accesses to a file occur
at the server, but there are cases in which an administrator
......@@ -281,8 +287,7 @@ A partial list of the supported mount options follows:
the client. Note that the mount.cifs helper must be
at version 1.10 or higher to support specifying the uid
(or gid) in non-numberic form.
gid If CIFS Unix extensions are not supported by the server
this overrides the default gid for inodes.
gid Set the default gid for inodes (similar to above).
file_mode If CIFS Unix extensions are not supported by the server
this overrides the default mode for file inodes.
dir_mode If CIFS Unix extensions are not supported by the server
......@@ -296,10 +301,21 @@ A partial list of the supported mount options follows:
during the local client kernel build will be used.
If server does not support Unicode, this parameter is
unused.
rsize default read size (usually 16K)
wsize default write size (usually 16K, 32K is often better over GigE)
maximum wsize currently allowed by CIFS is 57344 (14 4096 byte
pages)
rsize default read size (usually 16K). The client currently
can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
defaults to 16K and may be changed (from 8K to the maximum
kmalloc size allowed by your kernel) at module install time
for cifs.ko. Setting CIFSMaxBufSize to a very large value
will cause cifs to use more memory and may reduce performance
in some cases. To use rsize greater than 127K (the original
cifs protocol maximum) also requires that the server support
a new Unix Capability flag (for very large read) which some
newer servers (e.g. Samba 3.0.26 or later) do. rsize can be
set from a minimum of 2048 to a maximum of 130048 (127K or
CIFSMaxBufSize, whichever is smaller)
wsize default write size (default 57344)
maximum wsize currently allowed by CIFS is 57344 (fourteen
4096 byte pages)
rw mount the network share read-write (note that the
server may still consider the share read-only)
ro mount network share read-only
......@@ -354,7 +370,7 @@ A partial list of the supported mount options follows:
Note that this does not affect the normal ACL check on the
target machine done by the server software (of the server
ACL against the user name provided at mount time).
serverino Use servers inode numbers instead of generating automatically
serverino Use server's inode numbers instead of generating automatically
incrementing inode numbers on the client. Although this will
make it easier to spot hardlinked files (as they will have
the same inode numbers) and inode numbers may be persistent,
......@@ -362,12 +378,11 @@ A partial list of the supported mount options follows:
are unique if multiple server side mounts are exported under a
single share (since inode numbers on the servers might not
be unique if multiple filesystems are mounted under the same
shared higher level directory). Note that this requires that
the server support the CIFS Unix Extensions as other servers
do not return a unique IndexNumber on SMB FindFirst (most
servers return zero as the IndexNumber). Parameter has no
effect to Windows servers and others which do not support the
CIFS Unix Extensions.
shared higher level directory). Note that some older
(e.g. pre-Windows 2000) do not support returning UniqueIDs
or the CIFS Unix Extensions equivalent and for those
this mount option will have no effect. Exporting cifs mounts
under nfsd requires this mount option on the cifs mount.
noserverino Client generates inode numbers (rather than using the actual one
from the server) by default.
setuids If the CIFS Unix extensions are negotiated with the server
......@@ -375,7 +390,7 @@ A partial list of the supported mount options follows:
the local process on newly created files, directories, and
devices (create, mkdir, mknod). If the CIFS Unix Extensions
are not negotiated, for newly created files and directories
instead of using the default uid and gid specified on the
instead of using the default uid and gid specified on
the mount, cache the new file's uid and gid locally which means
that the uid for the file can change when the inode is
reloaded (or the user remounts the share).
......@@ -429,6 +444,13 @@ A partial list of the supported mount options follows:
noposixpaths If CIFS Unix extensions are supported, do not request
posix path name support (this may cause servers to
reject creatingfile with certain reserved characters).
nounix Disable the CIFS Unix Extensions for this mount (tree
connection). This is rarely needed, but it may be useful
in order to turn off multiple settings all at once (ie
posix acls, posix locks, posix paths, symlink support
and retrieving uids/gids/mode from the server) or to
work around a bug in server which implement the Unix
Extensions.
nobrl Do not send byte range lock requests to the server.
This is necessary for certain applications that break
with cifs style mandatory byte range locks (and most
......@@ -436,11 +458,17 @@ A partial list of the supported mount options follows:
byte range locks).
remount remount the share (often used to change from ro to rw mounts
or vice versa)
servern Specify the server 's netbios name (RFC1001 name) to use
when attempting to setup a session to the server. This is
This is needed for mounting to some older servers (such
as OS/2 or Windows 98 and Windows ME) since they do not
support a default server name. A server name can be up
to 15 characters long and is usually uppercased.
sfu When the CIFS Unix Extensions are not negotiated, attempt to
create device files and fifos in a format compatible with
Services for Unix (SFU). In addition retrieve bits 10-12
of the mode via the SETFILEBITS extended attribute (as
SFU does). In the future the bottom 9 bits of the mode
SFU does). In the future the bottom 9 bits of the
mode also will be emulated using queries of the security
descriptor (ACL).
sign Must use packet signing (helps avoid unwanted data modification
......@@ -467,7 +495,7 @@ including:
-V print mount.cifs version
-? display simple usage information
With recent 2.6 kernel versions of modutils, the version of the cifs kernel
With most 2.6 kernel versions of modutils, the version of the cifs kernel
module can be displayed via modinfo.
Misc /proc/fs/cifs Flags and Debug Info
......@@ -516,8 +544,22 @@ SecurityFlags Flags which control security negotiation and
must use plaintext passwords 0x20020
(reserved for future packet encryption) 0x00040
cifsFYI If set to one, additional debug information is
logged to the system error log. (default 0)
cifsFYI If set to non-zero value, additional debug information
will be logged to the system error log. This field
contains three flags controlling different classes of
debugging entries. The maximum value it can be set
to is 7 which enables all debugging points (default 0).
Some debugging statements are not compiled into the
cifs kernel unless CONFIG_CIFS_DEBUG2 is enabled in the
kernel configuration. cifsFYI may be set to one or
nore of the following flags (7 sets them all):
log cifs informational messages 0x01
log return codes from cifs entry points 0x02
log slow responses (ie which take longer than 1 second)
CONFIG_CIFS_STATS2 must be enabled in .config 0x04
traceSMB If set to one, debug information is logged to the
system error log with the start of smb requests
and responses (default 0)
......@@ -563,10 +605,10 @@ the start of smb requests and responses can be enabled via:
echo 1 > /proc/fs/cifs/traceSMB
Two other experimental features are under development and to test
require enabling CONFIG_CIFS_EXPERIMENTAL
Two other experimental features are under development. To test these
requires enabling CONFIG_CIFS_EXPERIMENTAL
More efficient write operations
ipv6 enablement
DNOTIFY fcntl: needed for support of directory change
notification and perhaps later for file leases)
......
Version 1.39 November 30, 2005
Version 1.49 April 26, 2007
A Partial List of Missing Features
==================================
......@@ -18,64 +18,53 @@ better)
d) Kerberos/SPNEGO session setup support - (started)
e) NTLMv2 authentication (mostly implemented - double check
that NTLMv2 signing works, also need to cleanup now unneeded SessSetup code in
fs/cifs/connect.c)
e) Cleanup now unneeded SessSetup code in
fs/cifs/connect.c and add back in NTLMSSP code if any servers
need it
f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup
used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
and raw NTLMSSP already. This is important when enabling
extended security and mounting to Windows 2003 Servers
f) Directory entry caching relies on a 1 second timer, rather than
g) Directory entry caching relies on a 1 second timer, rather than
using FindNotify or equivalent. - (started)
g) A few byte range testcases fail due to POSIX vs. Windows/CIFS
style byte range lock differences. Save byte range locks so
reconnect can replay them.
h) Support unlock all (unlock 0,MAX_OFFSET)
by unlocking all known byte range locks that we locked on the file.
i) quota support (needs minor kernel change since quota calls
h) quota support (needs minor kernel change since quota calls
to make it to network filesystems or deviceless filesystems)
j) investigate sync behavior (including syncpage) and check
i) investigate sync behavior (including syncpage) and check
for proper behavior of intr/nointr
k) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
j) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
extra copy in/out of the socket buffers in some cases.
l) finish support for IPv6. This is mostly complete but
needs a simple conversion of ipv6 to sin6_addr from the
address in string representation.
m) Better optimize open (and pathbased setfilesize) to reduce the
k) Better optimize open (and pathbased setfilesize) to reduce the
oplock breaks coming from windows srv. Piggyback identical file
opens on top of each other by incrementing reference count rather
than resending (helps reduce server resource utilization and avoid
spurious oplock breaks).
o) Improve performance of readpages by sending more than one read
l) Improve performance of readpages by sending more than one read
at a time when 8 pages or more are requested. In conjuntion
add support for async_cifs_readpages.
p) Add support for storing symlink info to Windows servers
m) Add support for storing symlink info to Windows servers
in the Extended Attribute format their SFU clients would recognize.
q) Finish fcntl D_NOTIFY support so kde and gnome file list windows
n) Finish fcntl D_NOTIFY support so kde and gnome file list windows
will autorefresh (partially complete by Asser). Needs minor kernel
vfs change to support removing D_NOTIFY on a file.
r) Add GUI tool to configure /proc/fs/cifs settings and for display of
o) Add GUI tool to configure /proc/fs/cifs settings and for display of
the CIFS statistics (started)
s) implement support for security and trusted categories of xattrs
p) implement support for security and trusted categories of xattrs
(requires minor protocol extension) to enable better support for SELINUX
t) Implement O_DIRECT flag on open (already supported on mount)
q) Implement O_DIRECT flag on open (already supported on mount)
u) Create UID mapping facility so server UIDs can be mapped on a per
r) Create UID mapping facility so server UIDs can be mapped on a per
mount or a per server basis to client UIDs or nobody if no mapping
exists. This is helpful when Unix extensions are negotiated to
allow better permission checking when UIDs differ on the server
......@@ -83,19 +72,25 @@ and client. Add new protocol request to the CIFS protocol
standard for asking the server for the corresponding name of a
particular uid.
v) Add support for CIFS Unix and also the newer POSIX extensions to the
s) Add support for CIFS Unix and also the newer POSIX extensions to the
server side for Samba 4.
w) Finish up the dos time conversion routines needed to return old server
time to the client (default time, of now or time 0 is used now for these
very old servers)
x) In support for OS/2 (LANMAN 1.2 and LANMAN2.1 based SMB servers)
t) In support for OS/2 (LANMAN 1.2 and LANMAN2.1 based SMB servers)
need to add ability to set time to server (utimes command)
y) Finish testing of Windows 9x/Windows ME server support (started).
u) DOS attrs - returned as pseudo-xattr in Samba format (check VFAT and NTFS for this too)
v) mount check for unmatched uids
KNOWN BUGS (updated February 26, 2007)
w) Add support for new vfs entry points for setlease and fallocate
x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of
processes can proceed better in parallel (on the server)
y) Fix Samba 3 to handle reads/writes over 127K (and remove the cifs mount
restriction of wsize max being 127K)
KNOWN BUGS (updated April 24, 2007)
====================================
See http://bugzilla.samba.org - search on product "CifsVFS" for
current bug list.
......@@ -110,6 +105,12 @@ but recognizes them
succeed but still return access denied (appears to be Windows
server not cifs client problem) and has not been reproduced recently.
NTFS partitions do not have this problem.
4) Unix/POSIX capabilities are reset after reconnection, and affect
a few fields in the tree connection but we do do not know which
superblocks to apply these changes to. We should probably walk
the list of superblocks to set these. Also need to check the
flags on the second mount to the same share, and see if we
can do the same trick that NFS does to remount duplicate shares.
Misc testing to do
==================
......@@ -126,3 +127,4 @@ negotiated size) and send larger write sizes to modern servers.
4) More exhaustively test against less common servers. More testing
against Windows 9x, Windows ME servers.
/*
/*
* The ASB.1/BER parsing code is derived from ip_nat_snmp_basic.c which was in
* turn derived from the gxsnmp package by Gregory McLean & Jochen Friedrich
*
*
* Copyright (c) 2000 RP Internet (www.rpi.net.au).
*
* This program is free software; you can redistribute it and/or modify
......@@ -83,7 +83,7 @@
static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 };
static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 };
/*
/*
* ASN.1 context.
*/
struct asn1_ctx {
......@@ -193,7 +193,7 @@ asn1_header_decode(struct asn1_ctx *ctx,
unsigned char **eoc,
unsigned int *cls, unsigned int *con, unsigned int *tag)
{
unsigned int def = 0;
unsigned int def = 0;
unsigned int len = 0;
if (!asn1_id_decode(ctx, cls, con, tag))
......@@ -334,7 +334,7 @@ static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx,
*integer |= ch;
}
return 1;
}
}
static unsigned char
asn1_octets_decode(struct asn1_ctx *ctx,
......@@ -379,7 +379,7 @@ asn1_subid_decode(struct asn1_ctx *ctx, unsigned long *subid)
return 1;
}
static int
static int
asn1_oid_decode(struct asn1_ctx *ctx,
unsigned char *eoc, unsigned long **oid, unsigned int *len)
{
......@@ -388,10 +388,9 @@ asn1_oid_decode(struct asn1_ctx *ctx,
unsigned long *optr;
size = eoc - ctx->pointer + 1;
*oid = kmalloc(size * sizeof (unsigned long), GFP_ATOMIC);
if (*oid == NULL) {
*oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
if (*oid == NULL)
return 0;
}
optr = *oid;
......@@ -462,7 +461,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
unsigned int cls, con, tag, oidlen, rc;
int use_ntlmssp = FALSE;
*secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default */
*secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/
/* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
......@@ -501,7 +500,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) {
cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0",
cFYI(1,
("cls = %d con = %d tag = %d end = %p (%d) exit 0",
cls, con, tag, end, *end));
return 0;
}
......@@ -511,7 +511,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) {
cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1",
cFYI(1,
("cls = %d con = %d tag = %d end = %p (%d) exit 1",
cls, con, tag, end, *end));
return 0;
}
......@@ -543,32 +544,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
if (!rc) {
cFYI(1,
("Error 1 decoding negTokenInit header exit 2"));
("Error decoding negTokenInit hdr exit2"));
return 0;
}
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
if(rc) {
if (rc) {
cFYI(1,
("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx",
oidlen, *oid, *(oid + 1), *(oid + 2),
*(oid + 3)));
rc = compare_oid(oid, oidlen, NTLMSSP_OID,
NTLMSSP_OID_LEN);
("OID len = %d oid = 0x%lx 0x%lx "
"0x%lx 0x%lx",
oidlen, *oid, *(oid + 1),
*(oid + 2), *(oid + 3)));
rc = compare_oid(oid, oidlen,
NTLMSSP_OID, NTLMSSP_OID_LEN);
kfree(oid);
if (rc)
use_ntlmssp = TRUE;
}
} else {
cFYI(1,("This should be an oid what is going on? "));
cFYI(1, ("Should be an oid what is going on?"));
}
}
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1,
("Error decoding last part of negTokenInit exit 3"));
("Error decoding last part negTokenInit exit3"));
return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { /* tag = 3 indicating mechListMIC */
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
/* tag = 3 indicating mechListMIC */
cFYI(1,
("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end));
......@@ -576,18 +579,17 @@ decode_negTokenInit(unsigned char *security_blob, int length,
}
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1,
("Error decoding last part of negTokenInit exit 5"));
("Error decoding last part negTokenInit exit5"));
return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) {
cFYI(1,
("Exit 6 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end));
cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end));
}
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1,
("Error decoding last part of negTokenInit exit 7"));
("Error decoding last part negTokenInit exit 7"));
return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
cFYI(1,
......@@ -597,20 +599,21 @@ decode_negTokenInit(unsigned char *security_blob, int length,
}
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1,
("Error decoding last part of negTokenInit exit 9"));
("Error decoding last part negTokenInit exit9"));
return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|| (tag != ASN1_GENSTR)) {
cFYI(1,
("Exit 10 cls = %d con = %d tag = %d end = %p (%d)",
("Exit10 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end));
return 0;
}
cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer)); /* is this UTF-8 or ASCII? */
cFYI(1, ("Need to call asn1_octets_decode() function for %s",
ctx.pointer)); /* is this UTF-8 or ASCII? */
}
/* if (use_kerberos)
*secType = Kerberos
/* if (use_kerberos)
*secType = Kerberos
else */
if (use_ntlmssp) {
*secType = NTLMSSP;
......
......@@ -22,12 +22,14 @@
#define CIFS_MOUNT_SET_UID 2 /* set current->euid in create etc. */
#define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */
#define CIFS_MOUNT_DIRECT_IO 8 /* do not write nor read through page cache */
#define CIFS_MOUNT_NO_XATTR 0x10 /* if set - disable xattr support */
#define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */
#define CIFS_MOUNT_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible. */
#define CIFS_MOUNT_UNX_EMUL 0x80 /* Network compat with SFUnix emulation */
#define CIFS_MOUNT_NO_BRL 0x100 /* No sending byte range locks to srv */
#define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */
#define CIFS_MOUNT_NO_XATTR 0x10 /* if set - disable xattr support */
#define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */
#define CIFS_MOUNT_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible*/
#define CIFS_MOUNT_UNX_EMUL 0x80 /* Network compat with SFUnix emulation */
#define CIFS_MOUNT_NO_BRL 0x100 /* No sending byte range locks to srv */
#define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */
#define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */
#define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */
struct cifs_sb_info {
struct cifsTconInfo *tcon; /* primary mount */
......@@ -41,6 +43,6 @@ struct cifs_sb_info {
mode_t mnt_dir_mode;
int mnt_cifs_flags;
int prepathlen;
char * prepath;
char *prepath;
};
#endif /* _CIFS_FS_SB_H */
......@@ -6,16 +6,16 @@
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/fs.h>
......@@ -32,7 +32,7 @@
*
*/
int
cifs_strfromUCS_le(char *to, const __le16 * from,
cifs_strfromUCS_le(char *to, const __le16 * from,
int len, const struct nls_table *codepage)
{
int i;
......@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
{
int charlen;
int i;
wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
wchar_t *wchar_to = (wchar_t *)to; /* needed to quiet sparse */
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
......@@ -79,7 +79,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
/* A question mark */
to[i] = cpu_to_le16(0x003f);
charlen = 1;
} else
} else
to[i] = cpu_to_le16(wchar_to[i]);
}
......
......@@ -5,20 +5,20 @@
* Convert a unicode character to upper or lower case using
* compressed tables.
*
* Copyright (c) International Business Machines Corp., 2000,2005555555555555555555555555555555555555555555555555555555
* Copyright (c) International Business Machines Corp., 2000,2007
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
......@@ -58,15 +58,19 @@ extern signed char UniLowerTable[512];
extern struct UniCaseRange UniLowerRange[];
#endif /* UNIUPR_NOLOWER */
#ifdef __KERNEL__
#ifndef __le16
int cifs_strfromUCS_le(char *, const __u16 *, int, const struct nls_table *);
int cifs_strtoUCS(__u16 *, const char *, int, const struct nls_table *);
#else
#define __le16 __u16
#define __le32 __u32
#define __le64 __u64
#define __be16 __u16
#define __be32 __u32
#define __be64 __u64
#endif
#ifdef __KERNEL__
int cifs_strfromUCS_le(char *, const __le16 *, int, const struct nls_table *);
int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
#endif
#endif
/*
* UniStrcat: Concatenate the second string to the first
......@@ -75,7 +79,7 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
* Address of the first string
*/
static inline wchar_t *
UniStrcat(wchar_t * ucs1, const wchar_t * ucs2)
UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
{
wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */
......@@ -93,7 +97,7 @@ UniStrcat(wchar_t * ucs1, const wchar_t * ucs2)
* or NULL if the character is not in the string
*/
static inline wchar_t *
UniStrchr(const wchar_t * ucs, wchar_t uc)
UniStrchr(const wchar_t *ucs, wchar_t uc)
{
while ((*ucs != uc) && *ucs)
ucs++;
......@@ -112,7 +116,7 @@ UniStrchr(const wchar_t * ucs, wchar_t uc)
* > 0: First string is greater than second
*/
static inline int
UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2)
UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
{
while ((*ucs1 == *ucs2) && *ucs1) {
ucs1++;
......@@ -125,7 +129,7 @@ UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2)
* UniStrcpy: Copy a string
*/
static inline wchar_t *
UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
{
wchar_t *anchor = ucs1; /* save the start of result string */
......@@ -137,7 +141,7 @@ UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
* UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes)
*/
static inline size_t
UniStrlen(const wchar_t * ucs1)
UniStrlen(const wchar_t *ucs1)
{
int i = 0;
......@@ -147,10 +151,11 @@ UniStrlen(const wchar_t * ucs1)
}
/*
* UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a string (length limited)
* UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a
* string (length limited)
*/
static inline size_t
UniStrnlen(const wchar_t * ucs1, int maxlen)
UniStrnlen(const wchar_t *ucs1, int maxlen)
{
int i = 0;
......@@ -166,7 +171,7 @@ UniStrnlen(const wchar_t * ucs1, int maxlen)
* UniStrncat: Concatenate length limited string
*/
static inline wchar_t *
UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1; /* save pointer to string 1 */
......@@ -184,7 +189,7 @@ UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncmp: Compare length limited string
*/
static inline int
UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
if (!n)
return 0; /* Null strings are equal */
......@@ -199,7 +204,7 @@ UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncmp_le: Compare length limited string - native to little-endian
*/
static inline int
UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
if (!n)
return 0; /* Null strings are equal */
......@@ -214,7 +219,7 @@ UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncpy: Copy length limited string with pad
*/
static inline wchar_t *
UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1;
......@@ -231,7 +236,7 @@ UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncpy_le: Copy length limited string with pad to little-endian
*/
static inline wchar_t *
UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1;
......@@ -252,7 +257,7 @@ UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* NULL if no matching string is found
*/
static inline wchar_t *
UniStrstr(const wchar_t * ucs1, const wchar_t * ucs2)
UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
{
const wchar_t *anchor1 = ucs1;
const wchar_t *anchor2 = ucs2;
......@@ -302,7 +307,7 @@ UniToupper(register wchar_t uc)
* UniStrupr: Upper case a unicode string
*/
static inline wchar_t *
UniStrupr(register wchar_t * upin)
UniStrupr(register wchar_t *upin)
{
register wchar_t *up;
......@@ -343,7 +348,7 @@ UniTolower(wchar_t uc)
* UniStrlwr: Lower case a unicode string
*/
static inline wchar_t *
UniStrlwr(register wchar_t * upin)
UniStrlwr(register wchar_t *upin)
{
register wchar_t *up;
......
......@@ -3,16 +3,16 @@
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* uniupr.h - Unicode compressed case ranges
......@@ -53,7 +53,7 @@ signed char CifsUniUpperTable[512] = {
0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, /* 1a0-1af */
-1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, /* 1b0-1bf */
0, 0, 0, 0, 0, -1, -2, 0, -1, -2, 0, -1, -2, 0, -1, 0, /* 1c0-1cf */
-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -79, 0, -1, /* 1d0-1df */
-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -79, 0, -1, /* 1d0-1df */
0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e0-1ef */
0, 0, -1, -2, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, /* 1f0-1ff */
};
......
......@@ -31,8 +31,8 @@ struct cifs_sid {
} __attribute__((packed));
/* everyone */
extern const struct cifs_sid sid_everyone;
/* extern const struct cifs_sid sid_everyone;*/
/* group users */
extern const struct cifs_sid sid_user;
/* extern const struct cifs_sid sid_user;*/
#endif /* _CIFSACL_H */
......@@ -27,8 +27,6 @@ extern void mdfour(unsigned char *out, unsigned char *in, int n);
/* smbdes.c */
extern void E_P16(unsigned char *p14, unsigned char *p16);
extern void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
extern void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
extern void E_old_pw_hash(unsigned char *, unsigned char *, unsigned char *);
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _CIFSFS_H
......@@ -32,10 +32,6 @@
#define TRUE 1
#endif
#ifndef __user
#define __user
#endif
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
#define current_fs_time(arg) CURRENT_TIME
......@@ -69,13 +65,13 @@ extern const struct address_space_operations cifs_addr_ops;
extern const struct address_space_operations cifs_addr_ops_smallbuf;
/* Functions related to super block operations */
extern struct super_operations cifs_super_ops;
/* extern const struct super_operations cifs_super_ops;*/
extern void cifs_read_inode(struct inode *);
/*extern void cifs_delete_inode(struct inode *);*/ /* BB not needed yet */
/* extern void cifs_write_inode(struct inode *); */ /* BB not needed yet */
/* Functions related to inodes */
extern struct inode_operations cifs_dir_inode_ops;
extern const struct inode_operations cifs_dir_inode_ops;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
extern int cifs_create(struct inode *, struct dentry *, int,
struct nameidata *);
......@@ -97,21 +93,21 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
extern int cifs_revalidate(struct dentry *);
extern int cifs_setattr(struct dentry *, struct iattr *);
extern struct inode_operations cifs_file_inode_ops;
extern struct inode_operations cifs_symlink_inode_ops;
extern const struct inode_operations cifs_file_inode_ops;
extern const struct inode_operations cifs_symlink_inode_ops;
/* Functions related to files and directories */
extern const struct file_operations cifs_file_ops;
extern const struct file_operations cifs_file_direct_ops; /* if directio mount */
extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
extern const struct file_operations cifs_file_nobrl_ops;
extern const struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
extern const struct file_operations cifs_file_direct_nobrl_ops; /* no brlocks */
extern int cifs_open(struct inode *inode, struct file *file);
extern int cifs_close(struct inode *inode, struct file *file);
extern int cifs_closedir(struct inode *inode, struct file *file);
extern ssize_t cifs_user_read(struct file *file, char __user *read_data,
size_t read_size, loff_t * poffset);
size_t read_size, loff_t *poffset);
extern ssize_t cifs_user_write(struct file *file, const char __user *write_data,
size_t write_size, loff_t * poffset);
size_t write_size, loff_t *poffset);
extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, struct dentry *, int);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
......@@ -132,12 +128,13 @@ extern struct dentry_operations cifs_ci_dentry_ops;
/* Functions related to symlinks */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd, void *);
extern void cifs_put_link(struct dentry *direntry,
struct nameidata *nd, void *);
#else
extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd);
#endif
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
int buflen);
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
const char *symname);
......@@ -146,7 +143,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t, int);
extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
extern int cifs_ioctl (struct inode * inode, struct file * filep,
extern int cifs_ioctl(struct inode *inode, struct file *filep,
unsigned int command, unsigned long arg);
#define CIFS_VERSION "1.47"
#define CIFS_VERSION "1.51"
#endif /* _CIFSFS_H */
/*
* fs/cifs/cifsglob.h
*
* Copyright (C) International Business Machines Corp., 2002,2006
* Copyright (C) International Business Machines Corp., 2002,2007
* Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org)
*
......@@ -14,7 +14,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU Lesser General Public License for more details.
*
*
*/
#include <linux/in.h>
#include <linux/in6.h>
......@@ -29,7 +29,7 @@
#define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1
#define MAX_SERVER_SIZE 15
#define MAX_SHARE_SIZE 64 /* used to be 20 - this should still be enough */
#define MAX_SHARE_SIZE 64 /* used to be 20, this should still be enough */
#define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null
termination then *2 for unicode versions */
#define MAX_PASSWORD_SIZE 16
......@@ -39,13 +39,13 @@
/*
* MAX_REQ is the maximum number of requests that WE will send
* on one socket concurently. It also matches the most common
* value of max multiplex returned by servers. We may
* value of max multiplex returned by servers. We may
* eventually want to use the negotiated value (in case
* future servers can handle more) when we are more confident that
* we will not have problems oveloading the socket with pending
* write data.
*/
#define CIFS_MAX_REQ 50
#define CIFS_MAX_REQ 50
#define SERVER_NAME_LENGTH 15
#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1)
......@@ -113,6 +113,17 @@ enum protocolEnum {
/* Netbios frames protocol not supported at this time */
};
struct mac_key {
unsigned int len;
union {
char ntlm[CIFS_SESS_KEY_SIZE + 16];
struct {
char key[16];
struct ntlmv2_resp resp;
} ntlmv2;
} data;
};
/*
*****************************************************************
* Except the CIFS PDUs themselves all the
......@@ -129,13 +140,13 @@ struct TCP_Server_Info {
struct sockaddr_in sockAddr;
struct sockaddr_in6 sockAddr6;
} addr;
wait_queue_head_t response_q;
wait_queue_head_t response_q;
wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/
struct list_head pending_mid_q;
void *Server_NlsInfo; /* BB - placeholder for future NLS info */
unsigned short server_codepage; /* codepage for the server */
unsigned long ip_address; /* IP addr for the server if known */
enum protocolEnum protocolType;
enum protocolEnum protocolType;
char versionMajor;
char versionMinor;
unsigned svlocal:1; /* local server or remote */
......@@ -168,14 +179,15 @@ struct TCP_Server_Info {
/* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
__u32 sequence_number; /* needed for CIFS PDU signature */
char mac_signing_key[CIFS_SESS_KEY_SIZE + 16];
struct mac_key mac_signing_key;
char ntlmv2_hash[16];
unsigned long lstrp; /* when we got last response from this server */
};
/*
* The following is our shortcut to user information. We surface the uid,
* and name. We always get the password on the fly in case it
* has changed. We also hang a list of sessions owned by this user off here.
* has changed. We also hang a list of sessions owned by this user off here.
*/
struct cifsUidInfo {
struct list_head userList;
......@@ -206,11 +218,11 @@ struct cifsSesInfo {
int Suid; /* remote smb uid */
uid_t linux_uid; /* local Linux uid */
int capabilities;
char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for
char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for
TCP names - will ipv6 and sctp addresses fit? */
char userName[MAX_USERNAME_SIZE + 1];
char * domainName;
char * password;
char *domainName;
char *password;
};
/* no more than one of the following three session flags may be set */
#define CIFS_SES_NT4 1
......@@ -222,7 +234,7 @@ struct cifsSesInfo {
#define CIFS_SES_LANMAN 8
/*
* there is one of these for each connection to a resource on a particular
* session
* session
*/
struct cifsTconInfo {
struct list_head cifsConnectionList;
......@@ -278,7 +290,9 @@ struct cifsTconInfo {
FILE_SYSTEM_UNIX_INFO fsUnixInfo;
unsigned retry:1;
unsigned nocase:1;
/* BB add field for back pointer to sb struct? */
unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol
for this mount even if server would support */
/* BB add field for back pointer to sb struct(s)? */
};
/*
......@@ -300,9 +314,9 @@ struct cifs_search_info {
__u16 entries_in_buffer;
__u16 info_level;
__u32 resume_key;
char * ntwrk_buf_start;
char * srch_entries_start;
char * presume_name;
char *ntwrk_buf_start;
char *srch_entries_start;
char *presume_name;
unsigned int resume_name_len;
unsigned endOfSearch:1;
unsigned emptyDir:1;
......@@ -318,15 +332,19 @@ struct cifsFileInfo {
__u16 netfid; /* file id from remote */
/* BB add lock scope info here if needed */ ;
/* lock scope id (0 if none) */
struct file * pfile; /* needed for writepage */
struct inode * pInode; /* needed for oplock break */
struct semaphore lock_sem;
struct file *pfile; /* needed for writepage */
struct inode *pInode; /* needed for oplock break */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)
struct mutex lock_mutex;
#else
struct semaphore lock_mutex;
#endif
struct list_head llist; /* list of byte range locks we have. */
unsigned closePend:1; /* file is marked to close */
unsigned invalidHandle:1; /* file closed via session abend */
atomic_t wrtPending; /* handle in use - defer close */
struct semaphore fh_sem; /* prevents reopen race after dead ses*/
char * search_resume_name; /* BB removeme BB */
char *search_resume_name; /* BB removeme BB */
struct cifs_search_info srch_inf;
};
......@@ -336,7 +354,7 @@ struct cifsFileInfo {
struct cifsInodeInfo {
struct list_head lockList;
/* BB add in lists for dirty pages - i.e. write caching info for oplock */
/* BB add in lists for dirty pages i.e. write caching info for oplock */
struct list_head openFileList;
int write_behind_rc;
__u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
......@@ -362,7 +380,7 @@ CIFS_SB(struct super_block *sb)
{
return sb->s_fs_info;
}
#else
#else /* 2.4 kernel case */
static inline struct cifsInodeInfo *
CIFS_I(struct inode *inode)
{
......@@ -408,9 +426,9 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
}
#else
#define cifs_stats_inc(field) do {} while(0)
#define cifs_stats_bytes_written(tcon, bytes) do {} while(0)
#define cifs_stats_bytes_read(tcon, bytes) do {} while(0)
#define cifs_stats_inc(field) do {} while (0)
#define cifs_stats_bytes_written(tcon, bytes) do {} while (0)
#define cifs_stats_bytes_read(tcon, bytes) do {} while (0)
#endif
......@@ -437,8 +455,8 @@ struct mid_q_entry {
struct oplock_q_entry {
struct list_head qhead;
struct inode * pinode;
struct cifsTconInfo * tcon;
struct inode *pinode;
struct cifsTconInfo *tcon;
__u16 netfid;
};
......@@ -453,7 +471,7 @@ struct dir_notify_req {
__u16 netfid;
__u32 filter; /* CompletionFilter (for multishot) */
int multishot;
struct file * pfile;
struct file *pfile;
};
#define MID_FREE 0
......@@ -491,7 +509,7 @@ require use of the stronger protocol */
#define CIFSSEC_MUST_LANMAN 0x10010
#define CIFSSEC_MUST_PLNTXT 0x20020
#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */
#else
#else
#define CIFSSEC_MASK 0x07007 /* flags supported if no weak config */
#endif /* WEAK_PW_HASH */
#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */
......@@ -529,7 +547,7 @@ require use of the stronger protocol */
* ----------
* sesSem operations on smb session
* tconSem operations on tree connection
* fh_sem file handle reconnection operations
* fh_sem file handle reconnection operations
*
****************************************************************************/
......@@ -542,9 +560,10 @@ require use of the stronger protocol */
/*
* The list of servers that did not respond with NT LM 0.12.
* This list helps improve performance and eliminate the messages indicating
* that we had a communications error talking to the server in this list.
* that we had a communications error talking to the server in this list.
*/
GLOBAL_EXTERN struct servers_not_supported *NotSuppList; /*@z4a */
/* Feature not supported */
/* GLOBAL_EXTERN struct servers_not_supported *NotSuppList; */
/*
* The following is a hash table of all the users we know about.
......@@ -594,15 +613,14 @@ GLOBAL_EXTERN atomic_t midCount;
/* Misc globals */
GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions
to be established on existing mount if we
have the uid/password or Kerberos credential
have the uid/password or Kerberos credential
or equivalent for current user */
GLOBAL_EXTERN unsigned int oplockEnabled;
GLOBAL_EXTERN unsigned int experimEnabled;
GLOBAL_EXTERN unsigned int lookupCacheEnabled;
GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent
GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent
with more secure ntlmssp2 challenge/resp */
GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */
GLOBAL_EXTERN unsigned int secFlags;
GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/
GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */
GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,7 +5,7 @@
* Author(s): Steve French (sfrench@us.ibm.com)
*
* Common Internet FileSystem (CIFS) client
*
*
* Operations related to support for exporting files via NFSD
*
* This library is free software; you can redistribute it and/or modify
......@@ -22,31 +22,49 @@
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
/*
* See Documentation/filesystems/Exporting
* and examples in fs/exportfs
*
* Since cifs is a network file system, an "fsid" must be included for
* any nfs exports file entries which refer to cifs paths. In addition
* the cifs mount must be mounted with the "serverino" option (ie use stable
* server inode numbers instead of locally generated temporary ones).
* Although cifs inodes do not use generation numbers (have generation number
* of zero) - the inode number alone should be good enough for simple cases
* in which users want to export cifs shares with NFS. The decode and encode
* could be improved by using a new routine which expects 64 bit inode numbers
* instead of the default 32 bit routines in fs/exportfs
*
*/
#include <linux/fs.h>
#include "cifsglob.h"
#include "cifs_debug.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
#include <linux/exportfs.h>
#endif
#ifdef CONFIG_CIFS_EXPERIMENTAL
static struct dentry *cifs_get_parent(struct dentry *dentry)
{
/* BB need to add code here eventually to enable export via NFSD */
return ERR_PTR(-EACCES);
/* BB need to add code here eventually to enable export via NFSD */
cFYI(1, ("get parent for %p", dentry));
return ERR_PTR(-EACCES);
}
struct export_operations cifs_export_ops = {
.get_parent = cifs_get_parent,
/* Following five export operations are unneeded so far and can default */
/* .get_dentry =
.get_name =
.find_exported_dentry =
.decode_fh =
.encode_fs = */
};
.get_parent = cifs_get_parent,
/* Following five export operations are unneeded so far and can default:
.get_dentry =
.get_name =
.find_exported_dentry =
.decode_fh =
.encode_fs = */
};
#endif /* EXPERIMENTAL */
......@@ -2,7 +2,7 @@
* fs/cifs/fcntl.c
*
* vfs operations that deal with the file control API
*
*
* Copyright (C) International Business Machines Corp., 2003,2004
* Author(s): Steve French (sfrench@us.ibm.com)
*
......@@ -35,39 +35,38 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
/* No way on Linux VFS to ask to monitor xattr
changes (and no stream support either */
if(fcntl_notify_flags & DN_ACCESS) {
if (fcntl_notify_flags & DN_ACCESS) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS;
}
if(fcntl_notify_flags & DN_MODIFY) {
if (fcntl_notify_flags & DN_MODIFY) {
/* What does this mean on directories? */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE |
FILE_NOTIFY_CHANGE_SIZE;
}
if(fcntl_notify_flags & DN_CREATE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
if (fcntl_notify_flags & DN_CREATE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
FILE_NOTIFY_CHANGE_LAST_WRITE;
}
if(fcntl_notify_flags & DN_DELETE) {
if (fcntl_notify_flags & DN_DELETE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE;
}
if(fcntl_notify_flags & DN_RENAME) {
if (fcntl_notify_flags & DN_RENAME) {
/* BB review this - checking various server behaviors */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
FILE_NOTIFY_CHANGE_FILE_NAME;
}
if(fcntl_notify_flags & DN_ATTRIB) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
if (fcntl_notify_flags & DN_ATTRIB) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
FILE_NOTIFY_CHANGE_ATTRIBUTES;
}
/* if(fcntl_notify_flags & DN_MULTISHOT) {
/* if (fcntl_notify_flags & DN_MULTISHOT) {
cifs_ntfy_flags |= ;
} */ /* BB fixme - not sure how to handle this with CIFS yet */
return cifs_ntfy_flags;
}
int cifs_dir_notify(struct file * file, unsigned long arg)
int cifs_dir_notify(struct file *file, unsigned long arg)
{
int xid;
int rc = -EINVAL;
......@@ -78,31 +77,37 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
__u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
__u16 netfid;
if(experimEnabled == 0)
if (experimEnabled == 0)
return 0;
xid = GetXid();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon;
full_path = build_path_from_dentry(file->f_dentry);
#else
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
full_path = build_path_from_dentry(file->f_path.dentry);
#endif
if(full_path == NULL) {
if (full_path == NULL) {
rc = -ENOMEM;
} else {
cFYI(1,("dir notify on file %s Arg 0x%lx",full_path,arg));
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
cFYI(1, ("dir notify on file %s Arg 0x%lx", full_path, arg));
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
&netfid, &oplock,NULL, cifs_sb->local_nls,
&netfid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
/* BB fixme - add this handle to a notify handle list */
if(rc) {
cFYI(1,("Could not open directory for notify"));
if (rc) {
cFYI(1, ("Could not open directory for notify"));
} else {
filter = convert_to_cifs_notify_flags(arg);
if(filter != 0) {
rc = CIFSSMBNotify(xid, pTcon,
if (filter != 0) {
rc = CIFSSMBNotify(xid, pTcon,
0 /* no subdirs */, netfid,
filter, file, arg & DN_MULTISHOT,
cifs_sb->local_nls);
......@@ -113,10 +118,10 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
it would close automatically but may be a way
to do it easily when inode freed or when
notify info is cleared/changed */
cFYI(1,("notify rc %d",rc));
cFYI(1, ("notify rc %d", rc));
}
}
FreeXid(xid);
return rc;
}
......@@ -3,7 +3,7 @@
*
* vfs operations that deal with io control
*
* Copyright (C) International Business Machines Corp., 2005
* Copyright (C) International Business Machines Corp., 2005,2007
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
......@@ -22,7 +22,6 @@
*/
#include <linux/fs.h>
#include <linux/ext2_fs.h>
#include "cifspdu.h"
#include "cifsglob.h"
#include "cifsproto.h"
......@@ -30,8 +29,17 @@
#include "cifsfs.h"
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
#ifndef FS_IOC_GETFLAGS
#define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
#ifndef FS_IOC_SETFLAGS
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
#endif
#ifndef FS_FL_USER_VISIBLE
#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
#endif
int cifs_ioctl (struct inode * inode, struct file * filep,
int cifs_ioctl (struct inode *inode, struct file *filep,
unsigned int command, unsigned long arg)
{
int rc = -ENOTTY; /* strange error - but the precedent */
......@@ -48,13 +56,13 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
xid = GetXid();
cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
cFYI(1, ("ioctl file %p cmd %u arg %lu", filep, command, arg));
cifs_sb = CIFS_SB(inode->i_sb);
#ifdef CONFIG_CIFS_POSIX
tcon = cifs_sb->tcon;
if(tcon)
if (tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else {
rc = -EIO;
......@@ -63,33 +71,33 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
}
#endif /* CONFIG_CIFS_POSIX */
switch(command) {
switch (command) {
case CIFS_IOC_CHECKUMOUNT:
cFYI(1,("User unmount attempted"));
if(cifs_sb->mnt_uid == current->uid)
cFYI(1, ("User unmount attempted"));
if (cifs_sb->mnt_uid == current->uid)
rc = 0;
else {
rc = -EACCES;
cFYI(1,("uids do not match"));
cFYI(1, ("uids do not match"));
}
break;
#ifdef CONFIG_CIFS_POSIX
case EXT2_IOC_GETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) {
case FS_IOC_GETFLAGS:
if (CIFS_UNIX_EXTATTR_CAP & caps) {
if (pSMBFile == NULL)
break;
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
&ExtAttrBits, &ExtAttrMask);
if(rc == 0)
if (rc == 0)
rc = put_user(ExtAttrBits &
EXT2_FL_USER_VISIBLE,
FS_FL_USER_VISIBLE,
(int __user *)arg);
}
break;
case EXT2_IOC_SETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) {
if(get_user(ExtAttrBits,(int __user *)arg)) {
case FS_IOC_SETFLAGS:
if (CIFS_UNIX_EXTATTR_CAP & caps) {
if (get_user(ExtAttrBits, (int __user *)arg)) {
rc = -EFAULT;
break;
}
......@@ -97,16 +105,15 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
break;
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
extAttrBits, &ExtAttrMask);*/
}
cFYI(1,("set flags not implemented yet"));
cFYI(1, ("set flags not implemented yet"));
break;
#endif /* CONFIG_CIFS_POSIX */
default:
cFYI(1,("unsupported ioctl"));
cFYI(1, ("unsupported ioctl"));
break;
}
FreeXid(xid);
return rc;
}
}
......@@ -53,32 +53,33 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
fromName = build_path_from_dentry(old_file);
toName = build_path_from_dentry(direntry);
if((fromName == NULL) || (toName == NULL)) {
if ((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM;
goto cifs_hl_exit;
}
if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX)
/* if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX)*/
if (pTcon->unix_ext)
rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls,
cifs_sb_target->local_nls,
cifs_sb_target->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
else {
rc = CIFSCreateHardLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls,
cifs_sb_target->local_nls,
cifs_sb_target->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
if((rc == -EIO) || (rc == -EINVAL))
rc = -EOPNOTSUPP;
if ((rc == -EIO) || (rc == -EINVAL))
rc = -EOPNOTSUPP;
}
d_drop(direntry); /* force new lookup from server of target */
/* if source file is cached (oplocked) revalidate will not go to server
until the file is closed or oplock broken so update nlinks locally */
if(old_file->d_inode) {
if (old_file->d_inode) {
cifsInode = CIFS_I(old_file->d_inode);
if(rc == 0) {
if (rc == 0) {
old_file->d_inode->i_nlink++;
/* BB should we make this contingent on superblock flag NOATIME? */
/* old_file->d_inode->i_ctime = CURRENT_TIME;*/
......@@ -87,14 +88,14 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
to set the parent dir cifs inode time to zero
to force revalidate (faster) for it too? */
}
/* if not oplocked will force revalidate to get info
/* if not oplocked will force revalidate to get info
on source file from srv */
cifsInode->time = 0;
/* Will update parent dir timestamps from srv within a second.
/* Will update parent dir timestamps from srv within a second.
Would it really be worth it to set the parent dir (cifs
inode) time field to zero to force revalidate on parent
directory faster ie
directory faster ie
CIFS_I(inode)->time = 0; */
}
......@@ -116,7 +117,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
int rc = -EACCES;
int xid;
char *full_path = NULL;
char * target_path = ERR_PTR(-ENOMEM);
char *target_path = ERR_PTR(-ENOMEM);
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
......@@ -136,13 +137,19 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
goto out;
}
/* BB add read reparse point symlink code and Unix extensions symlink code here BB */
/* We could change this to:
if (pTcon->unix_ext)
but there does not seem any point in refusing to
get symlink info if we can, even if unix extensions
turned off for this mount */
if (pTcon->ses->capabilities & CAP_UNIX)
rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path,
target_path,
PATH_MAX-1,
cifs_sb->local_nls);
else {
/* BB add read reparse point symlink code here */
/* rc = CIFSSMBQueryReparseLinkInfo */
/* BB Add code to Query ReparsePoint info */
/* BB Add MAC style xsymlink check here if enabled */
......@@ -192,7 +199,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
full_path = build_path_from_dentry(direntry);
if(full_path == NULL) {
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
}
......@@ -201,19 +208,20 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
cFYI(1, ("symname is %s", symname));
/* BB what if DFS and this volume is on different share? BB */
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
if (pTcon->unix_ext)
rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname,
cifs_sb->local_nls);
/* else
rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,cifs_sb_target->local_nls); */
rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls); */
if (rc == 0) {
if (pTcon->ses->capabilities & CAP_UNIX)
if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&newinode, full_path,
inode->i_sb,xid);
inode->i_sb, xid);
else
rc = cifs_get_inode_info(&newinode, full_path, NULL,
inode->i_sb,xid);
inode->i_sb, xid);
if (rc != 0) {
cFYI(1, ("Create symlink ok, getinodeinfo fail rc = %d",
......@@ -242,10 +250,10 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
char *full_path = NULL;
char *tmp_path = NULL;
char * tmpbuffer;
unsigned char * referrals = NULL;
int num_referrals = 0;
char *tmp_path = NULL;
char *tmpbuffer;
unsigned char *referrals = NULL;
unsigned int num_referrals = 0;
int len;
__u16 fid;
......@@ -253,13 +261,13 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
/* BB would it be safe against deadlock to grab this sem
/* BB would it be safe against deadlock to grab this sem
even though rename itself grabs the sem and calls lookup? */
/* down(&inode->i_sb->s_vfs_rename_sem);*/
/* mutex_lock(&inode->i_sb->s_vfs_rename_mutex);*/
full_path = build_path_from_dentry(direntry);
/* up(&inode->i_sb->s_vfs_rename_sem);*/
/* mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);*/
if(full_path == NULL) {
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
}
......@@ -267,70 +275,80 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
cFYI(1,
("Full path: %s inode = 0x%p pBuffer = 0x%p buflen = %d",
full_path, inode, pBuffer, buflen));
if(buflen > PATH_MAX)
if (buflen > PATH_MAX)
len = PATH_MAX;
else
len = buflen;
tmpbuffer = kmalloc(len,GFP_KERNEL);
if(tmpbuffer == NULL) {
tmpbuffer = kmalloc(len, GFP_KERNEL);
if (tmpbuffer == NULL) {
kfree(full_path);
FreeXid(xid);
return -ENOMEM;
}
/* BB add read reparse point symlink code and Unix extensions symlink code here BB */
/* BB add read reparse point symlink code and
Unix extensions symlink code here BB */
/* We could disable this based on pTcon->unix_ext flag instead ... but why? */
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path,
tmpbuffer,
len - 1,
cifs_sb->local_nls);
else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
cERROR(1,("SFU style symlinks not implemented yet"));
cERROR(1, ("SFU style symlinks not implemented yet"));
/* add open and read as in fs/cifs/inode.c */
} else {
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ,
OPEN_REPARSE_POINT,&fid, &oplock, NULL,
cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags &
OPEN_REPARSE_POINT, &fid, &oplock, NULL,
cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
if(!rc) {
if (!rc) {
rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path,
tmpbuffer,
len - 1,
len - 1,
fid,
cifs_sb->local_nls);
if(CIFSSMBClose(xid, pTcon, fid)) {
cFYI(1,("Error closing junction point (open for ioctl)"));
if (CIFSSMBClose(xid, pTcon, fid)) {
cFYI(1, ("Error closing junction point "
"(open for ioctl)"));
}
if(rc == -EIO) {
if (rc == -EIO) {
/* Query if DFS Junction */
tmp_path =
kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1,
GFP_KERNEL);
if (tmp_path) {
strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE);
strncat(tmp_path, full_path, MAX_PATHCONF);
rc = get_dfs_path(xid, pTcon->ses, tmp_path,
strncpy(tmp_path, pTcon->treeName,
MAX_TREE_SIZE);
strncat(tmp_path, full_path,
MAX_PATHCONF);
rc = get_dfs_path(xid, pTcon->ses,
tmp_path,
cifs_sb->local_nls,
&num_referrals, &referrals,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1,("Get DFS for %s rc = %d ",tmp_path, rc));
if((num_referrals == 0) && (rc == 0))
cFYI(1, ("Get DFS for %s rc = %d ",
tmp_path, rc));
if ((num_referrals == 0) && (rc == 0))
rc = -EACCES;
else {
cFYI(1,("num referral: %d",num_referrals));
if(referrals) {
cFYI(1,("referral string: %s",referrals));
strncpy(tmpbuffer, referrals, len-1);
cFYI(1, ("num referral: %d",
num_referrals));
if (referrals) {
cFYI(1,("referral string: %s", referrals));
strncpy(tmpbuffer,
referrals,
len-1);
}
}
kfree(referrals);
kfree(tmp_path);
}
/* BB add code like else decode referrals then memcpy to
tmpbuffer and free referrals string array BB */
/* BB add code like else decode referrals
then memcpy to tmpbuffer and free referrals
string array BB */
}
}
}
......
/*
/*
Unix SMB/Netbios implementation.
Version 1.9.
a implementation of MD4 designed for use in the SMB authentication protocol
Copyright (C) Andrew Tridgell 1997-1998.
Modified by Steve French (sfrench@us.ibm.com) 2002-2003
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
......@@ -170,7 +170,7 @@ mdfour(unsigned char *out, unsigned char *in, int n)
while (n > 64) {
copy64(M, in);
mdfour64(M,&A,&B, &C, &D);
mdfour64(M, &A, &B, &C, &D);
in += 64;
n -= 64;
}
......
......@@ -15,9 +15,9 @@
* will fill a supplied 16-byte array with the digest.
*/
/* This code slightly modified to fit into Samba by
abartlet@samba.org Jun 2001
and to fit the cifs vfs by
/* This code slightly modified to fit into Samba by
abartlet@samba.org Jun 2001
and to fit the cifs vfs by
Steve French sfrench@us.ibm.com */
#include <linux/string.h>
......@@ -106,7 +106,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
......@@ -252,10 +252,11 @@ MD5Transform(__u32 buf[4], __u32 const in[16])
buf[3] += d;
}
#if 0 /* currently unused */
/***********************************************************************
the rfc 2104 version of hmac_md5 initialisation.
***********************************************************************/
void
static void
hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx)
{
......@@ -289,6 +290,7 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
MD5Init(&ctx->ctx);
MD5Update(&ctx->ctx, ctx->k_ipad, 64);
}
#endif
/***********************************************************************
the microsoft version of hmac_md5 initialisation.
......@@ -350,7 +352,8 @@ hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx)
single function to calculate an HMAC MD5 digest from data.
use the microsoft hmacmd5 init method because the key is 16 bytes.
************************************************************/
void
#if 0 /* currently unused */
static void
hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest)
{
......@@ -361,3 +364,4 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
}
hmac_md5_final(digest, &ctx);
}
#endif
......@@ -27,12 +27,12 @@ void MD5Final(unsigned char digest[16], struct MD5Context *context);
/* The following definitions come from lib/hmacmd5.c */
void hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx);
/* void hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx);*/
void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
struct HMACMD5Context *ctx);
void hmac_md5_update(const unsigned char *text, int text_len,
struct HMACMD5Context *ctx);
void hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx);
void hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest);
/* void hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest);*/
/*
/*
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Luke Kenneth Casson Leighton 1997-2001.
*
*
* 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.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
......
/*
/*
Unix SMB/Netbios implementation.
Version 1.9.
NT error code constants
......@@ -6,17 +6,17 @@
Copyright (C) John H Terpstra 1996-2000
Copyright (C) Luke Kenneth Casson Leighton 1996-2000
Copyright (C) Paul Ashton 1998-2000
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
......
/*
* fs/cifs/ntlmssp.h
*
* Copyright (c) International Business Machines Corp., 2002,2006
* Copyright (c) International Business Machines Corp., 2002,2007
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define NTLMSSP_SIGNATURE "NTLMSSP"
......@@ -27,18 +27,18 @@
#define UnknownMessage cpu_to_le32(8)
/* Negotiate Flags */
#define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode
#define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM
#define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm
#define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability
#define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality
#define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are in unicode */
#define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */
#define NTLMSSP_REQUEST_TARGET 0x04 /* Server return its auth realm */
#define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signature capability */
#define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */
#define NTLMSSP_NEGOTIATE_DGRAM 0x0040
#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal
#define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication
#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Sign/seal use LM session key */
#define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */
#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 // Sign for all security levels
#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server on same machine */
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign for all security levels */
#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
#define NTLMSSP_TARGET_TYPE_SERVER 0x20000
#define NTLMSSP_TARGET_TYPE_SHARE 0x40000
......
......@@ -18,7 +18,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
......
/*
/*
Unix SMB/Netbios implementation.
Version 1.9.
a partial implementation of DES designed for use in the
a partial implementation of DES designed for use in the
SMB authentication protocol
Copyright (C) Andrew Tridgell 1998
Modified by Steve French (sfrench@us.ibm.com) 2002,2004
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* NOTES:
/* NOTES:
This code makes no attempt to be fast! In fact, it is a very
slow implementation
slow implementation
This code is NOT a complete DES implementation. It implements only
the minimum necessary for SMB authentication, as used by all SMB
......@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
};
static void
permute(char *out, char *in, uchar * p, int n)
permute(char *out, char *in, uchar *p, int n)
{
int i;
for (i = 0; i < n; i++)
......@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
char *rl;
/* Have to reduce stack usage */
pk1 = kmalloc(56+56+64+64,GFP_KERNEL);
if(pk1 == NULL)
pk1 = kmalloc(56+56+64+64, GFP_KERNEL);
if (pk1 == NULL)
return;
ki = kmalloc(16*48, GFP_KERNEL);
if(ki == NULL) {
if (ki == NULL) {
kfree(pk1);
return;
}
cd = pk1 + 56;
pd1= cd + 56;
pd1 = cd + 56;
rl = pd1 + 64;
permute(pk1, key, perm1, 56);
......@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
char *r2; /* r2[32] */
er = kmalloc(48+48+32+32+32, GFP_KERNEL);
if(er == NULL) {
if (er == NULL) {
kfree(pk1);
kfree(ki);
return;
......@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
char *keyb; /* keyb[64] */
unsigned char key2[8];
outb = kmalloc(64 * 3,GFP_KERNEL);
if(outb == NULL)
outb = kmalloc(64 * 3, GFP_KERNEL);
if (outb == NULL)
return;
inb = outb + 64;
......@@ -372,20 +372,20 @@ E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24)
smbhash(p24 + 16, c8, p21 + 14, 1);
}
void
#if 0 /* currently unsued */
static void
D_P16(unsigned char *p14, unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 0);
smbhash(out + 8, in + 8, p14 + 7, 0);
}
void
static void
E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 1);
smbhash(out + 8, in + 8, p14 + 7, 1);
}
#if 0
/* these routines are currently unneeded, but may be
needed later */
void
......
/*
/*
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
......@@ -7,17 +7,17 @@
Modified by Jeremy Allison 1995.
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
Modified by Steve French (sfrench@us.ibm.com) 2002-2003
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
......@@ -51,16 +51,13 @@
void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
void E_md4hash(const unsigned char *passwd, unsigned char *p16);
void nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]);
static void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
unsigned char p24[24]);
void NTLMSSPOWFencrypt(unsigned char passwd[8],
unsigned char *ntlmchalresp, unsigned char p24[24]);
void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
/*
This implements the X/Open SMB password encryption
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
encrypted password into p24 */
/* Note that password must be uppercased and null terminated */
void
......@@ -76,9 +73,9 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
E_P16(p14, p21);
SMBOWFencrypt(p21, c8, p24);
memset(p14,0,15);
memset(p21,0,21);
memset(p14, 0, 15);
memset(p21, 0, 21);
}
/* Routines for Windows NT MD4 Hash functions. */
......@@ -93,14 +90,14 @@ _my_wcslen(__u16 * str)
/*
* Convert a string into an NT UNICODE string.
* Note that regardless of processor type
* Note that regardless of processor type
* this must be in intel (little-endian)
* format.
*/
static int
_my_mbstowcs(__u16 * dst, const unsigned char *src, int len)
{ /* not a very good conversion routine - change/fix */
{ /* BB not a very good conversion routine - change/fix */
int i;
__u16 val;
......@@ -115,7 +112,7 @@ _my_mbstowcs(__u16 * dst, const unsigned char *src, int len)
return i;
}
/*
/*
* Creates the MD4 Hash of the users password in NT UNICODE.
*/
......@@ -126,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
__u16 wpwd[129];
/* Password cannot be longer than 128 characters */
if(passwd) {
if (passwd) {
len = strlen((char *) passwd);
if (len > 128) {
len = 128;
......@@ -141,11 +138,12 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
len = _my_wcslen(wpwd) * sizeof (__u16);
mdfour(p16, (unsigned char *) wpwd, len);
memset(wpwd,0,129 * 2);
memset(wpwd, 0, 129 * 2);
}
#if 0 /* currently unused */
/* Does both the NT and LM owfs of a user's password */
void
static void
nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
{
char passwd[514];
......@@ -171,6 +169,7 @@ nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
/* clear out local copy of user's password (just being paranoid). */
memset(passwd, '\0', sizeof (passwd));
}
#endif
/* Does the NTLMv2 owfs of a user's password */
#if 0 /* function not needed yet - but will be soon */
......@@ -179,17 +178,17 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
const char *domain_n, unsigned char kr_buf[16],
const struct nls_table *nls_codepage)
{
wchar_t * user_u;
wchar_t * dom_u;
wchar_t *user_u;
wchar_t *dom_u;
int user_l, domain_l;
struct HMACMD5Context ctx;
/* might as well do one alloc to hold both (user_u and dom_u) */
user_u = kmalloc(2048 * sizeof(wchar_t),GFP_KERNEL);
if(user_u == NULL)
user_u = kmalloc(2048 * sizeof(wchar_t), GFP_KERNEL);
if (user_u == NULL)
return;
dom_u = user_u + 1024;
/* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER);
push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */
......@@ -207,7 +206,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
kfree(user_u);
}
#endif
#endif
/* Does the des encryption from the NT or LM MD4 hash. */
static void
......@@ -223,7 +222,8 @@ SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
}
/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
void
#if 0 /* currently unused */
static void
NTLMSSPOWFencrypt(unsigned char passwd[8],
unsigned char *ntlmchalresp, unsigned char p24[24])
{
......@@ -235,6 +235,7 @@ NTLMSSPOWFencrypt(unsigned char passwd[8],
E_P24(p21, ntlmchalresp, p24);
}
#endif
/* Does the NT MD4 hash then des encryption. */
......@@ -255,15 +256,15 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
#if 0
static void
SMBOWFencrypt_ntv2(const unsigned char kr[16],
const struct data_blob * srv_chal,
const struct data_blob * cli_chal, unsigned char resp_buf[16])
const struct data_blob *srv_chal,
const struct data_blob *cli_chal, unsigned char resp_buf[16])
{
struct HMACMD5Context ctx;
struct HMACMD5Context ctx;
hmac_md5_init_limK_to_64(kr, 16, &ctx);
hmac_md5_update(srv_chal->data, srv_chal->length, &ctx);
hmac_md5_update(cli_chal->data, cli_chal->length, &ctx);
hmac_md5_final(resp_buf, &ctx);
hmac_md5_init_limK_to_64(kr, 16, &ctx);
hmac_md5_update(srv_chal->data, srv_chal->length, &ctx);
hmac_md5_update(cli_chal->data, cli_chal->length, &ctx);
hmac_md5_final(resp_buf, &ctx);
}
static void
......
......@@ -4,8 +4,8 @@
* Copyright (c) International Business Machines Corp., 2002,2004
* Author(s): Steve French (sfrench@us.ibm.com)
*
* See Error Codes section of the SNIA CIFS Specification
* for more information
* See Error Codes section of the SNIA CIFS Specification
* for more information
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
......@@ -19,7 +19,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define SUCCESS 0x00 /* The request was successful. */
......@@ -110,7 +110,7 @@
/* Below errors are used internally (do not come over the wire) for passthrough
from STATUS codes to POSIX only */
#define ErrTooManyLinks 0xFFFE
#define ErrTooManyLinks 0xFFFE
/* Following error codes may be generated with the ERRSRV error class.*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment