~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source3/modules/vfs_shadow_copy.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include "includes.h"
 
21
#include "smbd/smbd.h"
 
22
#include "ntioctl.h"
21
23
 
22
24
/*
23
25
    Please read the VFS module Samba-HowTo-Collection.
118
120
        return((SMB_STRUCT_DIR *)dirp);
119
121
}
120
122
 
 
123
static SMB_STRUCT_DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
 
124
{
 
125
        shadow_copy_Dir *dirp;
 
126
        SMB_STRUCT_DIR *p = SMB_VFS_NEXT_FDOPENDIR(handle,fsp,mask,attr);
 
127
 
 
128
        if (!p) {
 
129
                DEBUG(10,("shadow_copy_opendir: SMB_VFS_NEXT_FDOPENDIR() failed for [%s]\n",
 
130
                        smb_fname_str_dbg(fsp->fsp_name)));
 
131
                return NULL;
 
132
        }
 
133
 
 
134
        dirp = SMB_MALLOC_P(shadow_copy_Dir);
 
135
        if (!dirp) {
 
136
                DEBUG(0,("shadow_copy_fdopendir: Out of memory\n"));
 
137
                SMB_VFS_NEXT_CLOSEDIR(handle,p);
 
138
                /* We have now closed the fd in fsp. */
 
139
                fsp->fh->fd = -1;
 
140
                return NULL;
 
141
        }
 
142
 
 
143
        ZERO_STRUCTP(dirp);
 
144
 
 
145
        while (True) {
 
146
                SMB_STRUCT_DIRENT *d;
 
147
 
 
148
                d = SMB_VFS_NEXT_READDIR(handle, p, NULL);
 
149
                if (d == NULL) {
 
150
                        break;
 
151
                }
 
152
 
 
153
                if (shadow_copy_match_name(d->d_name)) {
 
154
                        DEBUG(8,("shadow_copy_fdopendir: hide [%s]\n",d->d_name));
 
155
                        continue;
 
156
                }
 
157
 
 
158
                DEBUG(10,("shadow_copy_fdopendir: not hide [%s]\n",d->d_name));
 
159
 
 
160
                dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,SMB_STRUCT_DIRENT, dirp->num+1);
 
161
                if (!dirp->dirs) {
 
162
                        DEBUG(0,("shadow_copy_fdopendir: Out of memory\n"));
 
163
                        break;
 
164
                }
 
165
 
 
166
                dirp->dirs[dirp->num++] = *d;
 
167
        }
 
168
 
 
169
        SMB_VFS_NEXT_CLOSEDIR(handle,p);
 
170
        /* We have now closed the fd in fsp. */
 
171
        fsp->fh->fd = -1;
 
172
        return((SMB_STRUCT_DIR *)dirp);
 
173
}
 
174
 
121
175
static SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle,
122
176
                                              SMB_STRUCT_DIR *_dirp,
123
177
                                              SMB_STRUCT_STAT *sbuf)
162
216
        return 0;       
163
217
}
164
218
 
165
 
static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
 
219
static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
 
220
                                            files_struct *fsp,
 
221
                                            struct shadow_copy_data *shadow_copy_data,
 
222
                                            bool labels)
166
223
{
167
224
        SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn->connectpath,NULL,0);
168
225
 
196
253
                        continue;
197
254
                }
198
255
 
199
 
                tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data->mem_ctx,
 
256
                tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data,
200
257
                                                                        shadow_copy_data->labels,
201
258
                                                                        (shadow_copy_data->num_volumes+1)*sizeof(SHADOW_COPY_LABEL));
202
259
                if (tlabels == NULL) {
216
273
 
217
274
static struct vfs_fn_pointers vfs_shadow_copy_fns = {
218
275
        .opendir = shadow_copy_opendir,
 
276
        .fdopendir = shadow_copy_fdopendir,
219
277
        .readdir = shadow_copy_readdir,
220
278
        .seekdir = shadow_copy_seekdir,
221
279
        .telldir = shadow_copy_telldir,