9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
@ 2023-09-28  6:34 Romano
  2023-09-28  7:14 ` unobe
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Romano @ 2023-09-28  6:34 UTC (permalink / raw)
  To: 9front


SMB 2/3 is not supported by cifsd, so clarify that in the man page and update teh code to mention in the log file if SMB2/3 is attempted. Also, while in the code, fix a typo, add a few more commands to the explicitly unsupported list, and align the return value for unsupported calls to the SMBv1 spec.
---
diff 755ac2c11ce134f76d83a2a42edb07a6304d1de8 f48ee862768b677d0b0fca82a7efecd0b4fb3b06
--- a/sys/man/8/cifsd
+++ b/sys/man/8/cifsd
@@ -1,6 +1,6 @@
 .TH CIFSD 8
 .SH NAME
-cifsd \- CIFS/SMB network daemon
+cifsd \- CIFS/SMBv1 network daemon
 .SH SYNOPSIS
 .PP
 .B ip/cifsd
@@ -25,6 +25,7 @@
 exports filesystems to
 .SM CIFS or
 .SM SMB
+version 1
 clients like Microsoft \(tm Windows.
 .PP
 It is normally started by the network listen process via the
--- a/sys/src/cmd/ip/cifsd/dat.h
+++ b/sys/src/cmd/ip/cifsd/dat.h
@@ -139,9 +139,11 @@
 	STATUS_SMB_BAD_TID				= 0x00050002,
 	STATUS_SMB_BAD_FID				= 0x00060001,
 	STATUS_OS2_INVALID_ACCESS		= 0x000C0001,
+	STATUS_SMB_BAD_COMMAND			= 0x00160002,
 	STATUS_SMB_BAD_UID				= 0x005B0002,
 	STATUS_OS2_INVALID_LEVEL  		= 0x007C0001,
 	STATUS_NO_MORE_FILES			= 0x80000006,
+	STATUS_NOT_IMPLEMENTED			= 0xC0000002,
 	STATUS_INVALID_HANDLE			= 0xC0000008,
 	STATUS_NO_SUCH_FILE				= 0xC000000F,
 	STATUS_ACCESS_DENIED			= 0xC0000022,
--- a/sys/src/cmd/ip/cifsd/main.c
+++ b/sys/src/cmd/ip/cifsd/main.c
@@ -7,6 +7,7 @@
 	LENHDR = 4,
 
 	MAGIC = 0xFF | ('S'<<8) | ('M'<<16) | ('B'<<24),
+	MAGIC_SMB2 = 0xFE | ('S'<<8) | ('M'<<16) | ('B'<<24),
 
 	SMB_FLAGS_CASE_INSENSITIVE = 0x08,
 	SMB_FLAGS_CANONICALIZED_PATHS = 0x10,
@@ -88,8 +89,8 @@
 		exits("botch");
 		return;
 	}
-	if(magic != MAGIC){
-		logit("bad smb magic");
+	if(magic != MAGIC) {
+		logit("bad smb magic [%x] %s", magic, (magic == MAGIC_SMB2 ? "(SMB2/3 not supported)" : ""));
 		exits("botch");
 		return;
 	}
--- a/sys/src/cmd/ip/cifsd/smb.c
+++ b/sys/src/cmd/ip/cifsd/smb.c
@@ -135,7 +135,7 @@
 			free(mcr);
 		}
 		remoteuser = getuser();
-		logit("auth successfull");
+		logit("auth successful");
 		break;
 	}
 	sessionuid = (namehash(getuser()) & 0x7FFF) | 1;
@@ -794,6 +794,12 @@
 }
 
 void
+smbstatusnotimplemented(Req *r, uchar *, uchar *, uchar *)
+{
+	r->respond(r, STATUS_NOT_IMPLEMENTED);
+}
+
+void
 smbecho(Req *r, uchar *h, uchar *p, uchar *e)
 {
 	uchar *t, *d, *de;
@@ -1711,7 +1717,7 @@
 void
 smbnoandxcommand(Req *r, uchar *, uchar *, uchar *)
 {
-	r->respond(r, (r->cmd == 0xFF) ? STATUS_INVALID_SMB : 0);
+	r->respond(r, (r->cmd == 0xFF) ? STATUS_SMB_BAD_COMMAND : 0);
 }
 
 struct {
@@ -1731,6 +1737,10 @@
 	[0x23] { "SMB_COM_QUERY_INFORMATION2", smbqueryinformation2 },
 	[0x24] { "SMB_COM_LOCKING_ANDX", smblockingandx },
 	[0x25] { "SMB_COM_TRANSACTION", smbtransaction },
+	[0x27] { "SMB_COM_IOCTL", smbstatusnotimplemented },
+	[0x28] { "SMB_COM_IOCTL_SECONDARY", smbstatusnotimplemented },
+	[0x29] { "SMB_COM_COPY", smbstatusnotimplemented },
+	[0x2a] { "SMB_COM_MOVE", smbstatusnotimplemented },
 	[0x2b] { "SMB_COM_ECHO", smbecho },
 	[0x2d] { "SMB_COM_OPEN_ANDX", smbopenandx },
 	[0x2e] { "SMB_COM_READ_ANDX", smbreadandx },
@@ -1737,6 +1747,7 @@
 	[0x2f] { "SMB_COM_WRITE_ANDX", smbwriteandx },
 	[0x32] { "SMB_COM_TRANSACTION2", smbtransaction },
 	[0x34] { "SMB_COM_FIND_CLOSE2", smbcloseflush },
+	[0x40] { "SMB_IOS", smbnoandxcommand },
 	[0x71] { "SMB_COM_DISCONNECT_TREE", smbdisconnecttree },
 	[0x72] { "SMB_COM_NEGOTIATE", smbnegotiate },
 	[0x73] { "SMB_COM_SESSION_SETUP_ANX", smbsessionsetupandx },
@@ -1750,6 +1761,7 @@
 void
 smbcmd(Req *r, int cmd, uchar *h, uchar *p, uchar *e)
 {
+	logit("processing [%.2x] command", cmd);
 	if((cmd >= nelem(optab)) || (optab[cmd].fun == nil)){
 		logit("[%.2x] command not implemented", cmd);
 		r->respond(r, STATUS_NOT_SUPPORTED);



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-09-28  6:34 [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3 Romano
@ 2023-09-28  7:14 ` unobe
  2023-12-11 18:57   ` unobe
  2023-12-11 19:31   ` unobe
  2023-12-18 12:41 ` cinap_lenrek
  2023-12-18 18:05 ` cinap_lenrek
  2 siblings, 2 replies; 9+ messages in thread
