diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-03-06 16:19:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:52:19 -0500 |
commit | a0e66eac7d8ff337b77e078038d0b23a25b22ee7 (patch) | |
tree | 07c99842739305ba950f6c3a1b4eb575f6e6d462 | |
parent | 0533fed85adefc9aa74b6d5ae6b4293fb9c11d6a (diff) | |
download | samba-a0e66eac7d8ff337b77e078038d0b23a25b22ee7.tar.gz samba-a0e66eac7d8ff337b77e078038d0b23a25b22ee7.tar.bz2 samba-a0e66eac7d8ff337b77e078038d0b23a25b22ee7.zip |
r13870: prefix more functions with smbsrv_
metze
(This used to be commit e6275db7b926d3660ad4a0f40041a5129001427a)
-rw-r--r-- | source4/smb_server/smb/negprot.c | 20 | ||||
-rw-r--r-- | source4/smb_server/smb/nttrans.c | 22 | ||||
-rw-r--r-- | source4/smb_server/smb/receive.c | 31 | ||||
-rw-r--r-- | source4/smb_server/smb/reply.c | 228 | ||||
-rw-r--r-- | source4/smb_server/smb/request.c | 30 | ||||
-rw-r--r-- | source4/smb_server/smb/search.c | 36 | ||||
-rw-r--r-- | source4/smb_server/smb/sesssetup.c | 12 | ||||
-rw-r--r-- | source4/smb_server/smb/signing.c | 22 | ||||
-rw-r--r-- | source4/smb_server/smb/trans2.c | 36 |
9 files changed, 220 insertions, 217 deletions
diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index c8cd826c75..10155bd9e7 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -65,7 +65,7 @@ static NTSTATUS get_challenge(struct smbsrv_connection *smb_conn, uint8_t buff[8 ****************************************************************************/ static void reply_corep(struct smbsrv_request *req, uint16_t choice) { - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), choice); @@ -77,7 +77,7 @@ static void reply_corep(struct smbsrv_request *req, uint16_t choice) return; } - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -89,7 +89,7 @@ static void reply_coreplus(struct smbsrv_request *req, uint16_t choice) { uint16_t raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0); - req_setup_reply(req, 13, 0); + smbsrv_setup_reply(req, 13, 0); /* Reply, SMBlockread, SMBwritelock supported. */ SCVAL(req->out.hdr,HDR_FLG, @@ -110,7 +110,7 @@ static void reply_coreplus(struct smbsrv_request *req, uint16_t choice) return; } - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -132,7 +132,7 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) req->smb_conn->negotiate.protocol = PROTOCOL_LANMAN1; - req_setup_reply(req, 13, req->smb_conn->negotiate.encrypted_passwords ? 8 : 0); + smbsrv_setup_reply(req, 13, req->smb_conn->negotiate.encrypted_passwords ? 8 : 0); /* SMBlockread, SMBwritelock supported. */ SCVAL(req->out.hdr,HDR_FLG, @@ -168,7 +168,7 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) return; } - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -190,7 +190,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) req->smb_conn->negotiate.protocol = PROTOCOL_LANMAN2; - req_setup_reply(req, 13, 0); + smbsrv_setup_reply(req, 13, 0); SSVAL(req->out.vwv, VWV(0), choice); SSVAL(req->out.vwv, VWV(1), secword); @@ -218,7 +218,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) return; } - req_send_reply(req); + smbsrv_send_reply(req); } static void reply_nt1_orig(struct smbsrv_request *req) @@ -313,7 +313,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) req->smb_conn->negotiate.protocol = PROTOCOL_NT1; - req_setup_reply(req, 17, 0); + smbsrv_setup_reply(req, 17, 0); SSVAL(req->out.vwv, VWV(0), choice); SCVAL(req->out.vwv, VWV(1), secword); @@ -415,7 +415,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) DEBUG(3,("using SPNEGO\n")); } - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); } /* diff --git a/source4/smb_server/smb/nttrans.c b/source4/smb_server/smb/nttrans.c index d1476e3601..8872398fc6 100644 --- a/source4/smb_server/smb/nttrans.c +++ b/source4/smb_server/smb/nttrans.c @@ -362,7 +362,7 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) /* parse request */ if (req->in.wct < 19) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -379,14 +379,14 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) trans.in.function = SVAL(req->in.vwv, 36); if (req->in.wct != 19 + trans.in.setup_count) { - req_reply_dos_error(req, ERRSRV, ERRerror); + smbsrv_send_dos_error(req, ERRSRV, ERRerror); return; } /* parse out the setup words */ trans.in.setup = talloc_array(req, uint16_t, trans.in.setup_count); if (!trans.in.setup) { - req_reply_error(req, NT_STATUS_NO_MEMORY); + smbsrv_send_error(req, NT_STATUS_NO_MEMORY); return; } for (i=0;i<trans.in.setup_count;i++) { @@ -395,7 +395,7 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) if (!req_pull_blob(req, req->in.hdr + param_ofs, param_count, &trans.in.params) || !req_pull_blob(req, req->in.hdr + data_ofs, data_count, &trans.in.data)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -410,14 +410,14 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) status = nttrans_backend(req, &trans); if (NT_STATUS_IS_ERR(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } #if 0 /* w2k3 does not check the max_setup count */ if (trans.out.setup_count > trans.in.max_setup) { - req_reply_error(req, NT_STATUS_BUFFER_TOO_SMALL); + smbsrv_send_error(req, NT_STATUS_BUFFER_TOO_SMALL); return; } #endif @@ -435,10 +435,10 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) params = trans.out.params.data; data = trans.out.data.data; - req_setup_reply(req, 18 + trans.out.setup_count, 0); + smbsrv_setup_reply(req, 18 + trans.out.setup_count, 0); if (!NT_STATUS_IS_OK(status)) { - req_setup_error(req, status); + smbsrv_setup_error(req, status); } /* we need to divide up the reply into chunks that fit into @@ -464,7 +464,7 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) /* don't destroy unless this is the last chunk */ if (params_left - this_param != 0 || data_left - this_data != 0) { - this_req = req_setup_secondary(req); + this_req = smbsrv_setup_secondary_request(req); } else { this_req = req; } @@ -505,7 +505,7 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) params += this_param; data += this_data; - req_send_reply(this_req); + smbsrv_send_reply(this_req); } while (params_left != 0 || data_left != 0); } @@ -515,5 +515,5 @@ void smbsrv_reply_nttrans(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_nttranss(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index bb37167e79..b7972e6b44 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -34,9 +34,12 @@ BOOL req_send_oplock_break(struct smbsrv_tcon *tcon, uint16_t fnum, uint8_t leve { struct smbsrv_request *req; - req = init_smb_request(tcon->smb_conn); + req = smbsrv_init_request(tcon->smb_conn); + if (!req) { + return False; + } - req_setup_reply(req, 8, 0); + smbsrv_setup_reply(req, 8, 0); SCVAL(req->out.hdr,HDR_COM,SMBlockingX); SSVAL(req->out.hdr,HDR_TID,tcon->tid); @@ -55,7 +58,7 @@ BOOL req_send_oplock_break(struct smbsrv_tcon *tcon, uint16_t fnum, uint8_t leve SSVAL(req->out.vwv, VWV(6), 0); SSVAL(req->out.vwv, VWV(7), 0); - req_send_reply(req); + smbsrv_send_reply(req); return True; } @@ -73,7 +76,7 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) /* see if its a special NBT packet */ if (CVAL(blob.data, 0) != 0) { - req = init_smb_request(smb_conn); + req = smbsrv_init_request(smb_conn); NT_STATUS_HAVE_NO_MEMORY(req); ZERO_STRUCT(req->in); @@ -100,7 +103,7 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) return NT_STATUS_OK; } - req = init_smb_request(smb_conn); + req = smbsrv_init_request(smb_conn); NT_STATUS_HAVE_NO_MEMORY(req); req->in.buffer = talloc_steal(req, blob.data); @@ -145,8 +148,8 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) req->flags2 = SVAL(req->in.hdr, HDR_FLG2); req->smbpid = SVAL(req->in.hdr, HDR_PID); - if (!req_signing_check_incoming(req)) { - req_reply_error(req, NT_STATUS_ACCESS_DENIED); + if (!smbsrv_signing_check_incoming(req)) { + smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED); return NT_STATUS_OK; } @@ -491,7 +494,7 @@ static void switch_message(int type, struct smbsrv_request *req) /* this must be called before we do any reply */ if (flags & SIGNING_NO_REPLY) { - req_signing_no_reply(req); + smbsrv_signing_no_reply(req); } /* see if the vuid is valid */ @@ -518,7 +521,7 @@ static void switch_message(int type, struct smbsrv_request *req) talloc_free(req); return; } - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } @@ -546,7 +549,7 @@ static void switch_message(int type, struct smbsrv_request *req) talloc_free(req); return; } - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } @@ -565,7 +568,7 @@ void smbsrv_chain_reply(struct smbsrv_request *req) uint16_t data_size; if (req->in.wct < 2 || req->out.wct < 2) { - req_reply_dos_error(req, ERRSRV, ERRerror); + smbsrv_send_dos_error(req, ERRSRV, ERRerror); return; } @@ -576,7 +579,7 @@ void smbsrv_chain_reply(struct smbsrv_request *req) /* end of chain */ SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - req_send_reply(req); + smbsrv_send_reply(req); return; } @@ -620,7 +623,7 @@ void smbsrv_chain_reply(struct smbsrv_request *req) error: SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); - req_reply_dos_error(req, ERRSRV, ERRerror); + smbsrv_send_dos_error(req, ERRSRV, ERRerror); } /* @@ -648,7 +651,7 @@ NTSTATUS smbsrv_init_smb_connection(struct smbsrv_connection *smb_conn) status = smbsrv_smb_init_tcons(smb_conn); NT_STATUS_NOT_OK_RETURN(status); - srv_init_signing(smb_conn); + smbsrv_init_signing(smb_conn); return NT_STATUS_OK; } diff --git a/source4/smb_server/smb/reply.c b/source4/smb_server/smb/reply.c index 3c92c6f6a5..b608959556 100644 --- a/source4/smb_server/smb/reply.c +++ b/source4/smb_server/smb/reply.c @@ -33,14 +33,14 @@ if ((req)->in.wct != (wcount)) { \ DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", \ (req)->in.wct, __FILE__, __LINE__, wcount)); \ - req_reply_dos_error(req, ERRSRV, ERRerror); \ + smbsrv_send_dos_error(req, ERRSRV, ERRerror); \ return; \ }} while (0) /* check req->async_states->status and if not OK then send an error reply */ #define CHECK_ASYNC_STATUS do { \ if (!NT_STATUS_IS_OK(req->async_states->status)) { \ - req_reply_error(req, req->async_states->status); \ + smbsrv_send_error(req, req->async_states->status); \ return; \ }} while (0) @@ -48,7 +48,7 @@ #define REQ_TALLOC(ptr, size) do { \ ptr = talloc_size(req, size); \ if (!ptr) { \ - req_reply_error(req, NT_STATUS_NO_MEMORY); \ + smbsrv_send_error(req, NT_STATUS_NO_MEMORY); \ return; \ }} while (0) @@ -72,8 +72,8 @@ static void reply_simple_send(struct smbsrv_request *req) { CHECK_ASYNC_STATUS; - req_setup_reply(req, 0, 0); - req_send_reply(req); + smbsrv_setup_reply(req, 0, 0); + smbsrv_send_reply(req); } @@ -97,7 +97,7 @@ void smbsrv_reply_tcon(struct smbsrv_request *req) p += req_pull_ascii4(req, &con.tcon.in.dev, p, STR_TERMINATE); if (!con.tcon.in.service || !con.tcon.in.password || !con.tcon.in.dev) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -105,18 +105,18 @@ void smbsrv_reply_tcon(struct smbsrv_request *req) status = smbsrv_tcon_backend(req, &con); if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply */ - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); SSVAL(req->out.vwv, VWV(0), con.tcon.out.max_xmit); SSVAL(req->out.vwv, VWV(1), con.tcon.out.tid); SSVAL(req->out.hdr, HDR_TID, req->tcon->tid); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -141,7 +141,7 @@ void smbsrv_reply_tcon_and_X(struct smbsrv_request *req) p = req->in.data; if (!req_pull_blob(req, p, passlen, &con.tconx.in.password)) { - req_reply_error(req, NT_STATUS_ILL_FORMED_PASSWORD); + smbsrv_send_error(req, NT_STATUS_ILL_FORMED_PASSWORD); return; } p += passlen; @@ -150,7 +150,7 @@ void smbsrv_reply_tcon_and_X(struct smbsrv_request *req) p += req_pull_string(req, &con.tconx.in.device, p, -1, STR_ASCII); if (!con.tconx.in.path || !con.tconx.in.device) { - req_reply_error(req, NT_STATUS_BAD_DEVICE_TYPE); + smbsrv_send_error(req, NT_STATUS_BAD_DEVICE_TYPE); return; } @@ -158,20 +158,20 @@ void smbsrv_reply_tcon_and_X(struct smbsrv_request *req) status = smbsrv_tcon_backend(req, &con); if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply - two variants */ if (req->smb_conn->negotiate.protocol < PROTOCOL_NT1) { - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); req_push_str(req, NULL, con.tconx.out.dev_type, -1, STR_TERMINATE|STR_ASCII); } else { - req_setup_reply(req, 3, 0); + smbsrv_setup_reply(req, 3, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -200,7 +200,7 @@ void smbsrv_reply_unknown(struct smbsrv_request *req) DEBUG(0,("unknown command type %d (0x%X)\n", type, type)); - req_reply_dos_error(req, ERRSRV, ERRunknownsmb); + smbsrv_send_dos_error(req, ERRSRV, ERRunknownsmb); } @@ -214,14 +214,14 @@ static void reply_ioctl_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* the +1 is for nicer alignment */ - req_setup_reply(req, 8, io->ioctl.out.blob.length+1); + smbsrv_setup_reply(req, 8, io->ioctl.out.blob.length+1); SSVAL(req->out.vwv, VWV(1), io->ioctl.out.blob.length); SSVAL(req->out.vwv, VWV(5), io->ioctl.out.blob.length); SSVAL(req->out.vwv, VWV(6), PTR_DIFF(req->out.data, req->out.hdr) + 1); memcpy(req->out.data+1, io->ioctl.out.blob.data, io->ioctl.out.blob.length); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -279,7 +279,7 @@ static void reply_getatr_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 10, 0); + smbsrv_setup_reply(req, 10, 0); SSVAL(req->out.vwv, VWV(0), st->getattr.out.attrib); srv_push_dos_date3(req->smb_conn, req->out.vwv, VWV(1), st->getattr.out.write_time); @@ -287,7 +287,7 @@ static void reply_getatr_send(struct smbsrv_request *req) REQ_VWV_RESERVED(5, 5); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -305,7 +305,7 @@ void smbsrv_reply_getatr(struct smbsrv_request *req) /* parse request */ req_pull_ascii4(req, &st->getattr.in.fname, req->in.data, STR_TERMINATE); if (!st->getattr.in.fname) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -338,7 +338,7 @@ void smbsrv_reply_setatr(struct smbsrv_request *req) req_pull_ascii4(req, &st->setattr.file.fname, req->in.data, STR_TERMINATE); if (!st->setattr.file.fname) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -362,7 +362,7 @@ static void reply_dskattr_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 5, 0); + smbsrv_setup_reply(req, 5, 0); SSVAL(req->out.vwv, VWV(0), fs->dskattr.out.units_total); SSVAL(req->out.vwv, VWV(1), fs->dskattr.out.blocks_per_unit); @@ -371,7 +371,7 @@ static void reply_dskattr_send(struct smbsrv_request *req) REQ_VWV_RESERVED(4, 1); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -408,7 +408,7 @@ static void reply_open_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 7, 0); + smbsrv_setup_reply(req, 7, 0); SSVAL(req->out.vwv, VWV(0), oi->openold.out.fnum); SSVAL(req->out.vwv, VWV(1), oi->openold.out.attrib); @@ -416,7 +416,7 @@ static void reply_open_send(struct smbsrv_request *req) SIVAL(req->out.vwv, VWV(4), oi->openold.out.size); SSVAL(req->out.vwv, VWV(6), oi->openold.out.rmode); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -437,7 +437,7 @@ void smbsrv_reply_open(struct smbsrv_request *req) req_pull_ascii4(req, &oi->openold.in.fname, req->in.data, STR_TERMINATE); if (!oi->openold.in.fname) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -463,9 +463,9 @@ static void reply_open_and_X_send(struct smbsrv_request *req) /* build the reply */ if (oi->openx.in.flags & OPENX_FLAGS_EXTENDED_RETURN) { - req_setup_reply(req, 19, 0); + smbsrv_setup_reply(req, 19, 0); } else { - req_setup_reply(req, 15, 0); + smbsrv_setup_reply(req, 15, 0); } SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); @@ -515,7 +515,7 @@ void smbsrv_reply_open_and_X(struct smbsrv_request *req) req_pull_ascii4(req, &oi->openx.in.fname, req->in.data, STR_TERMINATE); if (!oi->openx.in.fname) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -540,11 +540,11 @@ static void reply_mknew_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* build the reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), oi->mknew.out.fnum); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -570,7 +570,7 @@ void smbsrv_reply_mknew(struct smbsrv_request *req) req_pull_ascii4(req, &oi->mknew.in.fname, req->in.data, STR_TERMINATE); if (!oi->mknew.in.fname) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -594,14 +594,14 @@ static void reply_ctemp_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* build the reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), oi->ctemp.out.fnum); /* the returned filename is relative to the directory */ req_push_str(req, NULL, oi->ctemp.out.name, -1, STR_TERMINATE | STR_ASCII); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -624,7 +624,7 @@ void smbsrv_reply_ctemp(struct smbsrv_request *req) req_pull_ascii4(req, &oi->ctemp.in.directory, req->in.data, STR_TERMINATE); if (!oi->ctemp.in.directory) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } @@ -715,7 +715,7 @@ void smbsrv_reply_readbraw(struct smbsrv_request *req) req->out.size = io.readbraw.out.nread + NBT_HDR_SIZE; - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); return; failed: @@ -724,7 +724,7 @@ failed: req->out.buffer = talloc_size(req, req->out.size); SIVAL(req->out.buffer, 0, 0); /* init NBT header */ - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); } @@ -749,7 +749,7 @@ static void reply_lockread_send(struct smbsrv_request *req) SCVAL(req->out.data, 0, SMB_DATA_BLOCK); SSVAL(req->out.data, 1, io->lockread.out.nread); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -772,7 +772,7 @@ void smbsrv_reply_lockread(struct smbsrv_request *req) io->lockread.in.remaining = SVAL(req->in.vwv, VWV(4)); /* setup the reply packet assuming the maximum possible read */ - req_setup_reply(req, 5, 3 + io->lockread.in.count); + smbsrv_setup_reply(req, 5, 3 + io->lockread.in.count); /* tell the backend where to put the data */ io->lockread.out.data = req->out.data + 3; @@ -810,7 +810,7 @@ static void reply_read_send(struct smbsrv_request *req) SCVAL(req->out.data, 0, SMB_DATA_BLOCK); SSVAL(req->out.data, 1, io->read.out.nread); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -831,7 +831,7 @@ void smbsrv_reply_read(struct smbsrv_request *req) io->read.in.remaining = SVAL(req->in.vwv, VWV(4)); /* setup the reply packet assuming the maximum possible read */ - req_setup_reply(req, 5, 3 + io->read.in.count); + smbsrv_setup_reply(req, 5, 3 + io->read.in.count); /* tell the backend where to put the data */ io->read.out.data = req->out.data + 3; @@ -915,7 +915,7 @@ void smbsrv_reply_read_and_X(struct smbsrv_request *req) } /* setup the reply packet assuming the maximum possible read */ - req_setup_reply(req, 12, 1 + io->readx.in.maxcnt); + smbsrv_setup_reply(req, 12, 1 + io->readx.in.maxcnt); /* tell the backend where to put the data. Notice the pad byte. */ if (io->readx.in.maxcnt != 0xFFFF && @@ -941,7 +941,7 @@ void smbsrv_reply_read_and_X(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_writebraw(struct smbsrv_request *req) { - req_reply_dos_error(req, ERRSRV, ERRuseSTD); + smbsrv_send_dos_error(req, ERRSRV, ERRuseSTD); } @@ -955,11 +955,11 @@ static void reply_writeunlock_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), io->writeunlock.out.nwritten); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -981,13 +981,13 @@ void smbsrv_reply_writeunlock(struct smbsrv_request *req) /* make sure they gave us the data they promised */ if (io->writeunlock.in.count+3 > req->in.data_size) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } /* make sure the data block is big enough */ if (SVAL(req->in.data, 1) < io->writeunlock.in.count) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1013,11 +1013,11 @@ static void reply_write_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), io->write.out.nwritten); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1039,13 +1039,13 @@ void smbsrv_reply_write(struct smbsrv_request *req) /* make sure they gave us the data they promised */ if (req_data_oob(req, io->write.in.data, io->write.in.count)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } /* make sure the data block is big enough */ if (SVAL(req->in.data, 1) < io->write.in.count) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1070,7 +1070,7 @@ static void reply_write_and_X_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 6, 0); + smbsrv_setup_reply(req, 6, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -1112,7 +1112,7 @@ void smbsrv_reply_write_and_X(struct smbsrv_request *req) /* make sure the data is in bounds */ if (req_data_oob(req, io->writex.in.data, io->writex.in.count)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1137,11 +1137,11 @@ static void reply_lseek_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); SIVALS(req->out.vwv, VWV(0), io->out.offset); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1205,13 +1205,13 @@ void smbsrv_reply_exit(struct smbsrv_request *req) status = ntvfs_exit(req); req->tcon = NULL; if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } } - req_setup_reply(req, 0, 0); - req_send_reply(req); + smbsrv_setup_reply(req, 0, 0); + smbsrv_send_reply(req); } @@ -1253,11 +1253,11 @@ static void reply_writeclose_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), io->write.out.nwritten); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1283,7 +1283,7 @@ void smbsrv_reply_writeclose(struct smbsrv_request *req) /* make sure they gave us the data they promised */ if (req_data_oob(req, io->writeclose.in.data, io->writeclose.in.count)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1357,16 +1357,16 @@ void smbsrv_reply_tdis(struct smbsrv_request *req) REQ_CHECK_WCT(req, 0); if (req->tcon == NULL) { - req_reply_error(req, NT_STATUS_INVALID_HANDLE); + smbsrv_send_error(req, NT_STATUS_INVALID_HANDLE); return; } talloc_free(req->tcon); /* construct reply */ - req_setup_reply(req, 0, 0); + smbsrv_setup_reply(req, 0, 0); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -1383,7 +1383,7 @@ void smbsrv_reply_echo(struct smbsrv_request *req) count = SVAL(req->in.vwv, VWV(0)); - req_setup_reply(req, 1, req->in.data_size); + smbsrv_setup_reply(req, 1, req->in.data_size); memcpy(req->out.data, req->in.data, req->in.data_size); @@ -1391,13 +1391,13 @@ void smbsrv_reply_echo(struct smbsrv_request *req) struct smbsrv_request *this_req; if (i != count) { - this_req = req_setup_secondary(req); + this_req = smbsrv_setup_secondary_request(req); } else { this_req = req; } SSVAL(this_req->out.vwv, VWV(0), i); - req_send_reply(this_req); + smbsrv_send_reply(this_req); } } @@ -1413,11 +1413,11 @@ static void reply_printopen_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), oi->openold.out.fnum); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1482,7 +1482,7 @@ static void reply_printqueue_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); /* truncate the returned list to fit in the negotiated buffer size */ maxcount = (req_max_data(req) - 3) / el_size; @@ -1512,7 +1512,7 @@ static void reply_printqueue_send(struct smbsrv_request *req) req->out.ptr += el_size; } - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1555,7 +1555,7 @@ void smbsrv_reply_printwrite(struct smbsrv_request *req) io->splwrite.level = RAW_WRITE_SPLWRITE; if (req->in.data_size < 3) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1565,7 +1565,7 @@ void smbsrv_reply_printwrite(struct smbsrv_request *req) /* make sure they gave us the data they promised */ if (req_data_oob(req, io->splwrite.in.data, io->splwrite.in.count)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1646,7 +1646,7 @@ void smbsrv_reply_mv(struct smbsrv_request *req) p += req_pull_ascii4(req, &io->rename.in.pattern2, p, STR_TERMINATE); if (!io->rename.in.pattern1 || !io->rename.in.pattern2) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1682,7 +1682,7 @@ void smbsrv_reply_ntrename(struct smbsrv_request *req) p += req_pull_ascii4(req, &io->ntrename.in.new_name, p, STR_TERMINATE); if (!io->ntrename.in.old_name || !io->ntrename.in.new_name) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1705,11 +1705,11 @@ static void reply_copy_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* build the reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), cp->out.count); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1733,7 +1733,7 @@ void smbsrv_reply_copy(struct smbsrv_request *req) p += req_pull_ascii4(req, &cp->in.path2, p, STR_TERMINATE); if (!cp->in.path1 || !cp->in.path2) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1764,7 +1764,7 @@ static void reply_lockingX_send(struct smbsrv_request *req) } /* construct reply */ - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -1805,7 +1805,7 @@ void smbsrv_reply_lockingX(struct smbsrv_request *req) /* make sure we got the promised data */ if (req_data_oob(req, req->in.data, total_locks * lck_size)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1854,7 +1854,7 @@ void smbsrv_reply_lockingX(struct smbsrv_request *req) void smbsrv_reply_readbmpx(struct smbsrv_request *req) { /* tell the client to not use a multiplexed read - its too broken to use */ - req_reply_dos_error(req, ERRSRV, ERRuseSTD); + smbsrv_send_dos_error(req, ERRSRV, ERRuseSTD); } @@ -1890,7 +1890,7 @@ void smbsrv_reply_setattrE(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_writebmpx(struct smbsrv_request *req) { - req_reply_dos_error(req, ERRSRV, ERRuseSTD); + smbsrv_send_dos_error(req, ERRSRV, ERRuseSTD); } @@ -1899,7 +1899,7 @@ void smbsrv_reply_writebmpx(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_writebs(struct smbsrv_request *req) { - req_reply_dos_error(req, ERRSRV, ERRuseSTD); + smbsrv_send_dos_error(req, ERRSRV, ERRuseSTD); } @@ -1914,7 +1914,7 @@ static void reply_getattrE_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* setup reply */ - req_setup_reply(req, 11, 0); + smbsrv_setup_reply(req, 11, 0); srv_push_dos_date2(req->smb_conn, req->out.vwv, VWV(0), info->getattre.out.create_time); srv_push_dos_date2(req->smb_conn, req->out.vwv, VWV(2), info->getattre.out.access_time); @@ -1923,7 +1923,7 @@ static void reply_getattrE_send(struct smbsrv_request *req) SIVAL(req->out.vwv, VWV(8), info->getattre.out.alloc_size); SSVAL(req->out.vwv, VWV(10), info->getattre.out.attrib); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -1972,13 +1972,13 @@ static void reply_sesssetup_old(struct smbsrv_request *req) /* check the request isn't malformed */ if (req_data_oob(req, req->in.data, passlen)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p = req->in.data; if (!req_pull_blob(req, p, passlen, &sess.old.in.password)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p += passlen; @@ -1992,12 +1992,12 @@ static void reply_sesssetup_old(struct smbsrv_request *req) status = smbsrv_sesssetup_backend(req, &sess); if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply */ - req_setup_reply(req, 3, 0); + smbsrv_setup_reply(req, 3, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -2033,18 +2033,18 @@ static void reply_sesssetup_nt1(struct smbsrv_request *req) /* check the request isn't malformed */ if (req_data_oob(req, req->in.data, passlen1) || req_data_oob(req, req->in.data + passlen1, passlen2)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p = req->in.data; if (!req_pull_blob(req, p, passlen1, &sess.nt1.in.password1)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p += passlen1; if (!req_pull_blob(req, p, passlen2, &sess.nt1.in.password2)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p += passlen2; @@ -2058,12 +2058,12 @@ static void reply_sesssetup_nt1(struct smbsrv_request *req) status = smbsrv_sesssetup_backend(req, &sess); if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply */ - req_setup_reply(req, 3, 0); + smbsrv_setup_reply(req, 3, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -2101,7 +2101,7 @@ static void reply_sesssetup_spnego(struct smbsrv_request *req) p = req->in.data; if (!req_pull_blob(req, p, blob_len, &sess.spnego.in.secblob)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } p += blob_len; @@ -2115,15 +2115,15 @@ static void reply_sesssetup_spnego(struct smbsrv_request *req) if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply */ - req_setup_reply(req, 4, sess.spnego.out.secblob.length); + smbsrv_setup_reply(req, 4, sess.spnego.out.secblob.length); if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - req_setup_error(req, status); + smbsrv_send_error(req, status); } SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); @@ -2163,7 +2163,7 @@ void smbsrv_reply_sesssetup(struct smbsrv_request *req) } /* unsupported variant */ - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } /**************************************************************************** @@ -2175,7 +2175,7 @@ void smbsrv_reply_ulogoffX(struct smbsrv_request *req) NTSTATUS status; if (!req->session) { - req_reply_error(req, NT_STATUS_DOS(ERRSRV, ERRbaduid)); + smbsrv_send_error(req, NT_STATUS_DOS(ERRSRV, ERRbaduid)); return; } @@ -2186,7 +2186,7 @@ void smbsrv_reply_ulogoffX(struct smbsrv_request *req) status = ntvfs_logoff(req); req->tcon = NULL; if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } } @@ -2195,7 +2195,7 @@ void smbsrv_reply_ulogoffX(struct smbsrv_request *req) req->session = NULL; /* it is now invalid, don't use on any chained packets */ - req_setup_reply(req, 2, 0); + smbsrv_setup_reply(req, 2, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -2223,14 +2223,14 @@ void smbsrv_reply_findclose(struct smbsrv_request *req) status = ntvfs_search_close(req, &io); if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } /* construct reply */ - req_setup_reply(req, 0, 0); + smbsrv_setup_reply(req, 0, 0); - req_send_reply(req); + smbsrv_send_reply(req); } /**************************************************************************** @@ -2238,7 +2238,7 @@ void smbsrv_reply_findclose(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_findnclose(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } @@ -2252,7 +2252,7 @@ static void reply_ntcreate_and_X_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 34, 0); + smbsrv_setup_reply(req, 34, 0); SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE); SSVAL(req->out.vwv, VWV(1), 0); @@ -2314,7 +2314,7 @@ void smbsrv_reply_ntcreate_and_X(struct smbsrv_request *req) req_pull_string(req, &io->ntcreatex.in.fname, req->in.data, fname_len, STR_TERMINATE); if (!io->ntcreatex.in.fname) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -2344,7 +2344,7 @@ void smbsrv_reply_ntcancel(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_sends(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } /**************************************************************************** @@ -2352,7 +2352,7 @@ void smbsrv_reply_sends(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_sendstrt(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } /**************************************************************************** @@ -2360,7 +2360,7 @@ void smbsrv_reply_sendstrt(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_sendend(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } /**************************************************************************** @@ -2368,7 +2368,7 @@ void smbsrv_reply_sendend(struct smbsrv_request *req) ****************************************************************************/ void smbsrv_reply_sendtxt(struct smbsrv_request *req) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); } @@ -2438,7 +2438,7 @@ void smbsrv_reply_special(struct smbsrv_request *req) req->out.buffer = buf; req->out.size = 4; - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); return; case 0x89: /* session keepalive request @@ -2447,7 +2447,7 @@ void smbsrv_reply_special(struct smbsrv_request *req) SCVAL(buf, 3, 0); req->out.buffer = buf; req->out.size = 4; - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); return; case SMBkeepalive: diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index f8b58fefab..4b501ad973 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -36,7 +36,7 @@ construct a basic request packet, mostly used to construct async packets such as change notify and oplock break requests ****************************************************************************/ -struct smbsrv_request *init_smb_request(struct smbsrv_connection *smb_conn) +struct smbsrv_request *smbsrv_init_request(struct smbsrv_connection *smb_conn) { struct smbsrv_request *req; @@ -98,7 +98,7 @@ static void req_setup_chain_reply(struct smbsrv_request *req, uint_t wct, uint_t the caller will then fill in the command words and data before calling req_send_reply() to send the reply on its way */ -void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) +void smbsrv_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) { uint16_t flags2; @@ -165,7 +165,7 @@ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen) setup a copy of a request, used when the server needs to send more than one reply for a single request packet */ -struct smbsrv_request *req_setup_secondary(struct smbsrv_request *old_req) +struct smbsrv_request *smbsrv_setup_secondary_request(struct smbsrv_request *old_req) { struct smbsrv_request *req; ptrdiff_t diff; @@ -282,7 +282,7 @@ void req_grow_data(struct smbsrv_request *req, uint_t new_size) note that this only looks at req->out.buffer and req->out.size, allowing manually constructed packets to be sent */ -void req_send_reply_nosign(struct smbsrv_request *req) +void smbsrv_send_reply_nosign(struct smbsrv_request *req) { DATA_BLOB blob; NTSTATUS status; @@ -305,11 +305,11 @@ void req_send_reply_nosign(struct smbsrv_request *req) note that this only looks at req->out.buffer and req->out.size, allowing manually constructed packets to be sent */ -void req_send_reply(struct smbsrv_request *req) +void smbsrv_send_reply(struct smbsrv_request *req) { - req_sign_packet(req); + smbsrv_sign_packet(req); - req_send_reply_nosign(req); + smbsrv_send_reply_nosign(req); } @@ -318,23 +318,23 @@ void req_send_reply(struct smbsrv_request *req) construct and send an error packet with a forced DOS error code this is needed to match win2000 behaviour for some parts of the protocol */ -void req_reply_dos_error(struct smbsrv_request *req, uint8_t eclass, uint16_t ecode) +void smbsrv_send_dos_error(struct smbsrv_request *req, uint8_t eclass, uint16_t ecode) { /* if the basic packet hasn't been setup yet then do it now */ if (req->out.buffer == NULL) { - req_setup_reply(req, 0, 0); + smbsrv_setup_reply(req, 0, 0); } SCVAL(req->out.hdr, HDR_RCLS, eclass); SSVAL(req->out.hdr, HDR_ERR, ecode); SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) & ~FLAGS2_32_BIT_ERROR_CODES); - req_send_reply(req); + smbsrv_send_reply(req); } /* setup the header of a reply to include an NTSTATUS code */ -void req_setup_error(struct smbsrv_request *req, NTSTATUS status) +void smbsrv_setup_error(struct smbsrv_request *req, NTSTATUS status) { if (!req->smb_conn->config.nt_status_support || !(req->smb_conn->negotiate.client_caps & CAP_STATUS32)) { /* convert to DOS error codes */ @@ -362,20 +362,20 @@ void req_setup_error(struct smbsrv_request *req, NTSTATUS status) construct and send an error packet, then destroy the request auto-converts to DOS error format when appropriate */ -void req_reply_error(struct smbsrv_request *req, NTSTATUS status) +void smbsrv_send_error(struct smbsrv_request *req, NTSTATUS status) { if (req->smb_conn->connection->event.fde == NULL) { /* the socket has been destroyed - no point trying to send an error! */ talloc_free(req); return; } - req_setup_reply(req, 0, 0); + smbsrv_setup_reply(req, 0, 0); /* error returns never have any data */ req_grow_data(req, 0); - req_setup_error(req, status); - req_send_reply(req); + smbsrv_setup_error(req, status); + smbsrv_send_reply(req); } diff --git a/source4/smb_server/smb/search.c b/source4/smb_server/smb/search.c index 10d9a17808..297ea40063 100644 --- a/source4/smb_server/smb/search.c +++ b/source4/smb_server/smb/search.c @@ -30,7 +30,7 @@ /* check req->async.status and if not OK then send an error reply */ #define CHECK_ASYNC_STATUS do { \ if (!NT_STATUS_IS_OK(req->async_states->status)) { \ - req_reply_error(req, req->async_states->status); \ + smbsrv_send_error(req, req->async_states->status); \ return; \ }} while (0) @@ -48,7 +48,7 @@ #define REQ_TALLOC(ptr) do { \ ptr = talloc_size(req, sizeof(*(ptr))); \ if (!ptr) { \ - req_reply_error(req, NT_STATUS_NO_MEMORY); \ + smbsrv_send_error(req, NT_STATUS_NO_MEMORY); \ return; \ }} while (0) @@ -127,7 +127,7 @@ void smbsrv_reply_search(struct smbsrv_request *req) /* parse request */ if (req->in.wct != 2) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -135,16 +135,16 @@ void smbsrv_reply_search(struct smbsrv_request *req) p += req_pull_ascii4(req, &sf->search_first.in.pattern, p, STR_TERMINATE); if (!sf->search_first.in.pattern) { - req_reply_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); + smbsrv_send_error(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return; } if (req_data_oob(req, p, 3)) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } if (*p != 5) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } resume_key_length = SVAL(p, 1); @@ -156,14 +156,14 @@ void smbsrv_reply_search(struct smbsrv_request *req) state.last_entry_offset = 0; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); req_append_var_block(req, NULL, 0); if (resume_key_length != 0) { if (resume_key_length != 21 || req_data_oob(req, p, 21) || level == RAW_SEARCH_FUNIQUE) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -195,11 +195,11 @@ void smbsrv_reply_search(struct smbsrv_request *req) } if (!NT_STATUS_IS_OK(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } - req_send_reply(req); + smbsrv_send_reply(req); } @@ -211,11 +211,11 @@ static void reply_fclose_send(struct smbsrv_request *req) CHECK_ASYNC_STATUS; /* construct reply */ - req_setup_reply(req, 1, 0); + smbsrv_setup_reply(req, 1, 0); SSVAL(req->out.vwv, VWV(0), 0); - req_send_reply(req); + smbsrv_send_reply(req); } @@ -233,35 +233,35 @@ void smbsrv_reply_fclose(struct smbsrv_request *req) /* parse request */ if (req->in.wct != 2) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } p = req->in.data; p += req_pull_ascii4(req, &pattern, p, STR_TERMINATE); if (pattern && *pattern) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } if (req_data_oob(req, p, 3)) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } if (*p != 5) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } resume_key_length = SVAL(p, 1); p += 3; if (resume_key_length != 21) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } if (req_data_oob(req, p, 21)) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c index 916224b26e..29589ce074 100644 --- a/source4/smb_server/smb/sesssetup.c +++ b/source4/smb_server/smb/sesssetup.c @@ -231,19 +231,19 @@ static NTSTATUS sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *s return NT_STATUS_OK; } - if (!srv_setup_signing(req->smb_conn, &session_info->session_key, &sess->nt1.in.password2)) { + if (!smbsrv_setup_signing(req->smb_conn, &session_info->session_key, &sess->nt1.in.password2)) { /* Already signing, or disabled */ return NT_STATUS_OK; } /* Force check of the request packet, now we know the session key */ - req_signing_check_incoming(req); + smbsrv_signing_check_incoming(req); /* TODO: why don't we check the result here? */ /* Unfortunetly win2k3 as a client doesn't sign the request * packet here, so we have to force signing to start again */ - srv_signing_restart(req->smb_conn, &session_info->session_key, &sess->nt1.in.password2); + smbsrv_signing_restart(req->smb_conn, &session_info->session_key, &sess->nt1.in.password2); return NT_STATUS_OK; } @@ -331,11 +331,11 @@ static NTSTATUS sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup skey_status = gensec_session_key(smb_sess->gensec_ctx, &session_key); if (NT_STATUS_IS_OK(skey_status) && session_info->server_info->authenticated && - srv_setup_signing(req->smb_conn, &session_key, NULL)) { + smbsrv_setup_signing(req->smb_conn, &session_key, NULL)) { /* Force check of the request packet, now we know the session key */ - req_signing_check_incoming(req); + smbsrv_signing_check_incoming(req); - srv_signing_restart(req->smb_conn, &session_key, NULL); + smbsrv_signing_restart(req->smb_conn, &session_key, NULL); } /* Ensure this is marked as a 'real' vuid, not one diff --git a/source4/smb_server/smb/signing.c b/source4/smb_server/smb/signing.c index 7f441a2816..79596ed92d 100644 --- a/source4/smb_server/smb/signing.c +++ b/source4/smb_server/smb/signing.c @@ -26,7 +26,7 @@ /* sign an outgoing packet */ -void req_sign_packet(struct smbsrv_request *req) +void smbsrv_sign_packet(struct smbsrv_request *req) { #if 0 /* enable this when packet signing is preventing you working out why valgrind @@ -63,9 +63,9 @@ void req_sign_packet(struct smbsrv_request *req) setup the signing key for a connection. Called after authentication succeeds in a session setup */ -BOOL srv_setup_signing(struct smbsrv_connection *smb_conn, - DATA_BLOB *session_key, - DATA_BLOB *response) +BOOL smbsrv_setup_signing(struct smbsrv_connection *smb_conn, + DATA_BLOB *session_key, + DATA_BLOB *response) { if (!set_smb_signing_common(&smb_conn->signing)) { return False; @@ -74,15 +74,15 @@ BOOL srv_setup_signing(struct smbsrv_connection *smb_conn, &smb_conn->signing, session_key, response); } -void srv_signing_restart(struct smbsrv_connection *smb_conn, - DATA_BLOB *session_key, - DATA_BLOB *response) +void smbsrv_signing_restart(struct smbsrv_connection *smb_conn, + DATA_BLOB *session_key, + DATA_BLOB *response) { if (!smb_conn->signing.seen_valid) { DEBUG(5, ("Client did not send a valid signature on " "SPNEGO session setup - ignored, expect good next time\n")); /* force things back on (most clients do not sign this packet)... */ - srv_setup_signing(smb_conn, session_key, response); + smbsrv_setup_signing(smb_conn, session_key, response); smb_conn->signing.next_seq_num = 2; if (smb_conn->signing.mandatory_signing) { DEBUG(5, ("Configured for mandatory signing, 'good packet seen' forced on\n")); @@ -95,7 +95,7 @@ void srv_signing_restart(struct smbsrv_connection *smb_conn, } } -BOOL srv_init_signing(struct smbsrv_connection *smb_conn) +BOOL smbsrv_init_signing(struct smbsrv_connection *smb_conn) { smb_conn->signing.mac_key = data_blob(NULL, 0); if (!smbcli_set_signing_off(&smb_conn->signing)) { @@ -139,7 +139,7 @@ static void req_signing_alloc_seq_num(struct smbsrv_request *req) /* called for requests that do not produce a reply of their own */ -void req_signing_no_reply(struct smbsrv_request *req) +void smbsrv_signing_no_reply(struct smbsrv_request *req) { if (req->smb_conn->signing.signing_state != SMB_SIGNING_ENGINE_OFF) { req->smb_conn->signing.next_seq_num--; @@ -154,7 +154,7 @@ void req_signing_no_reply(struct smbsrv_request *req) * @return False if we had an established signing connection * which had a back checksum, True otherwise */ -BOOL req_signing_check_incoming(struct smbsrv_request *req) +BOOL smbsrv_signing_check_incoming(struct smbsrv_request *req) { BOOL good; diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c index 992581b8d3..da2a5999a4 100644 --- a/source4/smb_server/smb/trans2.c +++ b/source4/smb_server/smb/trans2.c @@ -1454,7 +1454,7 @@ static void reply_trans_continue(struct smbsrv_request *req, uint8_t command, /* make sure they don't flood us */ for (count=0,tp=req->smb_conn->trans_partial;tp;tp=tp->next) count++; if (count > 100) { - req_reply_error(req, NT_STATUS_INSUFFICIENT_RESOURCES); + smbsrv_send_error(req, NT_STATUS_INSUFFICIENT_RESOURCES); return; } @@ -1467,8 +1467,8 @@ static void reply_trans_continue(struct smbsrv_request *req, uint8_t command, DLIST_ADD(req->smb_conn->trans_partial, tp); /* send a 'please continue' reply */ - req_setup_reply(req, 0, 0); - req_send_reply(req); + smbsrv_setup_reply(req, 0, 0); + smbsrv_send_reply(req); } @@ -1491,7 +1491,7 @@ static void reply_trans_complete(struct smbsrv_request *req, uint8_t command, } if (NT_STATUS_IS_ERR(status)) { - req_reply_error(req, status); + smbsrv_send_error(req, status); return; } @@ -1500,10 +1500,10 @@ static void reply_trans_complete(struct smbsrv_request *req, uint8_t command, params = trans->out.params.data; data = trans->out.data.data; - req_setup_reply(req, 10 + trans->out.setup_count, 0); + smbsrv_setup_reply(req, 10 + trans->out.setup_count, 0); if (!NT_STATUS_IS_OK(status)) { - req_setup_error(req, status); + smbsrv_setup_error(req, status); } /* we need to divide up the reply into chunks that fit into @@ -1529,7 +1529,7 @@ static void reply_trans_complete(struct smbsrv_request *req, uint8_t command, /* don't destroy unless this is the last chunk */ if (params_left - this_param != 0 || data_left - this_data != 0) { - this_req = req_setup_secondary(req); + this_req = smbsrv_setup_secondary_request(req); } else { this_req = req; } @@ -1568,7 +1568,7 @@ static void reply_trans_complete(struct smbsrv_request *req, uint8_t command, params += this_param; data += this_data; - req_send_reply(this_req); + smbsrv_send_reply(this_req); } while (params_left != 0 || data_left != 0); } @@ -1586,13 +1586,13 @@ static void reply_trans_generic(struct smbsrv_request *req, uint8_t command) trans = talloc(req, struct smb_trans2); if (trans == NULL) { - req_reply_error(req, NT_STATUS_NO_MEMORY); + smbsrv_send_error(req, NT_STATUS_NO_MEMORY); return; } /* parse request */ if (req->in.wct < 14) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -1610,14 +1610,14 @@ static void reply_trans_generic(struct smbsrv_request *req, uint8_t command) trans->in.setup_count = CVAL(req->in.vwv, VWV(13)); if (req->in.wct != 14 + trans->in.setup_count) { - req_reply_dos_error(req, ERRSRV, ERRerror); + smbsrv_send_dos_error(req, ERRSRV, ERRerror); return; } /* parse out the setup words */ trans->in.setup = talloc_array(req, uint16_t, trans->in.setup_count); if (trans->in.setup_count && !trans->in.setup) { - req_reply_error(req, NT_STATUS_NO_MEMORY); + smbsrv_send_error(req, NT_STATUS_NO_MEMORY); return; } for (i=0;i<trans->in.setup_count;i++) { @@ -1630,7 +1630,7 @@ static void reply_trans_generic(struct smbsrv_request *req, uint8_t command) if (!req_pull_blob(req, req->in.hdr + param_ofs, param_count, &trans->in.params) || !req_pull_blob(req, req->in.hdr + data_ofs, data_count, &trans->in.data)) { - req_reply_error(req, NT_STATUS_FOOBAR); + smbsrv_send_error(req, NT_STATUS_FOOBAR); return; } @@ -1665,7 +1665,7 @@ static void reply_transs_generic(struct smbsrv_request *req, uint8_t command) } if (tp == NULL) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -1673,7 +1673,7 @@ static void reply_transs_generic(struct smbsrv_request *req, uint8_t command) /* parse request */ if (req->in.wct < 8) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -1688,7 +1688,7 @@ static void reply_transs_generic(struct smbsrv_request *req, uint8_t command) if (!req_pull_blob(req, req->in.hdr + param_ofs, param_count, ¶ms) || !req_pull_blob(req, req->in.hdr + data_ofs, data_count, &data)) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -1697,7 +1697,7 @@ static void reply_transs_generic(struct smbsrv_request *req, uint8_t command) param_disp != trans->in.params.length) || (data_count != 0 && data_disp != trans->in.data.length)) { - req_reply_error(req, NT_STATUS_INVALID_PARAMETER); + smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -1743,7 +1743,7 @@ static void reply_transs_generic(struct smbsrv_request *req, uint8_t command) return; failed: - req_reply_error(tp->req, NT_STATUS_NO_MEMORY); + smbsrv_send_error(tp->req, NT_STATUS_NO_MEMORY); DLIST_REMOVE(req->smb_conn->trans_partial, tp); talloc_free(req); talloc_free(tp); |