Commit 3a615de9 authored by Steve French's avatar Steve French

Initial check in of cifs filesystem version 0.54 for Linux 2.5 (to clean tree as one changeset)

parent 583bcb77
......@@ -8,6 +8,8 @@ affs.txt
- info and mount options for the Amiga Fast File System.
bfs.txt
- info for the SCO UnixWare Boot Filesystem (BFS).
cifs.txt
- description of the CIFS filesystem
coda.txt
- description of the CODA filesystem.
cramfs.txt
......
This module, cifs, is a filesystem that implements the SMB/CIFS protocol, which is the
protocol used by Windows based operating systems (including Windows 2000 and its successors)
as well as Samba, OS/2 and many others operating systems and network file server appliances.
The Cifs VFS filesystem module is designed to work well with servers that implement the newer versions
(dialects) of the SMB/CIFS protocol such as Samba, the program written by Andrew Tridgell
that turns any Unix host into a file server for DOS or Windows clients, as well as Windows NT,
Windows 2000 and its successors. It is not designed to handle older smb servers well, those that
implement older versions of the dialect (such as OS/2 or Windows 95), for this purpose use smbfs.
This module can support mounting without a mount helper program. The mount syntax is:
mount //server_ip_address/share_name /mnt -o user=username,password=your_password
where "username", "your_password" and "server_ip_address" and "share_name" should be replaced
with specific values (supplied by the user) e.g.
mount //9.53.216.16/public /mnt -o user=jsmith,password=openup
This cifs implementation is designed to handle network caching (safely) as well as to implement locking,
large file (64 bit access), distributed file system ("dfs") and other advanced protocol features. It
also implements the SNIA standard for Unix extensions to CIFS (when communicating with servers such as
Samba 2.2.3 or later which support it).
For more information contact sfrench@us.ibm.com
Cifs is an SMB client (or gateway). For more info on the SMB/CIFS protocol and Samba, including
documentation, please go to http://www.samba.org/ and then on to your nearest mirror. For more
information about the cifs vfs, go to the project page at:
http://us1.samba.org/samba/Linux_CIFS_client.html
......@@ -950,6 +950,33 @@ CONFIG_VXFS_FS
module, say M here and read <file:Documentation/modules.txt>. If
unsure, say N.
CIFS (Common Internet File System) support
CONFIG_CIFS
This is the client VFS module for the Common Internet File System
(CIFS) protocol which is the successor to the Server Message Block
(SMB) protocol, the native file sharing mechanism for most early
PC operating systems. CIFS is fully supported by current network
file servers such as Windows 2000 (including Windows NT version 4
and Windows XP) as well by Samba (which provides excellent CIFS
server support for Linux and many other operating systems). For
production systems the smbfs module may be used instead of this
cifs module since smbfs is currently more stable and provides
support for older servers. The intent of this module is to provide the
most advanced network file system function for CIFS compliant servers,
including support for dfs (heirarchical name space), secure per-user
session establishment, safe distributed caching (oplock), optional
packet signing, Unicode and other internationalization improvements, and
optional Winbind (nsswitch) integration. This module is in an early
development stage, so unless you are specifically interested in this
filesystem, just say N.
CIFS Debugging
CONFIG_CIFS_DEBUG
If you are experiencing any problems with the CIFS filesystem, say
Y here. This will result in additional debugging messages to be
written to the system log. Under normal circumstances, this
results in very little overhead.
CONFIG_SMB_FS
SMB (Server Message Block) is the protocol Windows for Workgroups
(WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share
......
......@@ -140,6 +140,8 @@ if [ "$CONFIG_NET" = "y" ]; then
fi
define_tristate CONFIG_EXPORTFS $CONFIG_NFSD
dep_tristate 'CIFS support (advanced network filesystem for Samba, Window and other CIFS compliant servers)(EXPERIMENTAL)' CONFIG_CIFS $CONFIG_INET
dep_tristate 'SMB file system support (to mount Windows shares etc.)' CONFIG_SMB_FS $CONFIG_INET
if [ "$CONFIG_SMB_FS" != "n" ]; then
bool ' Use a default NLS' CONFIG_SMB_NLS_DEFAULT
......
......@@ -65,6 +65,7 @@ obj-$(CONFIG_LOCKD) += lockd/
obj-$(CONFIG_NLS) += nls/
obj-$(CONFIG_SYSV_FS) += sysv/
obj-$(CONFIG_SMB_FS) += smbfs/
obj-$(CONFIG_CIFS) += cifs/
obj-$(CONFIG_NCP_FS) += ncpfs/
obj-$(CONFIG_HPFS_FS) += hpfs/
obj-$(CONFIG_NTFS_FS) += ntfs/
......
Original Author
===============
Steve French (sfrench@samba.org)
The author wishes to express his appreciation and thanks to:
Andrew Tridgell (Samba team) for his early suggestions about smb/cifs VFS
improvements. Thanks to IBM for allowing me the time and test resources to pursue
this project. Jim McDonough from IBM (and the Samba Team) for his help.
The IBM Linux JFS team for explaining many esoteric Linux filesystem features.
Dave Boutcher of IBM Rochester (author of the OS/400 smb/cifs filesystem client)
for proving years ago that a very good smb/cifs client could be done on a Unix like
operating system. Volker Lendecke, Andrew Tridgell, Urban Widmark, John Newbigin
and others for their work on the Linux smbfs module over the years. Thanks to
the other members of the Storage Network Industry Association CIFS Technical
Workgroup for their work specifying this highly complex protocol and finally
thanks to the Samba team for their technical advice and encouragement.
Version 0.54
------------
Fix problem with captive thread hanging around at unmount time. Adjust to 2.5.42-pre
changes to superblock layout. Remove wasteful allocation of smb buffers (now the send
buffer is reused for responses). Add more oplock handling. Additional minor cleanup.
Version 0.53
------------
More stylistic updates to better match kernel style. Add additional statistics
for filesystem which can be viewed via /proc/fs/cifs. Add more pieces of NTLMv2
and CIFS Packet Signing enablement.
Version 0.52
------------
Replace call to sleep_on with safer wait_on_event.
Make stylistic changes to better match kernel style recommendations.
Remove most typedef usage (except for the PDUs themselves).
Version 0.51
------------
Update mount so the -unc mount option is no longer required (the ip address can be specified
in a UNC style device name. Implementation of readpage/writepage started.
Version 0.50
------------
Fix intermittent problem with incorrect smb header checking on badly
fragmented tcp responses
Version 0.49
------------
Fixes to setting of allocation size and file size.
Version 0.48
------------
Various 2.5.38 fixes. Now works on 2.5.38
Version 0.47
------------
Prepare for 2.5 kernel merge. Remove ifdefs.
Version 0.46
------------
Socket buffer management fixes. Fix dual free.
Version 0.45
------------
Various big endian fixes for hardlinks and symlinks and also for dfs.
Version 0.44
------------
Various big endian fixes for servers with Unix extensions such as Samba
Version 0.43
------------
Various FindNext fixes for incorrect filenames on large directory searches on big endian
clients. basic posix file i/o tests now work on big endian machines, not just le
Version 0.42
------------
SessionSetup and NegotiateProtocol now work from Big Endian machines.
Various Big Endian fixes found during testing on the Linux on 390. Various fixes for compatability with older
versions of 2.4 kernel (now builds and works again on kernels at least as early as 2.4.7).
Version 0.41
------------
Various minor fixes for Connectathon Posix "basic" file i/o test suite. Directory caching fixed so hardlinked
files now return the correct rumber of links on fstat as they are repeatedly linked and unlinked.
Version 0.40
------------
Implemented "Raw" (i.e. not encapsulated in SPNEGO) NTLMSSP (i.e. the Security Provider Interface used to negotiate
session advanced session authentication). Raw NTLMSSP is preferred by Windows 2000 Professional and Windows XP.
Began implementing support for SPNEGO encapsulation of NTLMSSP based session authentication blobs
(which is the mechanism preferred by Windows 2000 server in the absence of Kerberos).
Version 0.38
------------
Introduced optional mount helper utility mount.cifs and made coreq changes to cifs vfs to enable
it. Fixed a few bugs in the DFS code (e.g. bcc two bytes too short and incorrect uid in PDU).
Version 0.37
------------
Rewrote much of connection and mount/unmount logic to handle bugs with
multiple uses to same share, multiple users to same server etc.
Version 0.36
------------
Fixed major problem with dentry corruption (missing call to dput)
Version 0.35
------------
Rewrite of readdir code to fix bug. Various fixes for bigendian machines.
Begin adding oplock support. Multiusermount and oplockEnabled flags added to /proc/fs/cifs
although corresponding function not fully implemented in the vfs yet
Version 0.34
------------
Fixed dentry caching bug, misc. cleanup
Version 0.33
------------
Fixed 2.5 support to handle build and configure changes as well as misc. 2.5 changes. Now can build
on current 2.5 beta version (2.5.24) of the Linux kernel as well as on 2.4 Linux kernels.
Support for STATUS codes (newer 32 bit NT error codes) added. DFS support begun to be added.
Version 0.32
------------
Unix extensions (symlink, readlink, hardlink, chmod and some chgrp and chown) implemented
and tested against Samba 2.2.5
Version 0.31
------------
1) Fixed lockrange to be correct (it was one byte too short)
2) Fixed GETLK (i.e. the fcntl call to test a range of bytes in a file to see if locked) to correctly
show range as locked when there is a conflict with an existing lock.
3) default file perms are now 2767 (indicating support for mandatory locks) instead of 777 for directories
in most cases. Eventually will offer optional ability to query server for the correct perms.
3) Fixed eventual trap when mounting twice to different shares on the same server when the first succeeded
but the second one was invalid and failed (the second one was incorrectly disconnecting the tcp and smb
session)
4) Fixed error logging of valid mount options
5) Removed logging of password field.
6) Moved negotiate, treeDisconnect and uloggoffX (only tConx and SessSetup remain in connect.c) to cifssmb.c
and cleaned them up and made them more consistent with other cifs functions.
7) Server support for Unix extensions is now fully detected and FindFirst is implemented both ways
(with or without Unix exentions) but FindNext and QueryPathInfo with the Unix extensions are not completed,
nor is the symlink support using the Unix extensions
8) Started adding the readlink and follow_link code
Version 0.3
-----------
Initial drop
#
# Makefile for Linux CIFS VFS client
#
obj-$(CONFIG_CIFS) += cifs.o
cifs-objs := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o
include $(TOPDIR)/Rules.make
This is the CIFS VFS support for Linux. It supports many advanced network filesystem
features such as heirarchical dfs like filesystem, hardlinks, locking and more.
It was designed to comply with the SNIA CIFS Technical Reference (which supersedes
the 1992 X/Open SMB Standard) as well as to perform best practice practical
interoperability with Windows 2000, Windows XP, Samba and equivalent
servers.
For questions or bug reports please contact sfrench@samba.org (sfrench@us.ibm.com)
Build instructions:
==================
extract the kernel from http://www.cifs.bkbits.net/linux-2.5 or
http://www.cifs.bkbits.net/linux-2.4
make menuconfig (or make xconfig)
select cifs from within the network filesystem choices
save and exit
make dep
make modules (or "make" if you did not select CIFS VFS to be built as a module)
Installation instructions:
=========================
If you have built the CIFS vfs as module (successfully)you
simply type "make modules_install" (or if you prefer manually copy the file to
the modules directory e.g. /lib/modules/2.4.10-4GB/kernel/fs/cifs/cifs.o).
If you have built the CIFS vfs into the kernel itself, follow the instructions
for your distribution on how to install a new kernel (usually you
would simply type "make install").
If you do not have the utility mount.cifs (in the Samba 3.0 source tree and on the
CIFS VFS web site) copy it to the directory /sbin (or the same directory in which
mount.smbfs resides). Although no helper software is required, the installation
of mount.cifs is recommended. Eventually the Samba 3.0 utility program "net"
may also be helpful since it may someday provide easier mount syntax for users used
to Windows e.g.
net use <mount point> <UNC name or cifs URL>
and there will likely be other helper programs available ala smbmount to provide
additional optional function in the future. Note that running Winbind on all
of your Linux clients is useful in mapping Uids and Gids consistently to the
proper network user.
Samba Considerations
====================
To get the maximum benefit from the CIFS VFS, we recommend using a server that
supports the SNIA CIFS Unix Extensions standard (e.g. Samba 2.2.5 or Samba 3.0)
but the CIFS vfs works fine with a wide variety of CIFS servers. Note that the
uid, gid and file permissions will display default values if you do not have
a server that supports the Unix extensions for CIFS (such as Samba 2.2.3 or
later). To enable the Unix CIFS Extensions in the Samba server, add the line:
unix extensions = yes
to your smb.conf file on the server. Note that the following smb.conf settings are
also useful (on the Samba server) when the majority of clients are Unix
or Linux:
case sensitive = yes
delete readonly = yes
Some administrators also change the "map archive" and the "create mask" parameters
from their defaults. For more information on these see the manual pages
("man smb.conf") on the Samba server system. Note that the cifs vfs, unlike the
smbfs vfs, does not read the smb.conf on the client system (the few optional settings
are passed in on mount via -o parameters instead).
Use instructions:
================
Once the CIFS VFS support is built into the kernel or installed as a module (cifs.o),
you can use mount syntax like the following to access Samba or Windows servers:
mount -t cifs //9.53.216.11/e$ /mnt -o user=myname,pass=mypassword
after -o the following cifs vfs specific options are supported:
user=<username>
pass=<password>
domain=<domain name>
TCP names (in addition to ip addresses) will be available when the mount helper
(mount.cifs) is complete
Restrictions
============
Servers must support the NTLM SMB dialect (which is the most recent, supported by Samba
and Windows NT, 2000 and XP and many other SMB/CIFS servers) and servers must support
either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC 1001/1002 support for
"Netbios-Over-TCP/IP." Neither of these is likely to be a problem as most servers
support this. IPv6 support is planned for the future.
Misc /proc/fs/cifs Flags and Debug Info
=======================================
Various experimental features and tracing can be enabled by changing flags in /proc/fs/cifs (after
the cifs module has been installed or built into the kernel, e.g. insmod cifs). To enable
a feature you can set it to 1 e.g. to enable tracing to the kernel message log you can do
"echo 1 > /proc/fs/cifs/cifsFYI" and "echo 1 > /proc/fs/cifs/traceSMB"
Also note that "cat /proc/fs/cifs/DebugData" will display some information about the currently
active sessions and the shares that are mounted. Currently the ntlmv2 enablement and packet
signing will not work since they the implementation is not quite complete, so do not enable
these flags unless you are doing specific testing. Enabling extended security works to
Windows 2000 Workstations and XP but not to Windows 2000 server or Samba since it does not
usually send "raw NTLMSSP" (instead it sends NTLMSSP encapsulated in SPNEGO/GSSAPI, which
support is not complete in the CIFS VFS yet).
version 0.5.3 October 8th, 2002
A Partial List of Known Problems and Missing Features
=====================================================
Contributions are welcome. There are plenty of opportunities
for visible, important contributions to this module. Here
is a partial list of the known problems and missing features:
a) Support for SecurityDescriptors for chmod/chgrp/chown
b) Better pam/winbind integration
c) multi-user mounts - multiplexed sessionsetups over single vc
(ie tcp session) - prettying up needed
d) Kerberos/SPNEGO session setup support - (started)
e)NTLMv2 authentication and MD5-HMAC signing of SMB PDUs - (mostly implemented)
f) oplock support (ie safe CIFS distributed file caching) is not complete.
In addition Directory entry caching relies on a 1 second timer, rather than
using FindNotify or equivalent. - (started)
g) There may be a few additional changes that could be done to take advantage
of recent 2.5 kernel improvements in byte-range locking
h) quota support
i) support for the Linux 2.5 kernel new feature get_xattr and set_xattr
j) finish off the mount helper, mount.cifs - (started)
k) support for memory mapped files only partially works until support for
MS_INVALIDATE implemented. readpage and writepage code not finished (started)
KNOWN BUGS (updated October 8nd, 2002)
====================================
1) symbolic links (Windows reparse points) are recognized but
can not be created remotely. They are implemented for Samba and those that
support the CIFS Unix extensions but Samba has a bug currently handling
symlink text beginning with slash
2) delete of file with read-only attribute set will fail (may be ok)
3) autoreconnection logic is only partially complete.
Misc testing to do
=================
1) check out max path names and max path name components against various server
types.
2) Run POSIX bencharks against cifs
3) Run dbench
4) Finish FSX testing on SMP now that we workaround the Samba bug
This diff is collapsed.
This diff is collapsed.
/*
*
* Copyright (c) International Business Machines Corp., 2000,2002
* Modified by Steve French (sfrench@us.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define CIFS_DEBUG /* BB temporary */
#ifndef _H_CIFS_DEBUG
#define _H_CIFS_DEBUG
void dump_mem(char *label, void *data, int length);
extern int traceSMB; /* flag which enables the function below */
void dump_smb(struct smb_hdr *, int);
/*
* debug ON
* --------
*/
#ifdef CIFS_DEBUG
/* information message: e.g., configuration, major event */
extern int cifsFYI;
#define cFYI(button,prspec)\
{ if (button && cifsFYI) printk prspec; }
/* debug event message: */
#define cEVENT(button,prspec)\
{ if (button) printk prspec; }
/* error event message: e.g., i/o error */
extern int cifsERROR;
#define cERROR(button, prspec)\
{ if (button && cifsERROR) { printk prspec; if (button > 1) BUG(); } }
/*
* debug OFF
* ---------
*/
#else /* _CIFS_DEBUG */
#define cERROR(button,prspec)
#define cEVENT(button,prspec)
#define cFYI(button, prspec)
#endif /* _CIFS_DEBUG */
/*
* statistics
* ----------
*/
#ifdef _CIFS_STATISTICS
#define INCREMENT(x) ((x)++)
#define DECREMENT(x) ((x)--)
#define HIGHWATERMARK(x,y) x = MAX((x), (y))
#else
#define INCREMENT(x)
#define DECREMENT(x)
#define HIGHWATERMARK(x,y)
#endif /* _CIFS_STATISTICS */
#endif /* _H_CIFS_DEBUG */
/*
* fs/cifs/cifs_fs_sb.h
*
* Copyright (c) International Business Machines Corp., 2002
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU Lesser General Public License for more details.
*
*/
#ifndef _CIFS_FS_SB_H
#define _CIFS_FS_SB_H
struct cifs_sb_info {
struct cifsTconInfo *tcon; /* primary mount */
/* list of implicit mounts beneath this mount point - needed in dfs case */
struct list_head nested_tcon_q;
struct nls_table *local_nls;
};
#endif /* _CIFS_FS_SB_H */
/*
* fs/cifs/cifs_unicode.c
*
* Copyright (c) International Business Machines Corp., 2000,2002
* Modified by Steve French (sfrench@us.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/fs.h>
#include "cifs_unicode.h"
#include "cifs_uniupr.h"
#include "cifspdu.h"
#include "cifs_debug.h"
/*
* NAME: toUpper()
*
* FUNCTION: Upper case ASCII string (in place) using the current codepage
*
*/
void
toUpper(const struct nls_table *n, char *mixed_string)
{
int i;
char temp;
for (i = 0; i < strlen(mixed_string); i++) {
temp = mixed_string[i];
mixed_string[i] = n->charset2upper[(int) temp];
}
}
/*
* NAME: cifs_strfromUCS()
*
* FUNCTION: Convert little-endian unicode string to character string
*
*/
int
cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
int len, const struct nls_table *codepage)
{
int i;
int outlen = 0;
for (i = 0; (i < len) && from[i]; i++) {
int charlen;
/* 2.4.0 kernel or greater */
charlen =
codepage->uni2char(le16_to_cpu(from[i]), &to[outlen],
NLS_MAX_CHARSET_SIZE);
if (charlen > 0) {
outlen += charlen;
} else {
to[outlen++] = '?';
}
}
to[outlen] = 0;
cEVENT(0, ("cifs_strfromUCS returning %d - '%s'\n", outlen, to));
return outlen;
}
/*
* NAME: cifs_strtoUCS()
*
* FUNCTION: Convert character string to unicode string
*
*/
int
cifs_strtoUCS(wchar_t * to, const char *from, int len,
const struct nls_table *codepage)
{
int charlen;
int i;
cEVENT(0, ("cifs_strtoUCS - '%s'\n", from));
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
/* works for 2.4.0 kernel or later */
charlen = codepage->char2uni(from, len, &to[i]);
if (charlen < 1) {
cERROR(1,
("cifs_strtoUCS: char2uni returned %d.\n",
charlen));
to[i] = cpu_to_le16(0x003f); /* a question mark */
charlen = 1;
}
to[i] = cpu_to_le16(to[i]);
}
cEVENT(0, (" returning %d\n", i));
to[i] = 0;
return i;
}
/*
* NAME: get_UCSname2()
*
* FUNCTION: Allocate and translate to unicode string
*
*/
/*int
get_UCSname2(struct component_name *uniName, struct dentry *dentry,
struct nls_table *nls_tab)
{
int length = dentry->d_name.len;
if (length > 255)
return ENAMETOOLONG;
uniName->name = kmalloc((length + 1) * sizeof (wchar_t), GFP_KERNEL);
if (uniName->name == NULL)
return ENOSPC;
uniName->namlen = cifs_strtoUCS(uniName->name, dentry->d_name.name,
length, nls_tab);
return 0;
} */
/*
* cifs_unicode: Unicode kernel case support
*
* Function:
* Convert a unicode character to upper or lower case using
* compressed tables.
*
* Copyright (c) International Business Machines Corp., 2000,2002
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Notes:
* These APIs are based on the C library functions. The semantics
* should match the C functions but with expanded size operands.
*
* The upper/lower functions are based on a table created by mkupr.
* This is a compressed table of upper and lower case conversion.
*
*/
#include <asm/byteorder.h>
#include <linux/types.h>
#include <linux/nls.h>
#define UNIUPR_NOLOWER /* Example to not expand lower case tables */
/* Just define what we want from uniupr.h. We don't want to define the tables
* in each source file.
*/
#ifndef UNICASERANGE_DEFINED
struct UniCaseRange {
wchar_t start;
wchar_t end;
signed char *table;
};
#endif /* UNICASERANGE_DEFINED */
#ifndef UNIUPR_NOUPPER
extern signed char CifsUniUpperTable[512];
extern const struct UniCaseRange CifsUniUpperRange[];
#endif /* UNIUPR_NOUPPER */
#ifndef UNIUPR_NOLOWER
extern signed char UniLowerTable[512];
extern struct UniCaseRange UniLowerRange[];
#endif /* UNIUPR_NOLOWER */
/*
* directory entry argument
*/
struct component_name {
int namlen;
wchar_t *name;
};
#ifdef __KERNEL__
int cifs_strfromUCS_le(char *, const wchar_t *, int, const struct nls_table *);
int cifs_strtoUCS(wchar_t *, const char *, int, const struct nls_table *);
int cifs_UCSname(struct component_name *, struct dentry *,
const struct nls_table *);
void toUpper(const struct nls_table *, char *);
#endif
#define free_UCSname(COMP) kfree((COMP)->name)
/*
* UniStrcat: Concatenate the second string to the first
*
* Returns:
* Address of the first string
*/
static inline wchar_t *
UniStrcat(wchar_t * ucs1, const wchar_t * ucs2)
{
wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */
while (*ucs1++) ; /* To end of first string */
ucs1--; /* Return to the null */
while ((*ucs1++ = *ucs2++)) ; /* copy string 2 over */
return anchor;
}
/*
* UniStrchr: Find a character in a string
*
* Returns:
* Address of first occurance of character in string
* or NULL if the character is not in the string
*/
static inline wchar_t *
UniStrchr(const wchar_t * ucs, wchar_t uc)
{
while ((*ucs != uc) && *ucs)
ucs++;
if (*ucs == uc)
return (wchar_t *) ucs;
return NULL;
}
/*
* UniStrcmp: Compare two strings
*
* Returns:
* < 0: First string is less than second
* = 0: Strings are equal
* > 0: First string is greater than second
*/
static inline int
UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2)
{
while ((*ucs1 == *ucs2) && *ucs1) {
ucs1++;
ucs2++;
}
return (int) *ucs1 - (int) *ucs2;
}
/*
* UniStrcpy: Copy a string
*/
static inline wchar_t *
UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
{
wchar_t *anchor = ucs1; /* save the start of result string */
while ((*ucs1++ = *ucs2++)) ;
return anchor;
}
/*
* UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes)
*/
static inline size_t
UniStrlen(const wchar_t * ucs1)
{
int i = 0;
while (*ucs1++)
i++;
return i;
}
/*
* UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a string (length limited)
*/
static inline size_t
UniStrnlen(const wchar_t * ucs1, int maxlen)
{
int i = 0;
while (*ucs1++) {
i++;
if (i >= maxlen)
break;
}
return i;
}
/*
* UniStrncat: Concatenate length limited string
*/
static inline wchar_t *
UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
{
wchar_t *anchor = ucs1; /* save pointer to string 1 */
while (*ucs1++) ;
ucs1--; /* point to null terminator of s1 */
while (n-- && (*ucs1 = *ucs2)) { /* copy s2 after s1 */
ucs1++;
ucs2++;
}
*ucs1 = 0; /* Null terminate the result */
return (anchor);
}
/*
* UniStrncmp: Compare length limited string
*/
static inline int
UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
{
if (!n)
return 0; /* Null strings are equal */
while ((*ucs1 == *ucs2) && *ucs1 && --n) {
ucs1++;
ucs2++;
}
return (int) *ucs1 - (int) *ucs2;
}
/*
* UniStrncmp_le: Compare length limited string - native to little-endian
*/
static inline int
UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
{
if (!n)
return 0; /* Null strings are equal */
while ((*ucs1 == __le16_to_cpu(*ucs2)) && *ucs1 && --n) {
ucs1++;
ucs2++;
}
return (int) *ucs1 - (int) __le16_to_cpu(*ucs2);
}
/*
* UniStrncpy: Copy length limited string with pad
*/
static inline wchar_t *
UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
{
wchar_t *anchor = ucs1;
while (n-- && *ucs2) /* Copy the strings */
*ucs1++ = *ucs2++;
n++;
while (n--) /* Pad with nulls */
*ucs1++ = 0;
return anchor;
}
/*
* UniStrncpy_le: Copy length limited string with pad to little-endian
*/
static inline wchar_t *
UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
{
wchar_t *anchor = ucs1;
while (n-- && *ucs2) /* Copy the strings */
*ucs1++ = __le16_to_cpu(*ucs2++);
n++;
while (n--) /* Pad with nulls */
*ucs1++ = 0;
return anchor;
}
/*
* UniStrstr: Find a string in a string
*
* Returns:
* Address of first match found
* NULL if no matching string is found
*/
static inline wchar_t *
UniStrstr(const wchar_t * ucs1, const wchar_t * ucs2)
{
const wchar_t *anchor1 = ucs1;
const wchar_t *anchor2 = ucs2;
while (*ucs1) {
if (*ucs1 == *ucs2) { /* Partial match found */
ucs1++;
ucs2++;
} else {
if (!*ucs2) /* Match found */
return (wchar_t *) anchor1;
ucs1 = ++anchor1; /* No match */
ucs2 = anchor2;
}
}
if (!*ucs2) /* Both end together */
return (wchar_t *) anchor1; /* Match found */
return NULL; /* No match */
}
#ifndef UNIUPR_NOUPPER
/*
* UniToupper: Convert a unicode character to upper case
*/
static inline wchar_t
UniToupper(register wchar_t uc)
{
register const struct UniCaseRange *rp;
if (uc < sizeof (CifsUniUpperTable)) { /* Latin characters */
return uc + CifsUniUpperTable[uc]; /* Use base tables */
} else {
rp = CifsUniUpperRange; /* Use range tables */
while (rp->start) {
if (uc < rp->start) /* Before start of range */
return uc; /* Uppercase = input */
if (uc <= rp->end) /* In range */
return uc + rp->table[uc - rp->start];
rp++; /* Try next range */
}
}
return uc; /* Past last range */
}
/*
* UniStrupr: Upper case a unicode string
*/
static inline wchar_t *
UniStrupr(register wchar_t * upin)
{
register wchar_t *up;
up = upin;
while (*up) { /* For all characters */
*up = UniToupper(*up);
up++;
}
return upin; /* Return input pointer */
}
#endif /* UNIUPR_NOUPPER */
#ifndef UNIUPR_NOLOWER
/*
* UniTolower: Convert a unicode character to lower case
*/
static inline wchar_t
UniTolower(wchar_t uc)
{
register struct UniCaseRange *rp;
if (uc < sizeof (UniLowerTable)) { /* Latin characters */
return uc + UniLowerTable[uc]; /* Use base tables */
} else {
rp = UniLowerRange; /* Use range tables */
while (rp->start) {
if (uc < rp->start) /* Before start of range */
return uc; /* Uppercase = input */
if (uc <= rp->end) /* In range */
return uc + rp->table[uc - rp->start];
rp++; /* Try next range */
}
}
return uc; /* Past last range */
}
/*
* UniStrlwr: Lower case a unicode string
*/
static inline wchar_t *
UniStrlwr(register wchar_t * upin)
{
register wchar_t *up;
up = upin;
while (*up) { /* For all characters */
*up = UniTolower(*up);
up++;
}
return upin; /* Return input pointer */
}
#endif
This diff is collapsed.
This diff is collapsed.
/*
* fs/cifs/cifsfs.h
*
* Copyright (c) International Business Machines Corp., 2002
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _CIFSFS_H
#define _CIFSFS_H
#define ROOT_I 2
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
extern int map_cifs_error(int error_class, int error_code,
int status_codes_negotiated);
extern struct address_space_operations cifs_addr_ops;
/* Functions related to super block operations */
extern struct super_operations cifs_super_ops;
extern void cifs_put_inode(struct inode *);
extern void cifs_read_inode(struct inode *);
extern void cifs_delete_inode(struct inode *);
/* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */
/* Functions related to inodes */
extern struct inode_operations cifs_dir_inode_ops;
extern int cifs_create(struct inode *, struct dentry *, int);
extern struct dentry *cifs_lookup(struct inode *, struct dentry *);
extern int cifs_unlink(struct inode *, struct dentry *);
extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
extern int cifs_mkdir(struct inode *, struct dentry *, int);
extern int cifs_rmdir(struct inode *, struct dentry *);
extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
struct dentry *);
extern int cifs_revalidate(struct dentry *);
extern int cifs_setattr(struct dentry *, struct iattr *);
extern struct inode_operations cifs_file_inode_ops;
extern void cifs_truncate_file(struct inode *);
extern struct inode_operations cifs_symlink_inode_ops;
/* Functions related to files and directories */
extern struct file_operations cifs_file_ops;
extern int cifs_open(struct inode *inode, struct file *file);
extern int cifs_close(struct inode *inode, struct file *file);
extern int cifs_closedir(struct inode *inode, struct file *file);
extern ssize_t cifs_read(struct file *file, char *read_data,
size_t read_size, loff_t * poffset);
extern ssize_t cifs_write(struct file *file, const char *write_data,
size_t write_size, loff_t * poffset);
extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, struct dentry *, int);
extern struct file_operations cifs_dir_ops;
extern int cifs_dir_open(struct inode *inode, struct file *file);
extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir);
/* Functions related to dir entries */
extern struct dentry_operations cifs_dentry_ops;
/* Functions related to symlinks */
extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
extern int cifs_readlink(struct dentry *direntry, char *buffer, int buflen);
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
const char *symname);
#endif /* _CIFSSMB_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef MD5_H
#define MD5_H
#ifndef HEADER_MD5_H
/* Try to avoid clashes with OpenSSL */
#define HEADER_MD5_H
#endif
struct MD5Context {
__u32 buf[4];
__u32 bits[2];
unsigned char in[64];
};
#endif /* !MD5_H */
#ifndef _HMAC_MD5_H
struct HMACMD5Context {
struct MD5Context ctx;
unsigned char k_ipad[65];
unsigned char k_opad[65];
};
#endif /* _HMAC_MD5_H */
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, unsigned char const *buf,
unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
/* The following definitions come from lib/hmacmd5.c */
void hmac_md5_init_rfc2104(unsigned char *key, int key_len,
struct HMACMD5Context *ctx);
void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
struct HMACMD5Context *ctx);
void hmac_md5_update(const unsigned char *text, int text_len,
struct HMACMD5Context *ctx);
void hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx);
void hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
unsigned char *digest);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* fs/cifs/ntlmssp.h
*
* Copyright (c) International Business Machines Corp., 2002
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma pack(1)
#define NTLMSSP_SIGNATURE "NTLMSSP"
/* Message Types */
#define NtLmNegotiate 1
#define NtLmChallenge 2
#define NtLmAuthenticate 3
#define UnknownMessage 8
/* Negotiate Flags */
#define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode
#define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM
#define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm
#define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability
#define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality
#define NTLMSSP_NEGOTIATE_DGRAM 0x0040
#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal
#define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication
#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 // Sign for all security levels
#define NTLMSSP_NEGOTIATE_NTLMV2 0x80000
#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000
#define NTLMSSP_NEGOTIATE_128 0x20000000
#define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000
/* server only negotiate flags */
#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 /* NEGOTIATE_DOMAIN 0x1000 ? */
#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 /* NEGOTIATE_WORKSTATION 0x2000 ? */
/* Although typedefs are not commonly used for structure definitions */
/* in the Linux kernel, in this particular case they are useful */
/* to more closely match the standards document for NTLMSSP from */
/* OpenGroup and to make the code more closely match the standard in */
/* appearance */
typedef struct _SECURITY_BUFFER {
__u16 Length;
__u16 MaximumLength;
__u32 Buffer; /* offset to buffer */
} SECURITY_BUFFER;
typedef struct _NEGOTIATE_MESSAGE {
__u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
__u32 MessageType;
__u32 NegotiateFlags;
SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */
SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */
char DomainString[0];
/* followed by WorkstationString */
} NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE;
typedef struct _CHALLENGE_MESSAGE {
__u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
__u32 MessageType;
SECURITY_BUFFER TargetName;
__u32 NegotiateFlags;
__u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
__u8 Reserved[8];
SECURITY_BUFFER TargetInfoArray;
} CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE;
typedef struct _AUTHENTICATE_MESSAGE {
__u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
__u32 MessageType;
SECURITY_BUFFER LmChallengeResponse;
SECURITY_BUFFER NtChallengeResponse;
SECURITY_BUFFER DomainName;
SECURITY_BUFFER UserName;
SECURITY_BUFFER WorkstationName;
SECURITY_BUFFER SessionKey;
__u32 NegotiateFlags;
char UserString[0];
} AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;
#pragma pack() /* resume default structure packing */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -12,7 +12,7 @@ fi
# msdos and Joliet want NLS
if [ "$CONFIG_JOLIET" = "y" -o "$CONFIG_FAT_FS" != "n" \
-o "$CONFIG_NTFS_FS" != "n" -o "$CONFIG_NCPFS_NLS" = "y" \
-o "$CONFIG_SMB_NLS" = "y" -o "$CONFIG_JFS_FS" != "n" ]; then
-o "$CONFIG_SMB_NLS" = "y" -o "$CONFIG_JFS_FS" != "n" -o "$CONFIG_CIFS" != "n"]; then
define_bool CONFIG_NLS y
else
define_bool CONFIG_NLS n
......
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