Skip to contentSkip to conversation

cifs: Remove pre-historic unused CIFSSMBCopy

PATCH Applied [email protected] 5 participants 12 messages Oct 7, 2024 – Nov 14, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Remove pre-historic unused CIFSSMBCopy

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
 				     struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-			struct cifs_tcon *source_tcon,
-			const char *fromName,
-			const __u16 target_tid,
-			const char *toName, const int flags,
-			const struct nls_table *nls_codepage,
-			int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
 			const unsigned char *searchName,
 			const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -63

69 lines not on this page · raw message

Signature · 1 line
2.46.2
#1 lore raw
Quoted 10 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

Ping?

Dave

Quoted 100 lines
---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
 				     struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-			struct cifs_tcon *source_tcon,
-			const char *fromName,
-			const __u16 target_tid,
-			const char *toName, const int flags,
-			const struct nls_table *nls_codepage,
-			int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
 			const unsigned char *searchName,
 			const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -63
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
 	return rc;
 }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-	    const char *fromName, const __u16 target_tid, const char *toName,
-	    const int flags, const struct nls_table *nls_codepage, int remap)
-{
-	int rc = 0;
-	COPY_REQ *pSMB = NULL;
-	COPY_RSP *pSMBr = NULL;
-	int bytes_returned;
-	int name_len, name_len2;
-	__u16 count;
-
-	cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-	rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-			(void **) &pSMBr);
-	if (rc)
-		return rc;
-
-	pSMB->BufferFormat = 0x04;
-	pSMB->Tid2 = target_tid;
-
-	pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-		name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-					      fromName, PATH_MAX, nls_codepage,
-					      remap);
-		name_len++;     /* trailing null */
-		name_len *= 2;
-		pSMB->OldFileName[name_len] = 0x04;     /* pad */
-		/* protocol requires ASCII signature byte on Unicode string */
-		pSMB->OldFileName[name_len + 1] = 0x00;
-		name_len2 =
-		    cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-				       toName, PATH_MAX, nls_codepage, remap);
-		name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-		name_len2 *= 2; /* convert to bytes */
-	} else {
-		name_len = copy_path_name(pSMB->OldFileName, fromName);
-		pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-		name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-		name_len2++;    /* signature byte */
-	}
-
-	count = 1 /* 1st signature byte */  + name_len + name_len2;
-	inc_rfc1001_len(pSMB, count);
-	pSMB->ByteCount = cpu_to_le16(count);
-
-	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-		(struct smb_hdr *) pSMBr, &bytes_returned, 0);
-	if (rc) {
-		cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-			 rc, le16_to_cpu(pSMBr->CopyCount));
-	}
-	cifs_buf_release(pSMB);
-
-	if (rc == -EAGAIN)
-		goto copyRetry;
-
-	return rc;
-}
-
 int
 CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
 		      const char *fromName, const char *toName,
Signature · 1 line
2.46.2
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#3 lore raw
In reply to a message not in the archive

As an alternative, might be useful to see if this command still works to Samba and/or older Windows (and e.g. enable an ioctl for it - might have been useful in the past to old servers)

Quoted 127 lines · Steve French

No objections to this from me. Will add it to for next next in the next few days so can queue it for 6.13-rc

Quoted 123 lines · Dr. David Alan Gilbert
Quoted 10 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

Ping?

Dave

Quoted 98 lines
---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
                                   struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-                     struct cifs_tcon *source_tcon,
-                     const char *fromName,
-                     const __u16 target_tid,
-                     const char *toName, const int flags,
-                     const struct nls_table *nls_codepage,
-                     int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
                      const unsigned char *searchName,
                      const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -64
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
      return rc;
 }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-         const char *fromName, const __u16 target_tid, const char *toName,
