rap.c (130737) | rap.c (150312) |
---|---|
1/* 2 * Copyright (c) 2000, 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 --- 16 unchanged lines hidden (view full) --- 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $Id: rap.c,v 1.8 2001/02/24 15:56:05 bp Exp $ | 1/* 2 * Copyright (c) 2000, 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 --- 16 unchanged lines hidden (view full) --- 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $Id: rap.c,v 1.8 2001/02/24 15:56:05 bp Exp $ |
33 * $FreeBSD: head/contrib/smbfs/lib/smb/rap.c 130737 2004-06-19 19:03:01Z le $ | 33 * $FreeBSD: head/contrib/smbfs/lib/smb/rap.c 150312 2005-09-19 08:07:18Z imura $ |
34 * 35 * This is very simple implementation of RAP protocol. 36 */ 37#include <sys/param.h> | 34 * 35 * This is very simple implementation of RAP protocol. 36 */ 37#include <sys/param.h> |
38#include <sys/endian.h> |
|
38#include <sys/errno.h> 39#include <sys/stat.h> 40#include <ctype.h> 41#include <err.h> 42#include <stdio.h> 43#include <unistd.h> 44#include <string.h> 45#include <stdlib.h> 46#include <sysexits.h> 47 | 39#include <sys/errno.h> 40#include <sys/stat.h> 41#include <ctype.h> 42#include <err.h> 43#include <stdio.h> 44#include <unistd.h> 45#include <string.h> 46#include <stdlib.h> 47#include <sysexits.h> 48 |
48#include <sys/mchain.h> 49 | |
50#include <netsmb/smb_lib.h> 51#include <netsmb/smb_conn.h> 52#include <netsmb/smb_rap.h> 53 54/*#include <sys/ioctl.h>*/ 55 56static int 57smb_rap_parserqparam(const char *s, char **next, int *rlen) --- 227 unchanged lines hidden (view full) --- 285 char ptype = *p; 286 int error, plen; 287 288 error = smb_rap_parserpparam(p, &p, &plen); 289 if (error) 290 return error; 291 switch (ptype) { 292 case 'h': | 49#include <netsmb/smb_lib.h> 50#include <netsmb/smb_conn.h> 51#include <netsmb/smb_rap.h> 52 53/*#include <sys/ioctl.h>*/ 54 55static int 56smb_rap_parserqparam(const char *s, char **next, int *rlen) --- 227 unchanged lines hidden (view full) --- 284 char ptype = *p; 285 int error, plen; 286 287 error = smb_rap_parserpparam(p, &p, &plen); 288 if (error) 289 return error; 290 switch (ptype) { 291 case 'h': |
293 *value = letohs(*(u_int16_t*)rap->r_npbuf); | 292 *value = le16toh(*(u_int16_t*)rap->r_npbuf); |
294 break; 295 default: 296 return EINVAL; 297 } 298 rap->r_npbuf += plen; 299 rap->r_nparam = p; 300 return 0; 301} --- 13 unchanged lines hidden (view full) --- 315 rap->r_plen, rap->r_pbuf, /* int tparamcnt, void *tparam */ 316 0, NULL, /* int tdatacnt, void *tdata */ 317 &rparamcnt, rap->r_pbuf, /* rparamcnt, void *rparam */ 318 &rdatacnt, rap->r_rcvbuf /* int *rdatacnt, void *rdata */ 319 ); 320 if (error) 321 return error; 322 rp = (u_int16_t*)rap->r_pbuf; | 293 break; 294 default: 295 return EINVAL; 296 } 297 rap->r_npbuf += plen; 298 rap->r_nparam = p; 299 return 0; 300} --- 13 unchanged lines hidden (view full) --- 314 rap->r_plen, rap->r_pbuf, /* int tparamcnt, void *tparam */ 315 0, NULL, /* int tdatacnt, void *tdata */ 316 &rparamcnt, rap->r_pbuf, /* rparamcnt, void *rparam */ 317 &rdatacnt, rap->r_rcvbuf /* int *rdatacnt, void *rdata */ 318 ); 319 if (error) 320 return error; 321 rp = (u_int16_t*)rap->r_pbuf; |
323 rap->r_result = letohs(*rp++); 324 conv = letohs(*rp++); | 322 rap->r_result = le16toh(*rp++); 323 conv = le16toh(*rp++); |
325 rap->r_npbuf = (char*)rp; 326 rap->r_entries = entries = 0; 327 done = 0; 328 while (!done && *p) { 329 ptype = *p; 330 switch (ptype) { 331 case 'e': | 324 rap->r_npbuf = (char*)rp; 325 rap->r_entries = entries = 0; 326 done = 0; 327 while (!done && *p) { 328 ptype = *p; 329 switch (ptype) { 330 case 'e': |
332 rap->r_entries = entries = letohs(*(u_int16_t*)rap->r_npbuf); | 331 rap->r_entries = entries = le16toh(*(u_int16_t*)rap->r_npbuf); |
333 rap->r_npbuf += 2; 334 p++; 335 break; 336 default: 337 done = 1; 338 } 339/* error = smb_rap_parserpparam(p, &p, &plen); 340 if (error) { --- 65 unchanged lines hidden --- | 332 rap->r_npbuf += 2; 333 p++; 334 break; 335 default: 336 done = 1; 337 } 338/* error = smb_rap_parserpparam(p, &p, &plen); 339 if (error) { --- 65 unchanged lines hidden --- |