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 tar.bz2: linux-cifs
# Etersoft (c) 2007 # Etersoft (c) 2007, 2008
# Multiplatform spec for autobuild system # Multiplatform spec for autobuild system
# in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx # in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
# kernel-source-XXXX for Slackware / MOPSLinux # kernel-source-XXXX for Slackware / MOPSLinux
Name: linux-cifs Name: linux-cifs
Version: 1.48a Version: 1.50c
%define relnum 7 Release: alt4
Summary: Advanced Common Internet File System for Linux with Etersoft extension Summary: Advanced Common Internet File System for Linux with Etersoft extension
...@@ -26,27 +26,19 @@ Url: http://linux-cifs.samba.org/ ...@@ -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 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 Source1: http://pserver.samba.org/samba/ftp/cifs-cvs/cifs-%version.tar.bz2
BuildRequires: rpm-build-compat >= 0.97
# Spec part for ALT Linux # Spec part for ALT Linux
%if %_vendor == "alt" %if %_vendor == "alt"
Release: alt%relnum
BuildRequires: rpm-build-compat >= 0.7
BuildRequires: kernel-build-tools 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 %ifarch x86_64
# Don't know if ifnarch exist # Don't know if ifnarch exist
BuildRequires: kernel-headers-modules-std-smp BuildRequires: kernel-headers-modules-std-smp
%else %else
BuildRequires: kernel-headers-modules-std-pae BuildRequires: kernel-headers-modules-std-pae
%endif %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 %endif
%if %_vendor == "suse" %if %_vendor == "suse"
...@@ -82,32 +74,56 @@ though. ...@@ -82,32 +74,56 @@ though.
This package has Etersoft's patches for WINE@Etersoft sharing access support. This package has Etersoft's patches for WINE@Etersoft sharing access support.
#cifs-bld-tmp/fs/cifs
%define intdir new-cifs-backport
%prep %prep
%setup -q %setup -q
tar xfj %SOURCE1 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 %install
#export KBUILD_VERBOSE=1 #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
%post_service %name %post_service %name
[ "$1" = "1" ] && %_initdir/%name start || : %start_service %name
%preun %preun
%preun_service %name %preun_service %name
%files %files
%defattr(-,root,root)
%_initdir/%name %_initdir/%name
%_initdir/%name.outformat %_initdir/%name.outformat
%module_dir/ /lib/modules/*
/usr/src/%name/ %_usrsrc/%name-%version/
%changelog %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 * Fri Jul 27 2007 Vitaly Lipatov <lav@altlinux.ru> 1.48a-alt7
- fix build on 2.6.22 kernels - fix build on 2.6.22 kernels
- fix scripts for Debian/Ubuntu - fix scripts for Debian/Ubuntu
......
/functions.sh/1.1/Sat Jun 9 18:28:40 2007// /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// /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//// 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.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-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-shared-1.50.patch/1.1/Fri Sep 14 12:11:33 2007//
/linux-cifs.init/1.27/Fri Aug 31 18:21:27 2007// /kernel_src.list/1.2/Fri Dec 7 14:19:41 2007//
/linux-cifs.release.sh/1.2/Fri Jul 27 11:58:40 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 + gcc
+ ? + ?
wine, - ? wine, - ?
Что делать с -e - посмотреть, как устроено в Ubuntu + -e - , Ubuntu
/proc /proc
#!/bin/sh #!/bin/sh
# 2006, 2007 (c) Etersoft http://etersoft.ru # 2006, 2007, 2008 (c) Etersoft http://etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# GNU Public License # GNU Public License
...@@ -7,18 +7,21 @@ ...@@ -7,18 +7,21 @@
. ./functions.sh . ./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 PACKNAME=linux-cifs
MODULENAME=etercifs
get_src_dir || fatal "Distro $($DISTR_VENDOR -e) is not supported yet" 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= BUILTLIST=
# SMP build # SMP build
[ -z "$RPM_BUILD_NCPUS" ] && RPM_BUILD_NCPUS=`/usr/bin/getconf _NPROCESSORS_ONLN` [ -z "$RPM_BUILD_NCPUS" ] && RPM_BUILD_NCPUS=`/usr/bin/getconf _NPROCESSORS_ONLN`
[ "$RPM_BUILD_NCPUS" -gt 1 ] && MAKESMP="-j$RPM_BUILD_NCPUS" || MAKESMP="" [ "$RPM_BUILD_NCPUS" -gt 1 ] && MAKESMP="-j$RPM_BUILD_NCPUS" || MAKESMP=""
# Heuristic
detect_kernel() detect_kernel()
{ {
# Detect kernel version # Detect kernel version
...@@ -41,10 +44,11 @@ detect_kernel() ...@@ -41,10 +44,11 @@ detect_kernel()
fi fi
} }
echo "Install sources to $SBIN_DIR/../src/linux-cifs/" [ -z "$DESTDIR$SRC_DIR" ] && exit 1
install -m755 -d $SBIN_DIR/../src/linux-cifs/ echo "Install sources to $DESTDIR/$SRC_DIR"
install -m644 $BUILDDIR/* $SBIN_DIR/../src/linux-cifs/ || exit 1 install -m755 -d $DESTDIR/$SRC_DIR
install -m644 buildmodule.sh $SBIN_DIR/../src/linux-cifs/ || exit 1 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 for KERNEL_SOURCE in `echo $BASE_KERNEL_SOURCES_DIR` ; do
[ -L $KERNEL_SOURCE ] && [ `basename $KERNEL_SOURCE` != "build" ] && continue [ -L $KERNEL_SOURCE ] && [ `basename $KERNEL_SOURCE` != "build" ] && continue
...@@ -69,15 +73,14 @@ for KERNEL_SOURCE in `echo $BASE_KERNEL_SOURCES_DIR` ; do ...@@ -69,15 +73,14 @@ for KERNEL_SOURCE in `echo $BASE_KERNEL_SOURCES_DIR` ; do
# Clean, build and check # Clean, build and check
make $USEGCC -C $KERNEL_SOURCE here=$BUILDDIR SUBDIRS=$BUILDDIR clean make $USEGCC -C $KERNEL_SOURCE here=$BUILDDIR SUBDIRS=$BUILDDIR clean
make $USEGCC -C $KERNEL_SOURCE here=$BUILDDIR SUBDIRS=$BUILDDIR modules $MAKESMP 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=$(echo $MODULENAME.o) || MODULENAME=$(echo $MODULENAME.?o)
[ "$KERVER" = "2.4" ] && MODULENAME=$MODULENAME.o || MODULENAME=$MODULENAME.ko [ "$KERVER" = "2.4" ] && MODULEFILENAME=$MODULEFILENAME.o || MODULEFILENAME=$MODULENAME.ko
test -r "$BUILDDIR/$MODULENAME" || { echo "can't locate built module $MODULENAME, continue" ; continue ; } test -r "$BUILDDIR/$MODULEFILENAME" || { echo "can't locate built module $MODULEFILENAME, continue" ; continue ; }
#echo "$KERNELVERSION $MODULENAME to $INSTALL_MOD_PATH" #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" mkdir -p $INSTALL_MOD_PATH/$KERNELVERSION/kernel/fs/cifs || fatal "broken path"
cp -fv $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/$KERNELVERSION/ || fatal "copy error" cp -fv $BUILDDIR/$MODULEFILENAME $INSTALL_MOD_PATH/$KERNELVERSION/kernel/fs/cifs || fatal "copy error"
# copy last as default # copy last as default
#cp -f $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/$PACKNAME/ #cp -f $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/$PACKNAME/
#make -C $KERNEL_SOURCE here=`pwd`/ SUBDIRS=`pwd`/ modules_install #make -C $KERNEL_SOURCE here=`pwd`/ SUBDIRS=`pwd`/ modules_install
...@@ -94,7 +97,8 @@ echo ...@@ -94,7 +97,8 @@ echo
mkdir -p $SBIN_DIR $INIT_DIR mkdir -p $SBIN_DIR $INIT_DIR
#install -m755 linux-cifs_depmod.sh $INSTALL_MOD_PATH/$PACKNAME/ #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/ install -m755 $PACKNAME.outformat $INIT_DIR/
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
# Build kernel module in installed system # Build kernel module in installed system
MODULENAME=cifs.ko MODULEFILENAME=etercifs.ko
BUILDDIR=/usr/src/linux-cifs BUILDDIR=$(pwd)
KERNELVERSION=$(uname -r) KERNELVERSION=$(uname -r)
# SMP build # SMP build
...@@ -19,8 +19,8 @@ if [ -z "$KERNSRC" ]; then ...@@ -19,8 +19,8 @@ if [ -z "$KERNSRC" ]; then
KERNSRC=/lib/modules/$KERNELVERSION/build KERNSRC=/lib/modules/$KERNELVERSION/build
fi fi
if [ -z "$INSTALL_MOD_PATH" ]; then if [ -z "$INSTALL_MOD_PATH" ]; then
#INSTALL_MOD_PATH=/lib/modules/$KERNELVERSION/kernel/extra INSTALL_MOD_PATH=/lib/modules/$KERNELVERSION/kernel/fs/cifs
INSTALL_MOD_PATH=/lib/modules/linux-cifs #INSTALL_MOD_PATH=/lib/modules/linux-cifs
fi fi
echo echo
...@@ -32,7 +32,7 @@ Error: no kernel headers found at $KERNSRC ...@@ -32,7 +32,7 @@ Error: no kernel headers found at $KERNSRC
Please install package Please install package
kernel-headers-modules-XXXX for ALT Linux kernel-headers-modules-XXXX for ALT Linux
kernel-XXXX-devel for FCx / ASP 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 linux-headers-XXXX for Debian / Ubuntu
kernel-source-XXXX for SuSe kernel-source-XXXX for SuSe
kernel-source-XXXX for Slackware / MOPSLinux kernel-source-XXXX for Slackware / MOPSLinux
...@@ -58,17 +58,17 @@ if ! which $GCCNAME ; then ...@@ -58,17 +58,17 @@ if ! which $GCCNAME ; then
fi fi
# Clean, build and check # 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 clean
make $USEGCC -C $KERNSRC here=$BUILDDIR SUBDIRS=$BUILDDIR modules $MAKESMP make $USEGCC -C $KERNSRC here=$BUILDDIR SUBDIRS=$BUILDDIR modules $MAKESMP
#[ "$KERVER" = "2.4" ] && MODULENAME=$MODULENAME.o || MODULENAME=$MODULENAME.ko #[ "$KERVER" = "2.4" ] && MODULENAME=$MODULENAME.o || MODULENAME=$MODULENAME.ko
test -r "$BUILDDIR/$MODULENAME" || { echo "can't locate built module $MODULENAME, continue" ; exit 1 ; } test -r "$BUILDDIR/$MODULEFILENAME" || { echo "can't locate built module $MODULEFILENAME, continue" ; exit 1 ; }
strip --strip-debug --discard-all $BUILDDIR/$MODULENAME strip --strip-debug --discard-all $BUILDDIR/$MODULEFILENAME
echo "Copying built module to $INSTALL_MOD_PATH" echo "Copying built module to $INSTALL_MOD_PATH"
mkdir -p $INSTALL_MOD_PATH mkdir -p $INSTALL_MOD_PATH
install -m 644 -o root -g root $BUILDDIR/$MODULENAME $INSTALL_MOD_PATH/ || exit 1 install -m 644 -o root -g root $BUILDDIR/$MODULEFILENAME $INSTALL_MOD_PATH/ || exit 1
#depmod -ae || exit 1 depmod -ae || exit 1
#echo "$MODULENAME build correctly" #echo "$MODULENAME build correctly"
exit 0 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 D
/var/local/cvsroot :ext:cvs.etersoft/var/local/cvsroot
...@@ -5,13 +5,13 @@ inherit eutils flag-o-matic multilib ...@@ -5,13 +5,13 @@ inherit eutils flag-o-matic multilib
DESCRIPTION="Advanced Common Internet File System for Linux with Etersoft extension" DESCRIPTION="Advanced Common Internet File System for Linux with Etersoft extension"
HOMEPAGE="http://etersoft.ru/wine" HOMEPAGE="http://etersoft.ru/wine"
CIFSVER=1.48a CIFSVER=1.50c
WINENUMVERSION=current WINENUMVERSION=1.0.8
SRC_URI="ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft-$WINENUMVERSION/sources/tarball/${P}.tar.bz2 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" ftp://updates.etersoft.ru/pub/Etersoft/WINE@Etersoft-$WINENUMVERSION/sources/tarball/cifs-$CIFSVER.tar.bz2"
LICENSE="LGPL-2.1" LICENSE="LGPL-2.1"
SLOT="0" SLOT="0"
KEYWORDS="-* ~amd64 ~x86" KEYWORDS="-* amd64 x86"
IUSE="" IUSE=""
RESTRICT="test" #72375 RESTRICT="test" #72375
...@@ -23,8 +23,8 @@ RDEPEND=">=sys-kernel/linux-headers-2.6" ...@@ -23,8 +23,8 @@ RDEPEND=">=sys-kernel/linux-headers-2.6"
src_unpack() { src_unpack() {
unpack ${A} unpack ${A}
cd "${WORKDIR}/${P}" || die cd "${WORKDIR}/${P}" || die
mv ../cifs-bld-tmp ./ || die mv ../new-cifs-backport ./ || die
patch -s -p1 -d cifs-bld-tmp/fs/cifs <linux-cifs-shared.patch || die patch -p1 -d new-cifs-backport/ <linux-cifs-shared-1.50c.patch || die
} }
config_cache() { config_cache() {
...@@ -46,7 +46,7 @@ src_compile() { ...@@ -46,7 +46,7 @@ src_compile() {
} }
src_install() { 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 true
} }
......
...@@ -4,6 +4,7 @@ ASPLinux /usr/src/kernels/* ...@@ -4,6 +4,7 @@ ASPLinux /usr/src/kernels/*
ASPLinux/10 /lib/modules/*/build ASPLinux/10 /lib/modules/*/build
RedHat /usr/src/kernels/* RedHat /usr/src/kernels/*
RHEL /usr/src/kernels/* RHEL /usr/src/kernels/*
CentOS /usr/src/kernels/*
LinuxXP /usr/src/kernels/* LinuxXP /usr/src/kernels/*
Scientific /usr/src/kernels/* Scientific /usr/src/kernels/*
FedoraCore /usr/src/kernels/* FedoraCore /usr/src/kernels/*
......
#!/bin/sh #!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# 2006, 2007 Public domain # 2006, 2007, 2008 Public domain
# Multiplatform init script # Multiplatform init script
# linux-cifs - CIFS support for Linux kernel # linux-cifs - CIFS support for Linux kernel
# #
...@@ -9,14 +9,15 @@ ...@@ -9,14 +9,15 @@
# #
# modulename: cifs # modulename: cifs
# #
RMMOD=/sbin/rmmod
MODPROBE=/sbin/modprobe
INSMOD=/sbin/insmod
MODULENAME=cifs ORIGMODULENAME=cifs
MODULENAME=etercifs
# current module or manually built # current module or manually built
DEFMODULEPATH=/lib/modules/linux-cifs/$(uname -r)/$MODULENAME.ko #MODULEPATH=`echo /lib/modules/$(uname -r)/kernel/fs/cifs/$MODULENAME.*`
MANMODULEPATH=/lib/modules/linux-cifs/$MODULENAME.ko
# use manually build if exists
[ -r "$MANMODULEPATH" ] && DEFMODULEPATH=$MANMODULEPATH
OUTFORMAT=/etc/init.d/outformat OUTFORMAT=/etc/init.d/outformat
[ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/linux-cifs.outformat [ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/linux-cifs.outformat
...@@ -71,6 +72,7 @@ get_pid() ...@@ -71,6 +72,7 @@ get_pid()
else 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)" 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 fi
return $dpid
} }
is_loaded() is_loaded()
...@@ -81,7 +83,12 @@ is_loaded() ...@@ -81,7 +83,12 @@ is_loaded()
is_moduled() is_moduled()
{ {
lsmod | grep $MODULENAME > /dev/null lsmod | grep "^$MODULENAME" > /dev/null
}
is_origmoduled()
{
lsmod | grep "^$ORIGMODULENAME" > /dev/null
} }
umount_cifs() umount_cifs()
...@@ -91,34 +98,37 @@ umount_cifs() ...@@ -91,34 +98,37 @@ umount_cifs()
WASCIFS=1 WASCIFS=1
fi fi
echo -n "Unmounting CIFS resources... " echo -n "Unmounting CIFS resources... "
umount -t cifs -a || { failure ; return ; } umount -t cifs -a || { failure ; return 1; }
success
} }
mount_cifs() mount_cifs()
{ {
echo -n "Mounting CIFS resources... " echo -n "Mounting CIFS resources... "
mount -t cifs -a || { failure ; return ; } mount -t cifs -a || { failure ; return 1; }
success
} }
load_module() load_module()
{ {
local i local i
if is_moduled ; then if is_origmoduled ; then
#test -r /proc/fs/cifs/Etersoft && { passed ; return ; } #test -r /proc/fs/cifs/Etersoft && { passed ; return ; }
umount_cifs umount_cifs
echo -n "Removing CIFS kernel module... " echo -n "Removing CIFS kernel module... "
rmmod $MODULENAME || { failure ; return ; } $RMMOD $ORIGMODULENAME || { failure ; return ; }
fi fi
# Preload module dependencies # Preload module dependencies
modprobe nls_base 2>/dev/null #$MODPROBE nls_base 2>/dev/null
# kernel depends # kernel depends
# || { echo -n "nls_base is not loaded" ; failure ; } # || { echo -n "nls_base is not loaded" ; failure ; }
echo -n "Loading CIFS kernel module... " echo -n "Loading CIFS kernel module... "
if [ -r "$DEFMODULEPATH" ] ; then $MODPROBE $MODULENAME && { success ; return ; }
insmod $DEFMODULEPATH && { echo ; echo -n " insmod $DEFMODULEPATH" ; success ; return ; } #if [ -r "$MODULEPATH" ] ; then
echo -n "Incorrect module. Your system: " ; uname -a ; dmesg | tail -n2 # $INSMOD $MODULEPATH && { echo ; echo -n " insmod $MODULEPATH" ; success ; return ; }
fi # echo -n "Incorrect module. Your system: " ; uname -a ; dmesg | tail -n2
#fi
echo -n "$MODULENAME from Etersoft is not found," echo -n "$MODULENAME from Etersoft is not found,"
echo -n "you can try compile it with 'service linux-cifs build' command." echo -n "you can try compile it with 'service linux-cifs build' command."
failure failure
...@@ -133,7 +143,7 @@ start() ...@@ -133,7 +143,7 @@ start()
echo 1 > /proc/fs/cifs/Etersoft && success || failure echo 1 > /proc/fs/cifs/Etersoft && success || failure
echo -n "Disable Linux extensions for CIFS..." echo -n "Disable Linux extensions for CIFS..."
echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled && success || failure echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled && success || failure
test -n "$WASCIFS" && mount_cifs test -n "$WASCIFS" && mount_cifs || :
else else
failure failure
fi fi
...@@ -141,10 +151,10 @@ start() ...@@ -141,10 +151,10 @@ start()
stop() stop()
{ {
echo -n "Unloading CIFS kernel module... "
umount_cifs umount_cifs
echo -n "Unloading CIFS kernel module... "
is_moduled || { passed ; return ; } 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 success
} }
...@@ -159,6 +169,9 @@ status() ...@@ -159,6 +169,9 @@ status()
#else #else
# PRECOMP="precompiled" # PRECOMP="precompiled"
#fi #fi
if is_origmoduled ; then
echo " origin kernel module $ORIGMODULENAME loaded, Etersoft extensions missed"
fi
if is_moduled ; then if is_moduled ; then
#echo " kernel module $MODULENAME is loaded ($PRECOMP)" #echo " kernel module $MODULENAME is loaded ($PRECOMP)"
test -d /proc/fs/cifs/ 2>/dev/null || { echo -n "Can't locale /proc/fs/cifs... " ; failure ; } test -d /proc/fs/cifs/ 2>/dev/null || { echo -n "Can't locale /proc/fs/cifs... " ; failure ; }
...@@ -168,7 +181,20 @@ status() ...@@ -168,7 +181,20 @@ status()
echo -n "Unix extensions for CIFS disabled..." echo -n "Unix extensions for CIFS disabled..."
test "`cat /proc/fs/cifs/LinuxExtensionsEnabled 2>/dev/null`" = "1" && failure || success test "`cat /proc/fs/cifs/LinuxExtensionsEnabled 2>/dev/null`" = "1" && failure || success
else 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 fi
} }
...@@ -184,15 +210,14 @@ case "$1" in ...@@ -184,15 +210,14 @@ case "$1" in
start start
;; ;;
build) build)
cd /usr/src/linux-cifs build_module
sh buildmodule.sh
;; ;;
status) status)
status status
;; ;;
condrestart) condrestart)
# remove manual built module # remove manual built module
rm -f $MANMODULEPATH # rm -f $MANMODULEPATH
if [ "`cat /proc/fs/cifs/Etersoft 2>/dev/null`" = "1" ] ; then if [ "`cat /proc/fs/cifs/Etersoft 2>/dev/null`" = "1" ] ; then
stop stop
start start
...@@ -201,6 +226,6 @@ case "$1" in ...@@ -201,6 +226,6 @@ case "$1" in
fi fi
;; ;;
*) *)
echo "Usage: linux-cifs {start|stop|restart|condrestart|condstop|status}" echo "Usage: linux-cifs {start|stop|restart|build|condrestart|condstop|status}"
esac esac
...@@ -18,17 +18,19 @@ update_from_cvs ...@@ -18,17 +18,19 @@ update_from_cvs
SPECNAME=linux-cifs.spec SPECNAME=linux-cifs.spec
prepare_tarball prepare_tarball
echo "build_srpm"
build_rpms_name $SPECNAME build_rpms_name $SPECNAME
test -z "$BASENAME" && fatal "BASENAME is empty" test -z "$BASENAME" && fatal "BASENAME is empty"
#NAMEVER=$BASENAME-$VERSION #NAMEVER=$BASENAME-$VERSION
#rpmbb $SPECNAME || fatal "Can't build" #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 # Path to local publishing
ETERDESTSRPM=$WINEPUB_PATH/sources ETERDESTSRPM=$WINEPUB_PATH/sources
cp -f $RPMSOURCEDIR/$TARNAME $ETERDESTSRPM/tarball/ cp -f $RPMSOURCEDIR/$TARNAME $ETERDESTSRPM/tarball/
echo "publish_srpm"
publish_srpm publish_srpm
fi fi
...@@ -43,3 +45,20 @@ fi ...@@ -43,3 +45,20 @@ fi
#cd gentoo #cd gentoo
#./release_port.sh #./release_port.sh
#cd - #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 # Multiplatform spec for autobuild system
# in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx # in kernel build dir you can have gcc_version.inc file with export GCC_VERSION=x.xx
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
# kernel-source-XXXX for Slackware / MOPSLinux # kernel-source-XXXX for Slackware / MOPSLinux
Name: linux-cifs Name: linux-cifs
Version: 1.48a Version: 1.50c
%define relnum 7 Release: alt4
Summary: Advanced Common Internet File System for Linux with Etersoft extension Summary: Advanced Common Internet File System for Linux with Etersoft extension
...@@ -26,27 +26,19 @@ Url: http://linux-cifs.samba.org/ ...@@ -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 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 Source1: http://pserver.samba.org/samba/ftp/cifs-cvs/cifs-%version.tar.bz2
BuildRequires: rpm-build-compat >= 0.97
# Spec part for ALT Linux # Spec part for ALT Linux
%if %_vendor == "alt" %if %_vendor == "alt"
Release: alt%relnum
BuildRequires: rpm-build-compat >= 0.7
BuildRequires: kernel-build-tools 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-wks-smp kernel-headers-modules-ovz-smp
# do not work?
%ifarch x86_64 %ifarch x86_64
# Don't know if ifnarch exist # Don't know if ifnarch exist
BuildRequires: kernel-headers-modules-std-smp BuildRequires: kernel-headers-modules-std-smp
%else %else
BuildRequires: kernel-headers-modules-std-pae BuildRequires: kernel-headers-modules-std-pae
%endif %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 %endif
%if %_vendor == "suse" %if %_vendor == "suse"
...@@ -82,32 +74,56 @@ though. ...@@ -82,32 +74,56 @@ though.
This package has Etersoft's patches for WINE@Etersoft sharing access support. This package has Etersoft's patches for WINE@Etersoft sharing access support.
#cifs-bld-tmp/fs/cifs
%define intdir new-cifs-backport
%prep %prep
%setup -q %setup -q
tar xfj %SOURCE1 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 %install
#export KBUILD_VERBOSE=1 #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
%post_service %name %post_service %name
[ "$1" = "1" ] && %_initdir/%name start || : %start_service %name
%preun %preun
%preun_service %name %preun_service %name
%files %files
%defattr(-,root,root)
%_initdir/%name %_initdir/%name
%_initdir/%name.outformat %_initdir/%name.outformat
%module_dir/ /lib/modules/*
/usr/src/%name/ %_usrsrc/%name-%version/
%changelog %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 * Fri Jul 27 2007 Vitaly Lipatov <lav@altlinux.ru> 1.48a-alt7
- fix build on 2.6.22 kernels - fix build on 2.6.22 kernels
- fix scripts for Debian/Ubuntu - 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 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 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 ...@@ -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). (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 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 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 Version 1.47
------------ ------------
...@@ -17,7 +52,12 @@ Fix oops in list_del during mount caused by unaligned string. ...@@ -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 Fix file corruption which could occur on some large file
copies caused by writepages page i/o completion bug. copies caused by writepages page i/o completion bug.
Seek to SEEK_END forces check for update of file size for non-cached 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 Version 1.46
------------ ------------
...@@ -246,7 +286,7 @@ improperly zeroed buffer in CIFS Unix extensions set times call. ...@@ -246,7 +286,7 @@ improperly zeroed buffer in CIFS Unix extensions set times call.
Version 1.25 Version 1.25
------------ ------------
Fix internationalization problem in cifs readdir with filenames that map to 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 for readdir to netapp servers. Fix search rewind (seek into readdir to return
non-consecutive entries). Do not do readdir when server negotiates non-consecutive entries). Do not do readdir when server negotiates
buffer size to small to fit filename. Add support for reading POSIX ACLs from 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: ...@@ -257,19 +257,25 @@ A partial list of the supported mount options follows:
mount. mount.
domain Set the SMB/CIFS workgroup name prepended to the domain Set the SMB/CIFS workgroup name prepended to the
username during CIFS session establishment username during CIFS session establishment
uid If CIFS Unix extensions are not supported by the server uid Set the default uid for inodes. For mounts to servers
this overrides the default uid for inodes. For mounts to which do support the CIFS Unix extensions, such as a
servers which do support the CIFS Unix extensions, such properly configured Samba server, the server provides
as a properly configured Samba server, the server provides the uid, gid and mode so this parameter should not be
the uid, gid and mode. For servers which do not support specified unless the server and clients uid and gid
the Unix extensions, the default uid (and gid) returned on numbering differ. If the server and client are in the
lookup of existing files is the uid (gid) of the person 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 who executed the mount (root, except when mount.cifs
is configured setuid for user mounts) unless the "uid=" is configured setuid for user mounts) unless the "uid="
(gid) mount option is specified. For the uid (gid) of newly (gid) mount option is specified. For the uid (gid) of newly
created files and directories, ie files created since created files and directories, ie files created since
the last mount of the server share, the expected uid 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 memory on the client. Also note that permission
checks (authorization checks) on accesses to a file occur checks (authorization checks) on accesses to a file occur
at the server, but there are cases in which an administrator at the server, but there are cases in which an administrator
...@@ -281,8 +287,7 @@ A partial list of the supported mount options follows: ...@@ -281,8 +287,7 @@ A partial list of the supported mount options follows:
the client. Note that the mount.cifs helper must be the client. Note that the mount.cifs helper must be
at version 1.10 or higher to support specifying the uid at version 1.10 or higher to support specifying the uid
(or gid) in non-numberic form. (or gid) in non-numberic form.
gid If CIFS Unix extensions are not supported by the server gid Set the default gid for inodes (similar to above).
this overrides the default gid for inodes.
file_mode If CIFS Unix extensions are not supported by the server file_mode If CIFS Unix extensions are not supported by the server
this overrides the default mode for file inodes. this overrides the default mode for file inodes.
dir_mode If CIFS Unix extensions are not supported by the server 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: ...@@ -296,10 +301,21 @@ A partial list of the supported mount options follows:
during the local client kernel build will be used. during the local client kernel build will be used.
If server does not support Unicode, this parameter is If server does not support Unicode, this parameter is
unused. unused.
rsize default read size (usually 16K) rsize default read size (usually 16K). The client currently
wsize default write size (usually 16K, 32K is often better over GigE) can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
maximum wsize currently allowed by CIFS is 57344 (14 4096 byte defaults to 16K and may be changed (from 8K to the maximum
pages) 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 rw mount the network share read-write (note that the
server may still consider the share read-only) server may still consider the share read-only)
ro mount network share read-only ro mount network share read-only
...@@ -354,7 +370,7 @@ A partial list of the supported mount options follows: ...@@ -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 Note that this does not affect the normal ACL check on the
target machine done by the server software (of the server target machine done by the server software (of the server
ACL against the user name provided at mount time). 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 incrementing inode numbers on the client. Although this will
make it easier to spot hardlinked files (as they will have make it easier to spot hardlinked files (as they will have
the same inode numbers) and inode numbers may be persistent, the same inode numbers) and inode numbers may be persistent,
...@@ -362,12 +378,11 @@ A partial list of the supported mount options follows: ...@@ -362,12 +378,11 @@ A partial list of the supported mount options follows:
are unique if multiple server side mounts are exported under a are unique if multiple server side mounts are exported under a
single share (since inode numbers on the servers might not single share (since inode numbers on the servers might not
be unique if multiple filesystems are mounted under the same be unique if multiple filesystems are mounted under the same
shared higher level directory). Note that this requires that shared higher level directory). Note that some older
the server support the CIFS Unix Extensions as other servers (e.g. pre-Windows 2000) do not support returning UniqueIDs
do not return a unique IndexNumber on SMB FindFirst (most or the CIFS Unix Extensions equivalent and for those
servers return zero as the IndexNumber). Parameter has no this mount option will have no effect. Exporting cifs mounts
effect to Windows servers and others which do not support the under nfsd requires this mount option on the cifs mount.
CIFS Unix Extensions.
noserverino Client generates inode numbers (rather than using the actual one noserverino Client generates inode numbers (rather than using the actual one
from the server) by default. from the server) by default.
setuids If the CIFS Unix extensions are negotiated with the server setuids If the CIFS Unix extensions are negotiated with the server
...@@ -375,7 +390,7 @@ A partial list of the supported mount options follows: ...@@ -375,7 +390,7 @@ A partial list of the supported mount options follows:
the local process on newly created files, directories, and the local process on newly created files, directories, and
devices (create, mkdir, mknod). If the CIFS Unix Extensions devices (create, mkdir, mknod). If the CIFS Unix Extensions
are not negotiated, for newly created files and directories 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 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 that the uid for the file can change when the inode is
reloaded (or the user remounts the share). reloaded (or the user remounts the share).
...@@ -429,6 +444,13 @@ A partial list of the supported mount options follows: ...@@ -429,6 +444,13 @@ A partial list of the supported mount options follows:
noposixpaths If CIFS Unix extensions are supported, do not request noposixpaths If CIFS Unix extensions are supported, do not request
posix path name support (this may cause servers to posix path name support (this may cause servers to
reject creatingfile with certain reserved characters). 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. nobrl Do not send byte range lock requests to the server.
This is necessary for certain applications that break This is necessary for certain applications that break
with cifs style mandatory byte range locks (and most with cifs style mandatory byte range locks (and most
...@@ -436,11 +458,17 @@ A partial list of the supported mount options follows: ...@@ -436,11 +458,17 @@ A partial list of the supported mount options follows:
byte range locks). byte range locks).
remount remount the share (often used to change from ro to rw mounts remount remount the share (often used to change from ro to rw mounts
or vice versa) 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 sfu When the CIFS Unix Extensions are not negotiated, attempt to
create device files and fifos in a format compatible with create device files and fifos in a format compatible with
Services for Unix (SFU). In addition retrieve bits 10-12 Services for Unix (SFU). In addition retrieve bits 10-12
of the mode via the SETFILEBITS extended attribute (as 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 mode also will be emulated using queries of the security
descriptor (ACL). descriptor (ACL).
sign Must use packet signing (helps avoid unwanted data modification sign Must use packet signing (helps avoid unwanted data modification
...@@ -467,7 +495,7 @@ including: ...@@ -467,7 +495,7 @@ including:
-V print mount.cifs version -V print mount.cifs version
-? display simple usage information -? 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. module can be displayed via modinfo.
Misc /proc/fs/cifs Flags and Debug Info Misc /proc/fs/cifs Flags and Debug Info
...@@ -516,8 +544,22 @@ SecurityFlags Flags which control security negotiation and ...@@ -516,8 +544,22 @@ SecurityFlags Flags which control security negotiation and
must use plaintext passwords 0x20020 must use plaintext passwords 0x20020
(reserved for future packet encryption) 0x00040 (reserved for future packet encryption) 0x00040
cifsFYI If set to one, additional debug information is cifsFYI If set to non-zero value, additional debug information
logged to the system error log. (default 0) 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 traceSMB If set to one, debug information is logged to the
system error log with the start of smb requests system error log with the start of smb requests
and responses (default 0) and responses (default 0)
...@@ -563,10 +605,10 @@ the start of smb requests and responses can be enabled via: ...@@ -563,10 +605,10 @@ the start of smb requests and responses can be enabled via:
echo 1 > /proc/fs/cifs/traceSMB echo 1 > /proc/fs/cifs/traceSMB
Two other experimental features are under development and to test Two other experimental features are under development. To test these
require enabling CONFIG_CIFS_EXPERIMENTAL requires enabling CONFIG_CIFS_EXPERIMENTAL
More efficient write operations ipv6 enablement
DNOTIFY fcntl: needed for support of directory change DNOTIFY fcntl: needed for support of directory change
notification and perhaps later for file leases) 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 A Partial List of Missing Features
================================== ==================================
...@@ -18,64 +18,53 @@ better) ...@@ -18,64 +18,53 @@ better)
d) Kerberos/SPNEGO session setup support - (started) d) Kerberos/SPNEGO session setup support - (started)
e) NTLMv2 authentication (mostly implemented - double check e) Cleanup now unneeded SessSetup code in
that NTLMv2 signing works, also need to cleanup now unneeded SessSetup code in fs/cifs/connect.c and add back in NTLMSSP code if any servers
fs/cifs/connect.c) need it
f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup
used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
and raw NTLMSSP already. This is important when enabling and raw NTLMSSP already. This is important when enabling
extended security and mounting to Windows 2003 Servers 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) using FindNotify or equivalent. - (started)
g) A few byte range testcases fail due to POSIX vs. Windows/CIFS h) quota support (needs minor kernel change since quota calls
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
to make it to network filesystems or deviceless filesystems) 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 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. extra copy in/out of the socket buffers in some cases.
l) finish support for IPv6. This is mostly complete but k) Better optimize open (and pathbased setfilesize) to reduce the
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
oplock breaks coming from windows srv. Piggyback identical file oplock breaks coming from windows srv. Piggyback identical file
opens on top of each other by incrementing reference count rather opens on top of each other by incrementing reference count rather
than resending (helps reduce server resource utilization and avoid than resending (helps reduce server resource utilization and avoid
spurious oplock breaks). 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 at a time when 8 pages or more are requested. In conjuntion
add support for async_cifs_readpages. 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. 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 will autorefresh (partially complete by Asser). Needs minor kernel
vfs change to support removing D_NOTIFY on a file. 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) 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 (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 mount or a per server basis to client UIDs or nobody if no mapping
exists. This is helpful when Unix extensions are negotiated to exists. This is helpful when Unix extensions are negotiated to
allow better permission checking when UIDs differ on the server allow better permission checking when UIDs differ on the server
...@@ -83,19 +72,25 @@ and client. Add new protocol request to the CIFS protocol ...@@ -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 standard for asking the server for the corresponding name of a
particular uid. 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. server side for Samba 4.
w) Finish up the dos time conversion routines needed to return old server t) In support for OS/2 (LANMAN 1.2 and LANMAN2.1 based SMB servers)
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)
need to add ability to set time to server (utimes command) 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 See http://bugzilla.samba.org - search on product "CifsVFS" for
current bug list. current bug list.
...@@ -110,6 +105,12 @@ but recognizes them ...@@ -110,6 +105,12 @@ but recognizes them
succeed but still return access denied (appears to be Windows succeed but still return access denied (appears to be Windows
server not cifs client problem) and has not been reproduced recently. server not cifs client problem) and has not been reproduced recently.
NTFS partitions do not have this problem. 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 Misc testing to do
================== ==================
...@@ -126,3 +127,4 @@ negotiated size) and send larger write sizes to modern servers. ...@@ -126,3 +127,4 @@ negotiated size) and send larger write sizes to modern servers.
4) More exhaustively test against less common servers. More testing 4) More exhaustively test against less common servers. More testing
against Windows 9x, Windows ME servers. against Windows 9x, Windows ME servers.
...@@ -388,10 +388,9 @@ asn1_oid_decode(struct asn1_ctx *ctx, ...@@ -388,10 +388,9 @@ asn1_oid_decode(struct asn1_ctx *ctx,
unsigned long *optr; unsigned long *optr;
size = eoc - ctx->pointer + 1; size = eoc - ctx->pointer + 1;
*oid = kmalloc(size * sizeof (unsigned long), GFP_ATOMIC); *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
if (*oid == NULL) { if (*oid == NULL)
return 0; return 0;
}
optr = *oid; optr = *oid;
...@@ -462,7 +461,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -462,7 +461,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
unsigned int cls, con, tag, oidlen, rc; unsigned int cls, con, tag, oidlen, rc;
int use_ntlmssp = FALSE; 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); */ /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
...@@ -501,7 +500,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -501,7 +500,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON) } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) { || (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)); cls, con, tag, end, *end));
return 0; return 0;
} }
...@@ -511,7 +511,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -511,7 +511,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (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)); cls, con, tag, end, *end));
return 0; return 0;
} }
...@@ -543,32 +544,34 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -543,32 +544,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
if (!rc) { if (!rc) {
cFYI(1, cFYI(1,
("Error 1 decoding negTokenInit header exit 2")); ("Error decoding negTokenInit hdr exit2"));
return 0; return 0;
} }
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
if(rc) { if (rc) {
cFYI(1, cFYI(1,
("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx", ("OID len = %d oid = 0x%lx 0x%lx "
oidlen, *oid, *(oid + 1), *(oid + 2), "0x%lx 0x%lx",
*(oid + 3))); oidlen, *oid, *(oid + 1),
rc = compare_oid(oid, oidlen, NTLMSSP_OID, *(oid + 2), *(oid + 3)));
NTLMSSP_OID_LEN); rc = compare_oid(oid, oidlen,
NTLMSSP_OID, NTLMSSP_OID_LEN);
kfree(oid); kfree(oid);
if (rc) if (rc)
use_ntlmssp = TRUE; use_ntlmssp = TRUE;
} }
} else { } 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) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 3")); ("Error decoding last part negTokenInit exit3"));
return 0; 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, cFYI(1,
("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
...@@ -576,18 +579,17 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -576,18 +579,17 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 5")); ("Error decoding last part negTokenInit exit5"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
cFYI(1, cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)",
("Exit 6 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 7")); ("Error decoding last part negTokenInit exit 7"));
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
cFYI(1, cFYI(1,
...@@ -597,16 +599,17 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -597,16 +599,17 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 9")); ("Error decoding last part negTokenInit exit9"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI) } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|| (tag != ASN1_GENSTR)) { || (tag != ASN1_GENSTR)) {
cFYI(1, 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)); cls, con, tag, end, *end));
return 0; 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) /* if (use_kerberos)
......
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
#define CIFS_MOUNT_DIRECT_IO 8 /* do not write nor read through page cache */ #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_NO_XATTR 0x10 /* if set - disable xattr support */
#define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */ #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_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible*/
#define CIFS_MOUNT_UNX_EMUL 0x80 /* Network compat with SFUnix emulation */ #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_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_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 cifs_sb_info {
struct cifsTconInfo *tcon; /* primary mount */ struct cifsTconInfo *tcon; /* primary mount */
...@@ -41,6 +43,6 @@ struct cifs_sb_info { ...@@ -41,6 +43,6 @@ struct cifs_sb_info {
mode_t mnt_dir_mode; mode_t mnt_dir_mode;
int mnt_cifs_flags; int mnt_cifs_flags;
int prepathlen; int prepathlen;
char * prepath; char *prepath;
}; };
#endif /* _CIFS_FS_SB_H */ #endif /* _CIFS_FS_SB_H */
...@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len, ...@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
{ {
int charlen; int charlen;
int i; 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) { for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Convert a unicode character to upper or lower case using * Convert a unicode character to upper or lower case using
* compressed tables. * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -58,15 +58,19 @@ extern signed char UniLowerTable[512]; ...@@ -58,15 +58,19 @@ extern signed char UniLowerTable[512];
extern struct UniCaseRange UniLowerRange[]; extern struct UniCaseRange UniLowerRange[];
#endif /* UNIUPR_NOLOWER */ #endif /* UNIUPR_NOLOWER */
#ifdef __KERNEL__
#ifndef __le16 #ifndef __le16
int cifs_strfromUCS_le(char *, const __u16 *, int, const struct nls_table *); #define __le16 __u16
int cifs_strtoUCS(__u16 *, const char *, int, const struct nls_table *); #define __le32 __u32
#else #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_strfromUCS_le(char *, const __le16 *, int, const struct nls_table *);
int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *); int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
#endif #endif
#endif
/* /*
* UniStrcat: Concatenate the second string to the first * UniStrcat: Concatenate the second string to the first
...@@ -75,7 +79,7 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *); ...@@ -75,7 +79,7 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
* Address of the first string * Address of the first string
*/ */
static inline wchar_t * 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 */ wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */
...@@ -93,7 +97,7 @@ UniStrcat(wchar_t * ucs1, const wchar_t * ucs2) ...@@ -93,7 +97,7 @@ UniStrcat(wchar_t * ucs1, const wchar_t * ucs2)
* or NULL if the character is not in the string * or NULL if the character is not in the string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrchr(const wchar_t * ucs, wchar_t uc) UniStrchr(const wchar_t *ucs, wchar_t uc)
{ {
while ((*ucs != uc) && *ucs) while ((*ucs != uc) && *ucs)
ucs++; ucs++;
...@@ -112,7 +116,7 @@ UniStrchr(const wchar_t * ucs, wchar_t uc) ...@@ -112,7 +116,7 @@ UniStrchr(const wchar_t * ucs, wchar_t uc)
* > 0: First string is greater than second * > 0: First string is greater than second
*/ */
static inline int 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) { while ((*ucs1 == *ucs2) && *ucs1) {
ucs1++; ucs1++;
...@@ -125,7 +129,7 @@ UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2) ...@@ -125,7 +129,7 @@ UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2)
* UniStrcpy: Copy a string * UniStrcpy: Copy a string
*/ */
static inline wchar_t * 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 */ wchar_t *anchor = ucs1; /* save the start of result string */
...@@ -137,7 +141,7 @@ UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) ...@@ -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) * UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes)
*/ */
static inline size_t static inline size_t
UniStrlen(const wchar_t * ucs1) UniStrlen(const wchar_t *ucs1)
{ {
int i = 0; int i = 0;
...@@ -147,10 +151,11 @@ UniStrlen(const wchar_t * ucs1) ...@@ -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 static inline size_t
UniStrnlen(const wchar_t * ucs1, int maxlen) UniStrnlen(const wchar_t *ucs1, int maxlen)
{ {
int i = 0; int i = 0;
...@@ -166,7 +171,7 @@ UniStrnlen(const wchar_t * ucs1, int maxlen) ...@@ -166,7 +171,7 @@ UniStrnlen(const wchar_t * ucs1, int maxlen)
* UniStrncat: Concatenate length limited string * UniStrncat: Concatenate length limited string
*/ */
static inline wchar_t * 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 */ wchar_t *anchor = ucs1; /* save pointer to string 1 */
...@@ -184,7 +189,7 @@ UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -184,7 +189,7 @@ UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncmp: Compare length limited string * UniStrncmp: Compare length limited string
*/ */
static inline int 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) if (!n)
return 0; /* Null strings are equal */ return 0; /* Null strings are equal */
...@@ -199,7 +204,7 @@ UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -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 * UniStrncmp_le: Compare length limited string - native to little-endian
*/ */
static inline int 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) if (!n)
return 0; /* Null strings are equal */ return 0; /* Null strings are equal */
...@@ -214,7 +219,7 @@ UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -214,7 +219,7 @@ UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncpy: Copy length limited string with pad * UniStrncpy: Copy length limited string with pad
*/ */
static inline wchar_t * 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; wchar_t *anchor = ucs1;
...@@ -231,7 +236,7 @@ UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -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 * UniStrncpy_le: Copy length limited string with pad to little-endian
*/ */
static inline wchar_t * 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; wchar_t *anchor = ucs1;
...@@ -252,7 +257,7 @@ UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -252,7 +257,7 @@ UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* NULL if no matching string is found * NULL if no matching string is found
*/ */
static inline wchar_t * 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 *anchor1 = ucs1;
const wchar_t *anchor2 = ucs2; const wchar_t *anchor2 = ucs2;
...@@ -302,7 +307,7 @@ UniToupper(register wchar_t uc) ...@@ -302,7 +307,7 @@ UniToupper(register wchar_t uc)
* UniStrupr: Upper case a unicode string * UniStrupr: Upper case a unicode string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrupr(register wchar_t * upin) UniStrupr(register wchar_t *upin)
{ {
register wchar_t *up; register wchar_t *up;
...@@ -343,7 +348,7 @@ UniTolower(wchar_t uc) ...@@ -343,7 +348,7 @@ UniTolower(wchar_t uc)
* UniStrlwr: Lower case a unicode string * UniStrlwr: Lower case a unicode string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrlwr(register wchar_t * upin) UniStrlwr(register wchar_t *upin)
{ {
register wchar_t *up; register wchar_t *up;
......
...@@ -31,8 +31,8 @@ struct cifs_sid { ...@@ -31,8 +31,8 @@ struct cifs_sid {
} __attribute__((packed)); } __attribute__((packed));
/* everyone */ /* everyone */
extern const struct cifs_sid sid_everyone; /* extern const struct cifs_sid sid_everyone;*/
/* group users */ /* group users */
extern const struct cifs_sid sid_user; /* extern const struct cifs_sid sid_user;*/
#endif /* _CIFSACL_H */ #endif /* _CIFSACL_H */
...@@ -27,8 +27,6 @@ extern void mdfour(unsigned char *out, unsigned char *in, int n); ...@@ -27,8 +27,6 @@ extern void mdfour(unsigned char *out, unsigned char *in, int n);
/* smbdes.c */ /* smbdes.c */
extern void E_P16(unsigned char *p14, unsigned char *p16); 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 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 *);
...@@ -32,10 +32,6 @@ ...@@ -32,10 +32,6 @@
#define TRUE 1 #define TRUE 1
#endif #endif
#ifndef __user
#define __user
#endif
#include <linux/version.h> #include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
#define current_fs_time(arg) CURRENT_TIME #define current_fs_time(arg) CURRENT_TIME
...@@ -69,13 +65,13 @@ extern const struct address_space_operations cifs_addr_ops; ...@@ -69,13 +65,13 @@ extern const struct address_space_operations cifs_addr_ops;
extern const struct address_space_operations cifs_addr_ops_smallbuf; extern const struct address_space_operations cifs_addr_ops_smallbuf;
/* Functions related to super block operations */ /* 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_read_inode(struct inode *);
/*extern void cifs_delete_inode(struct inode *);*/ /* BB not needed yet */ /*extern void cifs_delete_inode(struct inode *);*/ /* BB not needed yet */
/* extern void cifs_write_inode(struct inode *); */ /* BB not needed yet */ /* extern void cifs_write_inode(struct inode *); */ /* BB not needed yet */
/* Functions related to inodes */ /* 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) #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
extern int cifs_create(struct inode *, struct dentry *, int, extern int cifs_create(struct inode *, struct dentry *, int,
struct nameidata *); struct nameidata *);
...@@ -97,21 +93,21 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *, ...@@ -97,21 +93,21 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
extern int cifs_revalidate(struct dentry *); extern int cifs_revalidate(struct dentry *);
extern int cifs_setattr(struct dentry *, struct iattr *); extern int cifs_setattr(struct dentry *, struct iattr *);
extern struct inode_operations cifs_file_inode_ops; extern const struct inode_operations cifs_file_inode_ops;
extern struct inode_operations cifs_symlink_inode_ops; extern const struct inode_operations cifs_symlink_inode_ops;
/* Functions related to files and directories */ /* Functions related to files and directories */
extern const struct file_operations cifs_file_ops; 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_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_open(struct inode *inode, struct file *file);
extern int cifs_close(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 int cifs_closedir(struct inode *inode, struct file *file);
extern ssize_t cifs_user_read(struct file *file, char __user *read_data, 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, 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_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, struct dentry *, int); extern int cifs_fsync(struct file *, struct dentry *, int);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
...@@ -132,7 +128,8 @@ extern struct dentry_operations cifs_ci_dentry_ops; ...@@ -132,7 +128,8 @@ extern struct dentry_operations cifs_ci_dentry_ops;
/* Functions related to symlinks */ /* Functions related to symlinks */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd); 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 #else
extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd); extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd); extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd);
...@@ -146,7 +143,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *, ...@@ -146,7 +143,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t, int); size_t, int);
extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t cifs_listxattr(struct dentry *, char *, 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); unsigned int command, unsigned long arg);
#define CIFS_VERSION "1.47" #define CIFS_VERSION "1.51"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */
/* /*
* fs/cifs/cifsglob.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) * Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org) * Jeremy Allison (jra@samba.org)
* *
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1 #define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1
#define MAX_SERVER_SIZE 15 #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 #define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null
termination then *2 for unicode versions */ termination then *2 for unicode versions */
#define MAX_PASSWORD_SIZE 16 #define MAX_PASSWORD_SIZE 16
...@@ -113,6 +113,17 @@ enum protocolEnum { ...@@ -113,6 +113,17 @@ enum protocolEnum {
/* Netbios frames protocol not supported at this time */ /* 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 * Except the CIFS PDUs themselves all the
...@@ -168,7 +179,8 @@ struct TCP_Server_Info { ...@@ -168,7 +179,8 @@ struct TCP_Server_Info {
/* 16th byte of RFC1001 workstation name is always null */ /* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
__u32 sequence_number; /* needed for CIFS PDU signature */ __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 */ unsigned long lstrp; /* when we got last response from this server */
}; };
...@@ -209,8 +221,8 @@ struct cifsSesInfo { ...@@ -209,8 +221,8 @@ struct cifsSesInfo {
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? */ TCP names - will ipv6 and sctp addresses fit? */
char userName[MAX_USERNAME_SIZE + 1]; char userName[MAX_USERNAME_SIZE + 1];
char * domainName; char *domainName;
char * password; char *password;
}; };
/* no more than one of the following three session flags may be set */ /* no more than one of the following three session flags may be set */
#define CIFS_SES_NT4 1 #define CIFS_SES_NT4 1
...@@ -278,7 +290,9 @@ struct cifsTconInfo { ...@@ -278,7 +290,9 @@ struct cifsTconInfo {
FILE_SYSTEM_UNIX_INFO fsUnixInfo; FILE_SYSTEM_UNIX_INFO fsUnixInfo;
unsigned retry:1; unsigned retry:1;
unsigned nocase: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 { ...@@ -300,9 +314,9 @@ struct cifs_search_info {
__u16 entries_in_buffer; __u16 entries_in_buffer;
__u16 info_level; __u16 info_level;
__u32 resume_key; __u32 resume_key;
char * ntwrk_buf_start; char *ntwrk_buf_start;
char * srch_entries_start; char *srch_entries_start;
char * presume_name; char *presume_name;
unsigned int resume_name_len; unsigned int resume_name_len;
unsigned endOfSearch:1; unsigned endOfSearch:1;
unsigned emptyDir:1; unsigned emptyDir:1;
...@@ -318,15 +332,19 @@ struct cifsFileInfo { ...@@ -318,15 +332,19 @@ struct cifsFileInfo {
__u16 netfid; /* file id from remote */ __u16 netfid; /* file id from remote */
/* BB add lock scope info here if needed */ ; /* BB add lock scope info here if needed */ ;
/* lock scope id (0 if none) */ /* lock scope id (0 if none) */
struct file * pfile; /* needed for writepage */ struct file *pfile; /* needed for writepage */
struct inode * pInode; /* needed for oplock break */ struct inode *pInode; /* needed for oplock break */
struct semaphore lock_sem; #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. */ struct list_head llist; /* list of byte range locks we have. */
unsigned closePend:1; /* file is marked to close */ unsigned closePend:1; /* file is marked to close */
unsigned invalidHandle:1; /* file closed via session abend */ unsigned invalidHandle:1; /* file closed via session abend */
atomic_t wrtPending; /* handle in use - defer close */ atomic_t wrtPending; /* handle in use - defer close */
struct semaphore fh_sem; /* prevents reopen race after dead ses*/ 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; struct cifs_search_info srch_inf;
}; };
...@@ -336,7 +354,7 @@ struct cifsFileInfo { ...@@ -336,7 +354,7 @@ struct cifsFileInfo {
struct cifsInodeInfo { struct cifsInodeInfo {
struct list_head lockList; 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; struct list_head openFileList;
int write_behind_rc; int write_behind_rc;
__u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
...@@ -362,7 +380,7 @@ CIFS_SB(struct super_block *sb) ...@@ -362,7 +380,7 @@ CIFS_SB(struct super_block *sb)
{ {
return sb->s_fs_info; return sb->s_fs_info;
} }
#else #else /* 2.4 kernel case */
static inline struct cifsInodeInfo * static inline struct cifsInodeInfo *
CIFS_I(struct inode *inode) CIFS_I(struct inode *inode)
{ {
...@@ -408,9 +426,9 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon, ...@@ -408,9 +426,9 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
} }
#else #else
#define cifs_stats_inc(field) 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_written(tcon, bytes) do {} while (0)
#define cifs_stats_bytes_read(tcon, bytes) do {} while(0) #define cifs_stats_bytes_read(tcon, bytes) do {} while (0)
#endif #endif
...@@ -437,8 +455,8 @@ struct mid_q_entry { ...@@ -437,8 +455,8 @@ struct mid_q_entry {
struct oplock_q_entry { struct oplock_q_entry {
struct list_head qhead; struct list_head qhead;
struct inode * pinode; struct inode *pinode;
struct cifsTconInfo * tcon; struct cifsTconInfo *tcon;
__u16 netfid; __u16 netfid;
}; };
...@@ -453,7 +471,7 @@ struct dir_notify_req { ...@@ -453,7 +471,7 @@ struct dir_notify_req {
__u16 netfid; __u16 netfid;
__u32 filter; /* CompletionFilter (for multishot) */ __u32 filter; /* CompletionFilter (for multishot) */
int multishot; int multishot;
struct file * pfile; struct file *pfile;
}; };
#define MID_FREE 0 #define MID_FREE 0
...@@ -544,7 +562,8 @@ require use of the stronger protocol */ ...@@ -544,7 +562,8 @@ require use of the stronger protocol */
* This list helps improve performance and eliminate the messages indicating * 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. * The following is a hash table of all the users we know about.
...@@ -602,7 +621,6 @@ GLOBAL_EXTERN unsigned int lookupCacheEnabled; ...@@ -602,7 +621,6 @@ 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 */ with more secure ntlmssp2 challenge/resp */
GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */ 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 linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/
GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */ GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */
GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */
......
...@@ -26,27 +26,45 @@ ...@@ -26,27 +26,45 @@
/* /*
* See Documentation/filesystems/Exporting * See Documentation/filesystems/Exporting
* and examples in fs/exportfs * 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 <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 #ifdef CONFIG_CIFS_EXPERIMENTAL
static struct dentry *cifs_get_parent(struct dentry *dentry) static struct dentry *cifs_get_parent(struct dentry *dentry)
{ {
/* BB need to add code here eventually to enable export via NFSD */ /* BB need to add code here eventually to enable export via NFSD */
cFYI(1, ("get parent for %p", dentry));
return ERR_PTR(-EACCES); return ERR_PTR(-EACCES);
} }
struct export_operations cifs_export_ops = { struct export_operations cifs_export_ops = {
.get_parent = cifs_get_parent, .get_parent = cifs_get_parent,
/* Following five export operations are unneeded so far and can default */ /* Following five export operations are unneeded so far and can default:
/* .get_dentry = .get_dentry =
.get_name = .get_name =
.find_exported_dentry = .find_exported_dentry =
.decode_fh = .decode_fh =
.encode_fs = */ .encode_fs = */
}; };
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
...@@ -35,39 +35,38 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) ...@@ -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 /* No way on Linux VFS to ask to monitor xattr
changes (and no stream support either */ 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; 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? */ /* What does this mean on directories? */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE |
FILE_NOTIFY_CHANGE_SIZE; FILE_NOTIFY_CHANGE_SIZE;
} }
if(fcntl_notify_flags & DN_CREATE) { if (fcntl_notify_flags & DN_CREATE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
FILE_NOTIFY_CHANGE_LAST_WRITE; 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; 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 */ /* 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; FILE_NOTIFY_CHANGE_FILE_NAME;
} }
if(fcntl_notify_flags & DN_ATTRIB) { if (fcntl_notify_flags & DN_ATTRIB) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
FILE_NOTIFY_CHANGE_ATTRIBUTES; FILE_NOTIFY_CHANGE_ATTRIBUTES;
} }
/* if(fcntl_notify_flags & DN_MULTISHOT) { /* if (fcntl_notify_flags & DN_MULTISHOT) {
cifs_ntfy_flags |= ; cifs_ntfy_flags |= ;
} */ /* BB fixme - not sure how to handle this with CIFS yet */ } */ /* BB fixme - not sure how to handle this with CIFS yet */
return cifs_ntfy_flags; 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 xid;
int rc = -EINVAL; int rc = -EINVAL;
...@@ -78,30 +77,36 @@ int cifs_dir_notify(struct file * file, unsigned long arg) ...@@ -78,30 +77,36 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
__u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES; __u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
__u16 netfid; __u16 netfid;
if (experimEnabled == 0)
if(experimEnabled == 0)
return 0; return 0;
xid = GetXid(); xid = GetXid();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
cifs_sb = CIFS_SB(file->f_dentry->d_sb); cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
full_path = build_path_from_dentry(file->f_dentry); 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; rc = -ENOMEM;
} else { } else {
cFYI(1,("dir notify on file %s Arg 0x%lx",full_path,arg)); cFYI(1, ("dir notify on file %s Arg 0x%lx", full_path, arg));
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
GENERIC_READ | SYNCHRONIZE, 0 /* create options */, 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); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
/* BB fixme - add this handle to a notify handle list */ /* BB fixme - add this handle to a notify handle list */
if(rc) { if (rc) {
cFYI(1,("Could not open directory for notify")); cFYI(1, ("Could not open directory for notify"));
} else { } else {
filter = convert_to_cifs_notify_flags(arg); filter = convert_to_cifs_notify_flags(arg);
if(filter != 0) { if (filter != 0) {
rc = CIFSSMBNotify(xid, pTcon, rc = CIFSSMBNotify(xid, pTcon,
0 /* no subdirs */, netfid, 0 /* no subdirs */, netfid,
filter, file, arg & DN_MULTISHOT, filter, file, arg & DN_MULTISHOT,
...@@ -113,7 +118,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg) ...@@ -113,7 +118,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
it would close automatically but may be a way it would close automatically but may be a way
to do it easily when inode freed or when to do it easily when inode freed or when
notify info is cleared/changed */ notify info is cleared/changed */
cFYI(1,("notify rc %d",rc)); cFYI(1, ("notify rc %d", rc));
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* vfs operations that deal with io control * 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) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/ext2_fs.h>
#include "cifspdu.h" #include "cifspdu.h"
#include "cifsglob.h" #include "cifsglob.h"
#include "cifsproto.h" #include "cifsproto.h"
...@@ -30,8 +29,17 @@ ...@@ -30,8 +29,17 @@
#include "cifsfs.h" #include "cifsfs.h"
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) #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) unsigned int command, unsigned long arg)
{ {
int rc = -ENOTTY; /* strange error - but the precedent */ int rc = -ENOTTY; /* strange error - but the precedent */
...@@ -48,13 +56,13 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -48,13 +56,13 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
xid = GetXid(); 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); cifs_sb = CIFS_SB(inode->i_sb);
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
tcon = cifs_sb->tcon; tcon = cifs_sb->tcon;
if(tcon) if (tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability); caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else { else {
rc = -EIO; rc = -EIO;
...@@ -63,33 +71,33 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -63,33 +71,33 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
} }
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
switch(command) { switch (command) {
case CIFS_IOC_CHECKUMOUNT: case CIFS_IOC_CHECKUMOUNT:
cFYI(1,("User unmount attempted")); cFYI(1, ("User unmount attempted"));
if(cifs_sb->mnt_uid == current->uid) if (cifs_sb->mnt_uid == current->uid)
rc = 0; rc = 0;
else { else {
rc = -EACCES; rc = -EACCES;
cFYI(1,("uids do not match")); cFYI(1, ("uids do not match"));
} }
break; break;
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
case EXT2_IOC_GETFLAGS: case FS_IOC_GETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) { if (CIFS_UNIX_EXTATTR_CAP & caps) {
if (pSMBFile == NULL) if (pSMBFile == NULL)
break; break;
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
&ExtAttrBits, &ExtAttrMask); &ExtAttrBits, &ExtAttrMask);
if(rc == 0) if (rc == 0)
rc = put_user(ExtAttrBits & rc = put_user(ExtAttrBits &
EXT2_FL_USER_VISIBLE, FS_FL_USER_VISIBLE,
(int __user *)arg); (int __user *)arg);
} }
break; break;
case EXT2_IOC_SETFLAGS: case FS_IOC_SETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) { if (CIFS_UNIX_EXTATTR_CAP & caps) {
if(get_user(ExtAttrBits,(int __user *)arg)) { if (get_user(ExtAttrBits, (int __user *)arg)) {
rc = -EFAULT; rc = -EFAULT;
break; break;
} }
...@@ -97,13 +105,12 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -97,13 +105,12 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
break; break;
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
extAttrBits, &ExtAttrMask);*/ extAttrBits, &ExtAttrMask);*/
} }
cFYI(1,("set flags not implemented yet")); cFYI(1, ("set flags not implemented yet"));
break; break;
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
default: default:
cFYI(1,("unsupported ioctl")); cFYI(1, ("unsupported ioctl"));
break; break;
} }
......
...@@ -53,12 +53,13 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -53,12 +53,13 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
fromName = build_path_from_dentry(old_file); fromName = build_path_from_dentry(old_file);
toName = build_path_from_dentry(direntry); toName = build_path_from_dentry(direntry);
if((fromName == NULL) || (toName == NULL)) { if ((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM; rc = -ENOMEM;
goto cifs_hl_exit; 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, rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls, cifs_sb_target->local_nls,
cifs_sb_target->mnt_cifs_flags & cifs_sb_target->mnt_cifs_flags &
...@@ -68,7 +69,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -68,7 +69,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
cifs_sb_target->local_nls, cifs_sb_target->local_nls,
cifs_sb_target->mnt_cifs_flags & cifs_sb_target->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if((rc == -EIO) || (rc == -EINVAL)) if ((rc == -EIO) || (rc == -EINVAL))
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
} }
...@@ -76,9 +77,9 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -76,9 +77,9 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
/* if source file is cached (oplocked) revalidate will not go to server /* if source file is cached (oplocked) revalidate will not go to server
until the file is closed or oplock broken so update nlinks locally */ 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); cifsInode = CIFS_I(old_file->d_inode);
if(rc == 0) { if (rc == 0) {
old_file->d_inode->i_nlink++; old_file->d_inode->i_nlink++;
/* BB should we make this contingent on superblock flag NOATIME? */ /* BB should we make this contingent on superblock flag NOATIME? */
/* old_file->d_inode->i_ctime = CURRENT_TIME;*/ /* old_file->d_inode->i_ctime = CURRENT_TIME;*/
...@@ -116,7 +117,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) ...@@ -116,7 +117,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
int rc = -EACCES; int rc = -EACCES;
int xid; int xid;
char *full_path = NULL; char *full_path = NULL;
char * target_path = ERR_PTR(-ENOMEM); char *target_path = ERR_PTR(-ENOMEM);
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
...@@ -136,13 +137,19 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) ...@@ -136,13 +137,19 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
goto out; 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) if (pTcon->ses->capabilities & CAP_UNIX)
rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path, rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path,
target_path, target_path,
PATH_MAX-1, PATH_MAX-1,
cifs_sb->local_nls); cifs_sb->local_nls);
else { else {
/* BB add read reparse point symlink code here */
/* rc = CIFSSMBQueryReparseLinkInfo */ /* rc = CIFSSMBQueryReparseLinkInfo */
/* BB Add code to Query ReparsePoint info */ /* BB Add code to Query ReparsePoint info */
/* BB Add MAC style xsymlink check here if enabled */ /* BB Add MAC style xsymlink check here if enabled */
...@@ -192,7 +199,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) ...@@ -192,7 +199,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if(full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
return -ENOMEM; return -ENOMEM;
} }
...@@ -201,19 +208,20 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) ...@@ -201,19 +208,20 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
cFYI(1, ("symname is %s", symname)); cFYI(1, ("symname is %s", symname));
/* BB what if DFS and this volume is on different share? BB */ /* 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, rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname,
cifs_sb->local_nls); cifs_sb->local_nls);
/* else /* 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 (rc == 0) {
if (pTcon->ses->capabilities & CAP_UNIX) if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&newinode, full_path, rc = cifs_get_inode_info_unix(&newinode, full_path,
inode->i_sb,xid); inode->i_sb, xid);
else else
rc = cifs_get_inode_info(&newinode, full_path, NULL, rc = cifs_get_inode_info(&newinode, full_path, NULL,
inode->i_sb,xid); inode->i_sb, xid);
if (rc != 0) { if (rc != 0) {
cFYI(1, ("Create symlink ok, getinodeinfo fail rc = %d", cFYI(1, ("Create symlink ok, getinodeinfo fail rc = %d",
...@@ -243,9 +251,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) ...@@ -243,9 +251,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
char *full_path = NULL; char *full_path = NULL;
char *tmp_path = NULL; char *tmp_path = NULL;
char * tmpbuffer; char *tmpbuffer;
unsigned char * referrals = NULL; unsigned char *referrals = NULL;
int num_referrals = 0; unsigned int num_referrals = 0;
int len; int len;
__u16 fid; __u16 fid;
...@@ -255,11 +263,11 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) ...@@ -255,11 +263,11 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
/* 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? */ 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); 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); FreeXid(xid);
return -ENOMEM; return -ENOMEM;
} }
...@@ -267,70 +275,80 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) ...@@ -267,70 +275,80 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
cFYI(1, cFYI(1,
("Full path: %s inode = 0x%p pBuffer = 0x%p buflen = %d", ("Full path: %s inode = 0x%p pBuffer = 0x%p buflen = %d",
full_path, inode, pBuffer, buflen)); full_path, inode, pBuffer, buflen));
if(buflen > PATH_MAX) if (buflen > PATH_MAX)
len = PATH_MAX; len = PATH_MAX;
else else
len = buflen; len = buflen;
tmpbuffer = kmalloc(len,GFP_KERNEL); tmpbuffer = kmalloc(len, GFP_KERNEL);
if(tmpbuffer == NULL) { if (tmpbuffer == NULL) {
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return -ENOMEM; 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) if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path, rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path,
tmpbuffer, tmpbuffer,
len - 1, len - 1,
cifs_sb->local_nls); cifs_sb->local_nls);
else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { 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 */ /* add open and read as in fs/cifs/inode.c */
} else { } else {
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ, rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ,
OPEN_REPARSE_POINT,&fid, &oplock, NULL, OPEN_REPARSE_POINT, &fid, &oplock, NULL,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if(!rc) { if (!rc) {
rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path, rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path,
tmpbuffer, tmpbuffer,
len - 1, len - 1,
fid, fid,
cifs_sb->local_nls); cifs_sb->local_nls);
if(CIFSSMBClose(xid, pTcon, fid)) { if (CIFSSMBClose(xid, pTcon, fid)) {
cFYI(1,("Error closing junction point (open for ioctl)")); cFYI(1, ("Error closing junction point "
"(open for ioctl)"));
} }
if(rc == -EIO) { if (rc == -EIO) {
/* Query if DFS Junction */ /* Query if DFS Junction */
tmp_path = tmp_path =
kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1, kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1,
GFP_KERNEL); GFP_KERNEL);
if (tmp_path) { if (tmp_path) {
strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); strncpy(tmp_path, pTcon->treeName,
strncat(tmp_path, full_path, MAX_PATHCONF); MAX_TREE_SIZE);
rc = get_dfs_path(xid, pTcon->ses, tmp_path, strncat(tmp_path, full_path,
MAX_PATHCONF);
rc = get_dfs_path(xid, pTcon->ses,
tmp_path,
cifs_sb->local_nls, cifs_sb->local_nls,
&num_referrals, &referrals, &num_referrals, &referrals,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1,("Get DFS for %s rc = %d ",tmp_path, rc)); cFYI(1, ("Get DFS for %s rc = %d ",
if((num_referrals == 0) && (rc == 0)) tmp_path, rc));
if ((num_referrals == 0) && (rc == 0))
rc = -EACCES; rc = -EACCES;
else { else {
cFYI(1,("num referral: %d",num_referrals)); cFYI(1, ("num referral: %d",
if(referrals) { num_referrals));
cFYI(1,("referral string: %s",referrals)); if (referrals) {
strncpy(tmpbuffer, referrals, len-1); cFYI(1,("referral string: %s", referrals));
strncpy(tmpbuffer,
referrals,
len-1);
} }
} }
kfree(referrals); kfree(referrals);
kfree(tmp_path); kfree(tmp_path);
} }
/* BB add code like else decode referrals then memcpy to /* BB add code like else decode referrals
tmpbuffer and free referrals string array BB */ then memcpy to tmpbuffer and free referrals
string array BB */
} }
} }
} }
......
...@@ -170,7 +170,7 @@ mdfour(unsigned char *out, unsigned char *in, int n) ...@@ -170,7 +170,7 @@ mdfour(unsigned char *out, unsigned char *in, int n)
while (n > 64) { while (n > 64) {
copy64(M, in); copy64(M, in);
mdfour64(M,&A,&B, &C, &D); mdfour64(M, &A, &B, &C, &D);
in += 64; in += 64;
n -= 64; n -= 64;
} }
......
...@@ -252,10 +252,11 @@ MD5Transform(__u32 buf[4], __u32 const in[16]) ...@@ -252,10 +252,11 @@ MD5Transform(__u32 buf[4], __u32 const in[16])
buf[3] += d; buf[3] += d;
} }
#if 0 /* currently unused */
/*********************************************************************** /***********************************************************************
the rfc 2104 version of hmac_md5 initialisation. the rfc 2104 version of hmac_md5 initialisation.
***********************************************************************/ ***********************************************************************/
void static void
hmac_md5_init_rfc2104(unsigned char *key, int key_len, hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx) struct HMACMD5Context *ctx)
{ {
...@@ -289,6 +290,7 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len, ...@@ -289,6 +290,7 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
MD5Init(&ctx->ctx); MD5Init(&ctx->ctx);
MD5Update(&ctx->ctx, ctx->k_ipad, 64); MD5Update(&ctx->ctx, ctx->k_ipad, 64);
} }
#endif
/*********************************************************************** /***********************************************************************
the microsoft version of hmac_md5 initialisation. the microsoft version of hmac_md5 initialisation.
...@@ -350,7 +352,8 @@ hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx) ...@@ -350,7 +352,8 @@ hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx)
single function to calculate an HMAC MD5 digest from data. single function to calculate an HMAC MD5 digest from data.
use the microsoft hmacmd5 init method because the key is 16 bytes. 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, hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest) unsigned char *digest)
{ {
...@@ -361,3 +364,4 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len, ...@@ -361,3 +364,4 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
} }
hmac_md5_final(digest, &ctx); hmac_md5_final(digest, &ctx);
} }
#endif
...@@ -27,12 +27,12 @@ void MD5Final(unsigned char digest[16], struct MD5Context *context); ...@@ -27,12 +27,12 @@ void MD5Final(unsigned char digest[16], struct MD5Context *context);
/* The following definitions come from lib/hmacmd5.c */ /* The following definitions come from lib/hmacmd5.c */
void hmac_md5_init_rfc2104(unsigned char *key, int key_len, /* void hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx); struct HMACMD5Context *ctx);*/
void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
struct HMACMD5Context *ctx); struct HMACMD5Context *ctx);
void hmac_md5_update(const unsigned char *text, int text_len, void hmac_md5_update(const unsigned char *text, int text_len,
struct HMACMD5Context *ctx); struct HMACMD5Context *ctx);
void hmac_md5_final(unsigned char *digest, 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, /* void hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest); unsigned char *digest);*/
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Error mapping routines from Samba libsmb/errormap.c * Error mapping routines from Samba libsmb/errormap.c
* Copyright (C) Andrew Tridgell 2001 * Copyright (C) Andrew Tridgell 2001
* *
*
* This program is free software; you can redistribute it and/or modify * 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 * 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
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/inet.h>
#include "cifsfs.h" #include "cifsfs.h"
#include "cifspdu.h" #include "cifspdu.h"
#include "cifsglob.h" #include "cifsglob.h"
...@@ -64,22 +64,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { ...@@ -64,22 +64,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
{ERRbadshare, -ETXTBSY}, {ERRbadshare, -ETXTBSY},
{ERRlock, -EACCES}, {ERRlock, -EACCES},
{ERRunsup, -EINVAL}, {ERRunsup, -EINVAL},
{ERRnosuchshare,-ENXIO}, {ERRnosuchshare, -ENXIO},
{ERRfilexists, -EEXIST}, {ERRfilexists, -EEXIST},
{ERRinvparm, -EINVAL}, {ERRinvparm, -EINVAL},
{ERRdiskfull, -ENOSPC}, {ERRdiskfull, -ENOSPC},
{ERRinvname, -ENOENT}, {ERRinvname, -ENOENT},
{ERRinvlevel,-EOPNOTSUPP}, {ERRinvlevel, -EOPNOTSUPP},
{ERRdirnotempty, -ENOTEMPTY}, {ERRdirnotempty, -ENOTEMPTY},
{ERRnotlocked, -ENOLCK}, {ERRnotlocked, -ENOLCK},
{ERRcancelviolation, -ENOLCK}, {ERRcancelviolation, -ENOLCK},
{ERRalreadyexists, -EEXIST}, {ERRalreadyexists, -EEXIST},
{ERRmoredata, -EOVERFLOW}, {ERRmoredata, -EOVERFLOW},
{ERReasnotsupported,-EOPNOTSUPP}, {ERReasnotsupported, -EOPNOTSUPP},
{ErrQuota, -EDQUOT}, {ErrQuota, -EDQUOT},
{ErrNotALink, -ENOLINK}, {ErrNotALink, -ENOLINK},
{ERRnetlogonNotStarted,-ENOPROTOOPT}, {ERRnetlogonNotStarted, -ENOPROTOOPT},
{ErrTooManyLinks,-EMLINK}, {ErrTooManyLinks, -EMLINK},
{0, 0} {0, 0}
}; };
...@@ -129,11 +129,27 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { ...@@ -129,11 +129,27 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
/* Convert string containing dotted ip address to binary form */ /* Convert string containing dotted ip address to binary form */
/* returns 0 if invalid address */ /* returns 0 if invalid address */
/* BB add address family, change rc to status flag and return union or for ipv6 */
/* will need parent to call something like inet_pton to convert ipv6 address BB */
int int
cifs_inet_pton(int address_family, char *cp,void *dst) cifs_inet_pton(int address_family, char *cp, void *dst)
{ {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
int ret = 0;
/* calculate length by finding first slash or NULL */
/* BB Should we convert '/' slash to '\' here since it seems already
* done before this */
if ( address_family == AF_INET ) {
ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
} else if ( address_family == AF_INET6 ) {
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
}
#ifdef CONFIG_CIFS_DEBUG2
cFYI(1, ("address conversion returned %d for %s", ret, cp));
#endif
if (ret > 0)
ret = 1;
return ret;
#else /* pre-2.6.20 */
int value; int value;
int digit; int digit;
int i; int i;
...@@ -192,6 +208,7 @@ cifs_inet_pton(int address_family, char *cp,void *dst) ...@@ -192,6 +208,7 @@ cifs_inet_pton(int address_family, char *cp,void *dst)
*((__be32 *)dst) = *((__be32 *) bytes) | htonl(value); *((__be32 *)dst) = *((__be32 *) bytes) | htonl(value);
return 1; /* success */ return 1; /* success */
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -373,8 +390,8 @@ static const struct { ...@@ -373,8 +390,8 @@ static const struct {
ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, {
ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
/* { This NT error code was 'sqashed' /* { This NT error code was 'sqashed'
from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES from NT_STATUS_INSUFFICIENT_RESOURCES to
during the session setup } */ NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */
{ {
ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, { ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, {
ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, {
...@@ -618,8 +635,8 @@ static const struct { ...@@ -618,8 +635,8 @@ static const struct {
ERRDOS, 19, NT_STATUS_TOO_LATE}, { ERRDOS, 19, NT_STATUS_TOO_LATE}, {
ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
/* { This NT error code was 'sqashed' /* { This NT error code was 'sqashed'
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
during the session setup } */ NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */
{ {
ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, {
ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, {
...@@ -769,7 +786,7 @@ cifs_print_status(__u32 status_code) ...@@ -769,7 +786,7 @@ cifs_print_status(__u32 status_code)
if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
(status_code & 0xFFFFFF)) { (status_code & 0xFFFFFF)) {
printk(KERN_NOTICE "Status code returned 0x%08x %s\n", printk(KERN_NOTICE "Status code returned 0x%08x %s\n",
status_code,nt_errs[idx].nt_errstr); status_code, nt_errs[idx].nt_errstr);
} }
idx++; idx++;
} }
...@@ -812,9 +829,10 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -812,9 +829,10 @@ map_smb_to_linux_error(struct smb_hdr *smb)
return 0; return 0;
if (smb->Flags2 & SMBFLG2_ERR_STATUS) { if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
/* translate the newer STATUS codes to old style errors and then to POSIX errors */ /* translate the newer STATUS codes to old style SMB errors
* and then to POSIX errors */
__u32 err = le32_to_cpu(smb->Status.CifsError); __u32 err = le32_to_cpu(smb->Status.CifsError);
if(cifsFYI & CIFS_RC) if (cifsFYI & CIFS_RC)
cifs_print_status(err); cifs_print_status(err);
ntstatus_to_dos(err, &smberrclass, &smberrcode); ntstatus_to_dos(err, &smberrclass, &smberrcode);
} else { } else {
...@@ -825,18 +843,19 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -825,18 +843,19 @@ map_smb_to_linux_error(struct smb_hdr *smb)
/* old style errors */ /* old style errors */
/* DOS class smb error codes - map DOS */ /* DOS class smb error codes - map DOS */
if (smberrclass == ERRDOS) { /* one byte field no need to byte reverse */ if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */
for (i = 0; for (i = 0;
i < i <
sizeof (mapping_table_ERRDOS) / sizeof (mapping_table_ERRDOS) /
sizeof (struct smb_to_posix_error); i++) { sizeof (struct smb_to_posix_error); i++) {
if (mapping_table_ERRDOS[i].smb_err == 0) if (mapping_table_ERRDOS[i].smb_err == 0)
break; break;
else if (mapping_table_ERRDOS[i].smb_err == smberrcode) { else if (mapping_table_ERRDOS[i].smb_err ==
smberrcode) {
rc = mapping_table_ERRDOS[i].posix_code; rc = mapping_table_ERRDOS[i].posix_code;
break; break;
} }
/* else try the next error mapping one to see if it will match */ /* else try next error mapping one to see if match */
} }
} else if (smberrclass == ERRSRV) { /* server class of error codes */ } else if (smberrclass == ERRSRV) { /* server class of error codes */
for (i = 0; for (i = 0;
...@@ -845,18 +864,21 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -845,18 +864,21 @@ map_smb_to_linux_error(struct smb_hdr *smb)
sizeof (struct smb_to_posix_error); i++) { sizeof (struct smb_to_posix_error); i++) {
if (mapping_table_ERRSRV[i].smb_err == 0) if (mapping_table_ERRSRV[i].smb_err == 0)
break; break;
else if (mapping_table_ERRSRV[i].smb_err == smberrcode) { else if (mapping_table_ERRSRV[i].smb_err ==
smberrcode) {
rc = mapping_table_ERRSRV[i].posix_code; rc = mapping_table_ERRSRV[i].posix_code;
break; break;
} }
/* else try the next error mapping one to see if it will match */ /* else try next error mapping to see if match */
} }
} }
/* else ERRHRD class errors or junk - return EIO */ /* else ERRHRD class errors or junk - return EIO */
cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!", smberrcode,rc)); cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!",
smberrcode, rc));
/* generic corrective action e.g. reconnect SMB session on ERRbaduid could be added */ /* generic corrective action e.g. reconnect SMB session on
* ERRbaduid could be added */
return rc; return rc;
} }
...@@ -888,11 +910,9 @@ smbCalcSize_LE(struct smb_hdr *ptr) ...@@ -888,11 +910,9 @@ smbCalcSize_LE(struct smb_hdr *ptr)
* into Unix UTC (based 1970-01-01, in seconds). * into Unix UTC (based 1970-01-01, in seconds).
*/ */
static int total_days_of_prev_months[] = static int total_days_of_prev_months[] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
__le64 cnvrtDosCifsTm(__u16 date, __u16 time) __le64 cnvrtDosCifsTm(__u16 date, __u16 time)
{ {
return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time))); return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time)));
...@@ -922,6 +942,7 @@ cifs_UnixTimeToNT(struct timespec t) ...@@ -922,6 +942,7 @@ cifs_UnixTimeToNT(struct timespec t)
return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET; return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET;
} }
struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
{ {
struct timespec ts; struct timespec ts;
...@@ -929,20 +950,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -929,20 +950,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
SMB_TIME * st = (SMB_TIME *)&time; SMB_TIME * st = (SMB_TIME *)&time;
SMB_DATE * sd = (SMB_DATE *)&date; SMB_DATE * sd = (SMB_DATE *)&date;
cFYI(1,("date %d time %d",date, time)); cFYI(1, ("date %d time %d", date, time));
sec = 2 * st->TwoSeconds; sec = 2 * st->TwoSeconds;
min = st->Minutes; min = st->Minutes;
if((sec > 59) || (min > 59)) if ((sec > 59) || (min > 59))
cERROR(1,("illegal time min %d sec %d", min, sec)); cERROR(1, ("illegal time min %d sec %d", min, sec));
sec += (min * 60); sec += (min * 60);
sec += 60 * 60 * st->Hours; sec += 60 * 60 * st->Hours;
if(st->Hours > 24) if (st->Hours > 24)
cERROR(1,("illegal hours %d",st->Hours)); cERROR(1, ("illegal hours %d", st->Hours));
days = sd->Day; days = sd->Day;
month = sd->Month; month = sd->Month;
if((days > 31) || (month > 12)) if ((days > 31) || (month > 12))
cERROR(1,("illegal date, month %d day: %d", month, days)); cERROR(1, ("illegal date, month %d day: %d", month, days));
month -= 1; month -= 1;
days += total_days_of_prev_months[month]; days += total_days_of_prev_months[month];
days += 3652; /* account for difference in days between 1980 and 1970 */ days += 3652; /* account for difference in days between 1980 and 1970 */
...@@ -955,11 +976,11 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -955,11 +976,11 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
consider 2 special case years, ie the years 2000 and 2100, and only consider 2 special case years, ie the years 2000 and 2100, and only
adjust for the lack of leap year for the year 2100, as 2000 was a adjust for the lack of leap year for the year 2100, as 2000 was a
leap year (divisable by 400) */ leap year (divisable by 400) */
if(year >= 120) /* the year 2100 */ if (year >= 120) /* the year 2100 */
days = days - 1; /* do not count leap year for the year 2100 */ days = days - 1; /* do not count leap year for the year 2100 */
/* adjust for leap year where we are still before leap day */ /* adjust for leap year where we are still before leap day */
if(year != 120) if (year != 120)
days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0); days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
sec += 24 * 60 * 60 * days; sec += 24 * 60 * 60 * days;
......
/* /*
* fs/cifs/ntlmssp.h * 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) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -27,18 +27,18 @@ ...@@ -27,18 +27,18 @@
#define UnknownMessage cpu_to_le32(8) #define UnknownMessage cpu_to_le32(8)
/* Negotiate Flags */ /* Negotiate Flags */
#define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode #define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are in unicode */
#define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM #define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */
#define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm #define NTLMSSP_REQUEST_TARGET 0x04 /* Server return its auth realm */
#define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability #define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signature capability */
#define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality #define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */
#define NTLMSSP_NEGOTIATE_DGRAM 0x0040 #define NTLMSSP_NEGOTIATE_DGRAM 0x0040
#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal #define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Sign/seal use LM session key */
#define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication #define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */
#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine #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_ALWAYS_SIGN 0x8000 /* Sign for all security levels */
#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 #define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 #define NTLMSSP_TARGET_TYPE_SERVER 0x20000
#define NTLMSSP_TARGET_TYPE_SHARE 0x40000 #define NTLMSSP_TARGET_TYPE_SHARE 0x40000
......
...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = { ...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
}; };
static void static void
permute(char *out, char *in, uchar * p, int n) permute(char *out, char *in, uchar *p, int n)
{ {
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
char *rl; char *rl;
/* Have to reduce stack usage */ /* Have to reduce stack usage */
pk1 = kmalloc(56+56+64+64,GFP_KERNEL); pk1 = kmalloc(56+56+64+64, GFP_KERNEL);
if(pk1 == NULL) if (pk1 == NULL)
return; return;
ki = kmalloc(16*48, GFP_KERNEL); ki = kmalloc(16*48, GFP_KERNEL);
if(ki == NULL) { if (ki == NULL) {
kfree(pk1); kfree(pk1);
return; return;
} }
cd = pk1 + 56; cd = pk1 + 56;
pd1= cd + 56; pd1 = cd + 56;
rl = pd1 + 64; rl = pd1 + 64;
permute(pk1, key, perm1, 56); permute(pk1, key, perm1, 56);
...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
char *r2; /* r2[32] */ char *r2; /* r2[32] */
er = kmalloc(48+48+32+32+32, GFP_KERNEL); er = kmalloc(48+48+32+32+32, GFP_KERNEL);
if(er == NULL) { if (er == NULL) {
kfree(pk1); kfree(pk1);
kfree(ki); kfree(ki);
return; return;
...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) ...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
char *keyb; /* keyb[64] */ char *keyb; /* keyb[64] */
unsigned char key2[8]; unsigned char key2[8];
outb = kmalloc(64 * 3,GFP_KERNEL); outb = kmalloc(64 * 3, GFP_KERNEL);
if(outb == NULL) if (outb == NULL)
return; return;
inb = outb + 64; inb = outb + 64;
...@@ -372,20 +372,20 @@ E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24) ...@@ -372,20 +372,20 @@ E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24)
smbhash(p24 + 16, c8, p21 + 14, 1); 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) D_P16(unsigned char *p14, unsigned char *in, unsigned char *out)
{ {
smbhash(out, in, p14, 0); smbhash(out, in, p14, 0);
smbhash(out + 8, in + 8, p14 + 7, 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) E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out)
{ {
smbhash(out, in, p14, 1); smbhash(out, in, p14, 1);
smbhash(out + 8, in + 8, p14 + 7, 1); smbhash(out + 8, in + 8, p14 + 7, 1);
} }
#if 0
/* these routines are currently unneeded, but may be /* these routines are currently unneeded, but may be
needed later */ needed later */
void void
......
...@@ -51,11 +51,8 @@ ...@@ -51,11 +51,8 @@
void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
void E_md4hash(const unsigned char *passwd, unsigned char *p16); 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, static void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
unsigned char p24[24]); 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); void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
/* /*
...@@ -77,8 +74,8 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) ...@@ -77,8 +74,8 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
SMBOWFencrypt(p21, c8, p24); SMBOWFencrypt(p21, c8, p24);
memset(p14,0,15); memset(p14, 0, 15);
memset(p21,0,21); memset(p21, 0, 21);
} }
/* Routines for Windows NT MD4 Hash functions. */ /* Routines for Windows NT MD4 Hash functions. */
...@@ -100,7 +97,7 @@ _my_wcslen(__u16 * str) ...@@ -100,7 +97,7 @@ _my_wcslen(__u16 * str)
static int static int
_my_mbstowcs(__u16 * dst, const unsigned char *src, int len) _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; int i;
__u16 val; __u16 val;
...@@ -126,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) ...@@ -126,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
__u16 wpwd[129]; __u16 wpwd[129];
/* Password cannot be longer than 128 characters */ /* Password cannot be longer than 128 characters */
if(passwd) { if (passwd) {
len = strlen((char *) passwd); len = strlen((char *) passwd);
if (len > 128) { if (len > 128) {
len = 128; len = 128;
...@@ -141,11 +138,12 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) ...@@ -141,11 +138,12 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
len = _my_wcslen(wpwd) * sizeof (__u16); len = _my_wcslen(wpwd) * sizeof (__u16);
mdfour(p16, (unsigned char *) wpwd, len); 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 */ /* 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]) nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
{ {
char passwd[514]; char passwd[514];
...@@ -171,6 +169,7 @@ nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]) ...@@ -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). */ /* clear out local copy of user's password (just being paranoid). */
memset(passwd, '\0', sizeof (passwd)); memset(passwd, '\0', sizeof (passwd));
} }
#endif
/* Does the NTLMv2 owfs of a user's password */ /* Does the NTLMv2 owfs of a user's password */
#if 0 /* function not needed yet - but will be soon */ #if 0 /* function not needed yet - but will be soon */
...@@ -179,14 +178,14 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, ...@@ -179,14 +178,14 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
const char *domain_n, unsigned char kr_buf[16], const char *domain_n, unsigned char kr_buf[16],
const struct nls_table *nls_codepage) const struct nls_table *nls_codepage)
{ {
wchar_t * user_u; wchar_t *user_u;
wchar_t * dom_u; wchar_t *dom_u;
int user_l, domain_l; int user_l, domain_l;
struct HMACMD5Context ctx; struct HMACMD5Context ctx;
/* might as well do one alloc to hold both (user_u and dom_u) */ /* might as well do one alloc to hold both (user_u and dom_u) */
user_u = kmalloc(2048 * sizeof(wchar_t),GFP_KERNEL); user_u = kmalloc(2048 * sizeof(wchar_t), GFP_KERNEL);
if(user_u == NULL) if (user_u == NULL)
return; return;
dom_u = user_u + 1024; dom_u = user_u + 1024;
...@@ -223,7 +222,8 @@ SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8, ...@@ -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. */ /* 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], NTLMSSPOWFencrypt(unsigned char passwd[8],
unsigned char *ntlmchalresp, unsigned char p24[24]) unsigned char *ntlmchalresp, unsigned char p24[24])
{ {
...@@ -235,6 +235,7 @@ NTLMSSPOWFencrypt(unsigned char passwd[8], ...@@ -235,6 +235,7 @@ NTLMSSPOWFencrypt(unsigned char passwd[8],
E_P24(p21, ntlmchalresp, p24); E_P24(p21, ntlmchalresp, p24);
} }
#endif
/* Does the NT MD4 hash then des encryption. */ /* Does the NT MD4 hash then des encryption. */
...@@ -255,8 +256,8 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) ...@@ -255,8 +256,8 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
#if 0 #if 0
static void static void
SMBOWFencrypt_ntv2(const unsigned char kr[16], SMBOWFencrypt_ntv2(const unsigned char kr[16],
const struct data_blob * srv_chal, const struct data_blob *srv_chal,
const struct data_blob * cli_chal, unsigned char resp_buf[16]) const struct data_blob *cli_chal, unsigned char resp_buf[16])
{ {
struct HMACMD5Context ctx; struct HMACMD5Context ctx;
......
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