samba-technical@lists.samba.org
[Top] [All Lists]

Re: svn commit: samba r12087 - in branches/SAMBA_4_0/source/librpc/rpc:

Subject: Re: svn commit: samba r12087 - in branches/SAMBA_4_0/source/librpc/rpc: .
From: "Stefan (metze) Metzmacher"
Date: Tue, 06 Dec 2005 10:40:32 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mimir@xxxxxxxxx schrieb:
Hi Rafal,

sorry I told you something wrong in the last mail...


> +void continue_pipe_open_smb(struct composite_context *ctx)
> +{
> +     struct composite_context *c = talloc_get_type(ctx->async.private_data,
> +                                                   struct composite_context);
> +     struct pipe_np_smb_state *s = talloc_get_type(c->private_data,
> +                                                   struct pipe_np_smb_state);
> +
> +     c->status = dcerpc_pipe_open_smb_recv(ctx);
> +     if (!NT_STATUS_IS_OK(c->status)) {
> +
> +             DEBUG(0,("Failed to open pipe %s - %s\n", s->io.pipe_name, 
> nt_errstr(c->status)));
> +             composite_trigger_error(c);

this should be composite_error(), as the trigger versions are only used
in the _send() function that creates the composite_context, and where a async 
callback
isn't set by the caller.

> +     }
> +
> +     composite_done(c);
> +}

> +     if (!NT_STATUS_IS_OK(c->status)) {
> +
> +             DEBUG(0,("Failed to connect to %s - %s\n", s->io.binding->host, 
> nt_errstr(c->status)));
> +             composite_trigger_error(c);

same as above

> +     }

> +
> +     c->state = COMPOSITE_STATE_IN_PROGRESS;
> +     c->private_data = s;
> +     c->event_ctx = io->pipe->conn->event_ctx;
> +
> +     s->io  = *io;
> +     conn   = &s->conn;
> +
> +     conn->in.dest_host              = s->io.binding->host;
> +     conn->in.port                   = 0;
> +     conn->in.called_name            = strupper_talloc(tmp_ctx, 
> s->io.binding->host);

we should check this to

> +     conn->in.service                = "IPC$";
> +     conn->in.service_type           = NULL;
> +     conn->in.fallback_to_anonymous  = False;
> +     conn->in.workgroup              = lp_workgroup();
> +
> +     if (s->io.binding->flags & DCERPC_SCHANNEL) {
> +             struct cli_credentials *anon_creds
> +                     = cli_credentials_init(tmp_ctx);
> +             if (composite_nomem(anon_creds, c)) return NULL;

sorry it was my fault to tell you to add this, it should be
if (!anon_creds) {
        c->status = NT_STATUS_NO_MEMORY;
        goto failed;
}
as we need to use the trigger version here.

> +             cli_credentials_set_anonymous(anon_creds);
> +             cli_credentials_guess(anon_creds);
> +
> +             s->conn.in.credentials = anon_creds;
> +
> +     } else {
> +             s->conn.in.credentials = s->io.creds;
> +     }
> +
> +     conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, 
> s->io.pipe->conn->event_ctx);

here we also need to add this, because composite_continue would not cal the 
trigger version,
maybe we could always init the c->state with COMPOSITE_STATE_INIT, and then set
it to _IN_PROGRESS in the composite_continue_*() functions, and then let the
composite_is_ok(), composite_error(), composite_nomem(), composite_done
decide from the state if they need to act as trigger functions,
I think that would make the coding much easier, but we may need to review all 
current code...

if (!conn_req) {
        c->status = NT_STATUS_NO_MEMORY;
        goto failed;
}
> +     composite_continue(c, conn_req, continue_smb_connect, c);
> +     
> +     return c;
> +
> +failed:
> +     composite_trigger_error(c);
> +     return NULL;
> +}



- --
metze

Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDlVyOm70gjA5TCD8RAkovAKCSsWzkHFXC0pEjUZJGz1qz2SnkPACfas29
h49FTVM7WCDruLC11J1c4hs=
=BZiR
-----END PGP SIGNATURE-----

<Prev in Thread] Current Thread [Next in Thread>