mirror of
https://github.com/samba-team/samba.git
synced 2025-09-06 17:44:20 +03:00
look at the CAP_NT_SMBS bit in the client capabilities to determine if
we should serve up volume labels as ascii or unicode.
NT wants ascii, W95 wants unicode. It's a crazy protocol!
(This used to be commit 24b8a757ae
)
This commit is contained in:
@@ -41,6 +41,8 @@ extern pstring sesssetup_user;
|
|||||||
extern fstring global_myworkgroup;
|
extern fstring global_myworkgroup;
|
||||||
extern int Client;
|
extern int Client;
|
||||||
extern int global_oplock_break;
|
extern int global_oplock_break;
|
||||||
|
uint32 global_client_caps = 0;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
report a possible attack via the password buffer overflow bug
|
report a possible attack via the password buffer overflow bug
|
||||||
@@ -489,11 +491,11 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
|||||||
} else {
|
} else {
|
||||||
uint16 passlen1 = SVAL(inbuf,smb_vwv7);
|
uint16 passlen1 = SVAL(inbuf,smb_vwv7);
|
||||||
uint16 passlen2 = SVAL(inbuf,smb_vwv8);
|
uint16 passlen2 = SVAL(inbuf,smb_vwv8);
|
||||||
uint32 client_caps = IVAL(inbuf,smb_vwv11);
|
|
||||||
enum remote_arch_types ra_type = get_remote_arch();
|
enum remote_arch_types ra_type = get_remote_arch();
|
||||||
|
|
||||||
char *p = smb_buf(inbuf);
|
char *p = smb_buf(inbuf);
|
||||||
|
|
||||||
|
global_client_caps = IVAL(inbuf,smb_vwv11);
|
||||||
|
|
||||||
/* client_caps is used as final determination if client is NT or Win95.
|
/* client_caps is used as final determination if client is NT or Win95.
|
||||||
This is needed to return the correct error codes in some
|
This is needed to return the correct error codes in some
|
||||||
circumstances.
|
circumstances.
|
||||||
@@ -501,7 +503,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
|||||||
|
|
||||||
if(ra_type == RA_WINNT || ra_type == RA_WIN95)
|
if(ra_type == RA_WINNT || ra_type == RA_WIN95)
|
||||||
{
|
{
|
||||||
if(client_caps & (CAP_NT_SMBS | CAP_STATUS32))
|
if(global_client_caps & (CAP_NT_SMBS | CAP_STATUS32))
|
||||||
set_remote_arch( RA_WINNT);
|
set_remote_arch( RA_WINNT);
|
||||||
else
|
else
|
||||||
set_remote_arch( RA_WIN95);
|
set_remote_arch( RA_WIN95);
|
||||||
|
@@ -1069,6 +1069,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
|
|||||||
char *vname = volume_label(SNUM(conn));
|
char *vname = volume_label(SNUM(conn));
|
||||||
int snum = SNUM(conn);
|
int snum = SNUM(conn);
|
||||||
char *fstype = lp_fstype(SNUM(conn));
|
char *fstype = lp_fstype(SNUM(conn));
|
||||||
|
extern uint32 global_client_caps;
|
||||||
|
|
||||||
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
|
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
|
||||||
|
|
||||||
@@ -1131,24 +1132,28 @@ static int call_trans2qfsinfo(connection_struct *conn,
|
|||||||
break;
|
break;
|
||||||
case SMB_QUERY_FS_VOLUME_INFO:
|
case SMB_QUERY_FS_VOLUME_INFO:
|
||||||
|
|
||||||
/* NT4 always serves this up as unicode. JRA had noted this was
|
|
||||||
* not the case in an earlier comment. What is going on? I
|
|
||||||
* tested with Win95 -> NT and a sniff definately showed
|
|
||||||
* unicode. The volume label now shows up correctly under Win95
|
|
||||||
* with unicode here (tridge, Sep98)
|
|
||||||
*/
|
|
||||||
|
|
||||||
data_len = 18 + 2*strlen(vname);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add volume serial number - hash of a combination of
|
* Add volume serial number - hash of a combination of
|
||||||
* the called hostname and the service name.
|
* the called hostname and the service name.
|
||||||
*/
|
*/
|
||||||
SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^ (str_checksum(local_machine)<<16) );
|
SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^
|
||||||
SIVAL(pdata,12,strlen(vname)*2);
|
(str_checksum(local_machine)<<16));
|
||||||
PutUniCode(pdata+18,vname);
|
|
||||||
DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n", strlen(vname),
|
/* NT4 always serves this up as unicode but expects it to be
|
||||||
vname));
|
* delivered as ascii! (tridge && JRA)
|
||||||
|
*/
|
||||||
|
if (global_client_caps & CAP_NT_SMBS) {
|
||||||
|
data_len = 18 + strlen(vname);
|
||||||
|
SIVAL(pdata,12,strlen(vname));
|
||||||
|
pstrcpy(pdata+18,vname);
|
||||||
|
} else {
|
||||||
|
data_len = 18 + 2*strlen(vname);
|
||||||
|
SIVAL(pdata,12,strlen(vname)*2);
|
||||||
|
PutUniCode(pdata+18,vname);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n",
|
||||||
|
strlen(vname),vname));
|
||||||
break;
|
break;
|
||||||
case SMB_QUERY_FS_SIZE_INFO:
|
case SMB_QUERY_FS_SIZE_INFO:
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user