The branch, master has been updated
       via  b9a727c Tiny simplification to dom_sid_string_buf
       via  d77854f struct make "struct shadow_copy_data" its own talloc context
       via  0ec9a90 s3: Remove SHADOW_COPY_DATA typedef
      from  5f6f719 s3: Mark sockets in error state writable

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b9a727c5f17c96138698a06e8c894387531e82b2
Author: Volker Lendecke <[email protected]>
Date:   Tue May 31 22:07:11 2011 +0200

    Tiny simplification to dom_sid_string_buf
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Tue May 31 23:16:31 CEST 2011 on sn-devel-104

commit d77854fbb22bc9237cea14aae1179bbfe3bd0998
Author: Volker Lendecke <[email protected]>
Date:   Mon May 30 12:11:53 2011 +0200

    struct make "struct shadow_copy_data" its own talloc context

commit 0ec9a90c29b86435f32c1d47d89df85fa51742f2
Author: Volker Lendecke <[email protected]>
Date:   Mon May 30 12:06:31 2011 +0200

    s3: Remove SHADOW_COPY_DATA typedef

-----------------------------------------------------------------------

Summary of changes:
 libcli/security/dom_sid.c          |    3 +--
 source3/include/ntioctl.h          |    5 ++---
 source3/modules/vfs_default.c      |    5 ++++-
 source3/modules/vfs_full_audit.c   |    3 ++-
 source3/modules/vfs_shadow_copy.c  |    7 +++++--
 source3/modules/vfs_shadow_copy2.c |    6 +++---
 source3/modules/vfs_time_audit.c   |    2 +-
 source3/smbd/nttrans.c             |   24 +++++++-----------------
 source3/smbd/vfs.c                 |    2 +-
 9 files changed, 26 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/security/dom_sid.c b/libcli/security/dom_sid.c
index 2f80a36..16b7af9 100644
--- a/libcli/security/dom_sid.c
+++ b/libcli/security/dom_sid.c
@@ -367,8 +367,7 @@ int dom_sid_string_buf(const struct dom_sid *sid, char 
*buf, int buflen)
        uint32_t ia;
 
        if (!sid) {
-               strlcpy(buf, "(NULL SID)", buflen);
-               return 10;      /* strlen("(NULL SID)") */
+               return strlcpy(buf, "(NULL SID)", buflen);
        }
 
        ia = (sid->id_auth[5]) +
diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h
index 41b1dce..18707c5 100644
--- a/source3/include/ntioctl.h
+++ b/source3/include/ntioctl.h
@@ -77,13 +77,12 @@
 /* For FSCTL_GET_SHADOW_COPY_DATA ...*/
 typedef char SHADOW_COPY_LABEL[25];
 
-typedef struct shadow_copy_data {
-       TALLOC_CTX *mem_ctx;
+struct shadow_copy_data {
        /* Total number of shadow volumes currently mounted */
        uint32 num_volumes;
        /* Concatenated list of labels */
        SHADOW_COPY_LABEL *labels;
-} SHADOW_COPY_DATA;
+};
 
 
 #endif /* _NTIOCTL_H */
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5d6b512..4d06a10 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -84,7 +84,10 @@ static int vfswrap_set_quota(struct vfs_handle_struct 
*handle,  enum SMB_QUOTA_T
 #endif
 }
 
-static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, 
struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle,
+                                       struct files_struct *fsp,
+                                       struct shadow_copy_data 
*shadow_copy_data,
+                                       bool labels)
 {
        errno = ENOSYS;
        return -1;  /* Not implemented. */
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index cb03413..3b9c20a 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -697,7 +697,8 @@ static int smb_full_audit_set_quota(struct 
vfs_handle_struct *handle,
 
 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct 
*handle,
                                struct files_struct *fsp,
-                               SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+                               struct shadow_copy_data *shadow_copy_data,
+                               bool labels)
 {
        int result;
 
diff --git a/source3/modules/vfs_shadow_copy.c 
b/source3/modules/vfs_shadow_copy.c
index b93f98d..1db47d2 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -216,7 +216,10 @@ static int shadow_copy_closedir(vfs_handle_struct *handle, 
SMB_STRUCT_DIR *_dirp
        return 0;       
 }
 
-static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, 
files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
+static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
+                                           files_struct *fsp,
+                                           struct shadow_copy_data 
*shadow_copy_data,
+                                           bool labels)
 {
        SMB_STRUCT_DIR *p = 
SMB_VFS_NEXT_OPENDIR(handle,fsp->conn->connectpath,NULL,0);
 
@@ -250,7 +253,7 @@ static int 
shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_str
                        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 3613f25..25cc5d4 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -837,7 +837,7 @@ static int shadow_copy2_label_cmp_desc(const void *x, const 
void *y)
   sort the shadow copy data in ascending or descending order
  */
 static void shadow_copy2_sort_data(vfs_handle_struct *handle,
-                                  SHADOW_COPY_DATA *shadow_copy2_data)
+                                  struct shadow_copy_data *shadow_copy2_data)
 {
        int (*cmpfunc)(const void *, const void *);
        const char *sort;
@@ -869,7 +869,7 @@ static void shadow_copy2_sort_data(vfs_handle_struct 
*handle,
 
 static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle, 
                                              files_struct *fsp, 
-                                             SHADOW_COPY_DATA 
*shadow_copy2_data, 
+                                             struct shadow_copy_data 
*shadow_copy2_data,
                                              bool labels)
 {
        SMB_STRUCT_DIR *p;
@@ -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/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 37fe1c6..d21542c 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -144,7 +144,7 @@ static int smb_time_audit_set_quota(struct 
vfs_handle_struct *handle,
 
 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct 
*handle,
                                               struct files_struct *fsp,
-                                              SHADOW_COPY_DATA 
*shadow_copy_data,
+                                              struct shadow_copy_data 
*shadow_copy_data,
                                               bool labels)
 {
        int result;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 27ac267..18d5979 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2214,8 +2214,7 @@ static void call_nt_transact_ioctl(connection_struct 
*conn,
                 * Allocate the correct amount and return the pointer to let
                 * it be deallocated when we return.
                 */
-               SHADOW_COPY_DATA *shadow_data = NULL;
-               TALLOC_CTX *shadow_mem_ctx = NULL;
+               struct shadow_copy_data *shadow_data = NULL;
                bool labels = False;
                uint32 labels_data_count = 0;
                uint32 i;
@@ -2236,28 +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_COPY_DATA);
+               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));
@@ -2282,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;
                }
@@ -2322,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);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index e6ea34b..015fc56 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1174,7 +1174,7 @@ int smb_vfs_call_set_quota(struct vfs_handle_struct 
*handle,
 
 int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
                                      struct files_struct *fsp,
-                                     SHADOW_COPY_DATA *shadow_copy_data,
+                                     struct shadow_copy_data *shadow_copy_data,
                                      bool labels)
 {
        VFS_FIND(get_shadow_copy_data);


-- 
Samba Shared Repository

Reply via email to