-         const int flags, const struct nls_table *nls_codepage, int remap)
-{
-     int rc = 0;
-     COPY_REQ *pSMB = NULL;
-     COPY_RSP *pSMBr = NULL;
-     int bytes_returned;
-     int name_len, name_len2;
-     __u16 count;
-
-     cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-     rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-                     (void **) &pSMBr);
-     if (rc)
-             return rc;
-
-     pSMB->BufferFormat = 0x04;
-     pSMB->Tid2 = target_tid;
-
-     pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-     if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-             name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-                                           fromName, PATH_MAX, nls_codepage,
-                                           remap);
-             name_len++;     /* trailing null */
-             name_len *= 2;
-             pSMB->OldFileName[name_len] = 0x04;     /* pad */
-             /* protocol requires ASCII signature byte on Unicode string */
-             pSMB->OldFileName[name_len + 1] = 0x00;
-             name_len2 =
-                 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-                                    toName, PATH_MAX, nls_codepage, remap);
-             name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-             name_len2 *= 2; /* convert to bytes */
-     } else {
-             name_len = copy_path_name(pSMB->OldFileName, fromName);
-             pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-             name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-             name_len2++;    /* signature byte */
-     }
-
-     count = 1 /* 1st signature byte */  + name_len + name_len2;
-     inc_rfc1001_len(pSMB, count);
-     pSMB->ByteCount = cpu_to_le16(count);
-
-     rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-             (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-     if (rc) {
-             cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-                      rc, le16_to_cpu(pSMBr->CopyCount));
-     }
-     cifs_buf_release(pSMB);
-
-     if (rc == -EAGAIN)
-             goto copyRetry;
-
-     return rc;
-}
-
 int
 CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
                    const char *fromName, const char *toName,
--
Quoted 2 lines

2.46.2

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
reviewer
#4 lore raw
Quoted 3 lines · Steve French

As an alternative, might be useful to see if this command still works to Samba and/or older Windows (and e.g. enable an ioctl for it - might have been useful in the past to old servers)

Please let's not do anything to enhance usage of the hopelessly insecure SMB1 protocol. Especially not with something we just found in the back of the closet.

The MS-CIFS document has this to say about SMB_COM_COPY:

2.2.4.37 SMB_COM_COPY (0x29)
This command was introduced in the LAN Manager 1.0 dialect (see [SMB-LM1X] section 9.2.1 and [XOPEN-SMB] sections 14.1 and 15.2). It was rendered obsolete in the NT LAN Manager dialect. This command was used to perform server-side file copies, but is no longer used. Clients SHOULD NOT send requests using this command code. Servers receiving requests with this command code SHOULD return STATUS_NOT_IMPLEMENTED (ERRDOS/ERRbadfunc). <51>

<51> Section 2.2.4.37: Windows NT servers attempt to process this command, but the implementation is incomplete and the results are not predictable.

Deletion-Enthusiastically-Acked-by Tom Talpey <[email protected]>

Tom.

Quoted 130 lines · Steve French
Quoted 127 lines

No objections to this from me. Will add it to for next next in the next few days so can queue it for 6.13-rc

Quoted 123 lines · Dr. David Alan Gilbert
Quoted 10 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

Ping?

Dave

Quoted 98 lines
---
  fs/smb/client/cifsproto.h |  7 -----
  fs/smb/client/cifssmb.c   | 63 ---------------------------------------
  2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
                                    struct TCP_Server_Info *server);
 
  #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-                     struct cifs_tcon *source_tcon,
-                     const char *fromName,
-                     const __u16 target_tid,
-                     const char *toName, const int flags,
-                     const struct nls_table *nls_codepage,
-                     int remap_special_chars);
  extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
                       const unsigned char *searchName,
                       const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -64
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
       return rc;
  }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-         const char *fromName, const __u16 target_tid, const char *toName,
-         const int flags, const struct nls_table *nls_codepage, int remap)
-{
-     int rc = 0;
-     COPY_REQ *pSMB = NULL;
-     COPY_RSP *pSMBr = NULL;
-     int bytes_returned;
-     int name_len, name_len2;
-     __u16 count;
-
-     cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-     rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-                     (void **) &pSMBr);
-     if (rc)
-             return rc;
-
-     pSMB->BufferFormat = 0x04;
-     pSMB->Tid2 = target_tid;
-
-     pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-     if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-             name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-                                           fromName, PATH_MAX, nls_codepage,
-                                           remap);
-             name_len++;     /* trailing null */
-             name_len *= 2;
-             pSMB->OldFileName[name_len] = 0x04;     /* pad */
-             /* protocol requires ASCII signature byte on Unicode string */
-             pSMB->OldFileName[name_len + 1] = 0x00;
-             name_len2 =
-                 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-                                    toName, PATH_MAX, nls_codepage, remap);
-             name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-             name_len2 *= 2; /* convert to bytes */
-     } else {
-             name_len = copy_path_name(pSMB->OldFileName, fromName);
-             pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-             name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-             name_len2++;    /* signature byte */
-     }
-
-     count = 1 /* 1st signature byte */  + name_len + name_len2;
-     inc_rfc1001_len(pSMB, count);
-     pSMB->ByteCount = cpu_to_le16(count);
-
-     rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-             (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-     if (rc) {
-             cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-                      rc, le16_to_cpu(pSMBr->CopyCount));
-     }
-     cifs_buf_release(pSMB);
-
-     if (rc == -EAGAIN)
-             goto copyRetry;
-
-     return rc;
-}
-
  int
  CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
                     const char *fromName, const char *toName,
