summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-16 23:23:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:55 -0500
commit4a03172e66694b51a24f7b5566f361c1f1767e29 (patch)
treec29ddb9ce94d84c8c6bcba7e0ea86a2fb4524c89 /source4
parent7b79694eadc288592729567c3caa7c70f6662760 (diff)
downloadsamba-4a03172e66694b51a24f7b5566f361c1f1767e29.tar.gz
samba-4a03172e66694b51a24f7b5566f361c1f1767e29.tar.bz2
samba-4a03172e66694b51a24f7b5566f361c1f1767e29.zip
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)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/composite/connect.c16
-rw-r--r--source4/libcli/composite/loadfile.c12
-rw-r--r--source4/libcli/composite/savefile.c10
-rw-r--r--source4/libcli/composite/sesssetup.c8
-rw-r--r--source4/libcli/raw/clisocket.c4
5 files changed, 25 insertions, 25 deletions
diff --git a/source4/libcli/composite/connect.c b/source4/libcli/composite/connect.c
index bc39cc99fc..bdb1b4d263 100644
--- a/source4/libcli/composite/connect.c
+++ b/source4/libcli/composite/connect.c
@@ -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);
}
diff --git a/source4/libcli/composite/loadfile.c b/source4/libcli/composite/loadfile.c
index 2d38096c88..8290876224 100644
--- a/source4/libcli/composite/loadfile.c
+++ b/source4/libcli/composite/loadfile.c
@@ -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);
}
diff --git a/source4/libcli/composite/savefile.c b/source4/libcli/composite/savefile.c
index f516939c2b..06eb13bb01 100644
--- a/source4/libcli/composite/savefile.c
+++ b/source4/libcli/composite/savefile.c
@@ -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 */
diff --git a/source4/libcli/composite/sesssetup.c b/source4/libcli/composite/sesssetup.c
index fdc638837c..771f85e541 100644
--- a/source4/libcli/composite/sesssetup.c
+++ b/source4/libcli/composite/sesssetup.c
@@ -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);
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index ad1c6a13b8..66555695d3 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -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);