summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/smbd/process.c8
-rw-r--r--source3/smbd/reply.c284
3 files changed, 32 insertions, 264 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 24cab4d218..2d64d541a0 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -278,7 +278,6 @@ typedef struct {
BOOL bLargeReadwrite;
BOOL bReadRaw;
BOOL bWriteRaw;
- BOOL bReadbmpx;
BOOL bSyslogOnly;
BOOL bBrowseList;
BOOL bNISHomeMap;
@@ -991,7 +990,6 @@ static struct parm_struct parm_table[] = {
{"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
{"protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
{"min protocol", P_ENUM, P_GLOBAL, &Globals.minprotocol, NULL, enum_protocol, FLAG_ADVANCED},
- {"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL, FLAG_ADVANCED},
{"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL, FLAG_ADVANCED},
{"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, FLAG_ADVANCED},
{"disable netbios", P_BOOL, P_GLOBAL, &Globals.bDisableNetbios, NULL, NULL, FLAG_ADVANCED},
@@ -1536,7 +1534,6 @@ static void init_globals(BOOL first_time_only)
Globals.serverSchannel = Auto;
Globals.bReadRaw = True;
Globals.bWriteRaw = True;
- Globals.bReadbmpx = False;
Globals.bNullPasswords = False;
Globals.bObeyPamRestrictions = False;
Globals.syslog = 1;
@@ -1973,7 +1970,6 @@ FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
-FN_GLOBAL_BOOL(lp_readbmpx, &Globals.bReadbmpx)
FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index b4de0edc28..e64a18a196 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -717,11 +717,11 @@ static const struct smb_message_struct {
/* 0x18 */ { NULL, NULL, NULL, 0 },
/* 0x19 */ { NULL, NULL, NULL, 0 },
/* 0x1a */ { "SMBreadbraw",NULL,reply_readbraw,AS_USER},
-/* 0x1b */ { "SMBreadBmpx",reply_readbmpx,NULL,AS_USER},
-/* 0x1c */ { "SMBreadBs",NULL, NULL,0 },
+/* 0x1b */ { "SMBreadBmpx",NULL,reply_readbmpx,AS_USER},
+/* 0x1c */ { "SMBreadBs",NULL,reply_readbs,AS_USER },
/* 0x1d */ { "SMBwritebraw",NULL,reply_writebraw,AS_USER},
-/* 0x1e */ { "SMBwriteBmpx",reply_writebmpx,NULL,AS_USER},
-/* 0x1f */ { "SMBwriteBs",reply_writebs,NULL,AS_USER},
+/* 0x1e */ { "SMBwriteBmpx",NULL,reply_writebmpx,AS_USER},
+/* 0x1f */ { "SMBwriteBs",NULL,reply_writebs,AS_USER},
/* 0x20 */ { "SMBwritec",NULL, NULL,0},
/* 0x21 */ { NULL, NULL, NULL, 0 },
/* 0x22 */ { "SMBsetattrE",NULL,reply_setattrE,AS_USER | NEED_WRITE },
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 1a14d6c594..c7040278a5 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6539,80 +6539,30 @@ void reply_lockingX(connection_struct *conn, struct smb_request *req)
/****************************************************************************
Reply to a SMBreadbmpx (read block multiplex) request.
+ Always reply with an error, if someone has a platform really needs this,
+ please contact vl@samba.org
****************************************************************************/
-int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
+void reply_readbmpx(connection_struct *conn, struct smb_request *req)
{
- ssize_t nread = -1;
- ssize_t total_read;
- char *data;
- SMB_OFF_T startpos;
- int outsize;
- size_t maxcount;
- int max_per_packet;
- size_t tcount;
- int pad;
- files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
START_PROFILE(SMBreadBmpx);
+ reply_doserror(req, ERRSRV, ERRuseSTD);
+ END_PROFILE(SMBreadBmpx);
+ return;
+}
- /* this function doesn't seem to work - disable by default */
- if (!lp_readbmpx()) {
- END_PROFILE(SMBreadBmpx);
- return ERROR_DOS(ERRSRV,ERRuseSTD);
- }
-
- outsize = set_message(inbuf,outbuf,8,0,True);
-
- CHECK_FSP(fsp,conn);
- if (!CHECK_READ(fsp,inbuf)) {
- return(ERROR_DOS(ERRDOS,ERRbadaccess));
- }
-
- startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv1);
- maxcount = SVAL(inbuf,smb_vwv3);
-
- data = smb_buf(outbuf);
- pad = ((long)data)%4;
- if (pad)
- pad = 4 - pad;
- data += pad;
-
- max_per_packet = bufsize-(outsize+pad);
- tcount = maxcount;
- total_read = 0;
-
- if (is_locked(fsp,(uint32)SVAL(inbuf,smb_pid),(SMB_BIG_UINT)maxcount,(SMB_BIG_UINT)startpos, READ_LOCK)) {
- END_PROFILE(SMBreadBmpx);
- return ERROR_DOS(ERRDOS,ERRlock);
- }
-
- do {
- size_t N = MIN(max_per_packet,tcount-total_read);
-
- nread = read_file(fsp,data,startpos,N);
-
- if (nread <= 0)
- nread = 0;
-
- if (nread < (ssize_t)N)
- tcount = total_read + nread;
-
- set_message(inbuf,outbuf,8,nread+pad,False);
- SIVAL(outbuf,smb_vwv0,startpos);
- SSVAL(outbuf,smb_vwv2,tcount);
- SSVAL(outbuf,smb_vwv6,nread);
- SSVAL(outbuf,smb_vwv7,smb_offset(data,outbuf));
-
- show_msg(outbuf);
- if (!send_smb(smbd_server_fd(),outbuf))
- exit_server_cleanly("reply_readbmpx: send_smb failed.");
-
- total_read += nread;
- startpos += nread;
- } while (total_read < (ssize_t)tcount);
+/****************************************************************************
+ Reply to a SMBreadbs (read block multiplex secondary) request.
+ Always reply with an error, if someone has a platform really needs this,
+ please contact vl@samba.org
+****************************************************************************/
- END_PROFILE(SMBreadBmpx);
- return(-1);
+void reply_readbs(connection_struct *conn, struct smb_request *req)
+{
+ START_PROFILE(SMBreadBs);
+ reply_doserror(req, ERRSRV, ERRuseSTD);
+ END_PROFILE(SMBreadBs);
+ return;
}
/****************************************************************************
@@ -6693,208 +6643,30 @@ void reply_setattrE(connection_struct *conn, struct smb_request *req)
/****************************************************************************
Reply to a SMBwritebmpx (write block multiplex primary) request.
+ Always reply with an error, if someone has a platform really needs this,
+ please contact vl@samba.org
****************************************************************************/
-int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int size, int dum_buffsize)
+void reply_writebmpx(connection_struct *conn, struct smb_request *req)
{
- size_t numtowrite;
- ssize_t nwritten = -1;
- int outsize = 0;
- SMB_OFF_T startpos;
- size_t tcount;
- BOOL write_through;
- int smb_doff;
- char *data;
- files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
- NTSTATUS status;
START_PROFILE(SMBwriteBmpx);
-
- CHECK_FSP(fsp,conn);
- if (!CHECK_WRITE(fsp)) {
- return(ERROR_DOS(ERRDOS,ERRbadaccess));
- }
- if (HAS_CACHED_ERROR(fsp)) {
- return(CACHED_ERROR(fsp));
- }
-
- tcount = SVAL(inbuf,smb_vwv1);
- startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv3);
- write_through = BITSETW(inbuf+smb_vwv7,0);
- numtowrite = SVAL(inbuf,smb_vwv10);
- smb_doff = SVAL(inbuf,smb_vwv11);
-
- data = smb_base(inbuf) + smb_doff;
-
- /* If this fails we need to send an SMBwriteC response,
- not an SMBwritebmpx - set this up now so we don't forget */
- SCVAL(outbuf,smb_com,SMBwritec);
-
- if (is_locked(fsp,(uint32)SVAL(inbuf,smb_pid),(SMB_BIG_UINT)tcount,(SMB_BIG_UINT)startpos,WRITE_LOCK)) {
- END_PROFILE(SMBwriteBmpx);
- return(ERROR_DOS(ERRDOS,ERRlock));
- }
-
- nwritten = write_file(fsp,data,startpos,numtowrite);
-
- status = sync_file(conn, fsp, write_through);
- if (!NT_STATUS_IS_OK(status)) {
- END_PROFILE(SMBwriteBmpx);
- DEBUG(5,("reply_writebmpx: sync_file for %s returned %s\n",
- fsp->fsp_name, nt_errstr(status) ));
- return ERROR_NT(status);
- }
-
- if(nwritten < (ssize_t)numtowrite) {
- END_PROFILE(SMBwriteBmpx);
- return(UNIXERROR(ERRHRD,ERRdiskfull));
- }
-
- /* If the maximum to be written to this file
- is greater than what we just wrote then set
- up a secondary struct to be attached to this
- fd, we will use this to cache error messages etc. */
-
- if((ssize_t)tcount > nwritten) {
- write_bmpx_struct *wbms;
- if(fsp->wbmpx_ptr != NULL)
- wbms = fsp->wbmpx_ptr; /* Use an existing struct */
- else
- wbms = SMB_MALLOC_P(write_bmpx_struct);
- if(!wbms) {
- DEBUG(0,("Out of memory in reply_readmpx\n"));
- END_PROFILE(SMBwriteBmpx);
- return(ERROR_DOS(ERRSRV,ERRnoresource));
- }
- wbms->wr_mode = write_through;
- wbms->wr_discard = False; /* No errors yet */
- wbms->wr_total_written = nwritten;
- wbms->wr_errclass = 0;
- wbms->wr_error = 0;
- fsp->wbmpx_ptr = wbms;
- }
-
- /* We are returning successfully, set the message type back to
- SMBwritebmpx */
- SCVAL(outbuf,smb_com,SMBwriteBmpx);
-
- outsize = set_message(inbuf,outbuf,1,0,True);
-
- SSVALS(outbuf,smb_vwv0,-1); /* We don't support smb_remaining */
-
- DEBUG( 3, ( "writebmpx fnum=%d num=%d wrote=%d\n",
- fsp->fnum, (int)numtowrite, (int)nwritten ) );
-
- if (write_through && tcount==nwritten) {
- /* We need to send both a primary and a secondary response */
- smb_setlen(inbuf,outbuf,outsize - 4);
- show_msg(outbuf);
- if (!send_smb(smbd_server_fd(),outbuf))
- exit_server_cleanly("reply_writebmpx: send_smb failed.");
-
- /* Now the secondary */
- outsize = set_message(inbuf,outbuf,1,0,True);
- SCVAL(outbuf,smb_com,SMBwritec);
- SSVAL(outbuf,smb_vwv0,nwritten);
- }
-
+ reply_doserror(req, ERRSRV, ERRuseSTD);
END_PROFILE(SMBwriteBmpx);
- return(outsize);
+ return;
}
/****************************************************************************
Reply to a SMBwritebs (write block multiplex secondary) request.
+ Always reply with an error, if someone has a platform really needs this,
+ please contact vl@samba.org
****************************************************************************/
-int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
+void reply_writebs(connection_struct *conn, struct smb_request *req)
{
- size_t numtowrite;
- ssize_t nwritten = -1;
- int outsize = 0;
- SMB_OFF_T startpos;
- size_t tcount;
- BOOL write_through;
- int smb_doff;
- char *data;
- write_bmpx_struct *wbms;
- BOOL send_response = False;
- files_struct *fsp = file_fsp(SVAL(inbuf,smb_vwv0));
- NTSTATUS status;
START_PROFILE(SMBwriteBs);
-
- CHECK_FSP(fsp,conn);
- if (!CHECK_WRITE(fsp)) {
- return(ERROR_DOS(ERRDOS,ERRbadaccess));
- }
-
- tcount = SVAL(inbuf,smb_vwv1);
- startpos = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv2);
- numtowrite = SVAL(inbuf,smb_vwv6);
- smb_doff = SVAL(inbuf,smb_vwv7);
-
- data = smb_base(inbuf) + smb_doff;
-
- /* We need to send an SMBwriteC response, not an SMBwritebs */
- SCVAL(outbuf,smb_com,SMBwritec);
-
- /* This fd should have an auxiliary struct attached,
- check that it does */
- wbms = fsp->wbmpx_ptr;
- if(!wbms) {
- END_PROFILE(SMBwriteBs);
- return(-1);
- }
-
- /* If write through is set we can return errors, else we must cache them */
- write_through = wbms->wr_mode;
-
- /* Check for an earlier error */
- if(wbms->wr_discard) {
- END_PROFILE(SMBwriteBs);
- return -1; /* Just discard the packet */
- }
-
- nwritten = write_file(fsp,data,startpos,numtowrite);
-
- status = sync_file(conn, fsp, write_through);
-
- if (nwritten < (ssize_t)numtowrite || !NT_STATUS_IS_OK(status)) {
- if(write_through) {
- /* We are returning an error - we can delete the aux struct */
- if (wbms)
- free((char *)wbms);
- fsp->wbmpx_ptr = NULL;
- END_PROFILE(SMBwriteBs);
- return(ERROR_DOS(ERRHRD,ERRdiskfull));
- }
- wbms->wr_errclass = ERRHRD;
- wbms->wr_error = ERRdiskfull;
- wbms->wr_status = NT_STATUS_DISK_FULL;
- wbms->wr_discard = True;
- END_PROFILE(SMBwriteBs);
- return -1;
- }
-
- /* Increment the total written, if this matches tcount
- we can discard the auxiliary struct (hurrah !) and return a writeC */
- wbms->wr_total_written += nwritten;
- if(wbms->wr_total_written >= tcount) {
- if (write_through) {
- outsize = set_message(inbuf,outbuf,1,0,True);
- SSVAL(outbuf,smb_vwv0,wbms->wr_total_written);
- send_response = True;
- }
-
- free((char *)wbms);
- fsp->wbmpx_ptr = NULL;
- }
-
- if(send_response) {
- END_PROFILE(SMBwriteBs);
- return(outsize);
- }
-
+ reply_doserror(req, ERRSRV, ERRuseSTD);
END_PROFILE(SMBwriteBs);
- return(-1);
+ return;
}
/****************************************************************************