--
Quoted 2 lines

2.46.2

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /

\ _________________________|_____ http://www.treblig.org |_______/

#5 lore raw
Quoted 20 lines · * Tom Talpey ([email protected]) wrote:
Quoted 3 lines · Steve French

As an alternative, might be useful to see if this command still works to Samba and/or older Windows (and e.g. enable an ioctl for it - might have been useful in the past to old servers)

Please let's not do anything to enhance usage of the hopelessly insecure SMB1 protocol. Especially not with something we just found in the back of the closet.

The MS-CIFS document has this to say about SMB_COM_COPY:

2.2.4.37 SMB_COM_COPY (0x29)
This command was introduced in the LAN Manager 1.0 dialect (see [SMB-LM1X] section 9.2.1 and [XOPEN-SMB] sections 14.1 and 15.2). It was rendered obsolete in the NT LAN Manager dialect. This command was used to perform server-side file copies, but is no longer used. Clients SHOULD NOT send requests using this command code. Servers receiving requests with this command code SHOULD return STATUS_NOT_IMPLEMENTED (ERRDOS/ERRbadfunc). <51>

Quoted 3 lines

<51> Section 2.2.4.37: Windows NT servers attempt to process this command, but the implementation is incomplete and the results are not predictable.

Thanks for doing the archaeology!

Quoted 1 line
Deletion-Enthusiastically-Acked-by Tom Talpey <[email protected]>

Haha, thanks!

Dave

Quoted 134 lines

Tom.

Quoted 130 lines · Steve French
Quoted 127 lines

No objections to this from me. Will add it to for next next in the next few days so can queue it for 6.13-rc

Quoted 123 lines · Dr. David Alan Gilbert
Quoted 10 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

Ping?

Dave

Quoted 98 lines
---
  fs/smb/client/cifsproto.h |  7 -----
  fs/smb/client/cifssmb.c   | 63 ---------------------------------------
  2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
                                    struct TCP_Server_Info *server);
 
  #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-                     struct cifs_tcon *source_tcon,
-                     const char *fromName,
-                     const __u16 target_tid,
-                     const char *toName, const int flags,
-                     const struct nls_table *nls_codepage,
-                     int remap_special_chars);
  extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
                       const unsigned char *searchName,
                       const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -64
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
       return rc;
  }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-         const char *fromName, const __u16 target_tid, const char *toName,
-         const int flags, const struct nls_table *nls_codepage, int remap)
-{
-     int rc = 0;
-     COPY_REQ *pSMB = NULL;
-     COPY_RSP *pSMBr = NULL;
-     int bytes_returned;
-     int name_len, name_len2;
-     __u16 count;
-
-     cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-     rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-                     (void **) &pSMBr);
-     if (rc)
-             return rc;
-
-     pSMB->BufferFormat = 0x04;
-     pSMB->Tid2 = target_tid;
-
-     pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-     if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-             name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-                                           fromName, PATH_MAX, nls_codepage,
-                                           remap);
-             name_len++;     /* trailing null */
-             name_len *= 2;
-             pSMB->OldFileName[name_len] = 0x04;     /* pad */
-             /* protocol requires ASCII signature byte on Unicode string */
-             pSMB->OldFileName[name_len + 1] = 0x00;
-             name_len2 =
-                 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-                                    toName, PATH_MAX, nls_codepage, remap);
-             name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-             name_len2 *= 2; /* convert to bytes */
-     } else {
-             name_len = copy_path_name(pSMB->OldFileName, fromName);
-             pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-             name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-             name_len2++;    /* signature byte */
-     }
-
-     count = 1 /* 1st signature byte */  + name_len + name_len2;
-     inc_rfc1001_len(pSMB, count);
-     pSMB->ByteCount = cpu_to_le16(count);
-
-     rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-             (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-     if (rc) {
-             cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-                      rc, le16_to_cpu(pSMBr->CopyCount));
-     }
-     cifs_buf_release(pSMB);
-
-     if (rc == -EAGAIN)
-             goto copyRetry;
-
-     return rc;
-}
-
  int
  CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
                     const char *fromName, const char *toName,
--
Quoted 2 lines

2.46.2

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /

