3.1.6.8 Server Normalizes a ServerName

The server MUST provide the tuple <ServerName, ShareName> as input parameters. 

ShareName: The name of a shared resource.

ServerName: The name of a local server that the client is connecting to. This name MUST be less than 256 characters in length, and it MUST be a NetBIOS name, a fully qualified domain name (FQDN), a textual IPv4 or IPv6 address, or an empty string.

If ServerName is a nonempty string and it does not match any Transport.ServerName in TransportList and Alias.alias in AliasList, the server MUST set it as DefaultServerName. If ServerName is an empty string, the server MUST set it as "*" to indicate that the local server name used.

If ShareName is empty, the server MUST determine the normalized ServerName to be returned using the following algorithm:

 FOREACH Transport in TransportList
    IF ServerName is equal to Transport.ServerName
         RETURN ServerName
    ENDIF
 ENDFOR
 FOREACH Alias in AliasList
    IF ServerName is equal to Alias.alias
         RETURN Alias.target 
    ENDIF
 ENDFOR
 RETURN DefaultServerName
  

If ShareName is not empty, to determine the normalized ServerName to be returned, the server MUST look up the share in ShareList, using the following algorithm:

 FOREACH Share in ShareList
    IF ShareName is equal to Share.Name
         IF Share.ServerName is equal to ServerName
               RETURN Share.ServerName
         ELSE
            FOREACH Alias in AliasList
               IF ServerName is equal to Alias.alias
                  RETURN Alias.target 
               ENDIF
            ENDFOR
          ENDIF
    ENDIF
 ENDFOR
 RETURN empty string