Example #1
0
def async_rpc_open(event_ctx, server, cred, binding, arg, callback):
    # create a composite context for this sequence of asynchronous calls
    c = composite_create(None, event_ctx)
    c.contents.async.fn = callback
    c.contents.async.private_data = None

    # build a binding string using the only protocol we care about...
    binding = library.talloc_strdup(c, "%s:%s" % (binding, server))

    # create a set of credentials
    creds = library.cli_credentials_init(c)
    if library.composite_nomem(creds, c):
        return c
    library.cli_credentials_set_conf(creds);
    if cred:
        library.cli_credentials_parse_string(creds, cred, CRED_SPECIFIED);

    # issue the asynchronous rpc pipe connect request
    rpc_ctx = library.dcerpc_pipe_connect_send(c,
                                              binding,
                                              arg,
                                              creds,
                                              event_ctx)
    if library.composite_nomem(rpc_ctx, c):
        return c

    # setup the next stage of the connect process
    library.composite_continue(c, rpc_ctx, rpc_connect_continue, c)
    return c
Example #2
0
def async_rpc_open(event_ctx, server, cred, binding, arg, callback):
    # create a composite context for this sequence of asynchronous calls
    c = composite_create(None, event_ctx)
    c.contents. async .fn = callback
    c.contents. async .private_data = None

    # build a binding string using the only protocol we care about...
    binding = library.talloc_strdup(c, "%s:%s" % (binding, server))

    # create a set of credentials
    creds = library.cli_credentials_init(c)
    if library.composite_nomem(creds, c):
        return c
    library.cli_credentials_set_conf(creds)
    if cred:
        library.cli_credentials_parse_string(creds, cred, CRED_SPECIFIED)

    # issue the asynchronous rpc pipe connect request
    rpc_ctx = library.dcerpc_pipe_connect_send(c, binding, arg, creds,
                                               event_ctx)
    if library.composite_nomem(rpc_ctx, c):
        return c

    # setup the next stage of the connect process
    library.composite_continue(c, rpc_ctx, rpc_connect_continue, c)
    return c
Example #3
0
def talloc_asprintf(*args):
    ctx = args[0]
    fmt = args[1]
    s = fmt % args[2:]
    ret = library.talloc_strdup(ctx, s)
    return ret
Example #4
0
def talloc_asprintf(*args):
    ctx  = args[0]
    fmt = args[1]
    s = fmt % args[2:]
    ret = library.talloc_strdup(ctx, s)
    return ret