diff options
| author | Jeremy Allison <jra@samba.org> | 2002-02-27 21:46:53 +0000 | 
|---|---|---|
| committer | Jeremy Allison <jra@samba.org> | 2002-02-27 21:46:53 +0000 | 
| commit | 2da4d64cfcf289d18d622c67d3250c51e6b88466 (patch) | |
| tree | e6e8897eff144ae4f8cc6a79b94760a737d2e1bb | |
| parent | 9e2a06611d5ab7e2dbba7e9fbc84e1fcae0c58ed (diff) | |
| download | samba-2da4d64cfcf289d18d622c67d3250c51e6b88466.tar.gz samba-2da4d64cfcf289d18d622c67d3250c51e6b88466.tar.bz2 samba-2da4d64cfcf289d18d622c67d3250c51e6b88466.zip  | |
Added "nt status support" parameter. Fix offline synchronisation.
Jeremy.
(This used to be commit 9243a9778e52999d5c62cba484640637b24994d8)
| -rw-r--r-- | source3/include/smb.h | 1 | ||||
| -rw-r--r-- | source3/param/loadparm.c | 4 | ||||
| -rw-r--r-- | source3/smbd/error.c | 16 | ||||
| -rw-r--r-- | source3/smbd/negprot.c | 25 | ||||
| -rw-r--r-- | source3/smbd/nttrans.c | 9 | ||||
| -rw-r--r-- | source3/smbd/reply.c | 10 | 
6 files changed, 37 insertions, 28 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h index 6f05868a3f..357362f8a2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1277,6 +1277,7 @@ char *strdup(char *s);  #define FLAGS2_LONG_PATH_COMPONENTS   0x0001  #define FLAGS2_EXTENDED_ATTRIBUTES    0x0002 +#define FLAGS2_IS_LONG_NAME           0x0040  #define FLAGS2_EXTENDED_SECURITY      0x0800   #define FLAGS2_DFS_PATHNAMES          0x1000  #define FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 8679addcff..7548ff03a8 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -255,6 +255,7 @@ typedef struct  	BOOL bTimestampLogs;  	BOOL bNTSmbSupport;  	BOOL bNTPipeSupport; +	BOOL bNTStatusSupport;  	BOOL bStatCache;  	BOOL bKernelOplocks;  	BOOL bAllowTrustedDomains; @@ -808,6 +809,7 @@ static struct parm_struct parm_table[] = {  	{"nt pipe support", P_BOOL, P_GLOBAL, &Globals.bNTPipeSupport, NULL, NULL, 0},  	{"nt acl support", P_BOOL,  P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE }, +	{"nt status support", P_BOOL, P_GLOBAL, &Globals.bNTStatusSupport, NULL, NULL, 0},  	{"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL, 0},  	{"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, 0},  	{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, 0}, @@ -1298,6 +1300,7 @@ static void init_globals(void)  	Globals.bPasswdChatDebug = False;  	Globals.bUnicode = True;	/* Do unicode on the wire by default */  	Globals.bNTPipeSupport = True;	/* Do NT pipes by default. */ +	Globals.bNTStatusSupport = True; /* Use NT status by default. */  	Globals.bStatCache = True;	/* use stat cache by default */  	Globals.bRestrictAnonymous = False;  	Globals.bLanmanAuth = True;	/* Do use the LanMan hash if it is available */ @@ -1601,6 +1604,7 @@ FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)  FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)  FN_GLOBAL_BOOL(lp_unicode, &Globals.bUnicode)  FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport) +FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)  FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)  FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)  FN_GLOBAL_BOOL(lp_restrict_anonymous, &Globals.bRestrictAnonymous) diff --git a/source3/smbd/error.c b/source3/smbd/error.c index 6b3b73aa87..92a7c11b15 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -90,10 +90,17 @@ int error_packet(char *outbuf,NTSTATUS ntstatus,  	if (errno != 0)  		DEBUG(3,("error string = %s\n",strerror(errno))); -	if (global_client_caps & CAP_STATUS32) { -		if (NT_STATUS_V(ntstatus) == 0 && eclass) { +	/* +	 * We can explicitly force 32 bit error codes even when the +	 * parameter "nt status" is set to no by pre-setting the +	 * FLAGS2_32_BIT_ERROR_CODES bit in the smb_flg2 outbuf. +	 * This is to allow work arounds for client bugs that are needed +	 * when talking with clients that normally expect nt status codes. JRA. +	 */ + +	if ((lp_nt_status_support() || (SVAL(outbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) && (global_client_caps & CAP_STATUS32)) { +		if (NT_STATUS_V(ntstatus) == 0 && eclass)  			ntstatus = dos_to_ntstatus(eclass, ecode); -		}  		SIVAL(outbuf,smb_rcls,NT_STATUS_V(ntstatus));  		SSVAL(outbuf,smb_flg2, SVAL(outbuf,smb_flg2)|FLAGS2_32_BIT_ERROR_CODES);  		DEBUG(3,("error packet at %s(%d) cmd=%d (%s) %s\n", @@ -104,9 +111,8 @@ int error_packet(char *outbuf,NTSTATUS ntstatus,  		return outsize;  	}  -	if (eclass == 0 && NT_STATUS_V(ntstatus)) { +	if (eclass == 0 && NT_STATUS_V(ntstatus))  		ntstatus_to_dos(ntstatus, &eclass, &ecode); -	}  	SSVAL(outbuf,smb_flg2, SVAL(outbuf,smb_flg2)&~FLAGS2_32_BIT_ERROR_CODES);  	SSVAL(outbuf,smb_rcls,eclass); diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 934d594853..f4ed360845 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -220,7 +220,7 @@ static int reply_nt1(char *inbuf, char *outbuf)  {  	/* dual names + lock_and_read + nt SMBs + remote API calls */  	int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ| -		CAP_LEVEL_II_OPLOCKS|CAP_STATUS32; +		CAP_LEVEL_II_OPLOCKS;  	int secword=0;  	time_t t = time(NULL); @@ -242,28 +242,29 @@ static int reply_nt1(char *inbuf, char *outbuf)  	capabilities |= CAP_NT_SMBS|CAP_RPC_REMOTE_APIS|CAP_UNIX; -	if (lp_large_readwrite() && (SMB_OFF_T_BITS == 64)) { +	if (lp_large_readwrite() && (SMB_OFF_T_BITS == 64))  		capabilities |= CAP_LARGE_READX|CAP_LARGE_WRITEX|CAP_W2K_SMBS; -	} -	if (SMB_OFF_T_BITS == 64) { +	if (SMB_OFF_T_BITS == 64)  		capabilities |= CAP_LARGE_FILES; -	} -	 -	if (lp_readraw() && lp_writeraw()) { + +	if (lp_readraw() && lp_writeraw())  		capabilities |= CAP_RAW_MODE; -	}  	/* allow for disabling unicode */ -	if (lp_unicode()) { +	if (lp_unicode())  		capabilities |= CAP_UNICODE; -	} + +	if (lp_nt_status_support()) +		capabilities |= CAP_STATUS32;  	if (lp_host_msdfs())  		capabilities |= CAP_DFS; -	if (lp_security() >= SEC_USER) secword |= 1; -	if (global_encrypted_passwords_negotiated) secword |= 2; +	if (lp_security() >= SEC_USER) +		secword |= 1; +	if (global_encrypted_passwords_negotiated) +		secword |= 2;  	set_message(outbuf,17,0,True); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 501f0e9ab0..d56b7fe622 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -828,8 +828,8 @@ int reply_ntcreate_and_X(connection_struct *conn,  	if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))  		smb_action |= EXTENDED_OPLOCK_GRANTED; -#if 1 /* JRATEST */ -	/* W2K sends back 42 words here ! */ +#if 0 +	/* W2K sends back 42 words here ! If we do the same it breaks offline sync. Go figure... ? JRA. */  	set_message(outbuf,42,0,True);  #else  	set_message(outbuf,34,0,True); @@ -1809,9 +1809,8 @@ due to being in oplock break state.\n" ));      }    } -  if (Protocol >= PROTOCOL_NT1) { -    SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | 0x40); /* IS_LONG_NAME */ -  } +  if (Protocol >= PROTOCOL_NT1) +    SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | FLAGS2_IS_LONG_NAME);    /* Now we must call the relevant NT_TRANS function */    switch(function_code) { diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c7f805122d..0a349a9c8a 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -482,9 +482,8 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size      put_dos_date3(outbuf,smb_vwv1,mtime);    SIVAL(outbuf,smb_vwv3,(uint32)size); -  if (Protocol >= PROTOCOL_NT1) { -	  SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) | 0x40); /* IS_LONG_NAME */ -  } +  if (Protocol >= PROTOCOL_NT1) +	  SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);    DEBUG( 3, ( "getatr name=%s mode=%d size=%d\n", fname, mode, (uint32)size ) ); @@ -760,9 +759,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size    SCVAL(smb_buf(outbuf),0,5);    SSVAL(smb_buf(outbuf),1,numentries*DIR_STRUCT_SIZE); -  if (Protocol >= PROTOCOL_NT1) { -    SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) | 0x40); /* IS_LONG_NAME */ -  } +  if (Protocol >= PROTOCOL_NT1) +    SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);    outsize += DIR_STRUCT_SIZE*numentries;    smb_setlen(outbuf,outsize - 4);  | 
