smb_subr.c (227293) | smb_subr.c (227650) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/netsmb/smb_subr.c 227293 2011-11-07 06:44:47Z ed $"); | 28__FBSDID("$FreeBSD: head/sys/netsmb/smb_subr.c 227650 2011-11-18 03:05:20Z kevlo $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/endian.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/proc.h> 36#include <sys/lock.h> --- 308 unchanged lines hidden (view full) --- 345 346 if (size == 0) 347 return 0; 348 if (dp == NULL) { 349 return mb_put_mem(mbp, src, size, MB_MSYSTEM); 350 } 351 mbp->mb_copy = smb_copy_iconv; 352 mbp->mb_udata = dp; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/endian.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/proc.h> 36#include <sys/lock.h> --- 308 unchanged lines hidden (view full) --- 345 346 if (size == 0) 347 return 0; 348 if (dp == NULL) { 349 return mb_put_mem(mbp, src, size, MB_MSYSTEM); 350 } 351 mbp->mb_copy = smb_copy_iconv; 352 mbp->mb_udata = dp; |
353 if (SMB_UNICODE_STRINGS(vcp)) 354 mb_put_padbyte(mbp); |
|
353 return mb_put_mem(mbp, src, size, MB_MCUSTOM); 354} 355 356int 357smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp, const char *src, 358 int caseopt) 359{ 360 int error; 361 362 error = smb_put_dmem(mbp, vcp, src, strlen(src), caseopt); 363 if (error) 364 return error; | 355 return mb_put_mem(mbp, src, size, MB_MCUSTOM); 356} 357 358int 359smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp, const char *src, 360 int caseopt) 361{ 362 int error; 363 364 error = smb_put_dmem(mbp, vcp, src, strlen(src), caseopt); 365 if (error) 366 return error; |
367 if (SMB_UNICODE_STRINGS(vcp)) 368 return mb_put_uint16le(mbp, 0); |
|
365 return mb_put_uint8(mbp, 0); 366} 367 368int 369smb_put_asunistring(struct smb_rq *rqp, const char *src) 370{ 371 struct mbchain *mbp = &rqp->sr_rq; 372 struct iconv_drv *dp = rqp->sr_vc->vc_toserver; 373 u_char c; 374 int error; 375 376 while (*src) { 377 iconv_convmem(dp, &c, src++, 1); 378 error = mb_put_uint16le(mbp, c); 379 if (error) 380 return error; 381 } 382 return mb_put_uint16le(mbp, 0); 383} | 369 return mb_put_uint8(mbp, 0); 370} 371 372int 373smb_put_asunistring(struct smb_rq *rqp, const char *src) 374{ 375 struct mbchain *mbp = &rqp->sr_rq; 376 struct iconv_drv *dp = rqp->sr_vc->vc_toserver; 377 u_char c; 378 int error; 379 380 while (*src) { 381 iconv_convmem(dp, &c, src++, 1); 382 error = mb_put_uint16le(mbp, c); 383 if (error) 384 return error; 385 } 386 return mb_put_uint16le(mbp, 0); 387} |