summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-05-30 12:11:53 +0200
committerKarolin Seeger <kseeger@samba.org>2011-06-07 20:02:28 +0200
commitf9eba8a56b1bef0317dc052fe11eeb8b70b3ab69 (patch)
tree85dbafce57dddce4362d5267f8817cfd1f654c5b
parentad73d377ebcc0e73307628c54315feed259490b2 (diff)
downloadsamba-f9eba8a56b1bef0317dc052fe11eeb8b70b3ab69.tar.gz
struct make "struct shadow_copy_data" its own talloc context (cherry picked from commit d77854fbb22bc9237cea14aae1179bbfe3bd0998)
The last 3 patches address bug #8189 (Snapshot display not supported over SMB2). (cherry picked from commit 6aeb13996b2a7c1529a9083ad1a41c724ae1a35c)
-rw-r--r--source3/include/ntioctl.h1
-rw-r--r--source3/modules/vfs_shadow_copy.c2
-rw-r--r--source3/modules/vfs_shadow_copy2.c2
-rw-r--r--source3/smbd/nttrans.c21
4 files changed, 7 insertions, 19 deletions
diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h
index 3ed4a194a73..18707c5bbe2 100644
--- a/source3/include/ntioctl.h
+++ b/source3/include/ntioctl.h
@@ -78,7 +78,6 @@
typedef char SHADOW_COPY_LABEL[25];
struct shadow_copy_data {
- TALLOC_CTX *mem_ctx;
/* Total number of shadow volumes currently mounted */
uint32 num_volumes;
/* Concatenated list of labels */
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index c1ffac74989..1db47d216be 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -253,7 +253,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
continue;
}
- tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data->mem_ctx,
+ tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data,
shadow_copy_data->labels,
(shadow_copy_data->num_volumes+1)*sizeof(SHADOW_COPY_LABEL));
if (tlabels == NULL) {
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index f612c1b9caf..fedfb536b31 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -918,7 +918,7 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
continue;
}
- tlabels = talloc_realloc(shadow_copy2_data->mem_ctx,
+ tlabels = talloc_realloc(shadow_copy2_data,
shadow_copy2_data->labels,
SHADOW_COPY_LABEL, shadow_copy2_data->num_volumes+1);
if (tlabels == NULL) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 524d49029bc..427e5666295 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2215,7 +2215,6 @@ static void call_nt_transact_ioctl(connection_struct *conn,
* it be deallocated when we return.
*/
struct shadow_copy_data *shadow_data = NULL;
- TALLOC_CTX *shadow_mem_ctx = NULL;
bool labels = False;
uint32 labels_data_count = 0;
uint32 i;
@@ -2236,29 +2235,19 @@ static void call_nt_transact_ioctl(connection_struct *conn,
labels = True;
}
- shadow_mem_ctx = talloc_init("SHADOW_COPY_DATA");
- if (shadow_mem_ctx == NULL) {
- DEBUG(0,("talloc_init(SHADOW_COPY_DATA) failed!\n"));
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
-
- shadow_data = TALLOC_ZERO_P(shadow_mem_ctx,
+ shadow_data = TALLOC_ZERO_P(talloc_tos(),
struct shadow_copy_data);
if (shadow_data == NULL) {
DEBUG(0,("TALLOC_ZERO() failed!\n"));
- talloc_destroy(shadow_mem_ctx);
reply_nterror(req, NT_STATUS_NO_MEMORY);
return;
}
- shadow_data->mem_ctx = shadow_mem_ctx;
-
/*
* Call the VFS routine to actually do the work.
*/
if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp, shadow_data, labels)!=0) {
- talloc_destroy(shadow_data->mem_ctx);
+ TALLOC_FREE(shadow_data);
if (errno == ENOSYS) {
DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",
conn->connectpath));
@@ -2283,14 +2272,14 @@ static void call_nt_transact_ioctl(connection_struct *conn,
if (max_data_count<data_count) {
DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) too small (%u) bytes needed!\n",
max_data_count,data_count));
- talloc_destroy(shadow_data->mem_ctx);
+ TALLOC_FREE(shadow_data);
reply_nterror(req, NT_STATUS_BUFFER_TOO_SMALL);
return;
}
pdata = nttrans_realloc(ppdata, data_count);
if (pdata == NULL) {
- talloc_destroy(shadow_data->mem_ctx);
+ TALLOC_FREE(shadow_data);
reply_nterror(req, NT_STATUS_NO_MEMORY);
return;
}
@@ -2323,7 +2312,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
}
}
- talloc_destroy(shadow_data->mem_ctx);
+ TALLOC_FREE(shadow_data);
send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0,
pdata, data_count);