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

Commit 9ac00b7d authored by Steve French's avatar Steve French
Browse files

[CIFS] Do not send newer QFSInfo to legacy servers which can not support it



Fix dialect negotiation to save off when we have negotiated lanman.
This allows us to avoid sending some somewhat newer requests that the server
can not handle and go directly to the older version (infolevel) of the same
call. Make sure we try to negotiate a level which allows us to get the
server OS (which we check so we can detect Win9x vs. other legacy servers
and eventually work around the Win9x DOS time bug (they reverse date/time
fields).

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent f46d3e11
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -199,10 +199,12 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
    /* Only need to call the old QFSInfo if failed
    on newer one */
    if(rc)
	rc = CIFSSMBQFSInfo(xid, pTcon, buf);
	if((pTcon->ses->flags & CIFS_SES_LANMAN) == 0)
		rc = CIFSSMBQFSInfo(xid, pTcon, buf); /* not supported by OS2 */

	/* Old Windows servers do not support level 103, retry with level 
	   one if old server failed the previous call */ 
	/* Some old Windows servers also do not support level 103, retry with
	   older level one if old server failed the previous call or we
	   bypassed it because we detected that this was an older LANMAN sess */
	if(rc)
		rc = SMBOldQFSInfo(xid, pTcon, buf);
	/*     
+7 −2
Original line number Diff line number Diff line
@@ -203,9 +203,14 @@ struct cifsSesInfo {
	char * domainName;
	char * password;
};
/* session flags */
/* no more than one of the following three session flags may be set */
#define CIFS_SES_NT4 1

#define CIFS_SES_OS2 2
#define CIFS_SES_W9X 4
/* following flag is set for old servers such as OS2 (and Win95?)
   which do not negotiate NTLM or POSIX dialects, but instead
   negotiate one of the older LANMAN dialects */
#define CIFS_SES_LANMAN 8
/*
 * there is one of these for each connection to a resource on a particular
 * session 
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@

#ifdef CONFIG_CIFS_WEAK_PW_HASH
#define LANMAN_PROT 0
#define CIFS_PROT   1
#define LANMAN2_PROT 1
#define CIFS_PROT   2
#else
#define CIFS_PROT   0
#endif
+5 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ static struct {
} protocols[] = {
#ifdef CONFIG_CIFS_WEAK_PW_HASH
	{LANMAN_PROT, "\2LM1.2X002"},
	{LANMAN2_PROT, "\2LANMAN2.1"},
#endif /* weak password hashing for legacy clients */
	{CIFS_PROT, "\2NT LM 0.12"}, 
	{POSIX_PROT, "\2POSIX 2"},
@@ -67,13 +68,13 @@ static struct {
/* define the number of elements in the cifs dialect array */
#ifdef CONFIG_CIFS_POSIX
#ifdef CONFIG_CIFS_WEAK_PW_HASH
#define CIFS_NUM_PROT 3
#define CIFS_NUM_PROT 4
#else
#define CIFS_NUM_PROT 2
#endif /* CIFS_WEAK_PW_HASH */
#else /* not posix */
#ifdef CONFIG_CIFS_WEAK_PW_HASH
#define CIFS_NUM_PROT 2
#define CIFS_NUM_PROT 3
#else
#define CIFS_NUM_PROT 1
#endif /* CONFIG_CIFS_WEAK_PW_HASH */
@@ -446,7 +447,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
		goto neg_err_exit;
#ifdef CONFIG_CIFS_WEAK_PW_HASH 
	} else if((pSMBr->hdr.WordCount == 13)
			&& (pSMBr->DialectIndex == LANMAN_PROT)) {
			&& ((pSMBr->DialectIndex == LANMAN_PROT)
				|| (pSMBr->DialectIndex == LANMAN2_PROT))) {
		int tmp, adjust;
		struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr;

+1 −0
Original line number Diff line number Diff line
@@ -3316,6 +3316,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
		first_time = 1;
	}
	if (!rc) {
		pSesInfo->flags = 0;
		pSesInfo->capabilities = pSesInfo->server->capabilities;
		if(linuxExtEnabled == 0)
			pSesInfo->capabilities &= (~CAP_UNIX);
Loading