Terminating Active User Sessions

Declare Variables/Constants

#define CONTACT_SERVER    "localhost"
#define SERVER_PORT        5093

/*Modify following macros in reference to the client for which active session is to be killed.*/
#define CLIENT_HOSTNAME             "client_hostName"
#define CLIENT_USERNAME             "client_userName"
#define CLIENT_XDISPLAYNAME         ""
#define CLIENT_VENDORDEFINEDSHAREID ""

sntl_lmadmin_attr_t *pAttrLmAdminContext = NULL;
sntl_lmadmin_context_t *pLmAdminContext = NULL;
char *status = NULL;

static const char *input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                                            "<lmadmin>"
                                                "<terminateLoginSession>"
                                                    "<hostName>"CLIENT_HOSTNAME"</hostName>"
                                                    "<userName>"CLIENT_USERNAME"</userName>"
                                                    "<xDisplayName>"CLIENT_XDISPLAYNAME"</xDisplayName>"
                                                    "<vendorDefinedSharingId>"CLIENT_VENDORDEFINEDSHAREID"</vendorDefinedSharingId>"
                                                "</terminateLoginSession>"
                                            "</lmadmin>";

API Calls

To terminate active user session(s), execute the APIs in the specified sequential order only:

sntl_lmadmin_attr_new(&pAttrLmAdminContext);
sntl_lmadmin_attr_set(pAttrLmAdminContext, SNTL_ATTR_LMADMINCONTEXT_NETWORK_TIMEOUT, "30");
sntl_lmadmin_context_new(CONTACT_SERVER, SERVER_PORT, pAttrLmAdminContext, &pLmAdminContext);
sntl_lmadmin_post(pLmAdminContext, input, &status);

NOTE   The client macro names in this XML (such as CLIENT_HOSTNAME) should be replaced with actual client identification names. The clientInfo API can be called to obtain the actual values for client macro names.