Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5815449d authored by Steve French's avatar Steve French
Browse files

[CIFS] SessionSetup cleanup part 2



The cifs session setup code has three cases, and a fourth for backlevel
LANMAN2 style session setup needed to be added.  This new session setup
implmentation will eventually replace the other three and should be
easier to read while fixing a few minor problems (not setting
the LARGE READ/WRITEX flags when NTLMSSP was negotiated for example) and
adding support for NTLMv2 (which will be added with the next patch. In the
meantime, this code is marked in an CONFIG_CIFS_EXPERIMENTAL block and will
not be turned on by default until it is tested against more server types.

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent b580513e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@
#
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 xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.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 xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.o ntlmssp.o
+1 −0
Original line number Diff line number Diff line
@@ -260,4 +260,5 @@ void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_respon
/*	hmac_md5_update(v2_session_response+16)client thing,8,&context); */ /* BB fix */

	hmac_md5_final(v2_session_response,&context);
	cifs_dump_mem("v2_sess_rsp: ", v2_session_response, 32); /* BB removeme BB */
}
+10 −1
Original line number Diff line number Diff line
/*
 *   fs/cifs/cifsglob.h
 *
 *   Copyright (C) International Business Machines  Corp., 2002,2005
 *   Copyright (C) International Business Machines  Corp., 2002,2006
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *   This library is free software; you can redistribute it and/or modify
@@ -430,6 +430,15 @@ struct dir_notify_req {
#define   CIFS_LARGE_BUFFER     2
#define   CIFS_IOVEC            4    /* array of response buffers */

/* Type of session setup needed */
#define   CIFS_PLAINTEXT	0
#define   CIFS_LANMAN		1
#define   CIFS_NTLM		2
#define   CIFS_NTLMSSP_NEG	3
#define   CIFS_NTLMSSP_AUTH	4
#define   CIFS_SPNEGO_INIT	5
#define   CIFS_SPNEGO_TARG	6

/*
 *****************************************************************
 * All constants go here
+8 −2
Original line number Diff line number Diff line
/*
 *   fs/cifs/cifsproto.h
 *
 *   Copyright (c) International Business Machines  Corp., 2002,2005
 *   Copyright (c) International Business Machines  Corp., 2002,2006
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *   This library is free software; you can redistribute it and/or modify
@@ -64,8 +64,14 @@ extern int map_smb_to_linux_error(struct smb_hdr *smb);
extern void header_assemble(struct smb_hdr *, char /* command */ ,
			    const struct cifsTconInfo *, int /* length of
			    fixed section (word count) in two byte units */);
extern int small_smb_init_no_tc(int smb_cmd, int wct, struct cifsSesInfo *ses,
#ifdef CONFIG_CIFS_EXPERIMENTAL
extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
				struct cifsSesInfo *ses,
				void ** request_buf);
extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
			     const int stage, int * pNTLMv2_flg,
			     const struct nls_table *nls_cp);
#endif
extern __u16 GetNextMid(struct TCP_Server_Info *server);
extern struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16, 
						 struct cifsTconInfo *);
+7 −5
Original line number Diff line number Diff line
@@ -187,14 +187,16 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,

	return rc;
}

#ifdef CONFIG_CIFS_EXPERIMENTAL  
int
small_smb_init_no_tcon(int smb_command, int wct, struct cifsSesInfo *ses,
		       void **request_buf)
small_smb_init_no_tc(const int smb_command, const int wct, 
		     struct cifsSesInfo *ses, void **request_buf)
{
	int rc;
	struct smb_hdr * buffer;

	rc = small_smb_init(smb_command, wct, 0, request_buf);
	rc = small_smb_init(smb_command, wct, NULL, request_buf);
	if(rc)
		return rc;

@@ -212,7 +214,7 @@ small_smb_init_no_tcon(int smb_command, int wct, struct cifsSesInfo *ses,

	return rc;
}

#endif  /* CONFIG_CIFS_EXPERIMENTAL */

/* If the return code is zero, this function must fill in request_buf pointer */
static int
Loading