\ _________________________|_____ http://www.treblig.org |_______/

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#6 lore raw
In reply to Steve French
Quoted 3 lines · Steve French

As an alternative, might be useful to see if this command still works to Samba and/or older Windows (and e.g. enable an ioctl for it - might have been useful in the past to old servers)

No, this command has *never* been useful. Please don't enable it, just remove support.

#7 lore raw

All of SMB1 should be removed. Not just disabled but deleted.

What are the plans in samba? Any timeline to literally delete the smb1 code?

Quoted 8 lines · Jeremy Allison
Quoted 3 lines · Steve French

As an alternative, might be useful to see if this command still works to Samba and/or older Windows (and e.g. enable an ioctl for it - might have been useful in the past to old servers)

No, this command has *never* been useful. Please don't enable it, just remove support.

#8 lore raw
Quoted 3 lines · ronnie sahlberg

All of SMB1 should be removed. Not just disabled but deleted.

What are the plans in samba? Any timeline to literally delete the smb1 code?

It can already be compiled out of any build, so it's an option for any distro or user of Samba.

I'm not sure deleting the code is needed at this point, as it still has legacy uses (there are still commercial uses of OS/2 out there for example).

#9 lore raw

SMB1/SMB2.0 can be disabled fairly easily in the Linux client build, but there are occasional requests for it due to SMB1/CIFS still being used to access some old devices. Also some of the SMB1 code was moved to SMB1 specific files to make that clearer, and to make the module smaller when SMB1/SMB2.0 is not enabled. Even when SMB1/SMB2.0 is configured in the build, in the future it may be useful to not load the SMB1 specific files (put them in a helper module that contains all of the SMB1 specific code, rather in the main filesystem module) unless the user specifies "vers=1.0" on mount.

Quoted 14 lines · Jeremy Allison
Quoted 3 lines · ronnie sahlberg

All of SMB1 should be removed. Not just disabled but deleted.

What are the plans in samba? Any timeline to literally delete the smb1 code?

It can already be compiled out of any build, so it's an option for any distro or user of Samba.

I'm not sure deleting the code is needed at this point, as it still has legacy uses (there are still commercial uses of OS/2 out there for example).

Signature · 3 lines
Thanks,

Steve
#10 lore raw
In reply to Jeremy Allison
Quoted 6 lines · Jeremy Allison
Quoted 3 lines · ronnie sahlberg

All of SMB1 should be removed. Not just disabled but deleted.

What are the plans in samba? Any timeline to literally delete the smb1 code?

Quoted 8 lines

It can already be compiled out of any build, so it's an option for any distro or user of Samba.

I'm not sure deleting the code is needed at this point, as it still has legacy uses (there are still commercial uses of OS/2 out there for example).

There are still costs to maintain it. Especially since weird protocol quirks keep being exposed and affecting semantics much higher up in the stack.

There are probably still someone that runs 3Mbit Ethernet with 16-bit MAC addresses. But we don't support that with modern ethernet drivers.

Applied
#11 lore raw
In reply to [email protected]

merged into cifs-2.6.git for-next

Quoted 112 lines · On Mon, Oct 7, 2024 at 4:02 PM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
                                     struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-                       struct cifs_tcon *source_tcon,
-                       const char *fromName,
-                       const __u16 target_tid,
-                       const char *toName, const int flags,
-                       const struct nls_table *nls_codepage,
-                       int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
                        const unsigned char *searchName,
                        const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -64
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
        return rc;
 }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-           const char *fromName, const __u16 target_tid, const char *toName,
-           const int flags, const struct nls_table *nls_codepage, int remap)
-{
-       int rc = 0;
-       COPY_REQ *pSMB = NULL;
-       COPY_RSP *pSMBr = NULL;
-       int bytes_returned;
-       int name_len, name_len2;
-       __u16 count;
-
-       cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-       rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-                       (void **) &pSMBr);
-       if (rc)
-               return rc;
-
-       pSMB->BufferFormat = 0x04;
-       pSMB->Tid2 = target_tid;
-
-       pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-               name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-                                             fromName, PATH_MAX, nls_codepage,
-                                             remap);
-               name_len++;     /* trailing null */
-               name_len *= 2;
-               pSMB->OldFileName[name_len] = 0x04;     /* pad */
-               /* protocol requires ASCII signature byte on Unicode string */
-               pSMB->OldFileName[name_len + 1] = 0x00;
-               name_len2 =
-                   cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-                                      toName, PATH_MAX, nls_codepage, remap);
-               name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-               name_len2 *= 2; /* convert to bytes */
-       } else {
-               name_len = copy_path_name(pSMB->OldFileName, fromName);
-               pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-               name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-               name_len2++;    /* signature byte */
-       }
-
-       count = 1 /* 1st signature byte */  + name_len + name_len2;
-       inc_rfc1001_len(pSMB, count);
-       pSMB->ByteCount = cpu_to_le16(count);
-
-       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-               (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-       if (rc) {
-               cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-                        rc, le16_to_cpu(pSMBr->CopyCount));
-       }
-       cifs_buf_release(pSMB);
-
-       if (rc == -EAGAIN)
-               goto copyRetry;
-
-       return rc;
-}
-
 int
 CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
                      const char *fromName, const char *toName,
