~ubuntu-branches/ubuntu/oneiric/samba/oneiric-security

« back to all changes in this revision

Viewing changes to source3/smbd/vfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-03-10 10:03:01 UTC
  • mfrom: (0.39.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110310100301-jfjg41wv0iq05zj4
Tags: 2:3.5.8~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + 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/mksmbpasswd.awk:
    - Do not add user with UID less than 1000 to smbpasswd
  + debian/control:
    - Make libwbclient0 replace/conflict with hardy's likewise-open.
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
    - Add cuups breaks to push the package to aslo upgrade cups (LP: #639768)
  + debian/rules:
    - enable "native" PIE hardening.
    - Add BIND_NOW to maximize benefit of RELRO hardening.
  + 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.
    - Don't ship the /etc/network/if-up.d file.
  + debian/samba.postinst: 
    - Fixed bashism.
    - 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/samba.logrotate: Make it upstart compatible
  + debian/samba-common.dhcp: Fix typo to get a proper parsing in
    /etc/samba/dhcp.
  + Dropped:
    - debian/patches/fix-windows7-print-connection.patch: Merged upstream.
    - debian/patches/security-CVE-2011-0719.patch: Merged upstream. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
582
582
                return 0;
583
583
        }
584
584
 
 
585
#ifdef S_ISFIFO
 
586
        if (S_ISFIFO(st.st_ex_mode)) {
 
587
                return 0;
 
588
        }
 
589
#endif
 
590
 
585
591
        DEBUG(10,("vfs_fill_sparse: write zeros in file %s from len %.0f to "
586
592
                  "len %.0f (%.0f bytes)\n", fsp_str_dbg(fsp),
587
593
                  (double)st.st_ex_size, (double)len,
591
597
 
592
598
        flush_write_cache(fsp, SIZECHANGE_FLUSH);
593
599
 
 
600
 
 
601
        offset = st.st_ex_size;
 
602
        num_to_write = len - st.st_ex_size;
 
603
 
 
604
        /* Only do this on non-stream file handles. */
 
605
        if (fsp->base_fsp == NULL) {
 
606
                /* for allocation try posix_fallocate first. This can fail on some
 
607
                 * platforms e.g. when the filesystem doesn't support it and no
 
608
                 * emulation is being done by the libc (like on AIX with JFS1). In that
 
609
                 * case we do our own emulation. posix_fallocate implementations can
 
610
                 * return ENOTSUP or EINVAL in cases like that. */
 
611
                ret = sys_posix_fallocate(fsp->fh->fd, offset, num_to_write);
 
612
                if (ret == ENOSPC) {
 
613
                        errno = ENOSPC;
 
614
                        ret = -1;
 
615
                        goto out;
 
616
                }
 
617
                if (ret == 0) {
 
618
                        set_filelen_write_cache(fsp, len);
 
619
                        goto out;
 
620
                }
 
621
 
 
622
                DEBUG(10,("vfs_fill_sparse: sys_posix_fallocate failed with "
 
623
                        "error %d. Falling back to slow manual allocation\n", ret));
 
624
        }
 
625
 
594
626
        if (!sparse_buf) {
595
627
                sparse_buf = SMB_CALLOC_ARRAY(char, SPARSE_BUF_WRITE_SIZE);
596
628
                if (!sparse_buf) {
600
632
                }
601
633
        }
602
634
 
603
 
        offset = st.st_ex_size;
604
 
        num_to_write = len - st.st_ex_size;
605
635
        total = 0;
606
636
 
607
637
        while (total < num_to_write) {
928
958
                                break;
929
959
                        }
930
960
                        default:
931
 
                                DEBUG(1,("check_reduced_name: couldn't get "
 
961
                                DEBUG(3,("check_reduced_name: couldn't get "
932
962
                                         "realpath for %s\n", fname));
933
963
                                return map_nt_error_from_unix(errno);
934
964
                }