From: unobe @ 2023-09-28  7:14 UTC (permalink / raw)
  To: 9front

Desktop Mac (OS X) can connect to cifsd just fine, but iPhones (iOS)
cannot.  My hope is that the documentation will clarify what is
supported for someone down the road, and the logging will help
diagnose situations where a client is connecting with an unsupported
version.

Quoth Romano <unobe@cpan.org>:
> 
> SMB 2/3 is not supported by cifsd, so clarify that in the man page and update teh code to mention in the log file if SMB2/3 is attempted. Also, while in the code, fix a typo, add a few more commands to the explicitly unsupported list, and align the return value for unsupported calls to the SMBv1 spec.
> ---
> diff 755ac2c11ce134f76d83a2a42edb07a6304d1de8 f48ee862768b677d0b0fca82a7efecd0b4fb3b06
> --- a/sys/man/8/cifsd
> +++ b/sys/man/8/cifsd
> @@ -1,6 +1,6 @@
>  .TH CIFSD 8
>  .SH NAME
> -cifsd \- CIFS/SMB network daemon
> +cifsd \- CIFS/SMBv1 network daemon
>  .SH SYNOPSIS
>  .PP
>  .B ip/cifsd
> @@ -25,6 +25,7 @@
>  exports filesystems to
>  .SM CIFS or
>  .SM SMB
> +version 1
>  clients like Microsoft \(tm Windows.
>  .PP
>  It is normally started by the network listen process via the
> --- a/sys/src/cmd/ip/cifsd/dat.h
> +++ b/sys/src/cmd/ip/cifsd/dat.h
> @@ -139,9 +139,11 @@
>  	STATUS_SMB_BAD_TID				= 0x00050002,
>  	STATUS_SMB_BAD_FID				= 0x00060001,
>  	STATUS_OS2_INVALID_ACCESS		= 0x000C0001,
> +	STATUS_SMB_BAD_COMMAND			= 0x00160002,
>  	STATUS_SMB_BAD_UID				= 0x005B0002,
>  	STATUS_OS2_INVALID_LEVEL  		= 0x007C0001,
>  	STATUS_NO_MORE_FILES			= 0x80000006,
> +	STATUS_NOT_IMPLEMENTED			= 0xC0000002,
>  	STATUS_INVALID_HANDLE			= 0xC0000008,
>  	STATUS_NO_SUCH_FILE				= 0xC000000F,
>  	STATUS_ACCESS_DENIED			= 0xC0000022,
> --- a/sys/src/cmd/ip/cifsd/main.c
> +++ b/sys/src/cmd/ip/cifsd/main.c
> @@ -7,6 +7,7 @@
>  	LENHDR = 4,
>  
>  	MAGIC = 0xFF | ('S'<<8) | ('M'<<16) | ('B'<<24),
> +	MAGIC_SMB2 = 0xFE | ('S'<<8) | ('M'<<16) | ('B'<<24),
>  
>  	SMB_FLAGS_CASE_INSENSITIVE = 0x08,
>  	SMB_FLAGS_CANONICALIZED_PATHS = 0x10,
> @@ -88,8 +89,8 @@
>  		exits("botch");
>  		return;
>  	}
> -	if(magic != MAGIC){
> -		logit("bad smb magic");
> +	if(magic != MAGIC) {
> +		logit("bad smb magic [%x] %s", magic, (magic == MAGIC_SMB2 ? "(SMB2/3 not supported)" : ""));
>  		exits("botch");
>  		return;
>  	}
> --- a/sys/src/cmd/ip/cifsd/smb.c
> +++ b/sys/src/cmd/ip/cifsd/smb.c
> @@ -135,7 +135,7 @@
>  			free(mcr);
>  		}
>  		remoteuser = getuser();
> -		logit("auth successfull");
> +		logit("auth successful");
>  		break;
>  	}
>  	sessionuid = (namehash(getuser()) & 0x7FFF) | 1;
> @@ -794,6 +794,12 @@
>  }
>  
>  void
> +smbstatusnotimplemented(Req *r, uchar *, uchar *, uchar *)
> +{
> +	r->respond(r, STATUS_NOT_IMPLEMENTED);
> +}
> +
> +void
>  smbecho(Req *r, uchar *h, uchar *p, uchar *e)
>  {
>  	uchar *t, *d, *de;
> @@ -1711,7 +1717,7 @@
>  void
>  smbnoandxcommand(Req *r, uchar *, uchar *, uchar *)
>  {
> -	r->respond(r, (r->cmd == 0xFF) ? STATUS_INVALID_SMB : 0);
> +	r->respond(r, (r->cmd == 0xFF) ? STATUS_SMB_BAD_COMMAND : 0);
>  }
>  
>  struct {
> @@ -1731,6 +1737,10 @@
>  	[0x23] { "SMB_COM_QUERY_INFORMATION2", smbqueryinformation2 },
>  	[0x24] { "SMB_COM_LOCKING_ANDX", smblockingandx },
>  	[0x25] { "SMB_COM_TRANSACTION", smbtransaction },
> +	[0x27] { "SMB_COM_IOCTL", smbstatusnotimplemented },
> +	[0x28] { "SMB_COM_IOCTL_SECONDARY", smbstatusnotimplemented },
> +	[0x29] { "SMB_COM_COPY", smbstatusnotimplemented },
> +	[0x2a] { "SMB_COM_MOVE", smbstatusnotimplemented },
>  	[0x2b] { "SMB_COM_ECHO", smbecho },
>  	[0x2d] { "SMB_COM_OPEN_ANDX", smbopenandx },
>  	[0x2e] { "SMB_COM_READ_ANDX", smbreadandx },
> @@ -1737,6 +1747,7 @@
>  	[0x2f] { "SMB_COM_WRITE_ANDX", smbwriteandx },
>  	[0x32] { "SMB_COM_TRANSACTION2", smbtransaction },
>  	[0x34] { "SMB_COM_FIND_CLOSE2", smbcloseflush },
> +	[0x40] { "SMB_IOS", smbnoandxcommand },
>  	[0x71] { "SMB_COM_DISCONNECT_TREE", smbdisconnecttree },
>  	[0x72] { "SMB_COM_NEGOTIATE", smbnegotiate },
>  	[0x73] { "SMB_COM_SESSION_SETUP_ANX", smbsessionsetupandx },
> @@ -1750,6 +1761,7 @@
>  void
>  smbcmd(Req *r, int cmd, uchar *h, uchar *p, uchar *e)
>  {
> +	logit("processing [%.2x] command", cmd);
>  	if((cmd >= nelem(optab)) || (optab[cmd].fun == nil)){
>  		logit("[%.2x] command not implemented", cmd);
>  		r->respond(r, STATUS_NOT_SUPPORTED);
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-09-28  7:14 ` unobe
@ 2023-12-11 18:57   ` unobe
  2023-12-11 19:31   ` unobe
  1 sibling, 0 replies; 9+ messages in thread
From: unobe @ 2023-12-11 18:57 UTC (permalink / raw)
  To: 9front

Ping. Any comments on this one way or the other?

Quoth unobe@cpan.org:
> Desktop Mac (OS X) can connect to cifsd just fine, but iPhones (iOS)
> cannot.  My hope is that the documentation will clarify what is
> supported for someone down the road, and the logging will help
> diagnose situations where a client is connecting with an unsupported
> version.
> 
> Quoth Romano <unobe@cpan.org>:
> > 
> > SMB 2/3 is not supported by cifsd, so clarify that in the man page and update teh code to mention in the log file if SMB2/3 is attempted. Also, while in the code, fix a typo, add a few more commands to the explicitly unsupported list, and align the return value for unsupported calls to the SMBv1 spec.
> > ---
> > diff 755ac2c11ce134f76d83a2a42edb07a6304d1de8 f48ee862768b677d0b0fca82a7efecd0b4fb3b06
> > --- a/sys/man/8/cifsd
> > +++ b/sys/man/8/cifsd
> > @@ -1,6 +1,6 @@
> >  .TH CIFSD 8
> >  .SH NAME
> > -cifsd \- CIFS/SMB network daemon
> > +cifsd \- CIFS/SMBv1 network daemon
> >  .SH SYNOPSIS
> >  .PP
> >  .B ip/cifsd
> > @@ -25,6 +25,7 @@
> >  exports filesystems to
> >  .SM CIFS or
> >  .SM SMB
> > +version 1
> >  clients like Microsoft \(tm Windows.
> >  .PP
> >  It is normally started by the network listen process via the
> > --- a/sys/src/cmd/ip/cifsd/dat.h
> > +++ b/sys/src/cmd/ip/cifsd/dat.h
> > @@ -139,9 +139,11 @@
> >  	STATUS_SMB_BAD_TID				= 0x00050002,
> >  	STATUS_SMB_BAD_FID				= 0x00060001,
> >  	STATUS_OS2_INVALID_ACCESS		= 0x000C0001,
> > +	STATUS_SMB_BAD_COMMAND			= 0x00160002,
> >  	STATUS_SMB_BAD_UID				= 0x005B0002,
> >  	STATUS_OS2_INVALID_LEVEL  		= 0x007C0001,
> >  	STATUS_NO_MORE_FILES			= 0x80000006,
> > +	STATUS_NOT_IMPLEMENTED			= 0xC0000002,
> >  	STATUS_INVALID_HANDLE			= 0xC0000008,
> >  	STATUS_NO_SUCH_FILE				= 0xC000000F,
> >  	STATUS_ACCESS_DENIED			= 0xC0000022,
> > --- a/sys/src/cmd/ip/cifsd/main.c
> > +++ b/sys/src/cmd/ip/cifsd/main.c
> > @@ -7,6 +7,7 @@
> >  	LENHDR = 4,
> >  
> >  	MAGIC = 0xFF | ('S'<<8) | ('M'<<16) | ('B'<<24),
> > +	MAGIC_SMB2 = 0xFE | ('S'<<8) | ('M'<<16) | ('B'<<24),
> >  
> >  	SMB_FLAGS_CASE_INSENSITIVE = 0x08,
> >  	SMB_FLAGS_CANONICALIZED_PATHS = 0x10,
> > @@ -88,8 +89,8 @@
> >  		exits("botch");
> >  		return;
> >  	}
> > -	if(magic != MAGIC){
> > -		logit("bad smb magic");
> > +	if(magic != MAGIC) {
> > +		logit("bad smb magic [%x] %s", magic, (magic == MAGIC_SMB2 ? "(SMB2/3 not supported)" : ""));
> >  		exits("botch");
> >  		return;
> >  	}
> > --- a/sys/src/cmd/ip/cifsd/smb.c
> > +++ b/sys/src/cmd/ip/cifsd/smb.c
> > @@ -135,7 +135,7 @@
> >  			free(mcr);
> >  		}
> >  		remoteuser = getuser();
> > -		logit("auth successfull");
> > +		logit("auth successful");
> >  		break;
> >  	}
> >  	sessionuid = (namehash(getuser()) & 0x7FFF) | 1;
> > @@ -794,6 +794,12 @@
> >  }
> >  
> >  void
> > +smbstatusnotimplemented(Req *r, uchar *, uchar *, uchar *)
> > +{
> > +	r->respond(r, STATUS_NOT_IMPLEMENTED);
> > +}
> > +
> > +void
> >  smbecho(Req *r, uchar *h, uchar *p, uchar *e)
> >  {
> >  	uchar *t, *d, *de;
> > @@ -1711,7 +1717,7 @@
> >  void
> >  smbnoandxcommand(Req *r, uchar *, uchar *, uchar *)
> >  {
> > -	r->respond(r, (r->cmd == 0xFF) ? STATUS_INVALID_SMB : 0);
> > +	r->respond(r, (r->cmd == 0xFF) ? STATUS_SMB_BAD_COMMAND : 0);
> >  }
> >  
> >  struct {
> > @@ -1731,6 +1737,10 @@
> >  	[0x23] { "SMB_COM_QUERY_INFORMATION2", smbqueryinformation2 },
> >  	[0x24] { "SMB_COM_LOCKING_ANDX", smblockingandx },
> >  	[0x25] { "SMB_COM_TRANSACTION", smbtransaction },
> > +	[0x27] { "SMB_COM_IOCTL", smbstatusnotimplemented },
> > +	[0x28] { "SMB_COM_IOCTL_SECONDARY", smbstatusnotimplemented },
> > +	[0x29] { "SMB_COM_COPY", smbstatusnotimplemented },
> > +	[0x2a] { "SMB_COM_MOVE", smbstatusnotimplemented },
> >  	[0x2b] { "SMB_COM_ECHO", smbecho },
> >  	[0x2d] { "SMB_COM_OPEN_ANDX", smbopenandx },
> >  	[0x2e] { "SMB_COM_READ_ANDX", smbreadandx },
> > @@ -1737,6 +1747,7 @@
> >  	[0x2f] { "SMB_COM_WRITE_ANDX", smbwriteandx },
> >  	[0x32] { "SMB_COM_TRANSACTION2", smbtransaction },
> >  	[0x34] { "SMB_COM_FIND_CLOSE2", smbcloseflush },
> > +	[0x40] { "SMB_IOS", smbnoandxcommand },
> >  	[0x71] { "SMB_COM_DISCONNECT_TREE", smbdisconnecttree },
> >  	[0x72] { "SMB_COM_NEGOTIATE", smbnegotiate },
> >  	[0x73] { "SMB_COM_SESSION_SETUP_ANX", smbsessionsetupandx },
> > @@ -1750,6 +1761,7 @@
> >  void
> >  smbcmd(Req *r, int cmd, uchar *h, uchar *p, uchar *e)
> >  {
> > +	logit("processing [%.2x] command", cmd);
> >  	if((cmd >= nelem(optab)) || (optab[cmd].fun == nil)){
> >  		logit("[%.2x] command not implemented", cmd);
> >  		r->respond(r, STATUS_NOT_SUPPORTED);
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-09-28  7:14 ` unobe
  2023-12-11 18:57   ` unobe
@ 2023-12-11 19:31   ` unobe
  2023-12-15  0:01     ` Roberto E. Vargas Caballero
  1 sibling, 1 reply; 9+ messages in thread
From: unobe @ 2023-12-11 19:31 UTC (permalink / raw)
  To: 9front

Ping.

The cifs spec specifies the protocol for SMBv1/CIFS to be OXFF, 'SMB':
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/69a29f73-de0c-45a6-a1aa-8ceeea42217f

For SMBv2 and above, it's OxFE, 'SMB':
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/fb188936-5050-48d3-b350-dc43059638a4

Quoth unobe@cpan.org:
> Desktop Mac (OS X) can connect to cifsd just fine, but iPhones (iOS)
> cannot.  My hope is that the documentation will clarify what is
> supported for someone down the road, and the logging will help
> diagnose situations where a client is connecting with an unsupported
> version.
> 
> Quoth Romano <unobe@cpan.org>:
> > 
> > SMB 2/3 is not supported by cifsd, so clarify that in the man page and update teh code to mention in the log file if SMB2/3 is attempted. Also, while in the code, fix a typo, add a few more commands to the explicitly unsupported list, and align the return value for unsupported calls to the SMBv1 spec.
> > ---
> > diff 755ac2c11ce134f76d83a2a42edb07a6304d1de8 f48ee862768b677d0b0fca82a7efecd0b4fb3b06
> > --- a/sys/man/8/cifsd
> > +++ b/sys/man/8/cifsd
> > @@ -1,6 +1,6 @@
> >  .TH CIFSD 8
> >  .SH NAME
> > -cifsd \- CIFS/SMB network daemon
> > +cifsd \- CIFS/SMBv1 network daemon
> >  .SH SYNOPSIS
> >  .PP
> >  .B ip/cifsd
> > @@ -25,6 +25,7 @@
> >  exports filesystems to
> >  .SM CIFS or
> >  .SM SMB
> > +version 1
> >  clients like Microsoft \(tm Windows.
> >  .PP
> >  It is normally started by the network listen process via the
> > --- a/sys/src/cmd/ip/cifsd/dat.h
> > +++ b/sys/src/cmd/ip/cifsd/dat.h
> > @@ -139,9 +139,11 @@
> >  	STATUS_SMB_BAD_TID				= 0x00050002,
> >  	STATUS_SMB_BAD_FID				= 0x00060001,
> >  	STATUS_OS2_INVALID_ACCESS		= 0x000C0001,
> > +	STATUS_SMB_BAD_COMMAND			= 0x00160002,
> >  	STATUS_SMB_BAD_UID				= 0x005B0002,
> >  	STATUS_OS2_INVALID_LEVEL  		= 0x007C0001,
> >  	STATUS_NO_MORE_FILES			= 0x80000006,
> > +	STATUS_NOT_IMPLEMENTED			= 0xC0000002,
> >  	STATUS_INVALID_HANDLE			= 0xC0000008,
> >  	STATUS_NO_SUCH_FILE				= 0xC000000F,
> >  	STATUS_ACCESS_DENIED			= 0xC0000022,
> > --- a/sys/src/cmd/ip/cifsd/main.c
> > +++ b/sys/src/cmd/ip/cifsd/main.c
> > @@ -7,6 +7,7 @@
> >  	LENHDR = 4,
> >  
> >  	MAGIC = 0xFF | ('S'<<8) | ('M'<<16) | ('B'<<24),
> > +	MAGIC_SMB2 = 0xFE | ('S'<<8) | ('M'<<16) | ('B'<<24),
> >  
> >  	SMB_FLAGS_CASE_INSENSITIVE = 0x08,
> >  	SMB_FLAGS_CANONICALIZED_PATHS = 0x10,
> > @@ -88,8 +89,8 @@
> >  		exits("botch");
> >  		return;
> >  	}
> > -	if(magic != MAGIC){
> > -		logit("bad smb magic");
> > +	if(magic != MAGIC) {
> > +		logit("bad smb magic [%x] %s", magic, (magic == MAGIC_SMB2 ? "(SMB2/3 not supported)" : ""));
> >  		exits("botch");
> >  		return;
> >  	}
> > --- a/sys/src/cmd/ip/cifsd/smb.c
> > +++ b/sys/src/cmd/ip/cifsd/smb.c
> > @@ -135,7 +135,7 @@
> >  			free(mcr);
> >  		}
> >  		remoteuser = getuser();
> > -		logit("auth successfull");
> > +		logit("auth successful");
> >  		break;
> >  	}
> >  	sessionuid = (namehash(getuser()) & 0x7FFF) | 1;
> > @@ -794,6 +794,12 @@
> >  }
> >  
> >  void
> > +smbstatusnotimplemented(Req *r, uchar *, uchar *, uchar *)
> > +{
> > +	r->respond(r, STATUS_NOT_IMPLEMENTED);
> > +}
> > +
> > +void
> >  smbecho(Req *r, uchar *h, uchar *p, uchar *e)
> >  {
> >  	uchar *t, *d, *de;
> > @@ -1711,7 +1717,7 @@
> >  void
> >  smbnoandxcommand(Req *r, uchar *, uchar *, uchar *)
> >  {
> > -	r->respond(r, (r->cmd == 0xFF) ? STATUS_INVALID_SMB : 0);
> > +	r->respond(r, (r->cmd == 0xFF) ? STATUS_SMB_BAD_COMMAND : 0);
> >  }
> >  
> >  struct {
> > @@ -1731,6 +1737,10 @@
> >  	[0x23] { "SMB_COM_QUERY_INFORMATION2", smbqueryinformation2 },
> >  	[0x24] { "SMB_COM_LOCKING_ANDX", smblockingandx },
> >  	[0x25] { "SMB_COM_TRANSACTION", smbtransaction },
> > +	[0x27] { "SMB_COM_IOCTL", smbstatusnotimplemented },
> > +	[0x28] { "SMB_COM_IOCTL_SECONDARY", smbstatusnotimplemented },
> > +	[0x29] { "SMB_COM_COPY", smbstatusnotimplemented },
> > +	[0x2a] { "SMB_COM_MOVE", smbstatusnotimplemented },
> >  	[0x2b] { "SMB_COM_ECHO", smbecho },
> >  	[0x2d] { "SMB_COM_OPEN_ANDX", smbopenandx },
> >  	[0x2e] { "SMB_COM_READ_ANDX", smbreadandx },
> > @@ -1737,6 +1747,7 @@
> >  	[0x2f] { "SMB_COM_WRITE_ANDX", smbwriteandx },
> >  	[0x32] { "SMB_COM_TRANSACTION2", smbtransaction },
> >  	[0x34] { "SMB_COM_FIND_CLOSE2", smbcloseflush },
> > +	[0x40] { "SMB_IOS", smbnoandxcommand },
> >  	[0x71] { "SMB_COM_DISCONNECT_TREE", smbdisconnecttree },
> >  	[0x72] { "SMB_COM_NEGOTIATE", smbnegotiate },
> >  	[0x73] { "SMB_COM_SESSION_SETUP_ANX", smbsessionsetupandx },
> > @@ -1750,6 +1761,7 @@
> >  void
> >  smbcmd(Req *r, int cmd, uchar *h, uchar *p, uchar *e)
> >  {
> > +	logit("processing [%.2x] command", cmd);
> >  	if((cmd >= nelem(optab)) || (optab[cmd].fun == nil)){
> >  		logit("[%.2x] command not implemented", cmd);
> >  		r->respond(r, STATUS_NOT_SUPPORTED);
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-12-11 19:31   ` unobe
@ 2023-12-15  0:01     ` Roberto E. Vargas Caballero
  0 siblings, 0 replies; 9+ messages in thread
From: Roberto E. Vargas Caballero @ 2023-12-15  0:01 UTC (permalink / raw)
  To: 9front

Hi,

Cinap dis you see these commits? I think they seem interesting, but you should take
a look since you know more than me about this topic.

Regards,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-09-28  6:34 [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3 Romano
  2023-09-28  7:14 ` unobe
@ 2023-12-18 12:41 ` cinap_lenrek
  2023-12-18 18:05 ` cinap_lenrek
  2 siblings, 0 replies; 9+ messages in thread
From: cinap_lenrek @ 2023-12-18 12:41 UTC (permalink / raw)
  To: 9front

i'm sorry for a answer so late...

the change looks fine to me.

i'll apply when finishing work.

--
cinap

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-09-28  6:34 [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3 Romano
  2023-09-28  7:14 ` unobe
  2023-12-18 12:41 ` cinap_lenrek
@ 2023-12-18 18:05 ` cinap_lenrek
  2023-12-18 18:55   ` unobe
  2 siblings, 1 reply; 9+ messages in thread
From: cinap_lenrek @ 2023-12-18 18:05 UTC (permalink / raw)
  To: 9front

ok, applied.

i removed the following tho:

+	logit("processing [%.2x] command", cmd);

this is very dangerous and will just fill up your dump with
pointless log messages.

if you want to debug, pass the -d flag (it already logs the
commands in that case).

--
cinap

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-12-18 18:05 ` cinap_lenrek
@ 2023-12-18 18:55   ` unobe
  2023-12-19 17:36     ` cinap_lenrek
  0 siblings, 1 reply; 9+ messages in thread
From: unobe @ 2023-12-18 18:55 UTC (permalink / raw)
  To: 9front

Quoth cinap_lenrek@felloff.net:
> ok, applied.
> 
> i removed the following tho:
> 
> +	logit("processing [%.2x] command", cmd);
> 
> this is very dangerous and will just fill up your dump with
> pointless log messages.
> 
> if you want to debug, pass the -d flag (it already logs the
> commands in that case).

Thanks, cinap.  I don't recall at this point, but I think I had added
the logit() at the beginning of the sub because the command that was
problematic.  I do not think it was greater than nelems(optab) and yet
wasn't defined, so the 'if' condition would die.  There are now more
added commands, so maybe that won't even be an issue going forward.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3.
  2023-12-18 18:55   ` unobe
@ 2023-12-19 17:36     ` cinap_lenrek
  0 siblings, 0 replies; 9+ messages in thread
From: cinap_lenrek @ 2023-12-19 17:36 UTC (permalink / raw)
  To: 9front

no, thank you! :-)

--
cinap

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-12-19 17:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28  6:34 [9front] [PATCH 2/6] cifsd: clarify SMBv1 is supported, not SMB 2/3 Romano
2023-09-28  7:14 ` unobe
2023-12-11 18:57   ` unobe
2023-12-11 19:31   ` unobe
2023-12-15  0:01     ` Roberto E. Vargas Caballero
2023-12-18 12:41 ` cinap_lenrek
2023-12-18 18:05 ` cinap_lenrek
2023-12-18 18:55   ` unobe
2023-12-19 17:36     ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).