void PrlNetworkShapingTest::cleanup()
{

	DestroyVm();
	RestoreNetworkClassesConfig();

	m_hJob.reset(PrlSrv_Logoff(m_hServer));
	PrlJob_Wait(m_hJob, PRL_JOB_WAIT_TIMEOUT);
}
Esempio n. 2
0
void PrlApiTest::cleanup()
{
	if (m_JobHandle)
	{
		m_JobHandle.reset(PrlSrv_Logoff(m_Handle));
		PrlJob_Wait(m_JobHandle, PRL_JOB_WAIT_TIMEOUT);
	}
	m_Handle.reset();
	m_JobHandle.reset();
}
bool SimpleServerWrapper::Logoff()
{
	m_isLocalAdminInited = false;

	SdkHandleWrap hJob(PrlSrv_Logoff(m_ServerHandle));
	if (PRL_SUCCEEDED(PrlJob_Wait(hJob, PRL_JOB_WAIT_TIMEOUT)))
	{
		PRL_RESULT nRetCode = PRL_ERR_UNINITIALIZED;
		if (PRL_SUCCEEDED(PrlJob_GetRetCode(hJob, &nRetCode)))
		{
			if (PRL_SUCCEEDED(nRetCode))
				return (true);
			else
				WRITE_TRACE(DBG_FATAL, "Logoff operation failed with retcode: 0x%.8X '%s'",\
					nRetCode, PRL_RESULT_TO_STRING(nRetCode));
		}
		else
			WRITE_TRACE(DBG_FATAL, "Failed to extract return code from the job object");
	}
	else
		WRITE_TRACE(DBG_FATAL, "Failed to wait logoff job");

	return (false);
}
Esempio n. 4
0
void PrlApiTest::testLogoffOnNonServerHandle() {
	PrlHandleBase *pHandle = new PrlHandleServerJob(PrlHandleServerPtr(0), Uuid::createUuid(), PJOC_UNKNOWN);
	m_Handle.reset(pHandle->GetHandle());
	CHECK_ASYNC_OP_FAILED(PrlSrv_Logoff(m_Handle), PRL_ERR_INVALID_ARG);
}
Esempio n. 5
0
        fprintf(stderr, "Login job returned with error: %s\n", prl_result_to_string(nJobReturnCode));
        PrlHandle_Free(hJob);
        PrlHandle_Free(hServer);
        PrlApi_Deinit();
        return err;
    }
    return PRL_ERR_SUCCESS;
}

PRL_RESULT LogOff(PRL_HANDLE &hServer) {
    PRL_HANDLE hJob, hJobResult = PRL_INVALID_HANDLE;
    PRL_RESULT err, nJobReturnCode = PRL_ERR_UNINITIALIZED;

    nanosleep((struct timespec[]){{1, 100000000}}, NULL);

    hJob = PrlSrv_Logoff(hServer);
    err = PrlJob_Wait(hJob, 1000);
    if (PRL_FAILED(err)) {
        fprintf(stderr, "PrlJob_Wait for PrlSrv_Logoff returned error: %s\n", prl_result_to_string(err));
        PrlHandle_Free(hJob);
        PrlHandle_Free(hServer);
        PrlApi_Deinit();
        return err;
     }
    err = PrlJob_GetRetCode(hJob, &nJobReturnCode);
    if (PRL_FAILED(err)) {
        fprintf(stderr, "PrlJob_GetRetCode failed for PrlSrv_Logoff with error: %s\n", prl_result_to_string(err));
        PrlHandle_Free(hJob);
        PrlHandle_Free(hServer);
        PrlApi_Deinit();
        return err;