@@ -121,6 +121,32 @@ func TestDOSErrorDecomposesCIFSStatus(t *testing.T) {
121121 }
122122}
123123
124+ // TestDOSErrorTabulatesSMBNoSupport covers the one [MS-CIFS] composite that
125+ // cannot be decomposed. NT_STATUS_SMB_NO_SUPPORT is ERRSRV/ERRnosupport, but its
126+ // ErrorCode is 0xFFFF, so the value's top byte is 0xFF and the decomposition in
127+ // DOSError — which requires a zero top byte to tell a composite apart from a
128+ // real [MS-ERREF] NTSTATUS — cannot claim it. It is tabulated instead, and
129+ // without that entry a client which did not negotiate NT status codes would be
130+ // told ERRSRV/ERRsrverror for a subcommand the specification says to refuse with
131+ // ERRnosupport.
132+ func TestDOSErrorTabulatesSMBNoSupport (t * testing.T ) {
133+ got , ok := DOSError (nt_status .NT_STATUS_SMB_NO_SUPPORT )
134+ if ! ok {
135+ t .Fatal ("DOSError(NT_STATUS_SMB_NO_SUPPORT) reported no mapping" )
136+ }
137+ if want := (SMBStatus {ERRSRV , 0xFFFF }); got != want {
138+ t .Fatalf ("DOSError(NT_STATUS_SMB_NO_SUPPORT) = %s/0x%04X, want %s/0x%04X" ,
139+ got .Class , got .Code , want .Class , want .Code )
140+ }
141+ if got == unmappedError {
142+ t .Fatal ("it fell through to the generic ERRSRV/ERRsrverror" )
143+ }
144+ // It is still wire-identical to the NTSTATUS, like every other composite.
145+ if encoded := got .Encode (); encoded != uint32 (nt_status .NT_STATUS_SMB_NO_SUPPORT ) {
146+ t .Fatalf ("re-encoding gives 0x%08X, want 0x%08X" , encoded , uint32 (nt_status .NT_STATUS_SMB_NO_SUPPORT ))
147+ }
148+ }
149+
124150// TestDOSErrorUnmapped asserts an NTSTATUS with no legacy equivalent reports
125151// that fact and still yields something valid to send.
126152func TestDOSErrorUnmapped (t * testing.T ) {
0 commit comments