From 12476223c6aa7473c55bcf529639eefce8450680 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Apr 2011 17:26:40 +0200 Subject: s3-tsocket: only include ../lib/tsocket/tsocket.h where needed. Guenther --- source3/smbd/process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 248b3e403d..10632696c7 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "../lib/tsocket/tsocket.h" #include "system/filesys.h" #include "smbd/smbd.h" #include "smbd/globals.h" -- cgit From c233c21425a183dd1124329fdbca13ab92cc6d6a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 23:47:25 +0200 Subject: s3-proto: move remaining spoolss protos to own header file. Guenther --- source3/smbd/process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 10632696c7..c17ff7b5ac 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -33,6 +33,7 @@ #include "auth.h" #include "messages.h" #include "smbprofile.h" +#include "rpc_server/spoolss/srv_spoolss_nt.h" extern bool global_machine_password_needs_changing; -- cgit From 023260487517e835edd7f16c8485f9e84cf44667 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 3 May 2011 17:04:06 +0200 Subject: s3: Handle EINTR from sys_poll correctly Autobuild-User: Volker Lendecke Autobuild-Date: Tue May 3 18:06:48 CEST 2011 on sn-devel-104 --- source3/smbd/process.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index c17ff7b5ac..169c459534 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1005,7 +1005,10 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * errno = sav; } - if (ret == -1 && errno != EINTR) { + if (ret == -1) { + if (errno == EINTR) { + return NT_STATUS_RETRY; + } return map_nt_error_from_unix(errno); } -- cgit From 4f41be356a4e6b311d30de3b2e36e4c33aa72ca3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 5 May 2011 10:41:59 -0700 Subject: Fix many const compiler warnings. --- source3/smbd/process.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 169c459534..9306aa3e93 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -503,9 +503,9 @@ static bool init_smb_request(struct smb_request *req, req->vuid = SVAL(inbuf, smb_uid); req->tid = SVAL(inbuf, smb_tid); req->wct = CVAL(inbuf, smb_wct); - req->vwv = (uint16_t *)(inbuf+smb_vwv); + req->vwv = discard_const_p(uint16_t, (inbuf+smb_vwv)); req->buflen = smb_buflen(inbuf); - req->buf = (const uint8_t *)smb_buf(inbuf); + req->buf = (const uint8_t *)smb_buf_const(inbuf); req->unread_bytes = unread_bytes; req->encrypted = encrypted; req->sconn = sconn; @@ -524,7 +524,7 @@ static bool init_smb_request(struct smb_request *req, return false; } /* Ensure bcc is correct. */ - if (((uint8 *)smb_buf(inbuf)) + req->buflen > inbuf + req_size) { + if (((const uint8_t *)smb_buf_const(inbuf)) + req->buflen > inbuf + req_size) { DEBUG(0,("init_smb_request: invalid bcc number %u " "(wct = %u, size %u)\n", (unsigned int)req->buflen, @@ -1350,7 +1350,7 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, char *msg; if (asprintf(&msg, "num_bytes too large: %u", (unsigned)num_bytes) == -1) { - msg = CONST_DISCARD(char *, "num_bytes too large"); + msg = discard_const_p(char, "num_bytes too large"); } smb_panic(msg); } @@ -1377,7 +1377,7 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes) { char *outbuf; - if (!create_outbuf(req, req, (char *)req->inbuf, &outbuf, num_words, + if (!create_outbuf(req, req, (const char *)req->inbuf, &outbuf, num_words, num_bytes)) { smb_panic("could not allocate output buffer\n"); } @@ -1449,7 +1449,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in if (smb_messages[type].fn == NULL) { DEBUG(0,("Unknown message type %d!\n",type)); - smb_dump("Unknown", 1, (char *)req->inbuf, size); + smb_dump("Unknown", 1, (const char *)req->inbuf, size); reply_unknown_new(req, type); return NULL; } @@ -1464,10 +1464,10 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type), (int)sys_getpid(), (unsigned long)conn)); - smb_dump(smb_fn_name(type), 1, (char *)req->inbuf, size); + smb_dump(smb_fn_name(type), 1, (const char *)req->inbuf, size); /* Ensure this value is replaced in the incoming packet. */ - SSVAL(req->inbuf,smb_uid,session_tag); + SSVAL(discard_const_p(uint8_t, req->inbuf),smb_uid,session_tag); /* * Ensure the correct username is in current_user_info. This is a @@ -1753,7 +1753,7 @@ static void construct_reply_common(struct smb_request *req, const char *inbuf, void construct_reply_common_req(struct smb_request *req, char *outbuf) { - construct_reply_common(req, (char *)req->inbuf, outbuf); + construct_reply_common(req, (const char *)req->inbuf, outbuf); } /* @@ -1976,9 +1976,9 @@ void chain_reply(struct smb_request *req) uint32_t chain_offset; /* uint32_t to avoid overflow */ uint8_t wct; - uint16_t *vwv; + const uint16_t *vwv; uint16_t buflen; - uint8_t *buf; + const uint8_t *buf; if (IVAL(req->outbuf, smb_rcls) != 0) { fixup_chain_error_packet(req); @@ -2127,7 +2127,7 @@ void chain_reply(struct smb_request *req) if (length_needed > smblen) { goto error; } - vwv = (uint16_t *)(smb_base(req->inbuf) + chain_offset + 1); + vwv = (const uint16_t *)(smb_base(req->inbuf) + chain_offset + 1); /* * Now grab the new byte buffer.... @@ -2143,11 +2143,11 @@ void chain_reply(struct smb_request *req) if (length_needed > smblen) { goto error; } - buf = (uint8_t *)(vwv+wct+1); + buf = (const uint8_t *)(vwv+wct+1); req->cmd = chain_cmd; req->wct = wct; - req->vwv = vwv; + req->vwv = discard_const_p(uint16_t, vwv); req->buflen = buflen; req->buf = buf; @@ -2613,7 +2613,7 @@ static bool smbd_echo_reply(uint8_t *inbuf, size_t inbuf_len, return false; } - if (!create_outbuf(talloc_tos(), &req, (char *)req.inbuf, &outbuf, + if (!create_outbuf(talloc_tos(), &req, (const char *)req.inbuf, &outbuf, 1, req.buflen)) { DEBUG(10, ("create_outbuf failed\n")); return false; @@ -3162,7 +3162,7 @@ void smbd_process(struct smbd_server_connection *sconn) bool req_is_in_chain(struct smb_request *req) { - if (req->vwv != (uint16_t *)(req->inbuf+smb_vwv)) { + if (req->vwv != (const uint16_t *)(req->inbuf+smb_vwv)) { /* * We're right now handling a subsequent request, so we must * be in a chain -- cgit From 27022587e31769718ab53f4d114e03ac2f205f27 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 May 2011 11:47:43 +0200 Subject: s3-libsmb: move protos to libsmb/proto.h Guenther --- source3/smbd/process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 9306aa3e93..d4aadc9ee6 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -34,6 +34,7 @@ #include "messages.h" #include "smbprofile.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" +#include "libsmb/libsmb.h" extern bool global_machine_password_needs_changing; -- cgit From fc79169ca407c33ba78043b00f16c375fd0e92bc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 17 May 2011 17:23:26 +0200 Subject: s3: conn->sconn in smbd_server_connection_read/write_handler "struct smbd_server_connection" is called sconn elsewhere, avoid confusion Autobuild-User: Volker Lendecke Autobuild-Date: Tue May 17 19:00:20 CEST 2011 on sn-devel-104 --- source3/smbd/process.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index d4aadc9ee6..d58baeb930 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2246,13 +2246,14 @@ static bool fd_is_readable(int fd) } -static void smbd_server_connection_write_handler(struct smbd_server_connection *conn) +static void smbd_server_connection_write_handler( + struct smbd_server_connection *sconn) { /* TODO: make write nonblocking */ } static void smbd_server_connection_read_handler( - struct smbd_server_connection *conn, int fd) + struct smbd_server_connection *sconn, int fd) { uint8_t *inbuf = NULL; size_t inbuf_len = 0; @@ -2262,29 +2263,29 @@ static void smbd_server_connection_read_handler( NTSTATUS status; uint32_t seqnum; - bool from_client = (conn->sock == fd); + bool from_client = (sconn->sock == fd); if (from_client) { - smbd_lock_socket(conn); + smbd_lock_socket(sconn); if (lp_async_smb_echo_handler() && !fd_is_readable(fd)) { DEBUG(10,("the echo listener was faster\n")); - smbd_unlock_socket(conn); + smbd_unlock_socket(sconn); return; } /* TODO: make this completely nonblocking */ - status = receive_smb_talloc(mem_ctx, conn, fd, + status = receive_smb_talloc(mem_ctx, sconn, fd, (char **)(void *)&inbuf, 0, /* timeout */ &unread_bytes, &encrypted, &inbuf_len, &seqnum, false /* trusted channel */); - smbd_unlock_socket(conn); + smbd_unlock_socket(sconn); } else { /* TODO: make this completely nonblocking */ - status = receive_smb_talloc(mem_ctx, conn, fd, + status = receive_smb_talloc(mem_ctx, sconn, fd, (char **)(void *)&inbuf, 0, /* timeout */ &unread_bytes, @@ -2304,7 +2305,7 @@ static void smbd_server_connection_read_handler( } process: - process_smb(conn, inbuf, inbuf_len, unread_bytes, + process_smb(sconn, inbuf, inbuf_len, unread_bytes, seqnum, encrypted, NULL); } -- cgit From 642c6ba2b9c581bacfcb9a6cb4c5c95d446263ce Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 19 May 2011 18:13:40 +0200 Subject: Fix Bug 8152 - smbd crash in release_ip() release_ip() needs the private_data, but it was never saved away to feed it into release_ip() later Autobuild-User: Christian Ambach Autobuild-Date: Thu May 19 21:21:14 CEST 2011 on sn-devel-104 --- source3/smbd/process.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index d58baeb930..5f9845cba0 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2358,6 +2358,9 @@ static void release_ip(const char *ip, void *priv) p = addr + 7; } + DEBUG(10, ("Got release IP message for %s, " + "our address is %s\n", ip, p)); + if ((strcmp(p, ip) == 0) || ((p != addr) && strcmp(addr, ip) == 0)) { /* we can't afford to do a clean exit - that involves database writes, which would potentially mean we -- cgit From 8a2eff871f990aaaf1e11b333035097f5e6d3268 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 20 May 2011 13:07:17 +0200 Subject: s3: Fork the echo handler only after SMB1 negprot is done This enables activating the echo responder also if SMB2 is enabled, albeit it will only be used for SMB1 at this moment. Autobuild-User: Volker Lendecke Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104 --- source3/smbd/process.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 5f9845cba0..7f04a7bcb6 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2798,7 +2798,7 @@ static void smbd_echo_loop(struct smbd_server_connection *sconn, /* * Handle SMBecho requests in a forked child process */ -static bool fork_echo_handler(struct smbd_server_connection *sconn) +bool fork_echo_handler(struct smbd_server_connection *sconn) { int listener_pipe[2]; int res; @@ -2912,8 +2912,7 @@ void smbd_process(struct smbd_server_connection *sconn) const char *remaddr = NULL; int ret; - if (lp_maxprotocol() == PROTOCOL_SMB2 && - !lp_async_smb_echo_handler()) { + if (lp_maxprotocol() == PROTOCOL_SMB2) { /* * We're not making the decision here, * we're just allowing the client @@ -3034,10 +3033,6 @@ void smbd_process(struct smbd_server_connection *sconn) exit_server("Failed to init smb_signing"); } - if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) { - exit_server("Failed to fork echo handler"); - } - /* Setup oplocks */ if (!init_oplocks(sconn->msg_ctx)) exit_server("Failed to init oplocks"); -- cgit From df650fa8cf4954245eced7eccb26388c24acee82 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Fri, 20 May 2011 14:17:36 +0200 Subject: s3:smbd remove unused code in the early CTDB days, the RELEASE_IP message was defined and some code was added to react on such a message to make smbd exit if the IP address it was using for the server socket is removed by CTDB. Later, it was discovered that we need to stop smbd immediately and logic was added to ctdb_conn to call release_ip() without going through the messaging system. So this code is not used and can be removed Autobuild-User: Christian Ambach Autobuild-Date: Fri May 20 16:18:24 CEST 2011 on sn-devel-104 --- source3/smbd/process.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7f04a7bcb6..dc637de30a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2375,15 +2375,6 @@ static void release_ip(const char *ip, void *priv) } } -static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data, - uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) -{ - struct smbd_server_connection *sconn = talloc_get_type_abort( - private_data, struct smbd_server_connection); - - release_ip((char *)data->data, sconn->client_id.addr); -} - #ifdef CLUSTER_SUPPORT static int client_get_tcp_info(int sock, struct sockaddr_storage *server, struct sockaddr_storage *client) @@ -3040,8 +3031,6 @@ void smbd_process(struct smbd_server_connection *sconn) /* register our message handlers */ messaging_register(sconn->msg_ctx, NULL, MSG_SMB_FORCE_TDIS, msg_force_tdis); - messaging_register(sconn->msg_ctx, sconn, - MSG_SMB_RELEASE_IP, msg_release_ip); messaging_register(sconn->msg_ctx, NULL, MSG_SMB_CLOSE_FILE, msg_close_file); -- cgit From e5dd03d1991f125fa3cfddac9a41d2f9e6391c42 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 May 2011 18:51:56 +1000 Subject: s3-globals Remove smbd_event_context() (use server_event_context()) This has been a wrapper around server_event_context() for some time now, and removing this from dummmysmbd.c assists with library dependencies. Andrew Bartlett --- source3/smbd/process.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index dc637de30a..dbc0a33a0a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -624,7 +624,7 @@ static bool push_queued_message(struct smb_request *req, } } - msg->te = event_add_timed(smbd_event_context(), + msg->te = event_add_timed(server_event_context(), msg, end_time, smbd_deferred_open_timer, @@ -708,7 +708,7 @@ void schedule_deferred_open_message_smb(uint64_t mid) "scheduling mid %llu\n", (unsigned long long)mid )); - te = event_add_timed(smbd_event_context(), + te = event_add_timed(server_event_context(), pml, timeval_zero(), smbd_deferred_open_timer, @@ -934,8 +934,8 @@ void smbd_setup_sig_term_handler(void) { struct tevent_signal *se; - se = tevent_add_signal(smbd_event_context(), - smbd_event_context(), + se = tevent_add_signal(server_event_context(), + server_event_context(), SIGTERM, 0, smbd_sig_term_handler, NULL); @@ -987,11 +987,11 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * * select for longer than it would take to wait for them. */ - event_add_to_poll_args(smbd_event_context(), conn, + event_add_to_poll_args(server_event_context(), conn, &conn->pfds, &num_pfds, &timeout); /* Process a signal and timed events now... */ - if (run_events_poll(smbd_event_context(), 0, NULL, 0)) { + if (run_events_poll(server_event_context(), 0, NULL, 0)) { return NT_STATUS_RETRY; } @@ -1013,7 +1013,7 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * return map_nt_error_from_unix(errno); } - retry = run_events_poll(smbd_event_context(), ret, conn->pfds, + retry = run_events_poll(server_event_context(), ret, conn->pfds, num_pfds); if (retry) { return NT_STATUS_RETRY; @@ -2814,7 +2814,7 @@ bool fork_echo_handler(struct smbd_server_connection *sconn) set_blocking(listener_pipe[1], false); status = reinit_after_fork(sconn->msg_ctx, - smbd_event_context(), + server_event_context(), procid_self(), false); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("reinit_after_fork failed: %s\n", @@ -2834,7 +2834,7 @@ bool fork_echo_handler(struct smbd_server_connection *sconn) * Without smb signing this is the same as the normal smbd * listener. This needs to change once signing comes in. */ - sconn->smb1.echo_handler.trusted_fde = event_add_fd(smbd_event_context(), + sconn->smb1.echo_handler.trusted_fde = event_add_fd(server_event_context(), sconn, sconn->smb1.echo_handler.trusted_fd, EVENT_FD_READ, @@ -3044,7 +3044,7 @@ void smbd_process(struct smbd_server_connection *sconn) MSG_DEBUG, debug_message); if ((lp_keepalive() != 0) - && !(event_add_idle(smbd_event_context(), NULL, + && !(event_add_idle(server_event_context(), NULL, timeval_set(lp_keepalive(), 0), "keepalive", keepalive_fn, NULL))) { @@ -3052,14 +3052,14 @@ void smbd_process(struct smbd_server_connection *sconn) exit(1); } - if (!(event_add_idle(smbd_event_context(), NULL, + if (!(event_add_idle(server_event_context(), NULL, timeval_set(IDLE_CLOSED_TIMEOUT, 0), "deadtime", deadtime_fn, sconn))) { DEBUG(0, ("Could not add deadtime event\n")); exit(1); } - if (!(event_add_idle(smbd_event_context(), NULL, + if (!(event_add_idle(server_event_context(), NULL, timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0), "housekeeping", housekeeping_fn, sconn))) { DEBUG(0, ("Could not add housekeeping event\n")); @@ -3116,7 +3116,7 @@ void smbd_process(struct smbd_server_connection *sconn) exit_server("init_dptrs() failed"); } - sconn->smb1.fde = event_add_fd(smbd_event_context(), + sconn->smb1.fde = event_add_fd(server_event_context(), sconn, sconn->sock, EVENT_FD_READ, -- cgit From 06fb258500d04747d18b2b327221acd79c31f44c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Jun 2011 14:49:43 -0700 Subject: release_ip() is only used with CLUSTER_SUPPORT. --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index dbc0a33a0a..7d9626387d 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2346,6 +2346,7 @@ static void smbd_server_echo_handler(struct event_context *ev, } } +#ifdef CLUSTER_SUPPORT /**************************************************************************** received when we should release a specific IP ****************************************************************************/ @@ -2375,7 +2376,6 @@ static void release_ip(const char *ip, void *priv) } } -#ifdef CLUSTER_SUPPORT static int client_get_tcp_info(int sock, struct sockaddr_storage *server, struct sockaddr_storage *client) { -- cgit From 73b377432c5efb8451f09f6d25d8aa1b28c239c9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:10:15 +1000 Subject: s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc() Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett --- source3/smbd/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7d9626387d..01200660fa 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1894,7 +1894,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, return false; } - outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size); + outbuf = talloc_realloc(NULL, *poutbuf, uint8_t, new_size); if (outbuf == NULL) { DEBUG(0, ("talloc failed\n")); return false; @@ -1908,7 +1908,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) { DEBUG(1, ("invalid command chain\n")); - *poutbuf = TALLOC_REALLOC_ARRAY( + *poutbuf = talloc_realloc( NULL, *poutbuf, uint8_t, old_size); return false; } @@ -1996,7 +1996,7 @@ void chain_reply(struct smb_request *req) if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) { if (req->chain_outbuf == NULL) { - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { @@ -2028,7 +2028,7 @@ void chain_reply(struct smb_request *req) * over-allocated (reply_pipe_read_and_X used to be such an * example). */ - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { smb_panic("talloc failed"); -- cgit From 3d15137653a7d1b593a9af2eef12f6e5b9a04c4f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:30:12 +1000 Subject: s3-talloc Change TALLOC_ARRAY() to talloc_array() Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc. --- source3/smbd/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 01200660fa..2b8521d54a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -346,7 +346,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, * talloc and return. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -415,7 +415,7 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, * The +4 here can't wrap, we've checked the length above already. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -1356,7 +1356,7 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, smb_panic(msg); } - *outbuf = TALLOC_ARRAY(mem_ctx, char, + *outbuf = talloc_array(mem_ctx, char, smb_size + num_words*2 + num_bytes); if (*outbuf == NULL) { return false; -- cgit From d5e6a47f064a3923b1e257ab84fa7ccd7c4f89f4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:38:41 +1000 Subject: s3-talloc Change TALLOC_P() to talloc() Using the standard macro makes it easier to move code into common, as TALLOC_P isn't standard talloc. --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 2b8521d54a..78beb730b9 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -891,7 +891,7 @@ struct idle_event *event_add_idle(struct event_context *event_ctx, struct idle_event *result; struct timeval now = timeval_current(); - result = TALLOC_P(mem_ctx, struct idle_event); + result = talloc(mem_ctx, struct idle_event); if (result == NULL) { DEBUG(0, ("talloc failed\n")); return NULL; -- cgit From ad0a07c531fadd1639c5298951cfaf5cfe0cb10e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:44:43 +1000 Subject: s3-talloc Change TALLOC_ZERO_P() to talloc_zero() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc. --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 78beb730b9..75fa69782e 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -594,7 +594,7 @@ static bool push_queued_message(struct smb_request *req, int msg_len = smb_len(req->inbuf) + 4; struct pending_message_list *msg; - msg = TALLOC_ZERO_P(NULL, struct pending_message_list); + msg = talloc_zero(NULL, struct pending_message_list); if(msg == NULL) { DEBUG(0,("push_message: malloc fail (1)\n")); -- cgit From 8d4a8389bb2df77ff8923dda8368aa2915652c1a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 12:13:26 +1000 Subject: s3-talloc Change TALLOC_MEMDUP() to talloc_memdup() Using the standard macro makes it easier to move code into common, as TALLOC_MEMDUP isn't standard talloc. --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 75fa69782e..f3f532fbae 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -321,7 +321,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, /* Copy the header we've written. */ - *buffer = (char *)TALLOC_MEMDUP(mem_ctx, + *buffer = (char *)talloc_memdup(mem_ctx, writeX_header, sizeof(writeX_header)); -- cgit