--

2.46.2

Signature · 3 lines
Thanks,

Steve
#12 lore raw
Quoted 1 line · * Steve French ([email protected]) wrote:

merged into cifs-2.6.git for-next

Thanks!

Dave

Quoted 120 lines · On Mon, Oct 7, 2024 at 4:02 PM <[email protected]> wrote:
Quoted 112 lines

From: "Dr. David Alan Gilbert" <[email protected]>

CIFSSMBCopy() is unused, remove it.

It seems to have been that way pre-git; looking in a historic archive, I think it landed around May 2004 in Linus'
BKrev: 40ab7591J_OgkpHW-qhzZukvAUAw9g
and was unused back then.

---
 fs/smb/client/cifsproto.h |  7 -----
 fs/smb/client/cifssmb.c   | 63 ---------------------------------------
 2 files changed, 70 deletions(-)
fs/smb/client/cifsproto.h +0 -7
index 1d3470bca45e..8235b5a0aa2b 100644
@@ -549,13 +549,6 @@ extern int generate_smb311signingkey(struct cifs_ses *ses,
                                     struct TCP_Server_Info *server);
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern int CIFSSMBCopy(unsigned int xid,
-                       struct cifs_tcon *source_tcon,
-                       const char *fromName,
-                       const __u16 target_tid,
-                       const char *toName, const int flags,
-                       const struct nls_table *nls_codepage,
-                       int remap_special_chars);
 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
                        const unsigned char *searchName,
                        const unsigned char *ea_name, char *EAData,
fs/smb/client/cifssmb.c +0 -64
index c6f15dbe860a..ca50ac652e02 100644
@@ -2339,69 +2339,6 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon,
        return rc;
 }
 
-int
-CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
-           const char *fromName, const __u16 target_tid, const char *toName,
-           const int flags, const struct nls_table *nls_codepage, int remap)
-{
-       int rc = 0;
-       COPY_REQ *pSMB = NULL;
-       COPY_RSP *pSMBr = NULL;
-       int bytes_returned;
-       int name_len, name_len2;
-       __u16 count;
-
-       cifs_dbg(FYI, "In CIFSSMBCopy\n");
-copyRetry:
-       rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
-                       (void **) &pSMBr);
-       if (rc)
-               return rc;
-
-       pSMB->BufferFormat = 0x04;
-       pSMB->Tid2 = target_tid;
-
-       pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
-
-       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-               name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
-                                             fromName, PATH_MAX, nls_codepage,
-                                             remap);
-               name_len++;     /* trailing null */
-               name_len *= 2;
-               pSMB->OldFileName[name_len] = 0x04;     /* pad */
-               /* protocol requires ASCII signature byte on Unicode string */
-               pSMB->OldFileName[name_len + 1] = 0x00;
-               name_len2 =
-                   cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
-                                      toName, PATH_MAX, nls_codepage, remap);
-               name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
-               name_len2 *= 2; /* convert to bytes */
-       } else {
-               name_len = copy_path_name(pSMB->OldFileName, fromName);
-               pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
-               name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
-               name_len2++;    /* signature byte */
-       }
-
-       count = 1 /* 1st signature byte */  + name_len + name_len2;
-       inc_rfc1001_len(pSMB, count);
-       pSMB->ByteCount = cpu_to_le16(count);
-
-       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-               (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-       if (rc) {
-               cifs_dbg(FYI, "Send error in copy = %d with %d files copied\n",
-                        rc, le16_to_cpu(pSMBr->CopyCount));
-       }
-       cifs_buf_release(pSMB);
-
-       if (rc == -EAGAIN)
-               goto copyRetry;
-
-       return rc;
-}
-
 int
 CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
                      const char *fromName, const char *toName,
--

2.46.2

Signature · 3 lines
Thanks,

Steve
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/