Deleted Added
full compact
smb_rq.c (139823) smb_rq.c (161523)
1/*-
2 * Copyright (c) 2000-2001, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000-2001, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netsmb/smb_rq.c 139823 2005-01-07 01:45:51Z imp $");
34__FBSDID("$FreeBSD: head/sys/netsmb/smb_rq.c 161523 2006-08-22 03:05:51Z marcel $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/endian.h>
39#include <sys/kernel.h>
40#include <sys/malloc.h>
41#include <sys/module.h>
42#include <sys/proc.h>

--- 93 unchanged lines hidden (view full) ---

136 if ((flags2 & SMB_FLAGS2_SECURITY_SIGNATURE) == 0) {
137 mb_put_mem(mbp, tzero, 12, MB_MSYSTEM);
138 rqp->sr_rqsig = NULL;
139 } else {
140 mb_put_uint16le(mbp, 0 /*scred->sc_p->p_pid >> 16*/);
141 rqp->sr_rqsig = (u_int8_t *)mb_reserve(mbp, 8);
142 mb_put_uint16le(mbp, 0);
143 }
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/endian.h>
39#include <sys/kernel.h>
40#include <sys/malloc.h>
41#include <sys/module.h>
42#include <sys/proc.h>

--- 93 unchanged lines hidden (view full) ---

136 if ((flags2 & SMB_FLAGS2_SECURITY_SIGNATURE) == 0) {
137 mb_put_mem(mbp, tzero, 12, MB_MSYSTEM);
138 rqp->sr_rqsig = NULL;
139 } else {
140 mb_put_uint16le(mbp, 0 /*scred->sc_p->p_pid >> 16*/);
141 rqp->sr_rqsig = (u_int8_t *)mb_reserve(mbp, 8);
142 mb_put_uint16le(mbp, 0);
143 }
144 rqp->sr_rqtid = (u_int16_t*)mb_reserve(mbp, sizeof(u_int16_t));
144 rqp->sr_rqtid = mb_reserve(mbp, sizeof(u_int16_t));
145 mb_put_uint16le(mbp, 1 /*scred->sc_p->p_pid & 0xffff*/);
145 mb_put_uint16le(mbp, 1 /*scred->sc_p->p_pid & 0xffff*/);
146 rqp->sr_rquid = (u_int16_t*)mb_reserve(mbp, sizeof(u_int16_t));
146 rqp->sr_rquid = mb_reserve(mbp, sizeof(u_int16_t));
147 mb_put_uint16le(mbp, rqp->sr_mid);
148 return 0;
149}
150
151void
152smb_rq_done(struct smb_rq *rqp)
153{
154 mb_done(&rqp->sr_rq);

--- 79 unchanged lines hidden (view full) ---

234 if (rqp->sr_rq.mb_count & 1)
235 SMBERROR("odd word count\n");
236 *rqp->sr_wcount = rqp->sr_rq.mb_count / 2;
237}
238
239void
240smb_rq_bstart(struct smb_rq *rqp)
241{
147 mb_put_uint16le(mbp, rqp->sr_mid);
148 return 0;
149}
150
151void
152smb_rq_done(struct smb_rq *rqp)
153{
154 mb_done(&rqp->sr_rq);

--- 79 unchanged lines hidden (view full) ---

234 if (rqp->sr_rq.mb_count & 1)
235 SMBERROR("odd word count\n");
236 *rqp->sr_wcount = rqp->sr_rq.mb_count / 2;
237}
238
239void
240smb_rq_bstart(struct smb_rq *rqp)
241{
242 rqp->sr_bcount = (u_short*)mb_reserve(&rqp->sr_rq, sizeof(u_short));
242 rqp->sr_bcount = mb_reserve(&rqp->sr_rq, sizeof(u_short));
243 rqp->sr_rq.mb_count = 0;
244}
245
246void
247smb_rq_bend(struct smb_rq *rqp)
248{
249 int bcnt;
250
251 if (rqp->sr_bcount == NULL) {
252 SMBERROR("no bcount\n"); /* actually panic */
253 return;
254 }
255 bcnt = rqp->sr_rq.mb_count;
256 if (bcnt > 0xffff)
257 SMBERROR("byte count too large (%d)\n", bcnt);
243 rqp->sr_rq.mb_count = 0;
244}
245
246void
247smb_rq_bend(struct smb_rq *rqp)
248{
249 int bcnt;
250
251 if (rqp->sr_bcount == NULL) {
252 SMBERROR("no bcount\n"); /* actually panic */
253 return;
254 }
255 bcnt = rqp->sr_rq.mb_count;
256 if (bcnt > 0xffff)
257 SMBERROR("byte count too large (%d)\n", bcnt);
258 *rqp->sr_bcount = htole16(bcnt);
258 le16enc(rqp->sr_bcount, bcnt);
259}
260
261int
262smb_rq_intr(struct smb_rq *rqp)
263{
264 if (rqp->sr_flags & SMBR_INTR)
265 return EINTR;
266 return smb_td_intr(rqp->sr_cred->scr_td);

--- 505 unchanged lines hidden ---
259}
260
261int
262smb_rq_intr(struct smb_rq *rqp)
263{
264 if (rqp->sr_flags & SMBR_INTR)
265 return EINTR;
266 return smb_td_intr(rqp->sr_cred->scr_td);

--- 505 unchanged lines hidden ---