summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-26 06:44:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:17 -0500
commit3ea916b2278c202c99c80c02e80e588bd7daedb8 (patch)
tree95cb6b71a66de1101c568b77b32bd636b2a51b1f
parentdbc2346de8b2f213d8bb7e647c4f187c6103e474 (diff)
downloadsamba-3ea916b2278c202c99c80c02e80e588bd7daedb8.tar.gz
samba-3ea916b2278c202c99c80c02e80e588bd7daedb8.tar.bz2
samba-3ea916b2278c202c99c80c02e80e588bd7daedb8.zip
r2654: fixed some more server memory leaks. We are now down to a single leak
of 16 bytes, caused by the 16 byte data_blob in the smb_signing code. (This used to be commit 2f1b788e09686e065d22f621f5c0c585192c6740)
-rw-r--r--source4/auth/auth_sam.c18
-rw-r--r--source4/libcli/cliconnect.c2
-rw-r--r--source4/libcli/raw/clisession.c2
-rw-r--r--source4/libcli/raw/clisocket.c2
-rw-r--r--source4/libcli/raw/clitransport.c2
-rw-r--r--source4/libcli/raw/clitree.c2
-rw-r--r--source4/libcli/raw/rawrequest.c2
-rw-r--r--source4/ntvfs/posix/vfs_posix.c2
-rw-r--r--source4/smbd/process_standard.c4
9 files changed, 26 insertions, 10 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index 8c86328c05..6ddddafee3 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -39,6 +39,8 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
{
+ NTSTATUS status;
+
if (acct_flags & ACB_PWNOTREQ) {
if (lp_null_passwords()) {
DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n",
@@ -51,7 +53,7 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
}
}
- return ntlm_password_check(mem_ctx, &auth_context->challenge,
+ status = ntlm_password_check(mem_ctx, &auth_context->challenge,
&user_info->lm_resp, &user_info->nt_resp,
&user_info->lm_interactive_password,
&user_info->nt_interactive_password,
@@ -59,6 +61,17 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
user_info->smb_name.str,
user_info->client_domain.str,
lm_pwd->hash, nt_pwd->hash, user_sess_key, lm_sess_key);
+
+ if (NT_STATUS_IS_OK(status)) {
+ if (user_sess_key && user_sess_key->data) {
+ talloc_steal(auth_context, user_sess_key->data);
+ }
+ if (lm_sess_key && lm_sess_key->data) {
+ talloc_steal(auth_context, lm_sess_key->data);
+ }
+ }
+
+ return status;
}
@@ -330,8 +343,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
}
if (group_ret > 0 &&
- !(groupSIDs = talloc_realloc_p(groupSIDs,
- struct dom_sid *, group_ret))) {
+ !(groupSIDs = talloc_array_p(*server_info, struct dom_sid *, group_ret))) {
talloc_free(*server_info);
return NT_STATUS_NO_MEMORY;
}
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 66882f605d..27caaa9df9 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -211,7 +211,7 @@ struct smbcli_state *smbcli_state_init(void)
{
struct smbcli_state *cli;
- cli = talloc_named(NULL, sizeof(*cli), "smbcli_state");
+ cli = talloc_p(NULL, struct smbcli_state);
if (cli) {
ZERO_STRUCTP(cli);
}
diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c
index 37992968a4..75b9645018 100644
--- a/source4/libcli/raw/clisession.c
+++ b/source4/libcli/raw/clisession.c
@@ -33,7 +33,7 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport)
{
struct smbcli_session *session;
- session = talloc_named(NULL, sizeof(*session), "smbcli_session");
+ session = talloc_p(transport, struct smbcli_session);
if (!session) {
return NULL;
}
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index 654d8ee61b..5663672333 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -29,7 +29,7 @@ struct smbcli_socket *smbcli_sock_init(void)
{
struct smbcli_socket *sock;
- sock = talloc_named(NULL, sizeof(*sock), "smbcli_socket");
+ sock = talloc_p(NULL, struct smbcli_socket);
if (!sock) {
return NULL;
}
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 85d5337da7..c0d84179d6 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -49,7 +49,7 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock)
struct smbcli_transport *transport;
struct fd_event fde;
- transport = talloc_named(NULL, sizeof(*transport), "smbcli_transport");
+ transport = talloc_p(sock, struct smbcli_transport);
if (!transport) return NULL;
ZERO_STRUCTP(transport);
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 03a49708b3..c383eef768 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -34,7 +34,7 @@ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session)
{
struct smbcli_tree *tree;
- tree = talloc_named(NULL, sizeof(*tree), "smbcli_tree");
+ tree = talloc_p(session, struct smbcli_tree);
if (!tree) {
return NULL;
}
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 1ff36d0a8d..a94e796628 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -62,7 +62,7 @@ struct smbcli_request *smbcli_request_setup_nonsmb(struct smbcli_transport *tran
{
struct smbcli_request *req;
- req = talloc_named(NULL, sizeof(struct smbcli_request), "smcli_request");
+ req = talloc_p(transport, struct smbcli_request);
if (!req) {
return NULL;
}
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 9bd060c639..8705317b2a 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -59,7 +59,7 @@ static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename,
DEBUG(0,("WARNING: the posix vfs handler is incomplete - you probably want \"ntvfs handler = simple\"\n"));
- pvfs = talloc_named(tcon, sizeof(struct pvfs_state), "pvfs_connect(%s)", sharename);
+ pvfs = talloc_p(tcon, struct pvfs_state);
if (pvfs == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 194c6d24cc..a587278b8e 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -97,6 +97,10 @@ static void standard_terminate_connection(struct server_connection *conn, const
talloc_free(conn->service->srv_ctx);
}
+ /* this init_iconv() has the effect of freeing the iconv context memory,
+ which makes leak checking easier */
+ init_iconv();
+
/* terminate this process */
exit(0);
}