Home | History | Annotate | Download | only in smbsrv
      1 /*
      2  * CDDL HEADER START
      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 2009 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 #include <smbsrv/smb_kproto.h>
     27 
     28 
     29 /*
     30  * trans2_get_dfs_referral
     31  *
     32  * The client sends this request to ask the server to convert
     33  * RequestFilename into an alternate name for this file.  This request can
     34  * be sent to the server if the server response to the NEGOTIATE SMB
     35  * included the CAP_DFS capability.  The TID of the request must be IPC$.
     36  * Bit15 of Flags2 in the SMB header must be set, indicating this is a
     37  * UNICODE request.
     38  *
     39  * Client Request              Description
     40  * ==========================  =========================================
     41  * WordCount                   15
     42  * TotalDataCount              0
     43  * SetupCount                  1
     44  * Setup[0]                    TRANS2_GET_DFS_REFERRAL
     45  *
     46  * Parameter Block Encoding    Description
     47  * ==========================  =========================================
     48  * USHORT MaxReferralLevel     Latest referral version number understood
     49  * WCHAR RequestFileName;      DFS name of file for which referral is
     50  *                             sought
     51  *
     52  * Response Data Block         Description
     53  * ==========================  =========================================
     54  * USHORT PathConsumed;        Number of RequestFilename bytes client
     55  * USHORT NumberOfReferrals;   Number of referrals contained in this
     56  *                             response
     57  * USHORT Flags;               bit0 - The servers in Referrals are
     58  *                             capable of fielding
     59  *                             TRANS2_GET_DFS_REFERRAL.
     60  *                             bit1 - The servers in Referrals should
     61  *                             hold the storage for the requested file.
     62  * REFERRAL_LIST Referrals[]   Set of referrals for this file
     63  * UNICODESTRINGE Strings      Used to hold the strings pointed to by
     64  *                             Version 2 Referrals in REFERRALS.
     65  *
     66  * The server response is a list of Referrals which inform the client where
     67  * it should resubmit the request to obtain access to the file.
     68  * PathConsumed in the response indicates to the client how many characters
     69  * of  RequestFilename have been consumed by the server.  When the client
     70  * chooses one of the referrals to use for file access, the client may need
     71  * to strip the leading PathConsumed characters from the front of
     72  * RequestFileName before submitting the name to the target server.
     73  * Whether or not the pathname should be trimmed is indicated by the
     74  * individual referral as detailed below.
     75  *
     76  * Flags indicates how this referral should be treated.  If bit0 is clear,
     77  * any entity in the Referrals list holds the storage for RequestFileName.
     78  * If bit0 is set, any entity in the Referrals list has further referral
     79  * information for RequestFilename  a TRANS2_GET_DFS_REFERRAL request
     80  * should be sent to an entity in the Referrals list for further
     81  * resolution.
     82  *
     83  * The format of an individual referral contains version and  length
     84  * information allowing the client to skip referrals it does not
     85  * understand.  MaxReferralLevel indicates to the server the latest version
     86  * of referral which the client can digest.  Since each referral has a
     87  * uniform element, MaxReferralLevel is advisory only. Each element in
     88  * Referrals has this envelope:
     89  *
     90  * REFERRAL_LIST element
     91  * ======================================================================
     92  *
     93  * USHORT VersionNumber        Version of this referral element
     94  *
     95  * USHORT ReferralSize         Size of this referral element
     96  *
     97  * The following referral element versions are defined:
     98  *
     99  * Version 1 Referral Element Format
    100  * ======================================================================
    101  *
    102  * USHORT ServerType           Type of Node handling referral:
    103  *                             0 - Don't know
    104  *                             1 - SMB Server
    105  *                             2 - Netware Server
    106  *                             3 - Domain
    107  *
    108  * USHORT ReferralFlags        Flags which describe this referral:
    109  *                             01 - Strip off PathConsumed characters
    110  *                             before submitting RequestFileName to Node
    111  *
    112  * UNICODESTRING Node          Name of entity to visit next
    113  *
    114  * Version 2 Referral Element Format
    115  * ======================================================================
    116  *
    117  * USHORT ServerType              Type of Node handling referral:
    118  *                                 0 - Don't know
    119  *                                 1 - SMB Server
    120  *                                 2 - Netware Server
    121  *                                 3 - Domain
    122  *
    123  * USHORT ReferralFlags           Flags which describe this referral:
    124  *                                 01 - Strip off PathConsumed characters
    125  *                                 before submitting RequestFileName to
    126  *                                 Node
    127  *
    128  * ULONG Proximity                A hint describing the proximity of this
    129  *                                 server to the client. 0 indicates the
    130  *                                 closest, higher numbers indicate
    131  *                                 increasingly "distant" servers. The
    132  *                                 number is only relevant within the
    133  *                                 context of the servers listed in this
    134  *                                 particular SMB.
    135  *
    136  * ULONG TimeToLive               Number of seconds for which the client
    137  *                                 can cache this referral.
    138  *
    139  * USHORT DfsPathOffset           Offset, in bytes from the beginning of
    140  *                                 this referral, of  the DFS Path that
    141  *                                 matched PathConsumed bytes of the
    142  *                                 RequestFileName.
    143  *
    144  * USHORT DfsAlternatePathOffset  Offset, in bytes from the beginning of
    145  *                                 this referral, of an alternate name
    146  *                                 (8.3 format) of the DFS Path that
    147  *                                 matched PathConsumed bytes of the
    148  *                                 RequestFileName.
    149  *
    150  * USHORT NetworkAddressOffset    Offset, in bytes from the beginning of
    151  *                                 this referral, of the entity to visit
    152  *                                 next.
    153  *
    154  * The CIFS protocol imposes no referral selection policy.
    155  */
    156 int /*ARGSUSED*/
    157 smb_com_trans2_get_dfs_referral(struct smb_request *sr)
    158 {
    159 	return (SDRC_NOT_IMPLEMENTED);
    160 }
    161 
    162 
    163 /*
    164  * SMB: trans2_report_dfs_inconsistency
    165  *
    166  * As part of the Distributed Name Resolution algorithm, a DFS client may
    167  * discover a  knowledge inconsistency between the referral server (i.e.,
    168  * the server that handed out a referral), and the storage server (i.e.,
    169  * the server to which the client was redirected to by the referral
    170  * server). When such an inconsistency is discovered, the DFS client
    171  * optionally sends this SMB to the referral server, allowing the referral
    172  * server to take corrective action.
    173  *
    174  * Client Request                     Description
    175  * ================================== ==================================
    176  * WordCount                          15
    177  * MaxParameterCount                  0
    178  * SetupCount                         1
    179  * Setup[0]                           TRANS2_REPORT_DFS_INCONSISTENCY
    180  *
    181  * Parameter Block Encoding           Description
    182  * ================================== ==================================
    183  *
    184  * UNICODESTRING RequestFileName;     DFS Name of file for which
    185  *                                     referral was sought
    186  *
    187  * The data part of this request contains the referral element (Version 1
    188  * format only) believed to be in error.  These are encoded as described in
    189  * the TRANS2_GET_DFS_REFERRAL response.  If the server returns success,
    190  * the client can resubmit the TRANS2_GET_DFS_REFERRAL request to this
    191  * server to get a new referral.  It is not mandatory for the DFS knowledge
    192  * to be automatically repaired  the client must be prepared to receive
    193  * further errant referrals and must not wind up looping between this
    194  * request and the TRANS2_GET_DFS_REFERRAL request.
    195  *
    196  * Bit15 of Flags2 in the SMB header must be set, indicating this is a
    197  * UNICODE request.
    198  */
    199 int /*ARGSUSED*/
    200 smb_com_trans2_report_dfs_inconsistency(struct smb_request *sr)
    201 {
    202 	return (SDRC_NOT_IMPLEMENTED);
    203 }
    204