Print this page
    
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c
          +++ new/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  
    | 
      ↓ open down ↓ | 
    13 lines elided | 
    
      ↑ open up ↑ | 
  
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + *
       25 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  24   26   */
  25   27  
  26   28  #include <smbsrv/smb_kproto.h>
  27   29  
  28   30  
  29   31  /*
  30   32   * smb_com_logoff_andx
  31   33   *
  32   34   * This SMB is the inverse of SMB_COM_SESSION_SETUP_ANDX.
  33   35   *
  34   36   * Client Request                     Description
  35   37   * ================================== =================================
  36   38   *
  37   39   * UCHAR WordCount;                   Count of parameter words = 2
  38   40   * UCHAR AndXCommand;                 Secondary (X) command;  0xFF = none
  39   41   * UCHAR AndXReserved;                Reserved (must be 0)
  40   42   * USHORT AndXOffset;                 Offset to next command WordCount
  41   43   * USHORT ByteCount;                  Count of data bytes = 0
  42   44   *
  43   45   * Server Response                    Description
  44   46   * ================================== =================================
  45   47   *
  46   48   * UCHAR WordCount;                   Count of parameter words = 2
  47   49   * UCHAR AndXCommand;                 Secondary (X) command;  0xFF = none
  48   50   * UCHAR AndXReserved;                Reserved (must be 0)
  49   51   * USHORT AndXOffset;                 Offset to next command WordCount
  50   52   * USHORT ByteCount;                  Count of data bytes = 0
  51   53   *
  52   54   * The user represented by Uid in the SMB header is logged off.  The server
  53   55   * closes all files currently open by this user, and invalidates any
  54   56   * outstanding requests with this Uid.
  55   57   *
  
    | 
      ↓ open down ↓ | 
    22 lines elided | 
    
      ↑ open up ↑ | 
  
  56   58   * SMB_COM_SESSION_SETUP_ANDX is the only valid AndX command for this SMB.
  57   59   *
  58   60   * 4.1.3.1   Errors
  59   61   *
  60   62   * ERRSRV/invnid  - TID was invalid
  61   63   * ERRSRV/baduid  - UID was invalid
  62   64   */
  63   65  smb_sdrc_t
  64   66  smb_pre_logoff_andx(smb_request_t *sr)
  65   67  {
  66      -        DTRACE_SMB_1(op__LogoffX__start, smb_request_t *, sr);
       68 +        DTRACE_SMB_START(op__LogoffX, smb_request_t *, sr);
  67   69          return (SDRC_SUCCESS);
  68   70  }
  69   71  
  70   72  void
  71   73  smb_post_logoff_andx(smb_request_t *sr)
  72   74  {
  73      -        DTRACE_SMB_1(op__LogoffX__done, smb_request_t *, sr);
       75 +        DTRACE_SMB_DONE(op__LogoffX, smb_request_t *, sr);
  74   76  }
  75   77  
  76   78  smb_sdrc_t
  77   79  smb_com_logoff_andx(smb_request_t *sr)
  78   80  {
  79   81          if (sr->uid_user == NULL) {
  80   82                  smbsr_error(sr, 0, ERRSRV, ERRbaduid);
  81   83                  return (SDRC_ERROR);
  82   84          }
  83   85  
  84   86          smb_user_logoff(sr->uid_user);
  85   87  
  86   88          if (smbsr_encode_result(sr, 2, 0, "bb.ww", 2, sr->andx_com, -1, 0))
  87   89                  return (SDRC_ERROR);
  88   90          return (SDRC_SUCCESS);
  89   91  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX