diff options
author | Jeremy Allison <jra@samba.org> | 2002-01-11 19:10:25 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-01-11 19:10:25 +0000 |
commit | 01ff6ce4963e1daff019f2b936cef218e1c93f67 (patch) | |
tree | cc0f4705076a09781bb9365d56e1bd5f56a59d6e /source | |
parent | 0b0b937b58f4bf4e005fb622f0db19175fc46a47 (diff) | |
download | samba-01ff6ce4963e1daff019f2b936cef218e1c93f67.tar.gz |
Same fix as went into 2.2 (I'm waiting for jerry to finish some code).
Jeremy.
Diffstat (limited to 'source')
-rw-r--r-- | source/include/byteorder.h | 42 | ||||
-rw-r--r-- | source/lib/util.c | 12 | ||||
-rw-r--r-- | source/libsmb/cliconnect.c | 36 | ||||
-rw-r--r-- | source/libsmb/clidgram.c | 2 | ||||
-rw-r--r-- | source/libsmb/clientgen.c | 2 | ||||
-rw-r--r-- | source/libsmb/clifile.c | 52 | ||||
-rw-r--r-- | source/libsmb/clilist.c | 4 | ||||
-rw-r--r-- | source/libsmb/climessage.c | 6 | ||||
-rw-r--r-- | source/libsmb/clioplock.c | 2 | ||||
-rw-r--r-- | source/libsmb/clireadwrite.c | 12 | ||||
-rw-r--r-- | source/libsmb/clitrans.c | 8 | ||||
-rw-r--r-- | source/nmbd/nmbd_browsesync.c | 2 | ||||
-rw-r--r-- | source/nmbd/nmbd_elections.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_packets.c | 2 | ||||
-rw-r--r-- | source/nmbd/nmbd_sendannounce.c | 22 | ||||
-rw-r--r-- | source/smbd/lanman.c | 16 | ||||
-rw-r--r-- | source/smbd/negprot.c | 2 | ||||
-rw-r--r-- | source/smbd/process.c | 14 | ||||
-rw-r--r-- | source/smbd/reply.c | 68 | ||||
-rw-r--r-- | source/smbd/trans2.c | 10 |
20 files changed, 162 insertions, 156 deletions
diff --git a/source/include/byteorder.h b/source/include/byteorder.h index e6cce73cebf..fab77060be0 100644 --- a/source/include/byteorder.h +++ b/source/include/byteorder.h @@ -106,23 +106,25 @@ it also defines lots of intermediate macros, just ignore those :-) #define CAREFUL_ALIGNMENT 1 #endif -#define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) -#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) -#define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val)) +#define CVAL(buf,pos) (((const unsigned char *)(buf))[pos]) +#define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos]) /* Non-const version of CVAL */ +#define PVAL(buf,pos) ((const unsigned)CVAL(buf,pos)) +#define PVAL_NC(buf,pos) ((unsigned)CVAL(buf,pos)) /* Non const version of PVAL */ +#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val)) #if CAREFUL_ALIGNMENT #define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) #define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) -#define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) +#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(val)&0xFF,CVAL_NC(buf,pos+1)=(val)>>8) #define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) -#define SVALS(buf,pos) ((int16)SVAL(buf,pos)) -#define IVALS(buf,pos) ((int32)IVAL(buf,pos)) -#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val))) -#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val))) -#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) -#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) +#define SVALS(buf,pos) ((const int16)SVAL(buf,pos)) +#define IVALS(buf,pos) ((const int32)IVAL(buf,pos)) +#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((const uint16)(val))) +#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((const uint32)(val))) +#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((const int16)(val))) +#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((const int32)(val))) #else /* CAREFUL_ALIGNMENT */ @@ -134,16 +136,20 @@ it also defines lots of intermediate macros, just ignore those :-) */ /* get single value from an SMB buffer */ -#define SVAL(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) -#define IVAL(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) -#define SVALS(buf,pos) (*(int16 *)((char *)(buf) + (pos))) -#define IVALS(buf,pos) (*(int32 *)((char *)(buf) + (pos))) +#define SVAL(buf,pos) (*(const uint16 *)((const char *)(buf) + (pos))) +#define SVAL_NC(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define IVAL(buf,pos) (*(const uint32 *)((const char *)(buf) + (pos))) +#define IVAL_NC(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define SVALS(buf,pos) (*(const int16 *)((const char *)(buf) + (pos))) +#define SVALS_NC(buf,pos) (*(int16 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define IVALS(buf,pos) (*(const int32 *)((const char *)(buf) + (pos))) +#define IVALS_NC(buf,pos) (*(int32 *)((char *)(buf) + (pos))) /* Non const version of above. */ /* store single value in an SMB buffer */ -#define SSVAL(buf,pos,val) SVAL(buf,pos)=((uint16)(val)) -#define SIVAL(buf,pos,val) IVAL(buf,pos)=((uint32)(val)) -#define SSVALS(buf,pos,val) SVALS(buf,pos)=((int16)(val)) -#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val)) +#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((const uint16)(val)) +#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((const uint32)(val)) +#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((const int16)(val)) +#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((const int32)(val)) #endif /* CAREFUL_ALIGNMENT */ diff --git a/source/lib/util.c b/source/lib/util.c index 6caa6050663..97d89738736 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -311,10 +311,10 @@ void smb_setlen(char *buf,int len) { _smb_setlen(buf,len); - CVAL(buf,4) = 0xFF; - CVAL(buf,5) = 'S'; - CVAL(buf,6) = 'M'; - CVAL(buf,7) = 'B'; + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'S'); + SCVAL(buf,6,'M'); + SCVAL(buf,7,'B'); } /******************************************************************* @@ -324,7 +324,7 @@ int set_message(char *buf,int num_words,int num_bytes,BOOL zero) { if (zero) memset(buf + smb_size,'\0',num_words*2 + num_bytes); - CVAL(buf,smb_wct) = num_words; + SCVAL(buf,smb_wct,num_words); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); return (smb_size + num_words*2 + num_bytes); @@ -494,7 +494,7 @@ void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,ti push_ascii(buf+1,mask2,11, 0); memset(buf+21,'\0',DIR_STRUCT_SIZE-21); - CVAL(buf,21) = mode; + SCVAL(buf,21,mode); put_dos_date(buf,22,date); SSVAL(buf,26,size & 0xFFFF); SSVAL(buf,28,(size >> 16)&0xFFFF); diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c index 1812416426d..08d9f3b3826 100644 --- a/source/libsmb/cliconnect.c +++ b/source/libsmb/cliconnect.c @@ -76,10 +76,10 @@ static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user, /* send a session setup command */ memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,10, 0, True); - CVAL(cli->outbuf,smb_com) = SMBsesssetupX; + SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,cli->max_xmit); SSVAL(cli->outbuf,smb_vwv3,2); SSVAL(cli->outbuf,smb_vwv4,1); @@ -142,10 +142,10 @@ static BOOL cli_session_setup_guest(struct cli_state *cli) uint32 capabilities = cli_session_setup_capabilities(cli); set_message(cli->outbuf,13,0,True); - CVAL(cli->outbuf,smb_com) = SMBsesssetupX; + SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,CLI_BUFFER_SIZE); SSVAL(cli->outbuf,smb_vwv3,2); SSVAL(cli->outbuf,smb_vwv4,cli->pid); @@ -197,10 +197,10 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user, passlen = clistr_push(cli, pword, pass, sizeof(pword), STR_TERMINATE|STR_ASCII); set_message(cli->outbuf,13,0,True); - CVAL(cli->outbuf,smb_com) = SMBsesssetupX; + SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,CLI_BUFFER_SIZE); SSVAL(cli->outbuf,smb_vwv3,2); SSVAL(cli->outbuf,smb_vwv4,cli->pid); @@ -273,10 +273,10 @@ static BOOL cli_session_setup_nt1(struct cli_state *cli, char *user, memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,13,0,True); - CVAL(cli->outbuf,smb_com) = SMBsesssetupX; + SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,CLI_BUFFER_SIZE); SSVAL(cli->outbuf,smb_vwv3,2); SSVAL(cli->outbuf,smb_vwv4,cli->pid); @@ -335,10 +335,10 @@ static DATA_BLOB cli_session_setup_blob(struct cli_state *cli, DATA_BLOB blob) memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,12,0,True); - CVAL(cli->outbuf,smb_com) = SMBsesssetupX; + SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,CLI_BUFFER_SIZE); SSVAL(cli->outbuf,smb_vwv3,2); SSVAL(cli->outbuf,smb_vwv4,1); @@ -633,7 +633,7 @@ BOOL cli_ulogoff(struct cli_state *cli) { memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,2,0,True); - CVAL(cli->outbuf,smb_com) = SMBulogoffX; + SCVAL(cli->outbuf,smb_com,SMBulogoffX); cli_setup_packet(cli); SSVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,0); /* no additional info */ @@ -691,7 +691,7 @@ BOOL cli_send_tconX(struct cli_state *cli, } set_message(cli->outbuf,4, 0, True); - CVAL(cli->outbuf,smb_com) = SMBtconX; + SCVAL(cli->outbuf,smb_com,SMBtconX); cli_setup_packet(cli); SSVAL(cli->outbuf,smb_vwv0,0xFF); @@ -737,7 +737,7 @@ BOOL cli_tdis(struct cli_state *cli) { memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,0,0,True); - CVAL(cli->outbuf,smb_com) = SMBtdis; + SCVAL(cli->outbuf,smb_com,SMBtdis); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -770,11 +770,11 @@ void cli_negprot_send(struct cli_state *cli) p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } - CVAL(cli->outbuf,smb_com) = SMBnegprot; + SCVAL(cli->outbuf,smb_com,SMBnegprot); cli_setup_bcc(cli, p); cli_setup_packet(cli); - CVAL(smb_buf(cli->outbuf),0) = 2; + SCVAL(smb_buf(cli->outbuf),0,2); cli_send_smb(cli); } @@ -807,10 +807,10 @@ BOOL cli_negprot(struct cli_state *cli) p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } - CVAL(cli->outbuf,smb_com) = SMBnegprot; + SCVAL(cli->outbuf,smb_com,SMBnegprot); cli_setup_packet(cli); - CVAL(smb_buf(cli->outbuf),0) = 2; + SCVAL(smb_buf(cli->outbuf),0,2); cli_send_smb(cli); if (!cli_receive_smb(cli)) @@ -905,7 +905,7 @@ BOOL cli_session_request(struct cli_state *cli, /* setup the packet length */ _smb_setlen(cli->outbuf,len); - CVAL(cli->outbuf,0) = 0x81; + SCVAL(cli->outbuf,0,0x81); #ifdef WITH_SSL retry: diff --git a/source/libsmb/clidgram.c b/source/libsmb/clidgram.c index e990739de5a..ded47b7d068 100644 --- a/source/libsmb/clidgram.c +++ b/source/libsmb/clidgram.c @@ -71,7 +71,7 @@ int cli_send_mailslot(int dgram_sock, BOOL unique, char *mailslot, set_message(ptr,17,17 + len,True); memcpy(ptr,tmp,4); - CVAL(ptr,smb_com) = SMBtrans; + SCVAL(ptr,smb_com,SMBtrans); SSVAL(ptr,smb_vwv1,len); SSVAL(ptr,smb_vwv11,len); SSVAL(ptr,smb_vwv12,70 + strlen(mailslot)); diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c index 610af9cc237..022046ceb28 100644 --- a/source/libsmb/clientgen.c +++ b/source/libsmb/clientgen.c @@ -57,7 +57,7 @@ BOOL cli_receive_smb(struct cli_state *cli) if (!cli->oplock_handler(cli, fnum, level)) return False; } /* try to prevent loops */ - CVAL(cli->inbuf,smb_com) = 0xFF; + SCVAL(cli->inbuf,smb_com,0xFF); goto again; } } diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c index 5c372552784..7cd1e4ddb1d 100644 --- a/source/libsmb/clifile.c +++ b/source/libsmb/clifile.c @@ -36,7 +36,7 @@ BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_ set_message(cli->outbuf,1, 0, True); - CVAL(cli->outbuf,smb_com) = SMBmv; + SCVAL(cli->outbuf,smb_com,SMBmv); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -73,7 +73,7 @@ BOOL cli_unlink(struct cli_state *cli, const char *fname) set_message(cli->outbuf,1, 0,True); - CVAL(cli->outbuf,smb_com) = SMBunlink; + SCVAL(cli->outbuf,smb_com,SMBunlink); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -109,7 +109,7 @@ BOOL cli_mkdir(struct cli_state *cli, const char *dname) set_message(cli->outbuf,0, 0,True); - CVAL(cli->outbuf,smb_com) = SMBmkdir; + SCVAL(cli->outbuf,smb_com,SMBmkdir); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -144,7 +144,7 @@ BOOL cli_rmdir(struct cli_state *cli, const char *dname) set_message(cli->outbuf,0, 0, True); - CVAL(cli->outbuf,smb_com) = SMBrmdir; + SCVAL(cli->outbuf,smb_com,SMBrmdir); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -224,7 +224,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredA set_message(cli->outbuf,24,0,True); - CVAL(cli->outbuf,smb_com) = SMBntcreateX; + SCVAL(cli->outbuf,smb_com,SMBntcreateX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -317,7 +317,7 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode set_message(cli->outbuf,15,0,True); - CVAL(cli->outbuf,smb_com) = SMBopenX; + SCVAL(cli->outbuf,smb_com,SMBopenX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -331,8 +331,8 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode if (cli->use_oplocks) { /* if using oplocks then ask for a batch oplock via core and extended methods */ - CVAL(cli->outbuf,smb_flg) |= - FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK; + SCVAL(cli->outbuf,smb_flg, CVAL(cli->outbuf,smb_flg)| + FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK); SSVAL(cli->outbuf,smb_vwv2,SVAL(cli->outbuf,smb_vwv2) | 6); } @@ -364,7 +364,7 @@ BOOL cli_close(struct cli_state *cli, int fnum) set_message(cli->outbuf,3,0,True); - CVAL(cli->outbuf,smb_com) = SMBclose; + SCVAL(cli->outbuf,smb_com,SMBclose); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -394,13 +394,13 @@ BOOL cli_lock(struct cli_state *cli, int fnum, set_message(cli->outbuf,8,0,True); - CVAL(cli->outbuf,smb_com) = SMBlockingX; + SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); - CVAL(cli->outbuf,smb_vwv3) = (lock_type == READ_LOCK? 1 : 0); + SCVAL(cli->outbuf,smb_vwv3,(lock_type == READ_LOCK? 1 : 0)); SIVALS(cli->outbuf, smb_vwv4, timeout); SSVAL(cli->outbuf,smb_vwv6,0); SSVAL(cli->outbuf,smb_vwv7,1); @@ -445,13 +445,13 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len) set_message(cli->outbuf,8,0,True); - CVAL(cli->outbuf,smb_com) = SMBlockingX; + SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); - CVAL(cli->outbuf,smb_vwv3) = 0; + SCVAL(cli->outbuf,smb_vwv3,0); SIVALS(cli->outbuf, smb_vwv4, 0); SSVAL(cli->outbuf,smb_vwv6,1); SSVAL(cli->outbuf,smb_vwv7,0); @@ -497,13 +497,13 @@ BOOL cli_lock64(struct cli_state *cli, int fnum, set_message(cli->outbuf,8,0,True); - CVAL(cli->outbuf,smb_com) = SMBlockingX; + SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); - CVAL(cli->outbuf,smb_vwv3) = ltype; + SCVAL(cli->outbuf,smb_vwv3,ltype); SIVALS(cli->outbuf, smb_vwv4, timeout); SSVAL(cli->outbuf,smb_vwv6,0); SSVAL(cli->outbuf,smb_vwv7,1); @@ -550,13 +550,13 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_ set_message(cli->outbuf,8,0,True); - CVAL(cli->outbuf,smb_com) = SMBlockingX; + SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); - CVAL(cli->outbuf,smb_vwv3) = LOCKING_ANDX_LARGE_FILES; + SCVAL(cli->outbuf,smb_vwv3,LOCKING_ANDX_LARGE_FILES); SIVALS(cli->outbuf, smb_vwv4, 0); SSVAL(cli->outbuf,smb_vwv6,1); SSVAL(cli->outbuf,smb_vwv7,0); @@ -592,7 +592,7 @@ BOOL cli_getattrE(struct cli_state *cli, int fd, set_message(cli->outbuf,1,0,True); - CVAL(cli->outbuf,smb_com) = SMBgetattrE; + SCVAL(cli->outbuf,smb_com,SMBgetattrE); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -644,7 +644,7 @@ BOOL cli_getatr(struct cli_state *cli, const char *fname, set_message(cli->outbuf,0,0,True); - CVAL(cli->outbuf,smb_com) = SMBgetatr; + SCVAL(cli->outbuf,smb_com,SMBgetatr); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -692,7 +692,7 @@ BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t) set_message(cli->outbuf,8,0,True); - CVAL(cli->outbuf,smb_com) = SMBsetatr; + SCVAL(cli->outbuf,smb_com,SMBsetatr); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -760,7 +760,7 @@ BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail) { memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,0,0,True); - CVAL(cli->outbuf,smb_com) = SMBdskattr; + SCVAL(cli->outbuf,smb_com,SMBdskattr); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -790,7 +790,7 @@ int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path) set_message(cli->outbuf,3,0,True); - CVAL(cli->outbuf,smb_com) = SMBctemp; + SCVAL(cli->outbuf,smb_com,SMBctemp); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); diff --git a/source/libsmb/clilist.c b/source/libsmb/clilist.c index a9212c9dba1..0c80044b68f 100644 --- a/source/libsmb/clilist.c +++ b/source/libsmb/clilist.c @@ -358,7 +358,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, set_message(cli->outbuf,2,0,True); - CVAL(cli->outbuf,smb_com) = SMBsearch; + SCVAL(cli->outbuf,smb_com,SMBsearch); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -416,7 +416,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, memset(cli->inbuf,'\0',smb_size); set_message(cli->outbuf,2,0,True); - CVAL(cli->outbuf,smb_com) = SMBfclose; + SCVAL(cli->outbuf,smb_com,SMBfclose); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); diff --git a/source/libsmb/climessage.c b/source/libsmb/climessage.c index d32c5de0420..5ded79de96c 100644 --- a/source/libsmb/climessage.c +++ b/source/libsmb/climessage.c @@ -35,7 +35,7 @@ BOOL cli_message_start(struct cli_state *cli, char *host, char *username, /* send a SMBsendstrt command */ memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,0,0,True); - CVAL(cli->outbuf,smb_com) = SMBsendstrt; + SCVAL(cli->outbuf,smb_com,SMBsendstrt); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -70,7 +70,7 @@ BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp) memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,1,0,True); - CVAL(cli->outbuf,smb_com) = SMBsendtxt; + SCVAL(cli->outbuf,smb_com,SMBsendtxt); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -101,7 +101,7 @@ BOOL cli_message_end(struct cli_state *cli, int grp) { memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,1,0,True); - CVAL(cli->outbuf,smb_com) = SMBsendend; + SCVAL(cli->outbuf,smb_com,SMBsendend); SSVAL(cli->outbuf,smb_tid,cli->cnum); SSVAL(cli->outbuf,smb_vwv0,grp); diff --git a/source/libsmb/clioplock.c b/source/libsmb/clioplock.c index b38933181eb..dca0e96cb4a 100644 --- a/source/libsmb/clioplock.c +++ b/source/libsmb/clioplock.c @@ -37,7 +37,7 @@ BOOL cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level) memset(buf,'\0',smb_size); set_message(buf,8,0,True); - CVAL(buf,smb_com) = SMBlockingX; + SCVAL(buf,smb_com,SMBlockingX); SSVAL(buf,smb_tid, cli->cnum); cli_setup_packet(cli); SSVAL(buf,smb_vwv0,0xFF); diff --git a/source/libsmb/clireadwrite.c b/source/libsmb/clireadwrite.c index f141a208bf9..93333bff951 100644 --- a/source/libsmb/clireadwrite.c +++ b/source/libsmb/clireadwrite.c @@ -35,11 +35,11 @@ static BOOL cli_issue_read(struct cli_state *cli, int fnum, off_t offset, set_message(cli->outbuf,10,0,True); - CVAL(cli->outbuf,smb_com) = SMBreadX; + SCVAL(cli->outbuf,smb_com,SMBreadX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); SIVAL(cli->outbuf,smb_vwv3,offset); SSVAL(cli->outbuf,smb_vwv5,size); @@ -61,7 +61,7 @@ static BOOL cli_issue_readraw(struct cli_state *cli, int fnum, off_t offset, set_message(cli->outbuf,10,0,True); - CVAL(cli->outbuf,smb_com) = SMBreadbraw; + SCVAL(cli->outbuf,smb_com,SMBreadbraw); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -232,11 +232,11 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 else set_message(cli->outbuf,12,0,True); - CVAL(cli->outbuf,smb_com) = SMBwriteX; + SCVAL(cli->outbuf,smb_com,SMBwriteX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - CVAL(cli->outbuf,smb_vwv0) = 0xFF; + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); SIVAL(cli->outbuf,smb_vwv3,offset); @@ -327,7 +327,7 @@ ssize_t cli_smbwrite(struct cli_state *cli, set_message(cli->outbuf,5, 0,True); - CVAL(cli->outbuf,smb_com) = SMBwrite; + SCVAL(cli->outbuf,smb_com,SMBwrite); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); diff --git a/source/libsmb/clitrans.c b/source/libsmb/clitrans.c index 8da1cc665f0..5b534130124 100644 --- a/source/libsmb/clitrans.c +++ b/source/libsmb/clitrans.c @@ -46,7 +46,7 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,14+lsetup,0,True); - CVAL(cli->outbuf,smb_com) = trans; + SCVAL(cli->outbuf,smb_com,trans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); @@ -101,7 +101,7 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam)); set_message(cli->outbuf,trans==SMBtrans?8:9,0,True); - CVAL(cli->outbuf,smb_com) = trans==SMBtrans ? SMBtranss : SMBtranss2; + SCVAL(cli->outbuf,smb_com,(trans==SMBtrans ? SMBtranss : SMBtranss2)); outparam = smb_buf(cli->outbuf); outdata = outparam+this_lparam; @@ -271,7 +271,7 @@ BOOL cli_send_nt_trans(struct cli_state *cli, memset(cli->outbuf,'\0',smb_size); set_message(cli->outbuf,19+lsetup,0,True); - CVAL(cli->outbuf,smb_com) = SMBnttrans; + SCVAL(cli->outbuf,smb_com,SMBnttrans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); @@ -319,7 +319,7 @@ BOOL cli_send_nt_trans(struct cli_state *cli, this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam)); set_message(cli->outbuf,18,0,True); - CVAL(cli->outbuf,smb_com) = SMBnttranss; + SCVAL(cli->outbuf,smb_com,SMBnttranss); /* XXX - these should probably be aligned */ outparam = smb_buf(cli->outbuf); diff --git a/source/nmbd/nmbd_browsesync.c b/source/nmbd/nmbd_browsesync.c index 35bd29334e0..40e04e7ecb7 100644 --- a/source/nmbd/nmbd_browsesync.c +++ b/source/nmbd/nmbd_browsesync.c @@ -127,7 +127,7 @@ static void announce_local_master_browser_to_domain_master_browser( struct work_ memset(outbuf,'\0',sizeof(outbuf)); p = outbuf; - CVAL(p,0) = ANN_MasterAnnouncement; + SCVAL(p,0,ANN_MasterAnnouncement); p++; StrnCpy(p,global_myname,15); diff --git a/source/nmbd/nmbd_elections.c b/source/nmbd/nmbd_elections.c index 6db595269f7..ae225184951 100644 --- a/source/nmbd/nmbd_elections.c +++ b/source/nmbd/nmbd_elections.c @@ -44,10 +44,10 @@ static void send_election_dgram(struct subnet_record *subrec, char *workgroup_na memset(outbuf,'\0',sizeof(outbuf)); p = outbuf; - CVAL(p,0) = ANN_Election; /* Election opcode. */ + SCVAL(p,0,ANN_Election); /* Election opcode. */ p++; - CVAL(p,0) = (criterion == 0 && timeup == 0) ? 0 : ELECTION_VERSION; + SCVAL(p,0,((criterion == 0 && timeup == 0) ? 0 : ELECTION_VERSION)); SIVAL(p,1,criterion); SIVAL(p,5,timeup*1000); /* ms - Despite what the spec says. */ p += 13; diff --git a/source/nmbd/nmbd_packets.c b/source/nmbd/nmbd_packets.c index ace4ddfa25c..a81da0ca9bc 100644 --- a/source/nmbd/nmbd_packets.c +++ b/source/nmbd/nmbd_packets.c @@ -1936,7 +1936,7 @@ BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len, set_message(ptr,17,17 + len,True); memcpy(ptr,tmp,4); - CVAL(ptr,smb_com) = SMBtrans; + SCVAL(ptr,smb_com,SMBtrans); SSVAL(ptr,smb_vwv1,len); SSVAL(ptr,smb_vwv11,len); SSVAL(ptr,smb_vwv12,70 + strlen(mailslot)); diff --git a/source/nmbd/nmbd_sendannounce.c b/source/nmbd/nmbd_sendannounce.c index 1f56dea8824..ee3b3d110fa 100644 --- a/source/nmbd/nmbd_sendannounce.c +++ b/source/nmbd/nmbd_sendannounce.c @@ -47,9 +47,9 @@ void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_ad memset(outbuf,'\0',sizeof(outbuf)); p = outbuf; - CVAL(p,0) = ANN_ResetBrowserState; + SCVAL(p,0,ANN_ResetBrowserState); p++; - CVAL(p,0) = reset_type; + SCVAL(p,0,reset_type); p++; send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), @@ -74,10 +74,10 @@ to subnet %s\n", work->work_group, subrec->subnet_name)); memset(outbuf,'\0',sizeof(outbuf)); p = outbuf; - CVAL(p,0) = ANN_AnnouncementRequest; + SCVAL(p,0,ANN_AnnouncementRequest); p++; - CVAL(p,0) = work->token; /* (local) Unique workgroup token id. */ + SCVAL(p,0,work->token); /* (local) Unique workgroup token id. */ p++; p += push_string(NULL, p+1, global_myname, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); @@ -101,16 +101,16 @@ static void send_announcement(struct subnet_record *subrec, int announce_type, memset(outbuf,'\0',sizeof(outbuf)); p = outbuf+1; - CVAL(outbuf,0) = announce_type; + SCVAL(outbuf,0,announce_type); /* Announcement parameters. */ - CVAL(p,0) = updatecount; + SCVAL(p,0,updatecount); SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */ push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); - CVAL(p,21) = lp_major_announce_version(); /* Major version. */ - CVAL(p,22) = lp_minor_announce_version(); /* Minor version. */ + SCVAL(p,21,lp_major_announce_version()); /* Major version. */ + SCVAL(p,22,lp_minor_announce_version()); /* Minor version. */ SIVAL(p,23,server_type & ~SV_TYPE_LOCAL_LIST_ONLY); /* Browse version: got from NT/AS 4.00 - Value defined in smb.h (JHT). */ @@ -140,8 +140,8 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type SSVAL(p,0,announce_type); SIVAL(p,2,server_type & ~SV_TYPE_LOCAL_LIST_ONLY); - CVAL(p,6) = lp_major_announce_version(); /* Major version. */ - CVAL(p,7) = lp_minor_announce_version(); /* Minor version. */ + SCVAL(p,6,lp_major_announce_version()); /* Major version. */ + SCVAL(p,7,lp_minor_announce_version()); /* Minor version. */ SSVAL(p,8,announce_interval); /* In seconds - according to spec. */ p += 10; @@ -585,7 +585,7 @@ for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name memset(outbuf,'\0',sizeof(outbuf)); p = outbuf; - CVAL(p,0) = ANN_MasterAnnouncement; + SCVAL(p,0,ANN_MasterAnnouncement); p++; StrnCpy(p,global_myname,15); diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c index 64da736ae2e..fb8b52342ac 100644 --- a/source/smbd/lanman.c +++ b/source/smbd/lanman.c @@ -1512,7 +1512,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel, if (uLevel > 0) { int type; - CVAL(p,13) = 0; + SCVAL(p,13,0); type = STYPE_DISKTREE; if (lp_print_ok(snum)) type = STYPE_PRINTQ; if (strequal("IPC",lp_fstype(snum))) type = STYPE_IPC; @@ -1894,16 +1894,16 @@ static BOOL api_NetRemoteTOD(connection_struct *conn,uint16 vuid, char *param,ch t = LocalTime(&unixdate); SIVAL(p,4,0); /* msecs ? */ - CVAL(p,8) = t->tm_hour; - CVAL(p,9) = t->tm_min; - CVAL(p,10) = t->tm_sec; - CVAL(p,11) = 0; /* hundredths of seconds */ + SCVAL(p,8,t->tm_hour); + SCVAL(p,9,t->tm_min); + SCVAL(p,10,t->tm_sec); + SCVAL(p,11,0); /* hundredths of seconds */ SSVALS(p,12,TimeDiff(unixdate)/60); /* timezone in minutes from GMT */ SSVAL(p,14,10000); /* timer interval in 0.0001 of sec */ - CVAL(p,16) = t->tm_mday; - CVAL(p,17) = t->tm_mon + 1; + SCVAL(p,16,t->tm_mday); + SCVAL(p,17,t->tm_mon + 1); SSVAL(p,18,1900+t->tm_year); - CVAL(p,20) = t->tm_wday; + SCVAL(p,20,t->tm_wday); } diff --git a/source/smbd/negprot.c b/source/smbd/negprot.c index 81f035f3b67..5899f0af52b 100644 --- a/source/smbd/negprot.c +++ b/source/smbd/negprot.c @@ -269,7 +269,7 @@ static int reply_nt1(char *inbuf, char *outbuf) set_message(outbuf,17,0,True); - CVAL(outbuf,smb_vwv1) = secword; + SCVAL(outbuf,smb_vwv1,secword); Protocol = PROTOCOL_NT1; diff --git a/source/smbd/process.c b/source/smbd/process.c index ff53acbd9ee..b1fcf864e11 100644 --- a/source/smbd/process.c +++ b/source/smbd/process.c @@ -914,11 +914,11 @@ void construct_reply_common(char *inbuf,char *outbuf) memset(outbuf,'\0',smb_size); set_message(outbuf,0,0,True); - CVAL(outbuf,smb_com) = CVAL(inbuf,smb_com); + SCVAL(outbuf,smb_com,CVAL(inbuf,smb_com)); memcpy(outbuf+4,inbuf+4,4); - CVAL(outbuf,smb_rcls) = SMB_SUCCESS; - CVAL(outbuf,smb_reh) = 0; + SCVAL(outbuf,smb_rcls,SMB_SUCCESS); + SCVAL(outbuf,smb_reh,0); SCVAL(outbuf,smb_flg, FLAG_REPLY | (CVAL(inbuf,smb_flg) & FLAG_CASELESS_PATHNAMES)); SSVAL(outbuf,smb_flg2, FLAGS2_UNICODE_STRINGS | FLAGS2_LONG_PATH_COMPONENTS | @@ -949,7 +949,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize) /* maybe its not chained */ if (smb_com2 == 0xFF) { - CVAL(outbuf,smb_vwv0) = 0xFF; + SCVAL(outbuf,smb_vwv0,0xFF); return outsize; } @@ -969,7 +969,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize) /* we need to tell the client where the next part of the reply will be */ SSVAL(outbuf,smb_vwv1,smb_offset(outbuf+outsize,outbuf)); - CVAL(outbuf,smb_vwv0) = smb_com2; + SCVAL(outbuf,smb_vwv0,smb_com2); /* remember how much the caller added to the chain, only counting stuff after the parameter words */ @@ -991,7 +991,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize) memmove(inbuf2,inbuf,smb_wct); /* create the in buffer */ - CVAL(inbuf2,smb_com) = smb_com2; + SCVAL(inbuf2,smb_com,smb_com2); /* create the out buffer */ construct_reply_common(inbuf2, outbuf2); @@ -1006,7 +1006,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize) /* copy the new reply and request headers over the old ones, but preserve the smb_com field */ memmove(orig_outbuf,outbuf2,smb_wct); - CVAL(orig_outbuf,smb_com) = smb_com1; + SCVAL(orig_outbuf,smb_com,smb_com1); /* restore the saved data, being careful not to overwrite any data from the reply header */ diff --git a/source/smbd/reply.c b/source/smbd/reply.c index c67ce357c65..03d0c189424 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -66,8 +66,8 @@ int reply_special(char *inbuf,char *outbuf) switch (msg_type) { case 0x81: /* session request */ - CVAL(outbuf,0) = 0x82; - CVAL(outbuf,3) = 0; + SCVAL(outbuf,0,0x82); + SCVAL(outbuf,3,0); if (name_len(inbuf+4) > 50 || name_len(inbuf+4 + name_len(inbuf + 4)) > 50) { DEBUG(0,("Invalid name length in session request\n")); @@ -100,7 +100,7 @@ int reply_special(char *inbuf,char *outbuf) if (name_type == 'R') { /* We are being asked for a pathworks session --- no thanks! */ - CVAL(outbuf, 0) = 0x83; + SCVAL(outbuf, 0,0x83); break; } @@ -120,8 +120,8 @@ int reply_special(char *inbuf,char *outbuf) case 0x89: /* session keepalive request (some old clients produce this?) */ - CVAL(outbuf,0) = SMBkeepalive; - CVAL(outbuf,3) = 0; + SCVAL(outbuf,0,SMBkeepalive); + SCVAL(outbuf,3,0); break; case 0x82: /* positive session response */ @@ -651,7 +651,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if (strlen(directory) == 0) pstrcpy(directory,"./"); memset((char *)status,'\0',21); - CVAL(status,0) = dirtype; + SCVAL(status,0,dirtype); } else { @@ -735,7 +735,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if (numentries == 0 || !ok) { - CVAL(outbuf,smb_rcls) = ERRDOS; + SCVAL(outbuf,smb_rcls,ERRDOS); SSVAL(outbuf,smb_err,ERRnofiles); dptr_close(&dptr_num); } @@ -746,7 +746,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if(ok && expect_close && numentries == 0 && status_len == 0) { - CVAL(outbuf,smb_rcls) = ERRDOS; + SCVAL(outbuf,smb_rcls,ERRDOS); SSVAL(outbuf,smb_err,ERRnofiles); /* Also close the dptr - we know it's gone */ dptr_close(&dptr_num); @@ -758,7 +758,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size SSVAL(outbuf,smb_vwv0,numentries); SSVAL(outbuf,smb_vwv1,3 + numentries * DIR_STRUCT_SIZE); - CVAL(smb_buf(outbuf),0) = 5; + SCVAL(smb_buf(outbuf),0,5); SSVAL(smb_buf(outbuf),1,numentries*DIR_STRUCT_SIZE); if (Protocol >= PROTOCOL_NT1) { @@ -888,11 +888,11 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, SSVAL(outbuf,smb_vwv6,rmode); if (oplock_request && lp_fake_oplocks(SNUM(conn))) { - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); END_PROFILE(SMBopen); return(outsize); } @@ -988,11 +988,11 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt */ if (core_oplock_request && lp_fake_oplocks(SNUM(conn))) { - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } if(core_oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } set_message(outbuf,15,0,True); @@ -1103,11 +1103,11 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, SSVAL(outbuf,smb_vwv0,fsp->fnum); if (oplock_request && lp_fake_oplocks(SNUM(conn))) { - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); DEBUG( 2, ( "new file %s\n", fname ) ); DEBUG( 3, ( "mknew %s fd=%d dmode=%d umode=%o\n", @@ -1192,11 +1192,11 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, outsize = set_message_end(outbuf, p); if (oplock_request && lp_fake_oplocks(SNUM(conn))) { - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); } if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) - CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED; + SCVAL(outbuf,smb_flg,CVAL(outbuf,smb_flg)|CORE_OPLOCK_GRANTED); DEBUG( 2, ( "created temp file %s\n", fname ) ); DEBUG( 3, ( "ctemp %s fd=%d dmode=%d umode=%o\n", @@ -1624,7 +1624,7 @@ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int size, int outsize += nread; SSVAL(outbuf,smb_vwv0,nread); SSVAL(outbuf,smb_vwv5,nread+3); - CVAL(smb_buf(outbuf),0) = 1; + SCVAL(smb_buf(outbuf),0,1); SSVAL(smb_buf(outbuf),1,nread); DEBUG( 3, ( "read fnum=%d num=%d nread=%d\n", @@ -1742,8 +1742,8 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int size, } /* force the error type */ - CVAL(inbuf,smb_com) = SMBwritec; - CVAL(outbuf,smb_com) = SMBwritec; + SCVAL(inbuf,smb_com,SMBwritec); + SCVAL(outbuf,smb_com,SMBwritec); if (is_locked(fsp,conn,(SMB_BIG_UINT)tcount,(SMB_BIG_UINT)startpos, WRITE_LOCK,False)) { END_PROFILE(SMBwritebraw); @@ -1764,7 +1764,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int size, total_written = nwritten; /* Return a message to the redirector to tell it to send more bytes */ - CVAL(outbuf,smb_com) = SMBwritebraw; + SCVAL(outbuf,smb_com,SMBwritebraw); SSVALS(outbuf,smb_vwv0,-1); outsize = set_message(outbuf,Protocol>PROTOCOL_COREPLUS?1:0,0,True); if (!send_smb(smbd_server_fd(),outbuf)) @@ -1780,7 +1780,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int size, /* Set up outbuf to return the correct return */ outsize = set_message(outbuf,1,0,True); - CVAL(outbuf,smb_com) = SMBwritec; + SCVAL(outbuf,smb_com,SMBwritec); SSVAL(outbuf,smb_vwv0,total_written); if (numtowrite != 0) { @@ -1805,7 +1805,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int size, nwritten = write_file(fsp,inbuf+4,startpos+nwritten,numtowrite); if (nwritten < (ssize_t)numtowrite) { - CVAL(outbuf,smb_rcls) = ERRHRD; + SCVAL(outbuf,smb_rcls,ERRHRD); SSVAL(outbuf,smb_err,ERRdiskfull); } @@ -1966,7 +1966,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int size,int d SSVAL(outbuf,smb_vwv0,nwritten); if (nwritten < (ssize_t)numtowrite) { - CVAL(outbuf,smb_rcls) = ERRHRD; + SCVAL(outbuf,smb_rcls,ERRHRD); SSVAL(outbuf,smb_err,ERRdiskfull); } @@ -2062,7 +2062,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng SSVAL(outbuf,smb_vwv4,(nwritten>>16)&1); if (nwritten < (ssize_t)numtowrite) { - CVAL(outbuf,smb_rcls) = ERRHRD; + SCVAL(outbuf,smb_rcls,ERRHRD); SSVAL(outbuf,smb_err,ERRdiskfull); } @@ -2578,7 +2578,7 @@ int reply_printqueue(connection_struct *conn, SSVAL(outbuf,smb_vwv0,0); SSVAL(outbuf,smb_vwv1,0); - CVAL(smb_buf(outbuf),0) = 1; + SCVAL(smb_buf(outbuf),0,1); SSVAL(smb_buf(outbuf),1,0); DEBUG(3,("printqueue start_index=%d max_count=%d\n", @@ -2601,10 +2601,10 @@ int reply_printqueue(connection_struct *conn, for (i=first;i<first+num_to_get;i++) { put_dos_date2(p,0,queue[i].time); - CVAL(p,4) = (queue[i].status==LPQ_PRINTING?2:3); + SCVAL(p,4,(queue[i].status==LPQ_PRINTING?2:3)); SSVAL(p,5, queue[i].job); SIVAL(p,7,queue[i].size); - CVAL(p,11) = 0; + SCVAL(p,11,0); srvstr_push(outbuf, p+12, queue[i].user, 16, STR_ASCII); p += 28; } @@ -2613,7 +2613,7 @@ int reply_printqueue(connection_struct *conn, outsize = set_message(outbuf,2,28*count+3,False); SSVAL(outbuf,smb_vwv0,count); SSVAL(outbuf,smb_vwv1,(max_count>0?first+count:first-1)); - CVAL(smb_buf(outbuf),0) = 1; + SCVAL(smb_buf(outbuf),0,1); SSVAL(smb_buf(outbuf),1,28*count); } @@ -3557,7 +3557,7 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size } outsize = set_message(outbuf,0,0,True); - CVAL(outbuf,smb_reh) = CVAL(inbuf,smb_reh); + SCVAL(outbuf,smb_reh,CVAL(inbuf,smb_reh)); DEBUG(3,("setdir %s\n", newdir)); @@ -4044,7 +4044,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int size, /* If this fails we need to send an SMBwriteC response, not an SMBwritebmpx - set this up now so we don't forget */ - CVAL(outbuf,smb_com) = SMBwritec; + SCVAL(outbuf,smb_com,SMBwritec); if (is_locked(fsp,conn,(SMB_BIG_UINT)tcount,(SMB_BIG_UINT)startpos,WRITE_LOCK,False)) { END_PROFILE(SMBwriteBmpx); @@ -4087,7 +4087,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int size, /* We are returning successfully, set the message type back to SMBwritebmpx */ - CVAL(outbuf,smb_com) = SMBwriteBmpx; + SCVAL(outbuf,smb_com,SMBwriteBmpx); outsize = set_message(outbuf,1,0,True); @@ -4104,7 +4104,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int size, /* Now the secondary */ outsize = set_message(outbuf,1,0,True); - CVAL(outbuf,smb_com) = SMBwritec; + SCVAL(outbuf,smb_com,SMBwritec); SSVAL(outbuf,smb_vwv0,nwritten); } @@ -4142,7 +4142,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz data = smb_base(inbuf) + smb_doff; /* We need to send an SMBwriteC response, not an SMBwritebs */ - CVAL(outbuf,smb_com) = SMBwritec; + SCVAL(outbuf,smb_com,SMBwritec); /* This fd should have an auxiliary struct attached, check that it does */ diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c index 3addecb0b8b..60e03e002db 100644 --- a/source/smbd/trans2.c +++ b/source/smbd/trans2.c @@ -1614,8 +1614,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn, SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,size); SIVAL(pdata,16,sbuf.st_nlink); - CVAL(pdata,20) = 0; - CVAL(pdata,21) = (mode&aDIR)?1:0; + SCVAL(pdata,20,0); + SCVAL(pdata,21,(mode&aDIR)?1:0); break; case SMB_FILE_EA_INFORMATION: @@ -1678,8 +1678,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn, SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,size); SIVAL(pdata,16,sbuf.st_nlink); - CVAL(pdata,20) = delete_pending; - CVAL(pdata,21) = (mode&aDIR)?1:0; + SCVAL(pdata,20,delete_pending); + SCVAL(pdata,21,(mode&aDIR)?1:0); pdata += 24; SINO_T(pdata,0,(SMB_INO_T)sbuf.st_ino); pdata += 8; /* index number */ @@ -1728,7 +1728,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, case SMB_FILE_DISPOSITION_INFORMATION: data_size = 1; - CVAL(pdata,0) = delete_pending; + SCVAL(pdata,0,delete_pending); break; case SMB_FILE_POSITION_INFORMATION: |