mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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 2f1b788e09
)
This commit is contained in:
parent
dbc2346de8
commit
3ea916b227
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user