Connects an engine to a specified Target Service.
#include <smsutapi.h> #include <smstsapi.h> CCODE NWSMTSConnectToTargetService ( UINT32 *connection, STRING targetServiceName, STRING targetUserName, void *authentication);
(IN/OUT) Specifies a pointer to the connection information from NWSMConnectToTSA. Outputs a pointer to the connection to the Target Service in addition to the input information.
(IN) Specifies the Target Service name returned by NWSMTSScanTargetServiceName or NWSMTSListTargetServices.
(IN) Specifies the user name on a file server (maximum size is NWSM_MAX_TARGET_USER_NAME_LEN).
(IN) Points to the authentication necessary to establish a connection with the Target Service (for example, a user password).
See Section 9.3, Target Service Return Values for more information.
The following table lists the return values associated with the function.
Before NWSMTSConnectToTargetService is called, the engine must be connected to a TSA that has access to the desired target.
targetServiceName should contain a Target Service name from the name list returned by NWSMTSListTargetServices.
NWSMTSConnectToTargetService connects an engine to the specified Target Service and establishes the user's rights on the Target Service. After successfully connecting, the engine can access the Target Service’s data.
An engine can connect to only one Target Service per TSA connection. This means that a Target Service can have multiple connections, but each connection must be referenced by a different TSA connection.
targetUserName contains the user name that allows proper access to the Target Service’s data. For NetWare 3.x and earlier names, these are the bindery names. For NetWare 4.0 and later, these are directory names. For Linux file system TSA it is the user name of a user having an identity on the Linux system.
authentication is an unencrypted, length preceded (UINT16) string. However, the SMDR encrypt/decrypts it if it is passed between SMDRs. If no authentication is passed, set the length to zero. Do not pass a NULL pointer.
#include <smstsapi.h> #include <smsdrapi.h> UINT32 connection; STRING TSAName ; NWSM_NAME_LIST *serviceNameList = NULL; char targetServiceName[NWSM_MAX_TARGET_SRVC_NAME_LEN], targetUserName[NWSM_MAX_TARGET_USER_NAME_LEN], authentication[30]; /* Connect to the TSA. */ NWSMConnectToTSA(TSAName, &connection); /* Find Target Service through the connected TSA. */ sprintf(targetServiceName, "%s%s", TSAName, ".*"); NWSMTSListTargetServices(connection, targetServiceName , &serviceNameList); /* Set up the authentication. */ sprintf(&authentication[2], "%s", "Password"); *((UINT16 *)&authentication[0]) = strlen(&authentication[2]); /* Connect to the Target Service. */ NWSMTSConnectToTargetService(&connection, (STRING)serviceNameList->name, (STRING)targetUserName, authentication);