DsClientMakeSpnForTargetServer function

The DsClientMakeSpnForTargetServer function constructs a service principal name (SPN) that identifies a specific server to use for authentication.

Syntax


DWORD DsClientMakeSpnForTargetServer(
  _In_     LPCTSTR ServiceClass,
  _In_     LPCTSTR ServiceName,
  _Inout_  DWORD *pcSpnLength,
  _Out_    LPTSTR pszSpn
);

Parameters

ServiceClass [in]

Pointer to a null-terminated string that contains the class of the service as defined by the service. This can be any string unique to the service.

ServiceName [in]

Pointer to a null-terminated string that contains the distinguished name service (DNS) host name. This can either be a fully qualified name or an IP address in the Internet standard format.

Use of an IP address for ServiceName is not recommended because this can create a security issue. Before the SPN is constructed, the IP address must be translated to a computer name through DNS name resolution. It is possible for the DNS name resolution to be spoofed, replacing the intended computer name with an unauthorized computer name.

pcSpnLength [in, out]

Pointer to a DWORD value that, on entry, contains the size of the pszSpn buffer, in characters. On output, this parameter receives the number of characters copied to the pszSpn buffer, including the terminating NULL.

pszSpn [out]

Pointer to a string buffer that receives the SPN.

Return value

This function returns standard Windows error codes.

Remarks

When using this function, supply the service class and part of a DNS host name.

This function is a simplified version of the DsMakeSpn function. The ServiceName is made canonical by resolving through DNS.

GUID-based DNS names are not supported. When constructed, the simplified SPN is as follows:

ServiceClass / ServiceName / ServiceName

The instance name portion (second position) is always set to default. The port and referrer fields are not used.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Redistributable

Active Directory Client Extension on Windows NT 4.0 and Windows Me/98/95

Header

Ntdsapi.h

Library

Ntdsapi.lib

DLL

Ntdsapi.dll

Unicode and ANSI names

DsClientMakeSpnForTargetServerW (Unicode) and DsClientMakeSpnForTargetServerA (ANSI)

See also

DsMakeSpn
Domain Controller and Replication Management Functions

 

 

Show:
© 2014 Microsoft