3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  24  */
  25 
  26 #include <sys/sunddi.h>
  27 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
  28 #include <string.h>
  29 #include <strings.h>
  30 #include <stddef.h>
  31 #endif /* _KERNEL */
  32 #include <smbsrv/smb_door.h>
  33 #include <smbsrv/alloc.h>
  34 #include <sys/socket.h>
  35 #include <sys/sysmacros.h>
  36 
  37 #define SMB_XDRMAX32_SZ         0xFFFFFFFF
  38 
  39 bool_t smb_list_xdr(XDR *, list_t *,  const size_t, const size_t,
  40     const xdrproc_t);
  41 
  42 bool_t
  43 smb_buf32_xdr(XDR *xdrs, smb_buf32_t *objp)
 
 
 221                 return (FALSE);
 222         if (objp->a_family == AF_INET) {
 223                 if (!xdr_uint32_t(xdrs, (in_addr_t *)&objp->a_ipv4))
 224                         return (FALSE);
 225         } else {
 226                 if (!xdr_vector(xdrs, (char *)&objp->a_ipv6,
 227                     sizeof (objp->a_ipv6), sizeof (char), (xdrproc_t)xdr_char))
 228                         return (FALSE);
 229         }
 230         return (TRUE);
 231 }
 232 
 233 /*
 234  * XDR encode/decode for smb_netuserinfo_t.
 235  */
 236 bool_t
 237 smb_netuserinfo_xdr(XDR *xdrs, smb_netuserinfo_t *objp)
 238 {
 239         if (!xdr_uint64_t(xdrs, &objp->ui_session_id))
 240                 return (FALSE);
 241         if (!xdr_uint16_t(xdrs, &objp->ui_smb_uid))
 242                 return (FALSE);
 243         if (!xdr_uint16_t(xdrs, &objp->ui_domain_len))
 244                 return (FALSE);
 245         if (!xdr_string(xdrs, &objp->ui_domain, ~0))
 246                 return (FALSE);
 247         if (!xdr_uint16_t(xdrs, &objp->ui_account_len))
 248                 return (FALSE);
 249         if (!xdr_string(xdrs, &objp->ui_account, ~0))
 250                 return (FALSE);
 251         if (!xdr_uint32_t(xdrs, &objp->ui_posix_uid))
 252                 return (FALSE);
 253         if (!xdr_uint16_t(xdrs, &objp->ui_workstation_len))
 254                 return (FALSE);
 255         if (!xdr_string(xdrs, &objp->ui_workstation, ~0))
 256                 return (FALSE);
 257         if (!smb_inaddr_xdr(xdrs, &objp->ui_ipaddr))
 258                 return (FALSE);
 259         if (!xdr_int32_t(xdrs, &objp->ui_native_os))
 260                 return (FALSE);
 261         if (!xdr_int64_t(xdrs, &objp->ui_logon_time))
 262                 return (FALSE);
 
 | 
 
 
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  24  */
  25 
  26 #include <sys/sunddi.h>
  27 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
  28 #include <string.h>
  29 #include <strings.h>
  30 #include <stddef.h>
  31 #endif /* _KERNEL */
  32 #include <smbsrv/smb_door.h>
  33 #include <smbsrv/alloc.h>
  34 #include <sys/socket.h>
  35 #include <sys/sysmacros.h>
  36 
  37 #define SMB_XDRMAX32_SZ         0xFFFFFFFF
  38 
  39 bool_t smb_list_xdr(XDR *, list_t *,  const size_t, const size_t,
  40     const xdrproc_t);
  41 
  42 bool_t
  43 smb_buf32_xdr(XDR *xdrs, smb_buf32_t *objp)
 
 
 221                 return (FALSE);
 222         if (objp->a_family == AF_INET) {
 223                 if (!xdr_uint32_t(xdrs, (in_addr_t *)&objp->a_ipv4))
 224                         return (FALSE);
 225         } else {
 226                 if (!xdr_vector(xdrs, (char *)&objp->a_ipv6,
 227                     sizeof (objp->a_ipv6), sizeof (char), (xdrproc_t)xdr_char))
 228                         return (FALSE);
 229         }
 230         return (TRUE);
 231 }
 232 
 233 /*
 234  * XDR encode/decode for smb_netuserinfo_t.
 235  */
 236 bool_t
 237 smb_netuserinfo_xdr(XDR *xdrs, smb_netuserinfo_t *objp)
 238 {
 239         if (!xdr_uint64_t(xdrs, &objp->ui_session_id))
 240                 return (FALSE);
 241         if (!xdr_uint16_t(xdrs, &objp->ui_domain_len))
 242                 return (FALSE);
 243         if (!xdr_string(xdrs, &objp->ui_domain, ~0))
 244                 return (FALSE);
 245         if (!xdr_uint16_t(xdrs, &objp->ui_account_len))
 246                 return (FALSE);
 247         if (!xdr_string(xdrs, &objp->ui_account, ~0))
 248                 return (FALSE);
 249         if (!xdr_uint32_t(xdrs, &objp->ui_posix_uid))
 250                 return (FALSE);
 251         if (!xdr_uint16_t(xdrs, &objp->ui_workstation_len))
 252                 return (FALSE);
 253         if (!xdr_string(xdrs, &objp->ui_workstation, ~0))
 254                 return (FALSE);
 255         if (!smb_inaddr_xdr(xdrs, &objp->ui_ipaddr))
 256                 return (FALSE);
 257         if (!xdr_int32_t(xdrs, &objp->ui_native_os))
 258                 return (FALSE);
 259         if (!xdr_int64_t(xdrs, &objp->ui_logon_time))
 260                 return (FALSE);
 
 |