1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-21 03:17:08 +03:00

r4791: used the new talloc type safety macros to make the "void *private"

pointers in the composite code type safe.

This is a bit of an experiement, I'd be interested in comments on
whether we should use this more widely.
(This used to be commit 0e1da827b380998355f75f4ef4f424802059c278)
This commit is contained in:
Andrew Tridgell 2005-01-16 23:23:45 +00:00 committed by Gerald (Jerry) Carter
parent 7b79694ead
commit 4a03172e66
5 changed files with 25 additions and 25 deletions

View File

@ -53,7 +53,7 @@ static void composite_handler(struct smbcli_composite *);
static NTSTATUS connect_send_negprot(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
state->req = smb_raw_negotiate_send(state->transport, lp_maxprotocol());
NT_STATUS_HAVE_NO_MEMORY(state->req);
@ -72,7 +72,7 @@ static NTSTATUS connect_send_negprot(struct smbcli_composite *c,
static NTSTATUS connect_tcon(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
NTSTATUS status;
status = smb_tree_connect_recv(state->req, c, state->io_tcon);
@ -104,7 +104,7 @@ static NTSTATUS connect_tcon(struct smbcli_composite *c,
static NTSTATUS connect_session_setup(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
NTSTATUS status;
status = smb_composite_sesssetup_recv(state->creq);
@ -151,7 +151,7 @@ static NTSTATUS connect_session_setup(struct smbcli_composite *c,
static NTSTATUS connect_negprot(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
NTSTATUS status;
status = smb_raw_negotiate_recv(state->req);
@ -191,7 +191,7 @@ static NTSTATUS connect_negprot(struct smbcli_composite *c,
static NTSTATUS connect_session_request(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
NTSTATUS status;
status = smbcli_transport_connect_recv(state->req);
@ -207,7 +207,7 @@ static NTSTATUS connect_session_request(struct smbcli_composite *c,
static NTSTATUS connect_socket(struct smbcli_composite *c,
struct smb_composite_connect *io)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
NTSTATUS status;
struct nmb_name calling, called;
@ -245,7 +245,7 @@ static NTSTATUS connect_socket(struct smbcli_composite *c,
*/
static void state_handler(struct smbcli_composite *c)
{
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
switch (c->stage) {
case CONNECT_SOCKET:
@ -338,7 +338,7 @@ NTSTATUS smb_composite_connect_recv(struct smbcli_composite *c, TALLOC_CTX *mem_
status = smb_composite_wait(c);
if (NT_STATUS_IS_OK(status)) {
struct connect_state *state = c->private;
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
talloc_steal(mem_ctx, state->io->out.tree);
}

View File

@ -45,7 +45,7 @@ struct loadfile_state {
static NTSTATUS setup_close(struct smbcli_composite *c,
struct smbcli_tree *tree, uint16_t fnum)
{
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
union smb_close *io_close;
/* nothing to read, setup the close */
@ -74,7 +74,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c,
static NTSTATUS loadfile_open(struct smbcli_composite *c,
struct smb_composite_loadfile *io)
{
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
struct smbcli_tree *tree = state->req->tree;
NTSTATUS status;
@ -128,7 +128,7 @@ static NTSTATUS loadfile_open(struct smbcli_composite *c,
static NTSTATUS loadfile_read(struct smbcli_composite *c,
struct smb_composite_loadfile *io)
{
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
struct smbcli_tree *tree = state->req->tree;
NTSTATUS status;
@ -162,7 +162,7 @@ static NTSTATUS loadfile_read(struct smbcli_composite *c,
static NTSTATUS loadfile_close(struct smbcli_composite *c,
struct smb_composite_loadfile *io)
{
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
NTSTATUS status;
status = smbcli_request_simple_recv(state->req);
@ -183,7 +183,7 @@ static NTSTATUS loadfile_close(struct smbcli_composite *c,
static void loadfile_handler(struct smbcli_request *req)
{
struct smbcli_composite *c = req->async.private;
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
/* when this handler is called, the stage indicates what
call has just finished */
@ -271,7 +271,7 @@ NTSTATUS smb_composite_loadfile_recv(struct smbcli_composite *c, TALLOC_CTX *mem
status = smb_composite_wait(c);
if (NT_STATUS_IS_OK(status)) {
struct loadfile_state *state = c->private;
struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state);
talloc_steal(mem_ctx, state->io->out.data);
}

View File

@ -47,7 +47,7 @@ struct savefile_state {
static NTSTATUS setup_close(struct smbcli_composite *c,
struct smbcli_tree *tree, uint16_t fnum)
{
struct savefile_state *state = c->private;
struct savefile_state *state = talloc_get_type(c->private, struct savefile_state);
union smb_close *io_close;
/* nothing to write, setup the close */
@ -76,7 +76,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c,
static NTSTATUS savefile_open(struct smbcli_composite *c,
struct smb_composite_savefile *io)
{
struct savefile_state *state = c->private;
struct savefile_state *state = talloc_get_type(c->private, struct savefile_state);
union smb_write *io_write;
struct smbcli_tree *tree = state->req->tree;
NTSTATUS status;
@ -122,7 +122,7 @@ static NTSTATUS savefile_open(struct smbcli_composite *c,
static NTSTATUS savefile_write(struct smbcli_composite *c,
struct smb_composite_savefile *io)
{
struct savefile_state *state = c->private;
struct savefile_state *state = talloc_get_type(c->private, struct savefile_state);
struct smbcli_tree *tree = state->req->tree;
NTSTATUS status;
uint32_t max_xmit = tree->session->transport->negotiate.max_xmit;
@ -160,7 +160,7 @@ static NTSTATUS savefile_write(struct smbcli_composite *c,
static NTSTATUS savefile_close(struct smbcli_composite *c,
struct smb_composite_savefile *io)
{
struct savefile_state *state = c->private;
struct savefile_state *state = talloc_get_type(c->private, struct savefile_state);
NTSTATUS status;
status = smbcli_request_simple_recv(state->req);
@ -185,7 +185,7 @@ static NTSTATUS savefile_close(struct smbcli_composite *c,
static void savefile_handler(struct smbcli_request *req)
{
struct smbcli_composite *c = req->async.private;
struct savefile_state *state = c->private;
struct savefile_state *state = talloc_get_type(c->private, struct savefile_state);
/* when this handler is called, the stage indicates what
call has just finished */

View File

@ -94,7 +94,7 @@ static void use_nt1_session_keys(struct smbcli_session *session,
static void request_handler(struct smbcli_request *req)
{
struct smbcli_composite *c = req->async.private;
struct sesssetup_state *state = c->private;
struct sesssetup_state *state = talloc_get_type(c->private, struct sesssetup_state);
struct smbcli_session *session = req->session;
DATA_BLOB session_key = data_blob(NULL, 0);
DATA_BLOB null_data_blob = data_blob(NULL, 0);
@ -168,7 +168,7 @@ static struct smbcli_request *session_setup_nt1(struct smbcli_composite *c,
struct smbcli_session *session,
struct smb_composite_sesssetup *io)
{
struct sesssetup_state *state = c->private;
struct sesssetup_state *state = talloc_get_type(c->private, struct sesssetup_state);
state->setup.nt1.level = RAW_SESSSETUP_NT1;
state->setup.nt1.in.bufsize = session->transport->options.max_xmit;
@ -207,7 +207,7 @@ static struct smbcli_request *session_setup_old(struct smbcli_composite *c,
struct smbcli_session *session,
struct smb_composite_sesssetup *io)
{
struct sesssetup_state *state = c->private;
struct sesssetup_state *state = talloc_get_type(c->private, struct sesssetup_state);
state->setup.old.level = RAW_SESSSETUP_OLD;
state->setup.old.in.bufsize = session->transport->options.max_xmit;
@ -241,7 +241,7 @@ static struct smbcli_request *session_setup_spnego(struct smbcli_composite *c,
struct smbcli_session *session,
struct smb_composite_sesssetup *io)
{
struct sesssetup_state *state = c->private;
struct sesssetup_state *state = talloc_get_type(c->private, struct sesssetup_state);
NTSTATUS status;
DATA_BLOB session_key = data_blob(NULL, 0);
DATA_BLOB null_data_blob = data_blob(NULL, 0);

View File

@ -66,8 +66,8 @@ static NTSTATUS smbcli_sock_connect_one(struct smbcli_socket *sock,
static void smbcli_sock_connect_handler(struct event_context *ev, struct fd_event *fde,
struct timeval t, uint16_t flags)
{
struct smbcli_composite *c = fde->private;
struct clisocket_connect *conn = c->private;
struct smbcli_composite *c = talloc_get_type(fde->private, struct smbcli_composite);
struct clisocket_connect *conn = talloc_get_type(c->private, struct clisocket_connect);
int i;
c->status = socket_connect_complete(conn->sock->sock, 0);