Esempio n. 1
0
static BOOL torture_wbem_login_async(struct torture_context *torture)
{
    BOOL ret = True;
    TALLOC_CTX *mem_ctx = talloc_init("torture_wbem_login_async");
    struct com_context *com_ctx = NULL;
    const char *binding = NULL;
    struct composite_context *c = NULL;
    struct composite_context *new_ctx = NULL;
    struct GUID clsid;
    struct GUID iid;

    /*
     * Initialize our COM and DCOM contexts.
     */
    com_init_ctx(&com_ctx, NULL);
    dcom_client_init(com_ctx, cmdline_credentials);

    /*
     * Pull our needed test arguments from the torture parameters subsystem.
     */
    binding = torture_setting_string(torture, "binding", NULL);

    /*
     * Create a new composite for our call sequence, with the private data being
     * our return flag.
     */
    c = composite_create(mem_ctx, com_ctx->event_ctx);
    c->private_data = &ret;

    /*
     * Create the parameters needed for the activation call: we need the CLSID
     * and IID for the specific interface we're after.
     */
    GUID_from_string(CLSID_WBEMLEVEL1LOGIN, &clsid);
    GUID_from_string(COM_IWBEMLEVEL1LOGIN_UUID, &iid);

    /*
     * Fire off the asynchronous activation request with all the needed
     * input parameters. Then wait for the composite to be done within the
     * context of this function, which allows all the asynchronous magic to
     * still happen.
     */
    new_ctx = dcom_activate_send(c, &clsid, binding, 1, &iid, com_ctx);
    composite_continue(c, new_ctx, torture_wbem_login_async_cont, c);
    composite_wait(new_ctx);
    talloc_free(c);
    talloc_report_full(mem_ctx, stdout);

    return ret;
}
Esempio n. 2
0
void initcom(void)
{
	PyObject *m;
	WERROR error;

	error = com_init_ctx(&py_com_ctx, NULL);
	if (!W_ERROR_IS_OK(error)) {
		PyErr_FromWERROR(error);
		return;
	}

	m = Py_InitModule3("com", com_methods, "Simple COM implementation");
	if (m == NULL)
		return;
}
Esempio n. 3
0
/*
 * Test activating the IWbemLevel1Login interface synchronously.
 */
static BOOL torture_wbem_login(struct torture_context *torture)
{
    BOOL ret = True;
    TALLOC_CTX *mem_ctx = talloc_init("torture_wbem_login");
    struct com_context *com_ctx = NULL;
    const char *binding = NULL;
    struct IUnknown **mqi = NULL;
    struct GUID clsid;
    struct GUID iid;
    NTSTATUS status;

    /*
     * Initialize our COM and DCOM contexts.
     */
    com_init_ctx(&com_ctx, NULL);
    dcom_client_init(com_ctx, cmdline_credentials);

    /*
     * Pull our needed test arguments from the torture parameters subsystem.
     */
    binding = torture_setting_string(torture, "binding", NULL);

    /*
     * Create the parameters needed for the activation call: we need the CLSID
     * and IID for the specific interface we're after.
     */
    GUID_from_string(CLSID_WBEMLEVEL1LOGIN, &clsid);
    GUID_from_string(COM_IWBEMLEVEL1LOGIN_UUID, &iid);

    /*
     * Activate the interface using the DCOM synchronous method call.
     */
    status = dcom_activate(com_ctx, mem_ctx, binding, &clsid, &iid, 1, &mqi);
    ret = NT_STATUS_IS_OK(status);
    if (ret)
    {
        /*
         * Clean up by releasing the IUnknown interface on the remote server
         * and also by releasing our allocated interface pointer.
         */
        IUnknown_Release(mqi[0], mem_ctx);
        talloc_free(mqi);
    }

    talloc_report_full(mem_ctx, stdout);

    return ret;
}