Ignore:
Timestamp:
May 27, 2009, 9:09:42 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.8

Location:
branches/samba-3.2.x/source/modules
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/modules/nfs4_acls.c

    r204 r232  
    704704
    705705        SMB_STRUCT_STAT sbuf;
    706         bool need_chown = False;
     706        bool set_acl_as_root = false;
    707707        uid_t newUID = (uid_t)-1;
    708708        gid_t newGID = (gid_t)-1;
     709        int saved_errno;
    709710
    710711        DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
     
    734735                if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) ||
    735736                    ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
    736                         need_chown = True;
    737                 }
    738                 if (need_chown) {
    739                         if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) {
    740                                 if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
    741                                         DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
    742                                                  fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
    743                                                  strerror(errno)));
    744                                         return map_nt_error_from_unix(errno);
    745                                 }
    746 
    747                                 DEBUG(10,("chown %s, %u, %u succeeded.\n",
    748                                           fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
    749                                 if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf))
    750                                         return map_nt_error_from_unix(errno);
    751                                 need_chown = False;
    752                         } else { /* chown is needed, but _after_ changing acl */
    753                                 sbuf.st_uid = newUID; /* OWNER@ in case of e_special */
    754                                 sbuf.st_gid = newGID; /* GROUP@ in case of e_special */
    755                         }
    756                 }
    757         }
    758 
    759         if ((security_info_sent & DACL_SECURITY_INFORMATION)!=0 && psd->dacl!=NULL)
    760         {
    761                 acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
    762                 if (!acl)
    763                         return map_nt_error_from_unix(errno);
    764 
    765                 smbacl4_dump_nfs4acl(10, acl);
    766 
    767                 result = set_nfs4_native(fsp, acl);
    768                 if (result!=True)
    769                 {
    770                         DEBUG(10, ("set_nfs4_native failed with %s\n", strerror(errno)));
    771                         return map_nt_error_from_unix(errno);
    772                 }
    773         } else
     737                        if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
     738                                DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
     739                                         fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
     740                                         strerror(errno)));
     741                                return map_nt_error_from_unix(errno);
     742                        }
     743
     744                        DEBUG(10,("chown %s, %u, %u succeeded.\n",
     745                                  fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
     746                        if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf))
     747                                return map_nt_error_from_unix(errno);
     748                        /* If we successfully chowned, we know we must
     749                         * be able to set the acl, so do it as root.
     750                         */
     751                        set_acl_as_root = true;
     752                }
     753        }
     754
     755        if (!(security_info_sent & DACL_SECURITY_INFORMATION) || psd->dacl ==NULL) {
    774756                DEBUG(10, ("no dacl found; security_info_sent = 0x%x\n", security_info_sent));
    775 
    776         /* Any chown pending? */
    777         if (need_chown) {
    778                 DEBUG(3,("chown#2 %s. uid = %u, gid = %u.\n",
    779                          fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
    780                 if (try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
    781                         DEBUG(2,("chown#2 %s, %u, %u failed. Error = %s.\n",
    782                                  fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
    783                                  strerror(errno)));
    784                         return map_nt_error_from_unix(errno);
    785                 }
    786                 DEBUG(10,("chown#2 %s, %u, %u succeeded.\n",
    787                           fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
     757                return NT_STATUS_OK;
     758        }
     759
     760        acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
     761        if (!acl)
     762                return map_nt_error_from_unix(errno);
     763
     764        smbacl4_dump_nfs4acl(10, acl);
     765
     766        if (set_acl_as_root) {
     767                become_root();
     768        }
     769        result = set_nfs4_native(fsp, acl);
     770        saved_errno = errno;
     771        if (set_acl_as_root) {
     772                unbecome_root();
     773        }
     774        if (result!=True) {
     775                errno = saved_errno;
     776                DEBUG(10, ("set_nfs4_native failed with %s\n", strerror(errno)));
     777                return map_nt_error_from_unix(errno);
    788778        }
    789779
  • branches/samba-3.2.x/source/modules/vfs_default.c

    r141 r232  
    715715                return sys_ftruncate(fsp->fh->fd, len);
    716716
     717        /* available disk space is enough or not? */
     718        if (lp_strict_allocate(SNUM(fsp->conn))){
     719                SMB_BIG_UINT space_avail;
     720                SMB_BIG_UINT bsize,dfree,dsize;
     721
     722                space_avail = get_dfree_info(fsp->conn,fsp->fsp_name,false,&bsize,&dfree,&dsize);
     723                /* space_avail is 1k blocks */
     724                if (space_avail == (SMB_BIG_UINT)-1 ||
     725                                ((SMB_BIG_UINT)space_to_write/1024 > space_avail) ) {
     726                        errno = ENOSPC;
     727                        return -1;
     728                }
     729        }
     730
    717731        /* Write out the real space on disk. */
    718732        if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size)
  • branches/samba-3.2.x/source/modules/vfs_fileid.c

    r133 r232  
    189189        }
    190190
    191         data->device_mapping_fn = fileid_device_mapping_fsid;
     191        /*
     192         * "fileid:mapping" is only here as fallback for old setups
     193         * "fileid:algorithm" is the option new setups should use
     194         */
     195        algorithm = lp_parm_const_string(SNUM(handle->conn),
     196                                         "fileid", "mapping",
     197                                         "fsname");
    192198        algorithm = lp_parm_const_string(SNUM(handle->conn),
    193199                                         "fileid", "algorithm",
    194                                          "fsname");
     200                                         algorithm);
    195201        if (strcmp("fsname", algorithm) == 0) {
    196202                data->device_mapping_fn = fileid_device_mapping_fsname;
  • branches/samba-3.2.x/source/modules/vfs_full_audit.c

    r149 r232  
    702702{
    703703        char *prefix = NULL;
     704        char *result;
    704705
    705706        prefix = talloc_strdup(ctx,
     
    709710                return NULL;
    710711        }
    711         return talloc_sub_advanced(ctx,
     712        result = talloc_sub_advanced(ctx,
    712713                        lp_servicename(SNUM(conn)), conn->user,
    713714                        conn->connectpath, conn->gid,
     
    715716                        current_user_info.domain,
    716717                        prefix);
     718        TALLOC_FREE(prefix);
     719        return result;
    717720}
    718721
  • branches/samba-3.2.x/source/modules/vfs_streams_depot.c

    r228 r232  
    526526        char *ostream_fname = NULL;
    527527        char *nstream_fname = NULL;
     528        char *newname_full = NULL;
    528529
    529530        DEBUG(10, ("streams_depot_rename called for %s => %s\n",
     
    537538        }
    538539
    539         if (!(old_is_stream && new_is_stream)) {
    540                 errno = ENOSYS;
    541                 return -1;
    542         }
    543 
    544540        frame = talloc_stackframe();
    545541
     
    550546        }
    551547
    552         if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), oldname,
     548        if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), newname,
    553549                                                    &nbase, &nsname))) {
    554550                errno = ENOMEM;
     
    562558        }
    563559
    564         if (StrCaseCmp(obase, nbase) != 0) {
    565                 errno = ENOSYS;
    566                 goto done;
    567         }
    568 
    569560        ostream_fname = stream_name(handle, oldname, false);
    570561        if (ostream_fname == NULL) {
     
    572563        }
    573564
    574         nstream_fname = stream_name(handle, newname, false);
     565        /*
     566         * Handle passing in a stream name without the base file.  This is
     567         * exercised by the NTRENAME streams rename path.
     568         */
     569        if (StrCaseCmp(nbase, "./") == 0) {
     570                newname_full = talloc_asprintf(talloc_tos(), "%s:%s", obase,
     571                                               nsname);
     572                if (newname_full == NULL) {
     573                        errno = ENOMEM;
     574                        goto done;
     575                }
     576        }
     577
     578        nstream_fname = stream_name(handle,
     579                                    newname_full ? newname_full : newname,
     580                                    false);
    575581        if (nstream_fname == NULL) {
    576582                return -1;
  • branches/samba-3.2.x/source/modules/vfs_streams_xattr.c

    r228 r232  
    512512        }
    513513
    514         if (!(o_is_stream && n_is_stream)) {
    515                 errno = ENOSYS;
    516                 goto fail;
    517         }
    518 
    519514        frame = talloc_stackframe();
    520515        if (!frame) {
     
    541536
    542537        if (nstream == NULL) {
    543                 errno = ENOSYS;
    544                 goto fail;
    545         }
    546 
    547         /* the new base should be empty */
    548         if (StrCaseCmp(obase, nbase) != 0) {
    549538                errno = ENOSYS;
    550539                goto fail;
Note: See TracChangeset for help on using the changeset viewer.