Ignore:
Timestamp:
Nov 25, 2016, 8:04:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.7

Location:
vendor/current/source3/smbd
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/aio.c

    r988 r989  
    273273        int outsize;
    274274        char *outbuf = (char *)aio_ex->outbuf.data;
    275         char *data = smb_buf(outbuf) + 1 /* padding byte */;
    276275        ssize_t nread;
    277276        int err;
     
    302301                outsize = srv_set_message(outbuf,0,0,true);
    303302        } else {
    304                 outsize = srv_set_message(outbuf, 12,
    305                                           nread + 1 /* padding byte */, false);
    306                 SSVAL(outbuf,smb_vwv2, 0xFFFF); /* Remaining - must be * -1. */
    307                 SSVAL(outbuf,smb_vwv5, nread);
    308                 SSVAL(outbuf,smb_vwv6, smb_offset(data,outbuf));
    309                 SSVAL(outbuf,smb_vwv7, ((nread >> 16) & 1));
    310                 SSVAL(smb_buf(outbuf), -2, nread);
     303                outsize = setup_readX_header(outbuf, nread);
    311304
    312305                aio_ex->fsp->fh->pos = aio_ex->offset + nread;
  • vendor/current/source3/smbd/close.c

    r988 r989  
    169169        TALLOC_CTX *frame = talloc_stackframe();
    170170        NTSTATUS status;
     171        bool saved_posix_pathnames;
    171172
    172173        status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
     
    192193                return NT_STATUS_OK;
    193194        }
     195
     196        /*
     197         * Any stream names *must* be treated as Windows
     198         * pathnames, even if we're using UNIX extensions.
     199         */
     200
     201        saved_posix_pathnames = lp_set_posix_pathnames(false);
    194202
    195203        for (i=0; i<num_streams; i++) {
     
    224232
    225233 fail:
     234
     235        (void)lp_set_posix_pathnames(saved_posix_pathnames);
    226236        TALLOC_FREE(frame);
    227237        return status;
     
    247257        bool got_tokens = false;
    248258        bool normal_close;
    249         int ret_flock;
    250259
    251260        /* Ensure any pending write time updates are done. */
     
    268277                          "lock for file %s\n", fsp_str_dbg(fsp)));
    269278                return NT_STATUS_INVALID_PARAMETER;
     279        }
     280
     281        /* Remove the oplock before potentially deleting the file. */
     282        if(fsp->oplock_type) {
     283                remove_oplock_under_lock(fsp, lck);
    270284        }
    271285
     
    471485        }
    472486
    473         /* remove filesystem sharemodes */
    474         ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, 0, 0);
    475         if (ret_flock == -1) {
    476                 DEBUG(2, ("close_remove_share_mode: removing kernel flock for "
    477                                         "%s failed: %s\n", fsp_str_dbg(fsp),
    478                                         strerror(errno)));
     487        if (fsp->kernel_share_modes_taken) {
     488                int ret_flock;
     489
     490                /* remove filesystem sharemodes */
     491                ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, 0, 0);
     492                if (ret_flock == -1) {
     493                        DEBUG(2, ("close_remove_share_mode: removing kernel "
     494                                  "flock for %s failed: %s\n",
     495                                  fsp_str_dbg(fsp), strerror(errno)));
     496                }
    479497        }
    480498
     
    732750                file_free(req, fsp);
    733751                return NT_STATUS_OK;
    734         }
    735 
    736         /* Remove the oplock before potentially deleting the file. */
    737         if(fsp->oplock_type) {
    738                 remove_oplock(fsp);
    739752        }
    740753
  • vendor/current/source3/smbd/dfree.c

    r988 r989  
    5050****************************************************************************/
    5151
    52 uint64_t sys_disk_free(connection_struct *conn, const char *path,
     52uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
    5353                       uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    5454{
     
    5959        const char *dfree_command;
    6060        static bool dfree_broken = false;
     61        const char *path = fname->base_name;
    6162
    6263        (*dfree) = (*dsize) = 0;
     
    124125        }
    125126
    126         if (disk_quotas(conn, path, &bsize_q, &dfree_q, &dsize_q)) {
     127        if (disk_quotas(conn, fname, &bsize_q, &dfree_q, &dsize_q)) {
    127128                uint64_t min_bsize = MIN(*bsize, bsize_q);
    128129
     
    168169****************************************************************************/
    169170
    170 uint64_t get_dfree_info(connection_struct *conn,
    171                         const char *path,
    172                         uint64_t *bsize,
    173                         uint64_t *dfree,
    174                         uint64_t *dsize)
     171uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
     172                        uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    175173{
    176174        int dfree_cache_time = lp_dfree_cache_time(SNUM(conn));
     
    179177
    180178        if (!dfree_cache_time) {
    181                 return sys_disk_free(conn, path, bsize, dfree, dsize);
     179                return sys_disk_free(conn, fname, bsize, dfree, dsize);
    182180        }
    183181
     
    190188        }
    191189
    192         dfree_ret = sys_disk_free(conn, path, bsize, dfree, dsize);
     190        dfree_ret = sys_disk_free(conn, fname, bsize, dfree, dsize);
    193191
    194192        if (dfree_ret == (uint64_t)-1) {
  • vendor/current/source3/smbd/dosmode.c

    r988 r989  
    258258****************************************************************************/
    259259
    260 static bool get_ea_dos_attribute(connection_struct *conn,
    261                                 struct smb_filename *smb_fname,
    262                                 uint32_t *pattr)
     260bool get_ea_dos_attribute(connection_struct *conn,
     261                          struct smb_filename *smb_fname,
     262                          uint32_t *pattr)
    263263{
    264264        struct xattr_DOSATTRIB dosattrib;
     
    553553}
    554554
     555static uint32_t dos_mode_from_name(connection_struct *conn,
     556                                   const struct smb_filename *smb_fname,
     557                                   uint32_t dosmode)
     558{
     559        const char *p = NULL;
     560        uint32_t result = dosmode;
     561
     562        if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
     563            lp_hide_dot_files(SNUM(conn)))
     564        {
     565                p = strrchr_m(smb_fname->base_name, '/');
     566                if (p) {
     567                        p++;
     568                } else {
     569                        p = smb_fname->base_name;
     570                }
     571
     572                /* Only . and .. are not hidden. */
     573                if ((p[0] == '.') &&
     574                    !((p[1] == '\0') || (p[1] == '.' && p[2] == '\0')))
     575                {
     576                        result |= FILE_ATTRIBUTE_HIDDEN;
     577                }
     578        }
     579
     580        if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
     581            IS_HIDDEN_PATH(conn, smb_fname->base_name))
     582        {
     583                result |= FILE_ATTRIBUTE_HIDDEN;
     584        }
     585
     586        return result;
     587}
     588
    555589/****************************************************************************
    556590 Change a unix mode to a dos mode.
     
    568602        if (!VALID_STAT(smb_fname->st)) {
    569603                return 0;
    570         }
    571 
    572         /* First do any modifications that depend on the path name. */
    573         /* hide files with a name starting with a . */
    574         if (lp_hide_dot_files(SNUM(conn))) {
    575                 const char *p = strrchr_m(smb_fname->base_name,'/');
    576                 if (p) {
    577                         p++;
    578                 } else {
    579                         p = smb_fname->base_name;
    580                 }
    581 
    582                 /* Only . and .. are not hidden. */
    583                 if (p[0] == '.' && !((p[1] == '\0') ||
    584                                 (p[1] == '.' && p[2] == '\0'))) {
    585                         result |= FILE_ATTRIBUTE_HIDDEN;
    586                 }
    587604        }
    588605
     
    606623        }
    607624
    608         /* Optimization : Only call is_hidden_path if it's not already
    609            hidden. */
    610         if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
    611             IS_HIDDEN_PATH(conn, smb_fname->base_name)) {
    612                 result |= FILE_ATTRIBUTE_HIDDEN;
    613         }
     625        result |= dos_mode_from_name(conn, smb_fname, result);
    614626
    615627        if (result == 0) {
    616                 result = FILE_ATTRIBUTE_NORMAL;
     628                if (S_ISDIR(smb_fname->st.st_ex_mode)) {
     629                        result = FILE_ATTRIBUTE_DIRECTORY;
     630                } else {
     631                        result = FILE_ATTRIBUTE_NORMAL;
     632                }
    617633        }
    618634
  • vendor/current/source3/smbd/filename.c

    r988 r989  
    940940                        TALLOC_FREE(found_name);
    941941                } /* end else */
    942 
    943 #ifdef DEVELOPER
    944                 /*
    945                  * This sucks!
    946                  * We should never provide different behaviors
    947                  * depending on DEVELOPER!!!
    948                  */
    949                 if (VALID_STAT(smb_fname->st)) {
    950                         bool delete_pending;
    951                         uint32_t name_hash;
    952 
    953                         status = file_name_hash(conn,
    954                                         smb_fname_str_dbg(smb_fname),
    955                                         &name_hash);
    956                         if (!NT_STATUS_IS_OK(status)) {
    957                                 goto fail;
    958                         }
    959 
    960                         get_file_infos(vfs_file_id_from_sbuf(conn,
    961                                                              &smb_fname->st),
    962                                        name_hash,
    963                                        &delete_pending, NULL);
    964                         if (delete_pending) {
    965                                 status = NT_STATUS_DELETE_PENDING;
    966                                 goto fail;
    967                         }
    968                 }
    969 #endif
    970942
    971943                /*
  • vendor/current/source3/smbd/globals.h

    r988 r989  
    728728
    729729        /*
     730         * Keep track of whether the outstanding request counters
     731         * had been updated in dispatch, so that they need to be
     732         * adapted again in reply.
     733         */
     734        bool request_counters_updated;
     735
     736        /*
    730737         * The sub request for async backend calls.
    731738         * This is used for SMB2 Cancel.
  • vendor/current/source3/smbd/notifyd/notifyd.c

    r988 r989  
    12471247        size_t i;
    12481248
    1249         dbwrap_traverse_read(p->db, notifyd_db_del_syswatches, NULL, NULL);
     1249        if (p->db != NULL) {
     1250                dbwrap_traverse_read(p->db, notifyd_db_del_syswatches,
     1251                                     NULL, NULL);
     1252        }
    12501253
    12511254        for (i = 0; i<state->num_peers; i++) {
  • vendor/current/source3/smbd/open.c

    r988 r989  
    884884                }
    885885
     886                if (local_flags & O_NONBLOCK) {
     887                        /*
     888                         * GPFS can return ETIMEDOUT for pread on
     889                         * nonblocking file descriptors when files
     890                         * migrated to tape need to be recalled. I
     891                         * could imagine this happens elsehwere
     892                         * too. With blocking file descriptors this
     893                         * does not happen.
     894                         */
     895                        ret = set_blocking(fsp->fh->fd, true);
     896                        if (ret == -1) {
     897                                status = map_nt_error_from_unix(errno);
     898                                DBG_WARNING("Could not set fd to blocking: "
     899                                            "%s\n", strerror(errno));
     900                                fd_close(fsp);
     901                                return status;
     902                        }
     903                }
     904
    886905                ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
    887906                if (ret == -1) {
     
    25182537                new_dos_attributes &= SAMBA_ATTRIBUTES_MASK;
    25192538                if (file_existed) {
    2520                         existing_dos_attributes = dos_mode(conn, smb_fname);
     2539                        /*
     2540                         * Only use strored DOS attributes for checks
     2541                         * against requested attributes (below via
     2542                         * open_match_attributes()), cf bug #11992
     2543                         * for details. -slow
     2544                         */
     2545                        bool ok;
     2546                        uint32_t attr = 0;
     2547
     2548                        ok = get_ea_dos_attribute(conn, smb_fname, &attr);
     2549                        if (ok) {
     2550                                existing_dos_attributes = attr;
     2551                        }
    25212552                }
    25222553        }
     
    30853116                        return NT_STATUS_SHARING_VIOLATION;
    30863117                }
     3118
     3119                fsp->kernel_share_modes_taken = true;
    30873120        }
    30883121
     
    38583891        TALLOC_CTX *frame = talloc_stackframe();
    38593892        NTSTATUS status;
     3893        bool saved_posix_pathnames;
    38603894
    38613895        status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
     
    38893923                goto fail;
    38903924        }
     3925
     3926        /*
     3927         * Any stream names *must* be treated as Windows
     3928         * pathnames, even if we're using UNIX extensions.
     3929         */
     3930
     3931        saved_posix_pathnames = lp_set_posix_pathnames(false);
    38913932
    38923933        for (i=0; i<num_streams; i++) {
     
    39573998
    39583999 fail:
     4000
     4001        (void)lp_set_posix_pathnames(saved_posix_pathnames);
    39594002        TALLOC_FREE(frame);
    39604003        return status;
  • vendor/current/source3/smbd/oplock.c

    r988 r989  
    191191                 * If we're the only one, we don't need a brlock entry
    192192                 */
     193                remove_stale_share_mode_entries(d);
    193194                SMB_ASSERT(d->num_share_modes == 1);
    194195                SMB_ASSERT(EXCLUSIVE_OPLOCK_TYPE(d->share_modes[0].op_type));
     
    220221        TALLOC_FREE(br_lck);
    221222        return true;
     223}
     224
     225/****************************************************************************
     226 Remove a file oplock with lock already held. Copes with level II and exclusive.
     227****************************************************************************/
     228
     229bool remove_oplock_under_lock(files_struct *fsp, struct share_mode_lock *lck)
     230{
     231        bool ret;
     232
     233        ret = remove_share_oplock(lck, fsp);
     234        if (!ret) {
     235                DBG_ERR("failed to remove share oplock for "
     236                        "file %s, %s, %s\n",
     237                        fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
     238                        file_id_string_tos(&fsp->file_id));
     239        }
     240        release_file_oplock(fsp);
     241
     242        ret = update_num_read_oplocks(fsp, lck);
     243        if (!ret) {
     244                DBG_ERR("update_num_read_oplocks failed for "
     245                        "file %s, %s, %s\n",
     246                        fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
     247                        file_id_string_tos(&fsp->file_id));
     248        }
     249
     250        return ret;
    222251}
    223252
     
    233262        struct share_mode_lock *lck;
    234263
    235         DEBUG(10, ("remove_oplock called for %s\n",
    236                    fsp_str_dbg(fsp)));
     264        DBG_DEBUG("remove_oplock called for %s\n", fsp_str_dbg(fsp));
    237265
    238266        /* Remove the oplock flag from the sharemode. */
    239267        lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
    240268        if (lck == NULL) {
    241                 DEBUG(0,("remove_oplock: failed to lock share entry for "
    242                          "file %s\n", fsp_str_dbg(fsp)));
    243                 return False;
    244         }
    245 
    246         ret = remove_share_oplock(lck, fsp);
    247         if (!ret) {
    248                 DEBUG(0,("remove_oplock: failed to remove share oplock for "
    249                          "file %s, %s, %s\n",
    250                          fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
    251                          file_id_string_tos(&fsp->file_id)));
    252         }
    253         release_file_oplock(fsp);
    254 
    255         ret = update_num_read_oplocks(fsp, lck);
    256         if (!ret) {
    257                 DEBUG(0, ("%s: update_num_read_oplocks failed for "
    258                          "file %s, %s, %s\n",
    259                           __func__, fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
    260                          file_id_string_tos(&fsp->file_id)));
    261         }
     269                DBG_ERR("failed to lock share entry for "
     270                         "file %s\n", fsp_str_dbg(fsp));
     271                return false;
     272        }
     273
     274        ret = remove_oplock_under_lock(fsp, lck);
    262275
    263276        TALLOC_FREE(lck);
  • vendor/current/source3/smbd/pipes.c

    r988 r989  
    493493              + 2               /* the buflen field */
    494494              + 1);             /* padding byte */
    495         SSVAL(req->outbuf,smb_vwv11,state->smb_maxcnt);
    496495
    497496        DEBUG(3,("readX-IPC min=%d max=%d nread=%d\n",
  • vendor/current/source3/smbd/posix_acls.c

    r988 r989  
    46634663}
    46644664
    4665 /* Stolen shamelessly from pvfs_default_acl() in source4 :-). */
    4666 
    4667 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
    4668                                         const char *name,
    4669                                         SMB_STRUCT_STAT *psbuf,
    4670                                         struct security_descriptor **ppdesc)
    4671 {
    4672         struct dom_sid owner_sid, group_sid;
    4673         size_t size = 0;
    4674         struct security_ace aces[4];
    4675         uint32_t access_mask = 0;
    4676         mode_t mode = psbuf->st_ex_mode;
    4677         struct security_acl *new_dacl = NULL;
    4678         int idx = 0;
    4679 
    4680         DEBUG(10,("make_default_filesystem_acl: file %s mode = 0%o\n",
    4681                 name, (int)mode ));
    4682 
    4683         uid_to_sid(&owner_sid, psbuf->st_ex_uid);
    4684         gid_to_sid(&group_sid, psbuf->st_ex_gid);
    4685 
    4686         /*
    4687          We provide up to 4 ACEs
    4688                 - Owner
    4689                 - Group
    4690                 - Everyone
    4691                 - NT System
    4692         */
    4693 
    4694         if (mode & S_IRUSR) {
    4695                 if (mode & S_IWUSR) {
    4696                         access_mask |= SEC_RIGHTS_FILE_ALL;
    4697                 } else {
    4698                         access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
    4699                 }
    4700         }
    4701         if (mode & S_IWUSR) {
    4702                 access_mask |= SEC_RIGHTS_FILE_WRITE | SEC_STD_DELETE;
    4703         }
    4704 
    4705         init_sec_ace(&aces[idx],
    4706                         &owner_sid,
    4707                         SEC_ACE_TYPE_ACCESS_ALLOWED,
    4708                         access_mask,
    4709                         0);
    4710         idx++;
    4711 
    4712         access_mask = 0;
    4713         if (mode & S_IRGRP) {
    4714                 access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
    4715         }
    4716         if (mode & S_IWGRP) {
    4717                 /* note that delete is not granted - this matches posix behaviour */
    4718                 access_mask |= SEC_RIGHTS_FILE_WRITE;
    4719         }
    4720         if (access_mask) {
    4721                 init_sec_ace(&aces[idx],
    4722                         &group_sid,
    4723                         SEC_ACE_TYPE_ACCESS_ALLOWED,
    4724                         access_mask,
    4725                         0);
    4726                 idx++;
    4727         }
    4728 
    4729         access_mask = 0;
    4730         if (mode & S_IROTH) {
    4731                 access_mask |= SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE;
    4732         }
    4733         if (mode & S_IWOTH) {
    4734                 access_mask |= SEC_RIGHTS_FILE_WRITE;
    4735         }
    4736         if (access_mask) {
    4737                 init_sec_ace(&aces[idx],
    4738                         &global_sid_World,
    4739                         SEC_ACE_TYPE_ACCESS_ALLOWED,
    4740                         access_mask,
    4741                         0);
    4742                 idx++;
    4743         }
    4744 
    4745         init_sec_ace(&aces[idx],
    4746                         &global_sid_System,
    4747                         SEC_ACE_TYPE_ACCESS_ALLOWED,
    4748                         SEC_RIGHTS_FILE_ALL,
    4749                         0);
    4750         idx++;
    4751 
    4752         new_dacl = make_sec_acl(ctx,
    4753                         NT4_ACL_REVISION,
    4754                         idx,
    4755                         aces);
    4756 
    4757         if (!new_dacl) {
    4758                 return NT_STATUS_NO_MEMORY;
    4759         }
    4760 
    4761         *ppdesc = make_sec_desc(ctx,
    4762                         SECURITY_DESCRIPTOR_REVISION_1,
    4763                         SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT,
    4764                         &owner_sid,
    4765                         &group_sid,
    4766                         NULL,
    4767                         new_dacl,
    4768                         &size);
    4769         if (!*ppdesc) {
    4770                 return NT_STATUS_NO_MEMORY;
    4771         }
    4772         return NT_STATUS_OK;
    4773 }
    4774 
    47754665int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
    47764666                                const char *path_p,
  • vendor/current/source3/smbd/process.c

    r988 r989  
    32243224        state->xconn = xconn;
    32253225        state->parent_pipe = parent_pipe;
    3226         state->ev = s3_tevent_context_init(state);
     3226        state->ev = samba_tevent_context_init(state);
    32273227        if (state->ev == NULL) {
    3228                 DEBUG(1, ("tevent_context_init failed\n"));
     3228                DEBUG(1, ("samba_tevent_context_init failed\n"));
    32293229                TALLOC_FREE(state);
    32303230                return;
  • vendor/current/source3/smbd/proto.h

    r988 r989  
    172172/* The following definitions come from smbd/dfree.c  */
    173173
    174 uint64_t sys_disk_free(connection_struct *conn, const char *path,
    175                               uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    176 uint64_t get_dfree_info(connection_struct *conn,
    177                         const char *path,
    178                         uint64_t *bsize,
    179                         uint64_t *dfree,
    180                         uint64_t *dsize);
     174uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
     175                       uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
     176uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
     177                        uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    181178
    182179/* The following definitions come from smbd/dir.c  */
     
    260257int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
    261258                     uint32_t dosmode, const char *parent_dir, bool newfile);
     259bool get_ea_dos_attribute(connection_struct *conn,
     260                          struct smb_filename *smb_fname,
     261                          uint32_t *pattr);
    262262NTSTATUS file_set_sparse(connection_struct *conn,
    263263                         struct files_struct *fsp,
     
    681681void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
    682682NTSTATUS set_file_oplock(files_struct *fsp);
     683bool remove_oplock_under_lock(files_struct *fsp, struct share_mode_lock *lck);
    683684bool remove_oplock(files_struct *fsp);
    684685bool downgrade_oplock(files_struct *fsp);
     
    762763                             uint32_t security_info_wanted,
    763764                             struct security_descriptor **sd);
    764 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
    765                                         const char *name,
    766                                         SMB_STRUCT_STAT *psbuf,
    767                                         struct security_descriptor **ppdesc);
    768765int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
    769766                                const char *path_p,
     
    830827/* The following definitions come from smbd/quotas.c  */
    831828
    832 bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
    833                  uint64_t *dfree, uint64_t *dsize);
    834 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
     829bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
     830                 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    835831
    836832/* The following definitions come from smbd/reply.c  */
     
    916912void reply_readbraw(struct smb_request *req);
    917913void reply_lockread(struct smb_request *req);
     914int setup_readX_header(char *outbuf, size_t smb_maxcnt);
    918915void reply_read(struct smb_request *req);
    919916void reply_read_and_X(struct smb_request *req);
  • vendor/current/source3/smbd/quotas.c

    r988 r989  
    237237****************************************************************************/
    238238
    239 bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
    240                  uint64_t *dfree, uint64_t *dsize)
     239bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
     240                 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    241241{
    242242        uid_t euser_id;
     
    255255        SMB_DEV_T devno;
    256256        bool found = false;
     257        const char *path = fname->base_name;
    257258
    258259        euser_id = geteuid();
    259260
    260         if (sys_stat(path, &sbuf, false) == -1) {
    261                 return false;
    262         }
    263 
    264         devno = sbuf.st_ex_dev ;
     261        devno = fname->st.st_ex_dev;
    265262        DEBUG(5,("disk_quotas: looking for path \"%s\" devno=%x\n",
    266263                path, (unsigned int)devno));
     
    427424****************************************************************************/
    428425
    429 bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
    430                  uint64_t *dfree, uint64_t *dsize)
     426bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
     427                 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    431428{
    432429  int r;
    433430  struct dqblk D;
    434431  uid_t euser_id;
     432  const char *path = fname->base_name;
    435433#if !defined(AIX)
    436434  char dev_disk[256];
    437   SMB_STRUCT_STAT S;
     435  SMB_STRUCT_STAT S = fname->st;
    438436
    439437  /* find the block device file */
     
    658656#else /* WITH_QUOTAS */
    659657
    660 bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
    661                  uint64_t *dfree, uint64_t *dsize)
     658bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
     659                 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    662660{
    663661        (*bsize) = 512; /* This value should be ignored */
     
    677675   this file should be removed later
    678676   */
    679 bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
    680                  uint64_t *dfree, uint64_t *dsize)
     677bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
     678                 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
    681679{
    682680        int r;
     
    684682        unid_t id;
    685683
     684        /*
     685         * First of all, check whether user quota is
     686         * enforced. If the call fails, assume it is
     687         * not enforced.
     688         */
     689        ZERO_STRUCT(D);
     690        id.uid = -1;
     691        r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_USER_FS_QUOTA_TYPE,
     692                              id, &D);
     693        if (r == -1 && errno != ENOSYS) {
     694                goto try_group_quota;
     695        }
     696        if (r == 0 && (D.qflags & QUOTAS_DENY_DISK) == 0) {
     697                goto try_group_quota;
     698        }
     699
     700        ZERO_STRUCT(D);
    686701        id.uid = geteuid();
    687702
    688         ZERO_STRUCT(D);
    689         r = SMB_VFS_GET_QUOTA(conn, path, SMB_USER_QUOTA_TYPE, id, &D);
     703        /* if new files created under this folder get this
     704         * folder's UID, then available space is governed by
     705         * the quota of the folder's UID, not the creating user.
     706         */
     707        if (lp_inherit_owner(SNUM(conn)) &&
     708            id.uid != fname->st.st_ex_uid && id.uid != sec_initial_uid()) {
     709                int save_errno;
     710
     711                id.uid = fname->st.st_ex_uid;
     712                become_root();
     713                r = SMB_VFS_GET_QUOTA(conn, fname->base_name,
     714                                      SMB_USER_QUOTA_TYPE, id, &D);
     715                save_errno = errno;
     716                unbecome_root();
     717                errno = save_errno;
     718        } else {
     719                r = SMB_VFS_GET_QUOTA(conn, fname->base_name,
     720                                      SMB_USER_QUOTA_TYPE, id, &D);
     721        }
    690722
    691723        /* Use softlimit to determine disk space, except when it has been exceeded */
     
    723755       
    724756try_group_quota:
     757        /*
     758         * First of all, check whether group quota is
     759         * enforced. If the call fails, assume it is
     760         * not enforced.
     761         */
     762        ZERO_STRUCT(D);
     763        id.gid = -1;
     764        r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_GROUP_FS_QUOTA_TYPE,
     765                              id, &D);
     766        if (r == -1 && errno != ENOSYS) {
     767                return false;
     768        }
     769        if (r == 0 && (D.qflags & QUOTAS_DENY_DISK) == 0) {
     770                return false;
     771        }
     772
    725773        id.gid = getegid();
    726774
    727775        ZERO_STRUCT(D);
    728         r = SMB_VFS_GET_QUOTA(conn, path, SMB_GROUP_QUOTA_TYPE, id, &D);
     776        r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_GROUP_QUOTA_TYPE, id,
     777                              &D);
    729778
    730779        /* Use softlimit to determine disk space, except when it has been exceeded */
  • vendor/current/source3/smbd/reply.c

    r988 r989  
    15741574        uint64_t ret;
    15751575        uint64_t dfree,dsize,bsize;
     1576        struct smb_filename smb_fname;
    15761577        START_PROFILE(SMBdskattr);
    15771578
    1578         ret = get_dfree_info(conn, ".", &bsize, &dfree, &dsize);
     1579        ZERO_STRUCT(smb_fname);
     1580        smb_fname.base_name = discard_const_p(char, ".");
     1581
     1582        if (SMB_VFS_STAT(conn, &smb_fname) != 0) {
     1583                reply_nterror(req, map_nt_error_from_unix(errno));
     1584                DBG_WARNING("stat of . failed (%s)\n", strerror(errno));
     1585                END_PROFILE(SMBdskattr);
     1586                return;
     1587        }
     1588
     1589        ret = get_dfree_info(conn, &smb_fname, &bsize, &dfree, &dsize);
    15791590        if (ret == (uint64_t)-1) {
    15801591                reply_nterror(req, map_nt_error_from_unix(errno));
     
    38973908****************************************************************************/
    38983909
    3899 static int setup_readX_header(struct smb_request *req, char *outbuf,
    3900                               size_t smb_maxcnt)
     3910int setup_readX_header(char *outbuf, size_t smb_maxcnt)
    39013911{
    39023912        int outsize;
     
    39173927              + 1);             /* padding byte */
    39183928        SSVAL(outbuf,smb_vwv7,(smb_maxcnt >> 16));
    3919         SSVAL(outbuf,smb_vwv11,smb_maxcnt);
    39203929        SCVAL(smb_buf(outbuf), 0, 0); /* padding byte */
    39213930        /* Reset the outgoing length, set_message truncates at 0x1FFFF. */
     
    39853994
    39863995                construct_reply_common_req(req, (char *)headerbuf);
    3987                 setup_readX_header(req, (char *)headerbuf, smb_maxcnt);
     3996                setup_readX_header((char *)headerbuf, smb_maxcnt);
    39883997
    39893998                nread = SMB_VFS_SENDFILE(xconn->transport.sock, fsp, &header,
     
    40864095
    40874096                construct_reply_common_req(req, (char *)headerbuf);
    4088                 setup_readX_header(req, (char *)headerbuf, smb_maxcnt);
     4097                setup_readX_header((char *)headerbuf, smb_maxcnt);
    40894098
    40904099                /* Send out the header. */
     
    41364145        }
    41374146
    4138         setup_readX_header(req, (char *)req->outbuf, nread);
     4147        setup_readX_header((char *)req->outbuf, nread);
    41394148
    41404149        DEBUG(3, ("send_file_readX %s max=%d nread=%d\n",
  • vendor/current/source3/smbd/server.c

    r988 r989  
    397397        }
    398398
    399         status = reinit_after_fork(msg, ev, true, "smbd-notifyd");
     399        status = smbd_reinit_after_fork(msg, ev, true, "smbd-notifyd");
    400400        if (!NT_STATUS_IS_OK(status)) {
    401401                DEBUG(1, ("%s: reinit_after_fork failed: %s\n",
     
    479479        close(up_pipe[0]);
    480480
    481         status = reinit_after_fork(msg, ev, true, "cleanupd");
     481        status = smbd_reinit_after_fork(msg, ev, true, "cleanupd");
    482482        if (!NT_STATUS_IS_OK(status)) {
    483483                DBG_WARNING("reinit_after_fork failed: %s\n",
     
    14131413         * initialized before the messaging context, cause the messaging
    14141414         * context holds an event context.
    1415          * FIXME: This should be s3_tevent_context_init()
    14161415         */
    14171416        ev_ctx = server_event_context();
  • vendor/current/source3/smbd/service.c

    r988 r989  
    182182{
    183183        int snum;
     184        enum remote_arch_types ra_type;
    184185
    185186        if (!conn)  {
     
    207208        last_flags = flags;
    208209
    209         /* Obey the client case sensitivity requests - only for clients that support it. */
     210        /*
     211         * Obey the client case sensitivity requests - only for clients that
     212         * support it. */
    210213        switch (lp_case_sensitive(snum)) {
    211                 case Auto:
    212                         {
    213                                 /* We need this uglyness due to DOS/Win9x clients that lie about case insensitivity. */
    214                                 enum remote_arch_types ra_type = get_remote_arch();
    215                                 if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) {
    216                                         /* Client can't support per-packet case sensitive pathnames. */
    217                                         conn->case_sensitive = False;
    218                                 } else {
    219                                         conn->case_sensitive = !(flags & FLAG_CASELESS_PATHNAMES);
    220                                 }
    221                         }
    222                         break;
    223                 case True:
    224                         conn->case_sensitive = True;
    225                         break;
    226                 default:
    227                         conn->case_sensitive = False;
    228                         break;
    229         }
    230         return(True);
     214        case Auto:
     215                /*
     216                 * We need this uglyness due to DOS/Win9x clients that lie
     217                 * about case insensitivity. */
     218                ra_type = get_remote_arch();
     219                if (conn->sconn->using_smb2) {
     220                        conn->case_sensitive = false;
     221                } else if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) {
     222                        /*
     223                         * Client can't support per-packet case sensitive
     224                         * pathnames. */
     225                        conn->case_sensitive = false;
     226                } else {
     227                        conn->case_sensitive =
     228                                        !(flags & FLAG_CASELESS_PATHNAMES);
     229                }
     230        break;
     231        case True:
     232                conn->case_sensitive = true;
     233                break;
     234        default:
     235                conn->case_sensitive = false;
     236                break;
     237        }
     238        return true;
    231239}
    232240
  • vendor/current/source3/smbd/sesssetup.c

    r988 r989  
    131131        struct smbd_server_connection *sconn = req->sconn;
    132132        uint16_t action = 0;
     133        bool is_authenticated = false;
    133134        NTTIME now = timeval_to_nttime(&req->request_time);
    134135        struct smbXsrv_session *session = NULL;
     
    337338
    338339                if (security_session_user_level(session_info, NULL) >= SECURITY_USER) {
     340                        is_authenticated = true;
    339341                        session->compat->homes_snum =
    340342                                register_homes_share(session_info->unix_info->unix_name);
     
    342344
    343345                if (srv_is_signing_negotiated(xconn) &&
    344                     action == 0 &&
     346                    is_authenticated &&
    345347                    session->global->signing_key.length > 0)
    346348                {
     
    602604        uint16_t smb_flag2 = req->flags2;
    603605        uint16_t action = 0;
     606        bool is_authenticated = false;
    604607        NTTIME now = timeval_to_nttime(&req->request_time);
    605608        struct smbXsrv_session *session = NULL;
     
    10391042
    10401043        if (security_session_user_level(session_info, NULL) >= SECURITY_USER) {
     1044                is_authenticated = true;
    10411045                session->compat->homes_snum =
    10421046                        register_homes_share(session_info->unix_info->unix_name);
     
    10441048
    10451049        if (srv_is_signing_negotiated(xconn) &&
    1046             action == 0 &&
     1050            is_authenticated &&
    10471051            session->global->signing_key.length > 0)
    10481052        {
  • vendor/current/source3/smbd/smb2_glue.c

    r988 r989  
    4949                         FLAGS2_LONG_PATH_COMPONENTS |
    5050                         FLAGS2_IS_LONG_NAME;
     51
     52        /* This is not documented in revision 49 of [MS-SMB2] but should be
     53         * added in a later revision (and torture test smb2.read.access
     54         * as well as smb2.ioctl_copy_chunk_bad_access against
     55         * Server 2012R2 confirms this)
     56         *
     57         * If FILE_EXECUTE is granted to a handle then the SMB2 server
     58         * acts as if FILE_READ_DATA has also been granted. We must still
     59         * keep the original granted mask, because with ioctl requests,
     60         * access checks are made on the file handle, "below" the SMB2
     61         * server, and the object store below the SMB layer is not aware
     62         * of this arrangement (see smb2.ioctl.copy_chunk_bad_access
     63         * torture test).
     64         */
     65        smbreq->flags2 |= FLAGS2_READ_PERMIT_EXECUTE;
     66
    5167        if (IVAL(inhdr, SMB2_HDR_FLAGS) & SMB2_HDR_FLAG_DFS) {
    5268                smbreq->flags2 |= FLAGS2_DFS_PATHNAMES;
  • vendor/current/source3/smbd/smb2_ioctl_filesys.c

    r988 r989  
    4949        /* Windows doesn't check for SEC_FILE_READ_ATTRIBUTE permission here */
    5050
    51         if ((fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) == 0) {
    52                 DEBUG(4, ("FS does not advertise compression support\n"));
    53                 return NT_STATUS_NOT_SUPPORTED;
    54         }
    55 
    5651        ZERO_STRUCT(cmpr_state);
    57         status = SMB_VFS_GET_COMPRESSION(fsp->conn,
    58                                          mem_ctx,
    59                                          fsp,
    60                                          NULL,
    61                                          &cmpr_state.format);
    62         if (!NT_STATUS_IS_OK(status)) {
    63                 return status;
     52        if (fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) {
     53                status = SMB_VFS_GET_COMPRESSION(fsp->conn,
     54                                                 mem_ctx,
     55                                                 fsp,
     56                                                 NULL,
     57                                                 &cmpr_state.format);
     58                if (!NT_STATUS_IS_OK(status)) {
     59                        return status;
     60                }
     61        } else {
     62                /*
     63                 * bso#12144: The underlying filesystem doesn't support
     64                 * compression, so we should respond with "not-compressed"
     65                 * (like WS2016 ReFS) instead of STATUS_NOT_SUPPORTED or
     66                 * NT_STATUS_INVALID_DEVICE_REQUEST.
     67                 */
     68                cmpr_state.format = COMPRESSION_FORMAT_NONE;
    6469        }
    6570
  • vendor/current/source3/smbd/smb2_ioctl_network_fs.c

    r988 r989  
    118118         *   FILE_READ_DATA, and the CtlCode is FSCTL_SRV_COPYCHUNK.
    119119         */
    120         if ((ctl_code == FSCTL_SRV_COPYCHUNK)
    121           && !CHECK_READ(dst_fsp, smb1req)) {
     120        if ((ctl_code == FSCTL_SRV_COPYCHUNK) &&
     121            !CHECK_READ_IOCTL(dst_fsp, smb1req)) {
    122122                DEBUG(5, ("copy chunk no read on dest handle (%s).\n",
    123123                        smb_fname_str_dbg(dst_fsp->fsp_name) ));
  • vendor/current/source3/smbd/smb2_server.c

    r988 r989  
    4747        uint16_t fileid_ofs;
    4848        bool allow_invalid_fileid;
     49        bool modify;
    4950} smbd_smb2_table[] = {
    5051#define _OP(o) .opcode = o, .name = #o
     
    99100                .need_tcon = true,
    100101                .fileid_ofs = 0x10,
     102                .modify = true,
    101103        },{
    102104                _OP(SMB2_OP_LOCK),
     
    110112                .fileid_ofs = 0x08,
    111113                .allow_invalid_fileid = true,
     114                .modify = true,
    112115        },{
    113116                _OP(SMB2_OP_CANCEL),
     
    136139                .need_tcon = true,
    137140                .fileid_ofs = 0x10,
     141                .modify = true,
    138142        },{
    139143                _OP(SMB2_OP_BREAK),
     
    21082112}
    21092113
     2114static NTSTATUS smbd_smb2_request_dispatch_update_counts(
     2115                                struct smbd_smb2_request *req,
     2116                                bool modify_call)
     2117{
     2118        struct smbXsrv_connection *xconn = req->xconn;
     2119        const uint8_t *inhdr;
     2120        uint16_t channel_sequence;
     2121        uint32_t flags;
     2122        int cmp;
     2123        struct smbXsrv_open *op;
     2124        bool update_open = false;
     2125        NTSTATUS status = NT_STATUS_OK;
     2126
     2127        req->request_counters_updated = false;
     2128
     2129        if (xconn->protocol < PROTOCOL_SMB2_22) {
     2130                return NT_STATUS_OK;
     2131        }
     2132
     2133        if (req->compat_chain_fsp == NULL) {
     2134                return NT_STATUS_OK;
     2135        }
     2136
     2137        op = req->compat_chain_fsp->op;
     2138        if (op == NULL) {
     2139                return NT_STATUS_OK;
     2140        }
     2141
     2142        inhdr = SMBD_SMB2_IN_HDR_PTR(req);
     2143        flags = IVAL(inhdr, SMB2_HDR_FLAGS);
     2144        channel_sequence = SVAL(inhdr, SMB2_HDR_CHANNEL_SEQUENCE);
     2145
     2146        cmp = channel_sequence - op->global->channel_sequence;
     2147
     2148        if (abs(cmp) > INT16_MAX) {
     2149                /*
     2150                 * [MS-SMB2] 3.3.5.2.10 - Verifying the Channel Sequence Number:
     2151                 *
     2152                 * If the channel sequence number of the request and the one
     2153                 * known to the server are not equal, the channel sequence
     2154                 * number and outstanding request counts are only updated
     2155                 * "... if the unsigned difference using 16-bit arithmetic
     2156                 * between ChannelSequence and Open.ChannelSequence is less than
     2157                 * or equal to 0x7FFF ...".
     2158                 * Otherwise, an error is returned for the modifying
     2159                 * calls write, set_info, and ioctl.
     2160                 *
     2161                 * There are currently two issues with the description:
     2162                 *
     2163                 * * For the other calls, the document seems to imply
     2164                 *   that processing continues without adapting the
     2165                 *   counters (if the sequence numbers are not equal).
     2166                 *
     2167                 *   TODO: This needs clarification!
     2168                 *
     2169                 * * Also, the behaviour if the difference is larger
     2170                 *   than 0x7FFF is not clear. The document seems to
     2171                 *   imply that if such a difference is reached,
     2172                 *   the server starts to ignore the counters or
     2173                 *   in the case of the modifying calls, return errors.
     2174                 *
     2175                 *   TODO: This needs clarification!
     2176                 *
     2177                 * At this point Samba tries to be a little more
     2178                 * clever than the description in the MS-SMB2 document
     2179                 * by heuristically detecting and properly treating
     2180                 * a 16 bit overflow of the client-submitted sequence
     2181                 * number:
     2182                 *
     2183                 * If the stored channel squence number is more than
     2184                 * 0x7FFF larger than the one from the request, then
     2185                 * the client-provided sequence number has likely
     2186                 * overflown. We treat this case as valid instead
     2187                 * of as failure.
     2188                 *
     2189                 * The MS-SMB2 behaviour would be setting cmp = -1.
     2190                 */
     2191                cmp *= -1;
     2192        }
     2193
     2194        if (!(flags & SMB2_HDR_FLAG_REPLAY_OPERATION)) {
     2195                if (cmp == 0) {
     2196                        op->request_count += 1;
     2197                        req->request_counters_updated = true;
     2198                } else if (cmp > 0) {
     2199                        op->pre_request_count += op->request_count;
     2200                        op->request_count = 1;
     2201                        op->global->channel_sequence = channel_sequence;
     2202                        update_open = true;
     2203                        req->request_counters_updated = true;
     2204                } else if (modify_call) {
     2205                        return NT_STATUS_FILE_NOT_AVAILABLE;
     2206                }
     2207        } else {
     2208                if (cmp == 0 && op->pre_request_count == 0) {
     2209                        op->request_count += 1;
     2210                        req->request_counters_updated = true;
     2211                } else if (cmp > 0 && op->pre_request_count == 0) {
     2212                        op->pre_request_count += op->request_count;
     2213                        op->request_count = 1;
     2214                        op->global->channel_sequence = channel_sequence;
     2215                        update_open = true;
     2216                        req->request_counters_updated = true;
     2217                } else if (modify_call) {
     2218                        return NT_STATUS_FILE_NOT_AVAILABLE;
     2219                }
     2220        }
     2221
     2222        if (update_open) {
     2223                status = smbXsrv_open_update(op);
     2224        }
     2225
     2226        return status;
     2227}
     2228
    21102229NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
    21112230{
     
    24052524        }
    24062525
     2526        status = smbd_smb2_request_dispatch_update_counts(req, call->modify);
     2527        if (!NT_STATUS_IS_OK(status)) {
     2528                return smbd_smb2_request_error(req, status);
     2529        }
     2530
    24072531        if (call->as_root) {
    24082532                SMB_ASSERT(call->fileid_ofs == 0);
     
    25532677}
    25542678
     2679static void smbd_smb2_request_reply_update_counts(struct smbd_smb2_request *req)
     2680{
     2681        struct smbXsrv_connection *xconn = req->xconn;
     2682        const uint8_t *inhdr;
     2683        uint16_t channel_sequence;
     2684        struct smbXsrv_open *op;
     2685
     2686        if (!req->request_counters_updated) {
     2687                return;
     2688        }
     2689
     2690        if (xconn->protocol < PROTOCOL_SMB2_22) {
     2691                return;
     2692        }
     2693
     2694        if (req->compat_chain_fsp == NULL) {
     2695                return;
     2696        }
     2697
     2698        op = req->compat_chain_fsp->op;
     2699        if (op == NULL) {
     2700                return;
     2701        }
     2702
     2703        inhdr = SMBD_SMB2_IN_HDR_PTR(req);
     2704        channel_sequence = SVAL(inhdr, SMB2_HDR_CHANNEL_SEQUENCE);
     2705
     2706        if (op->global->channel_sequence == channel_sequence) {
     2707                SMB_ASSERT(op->request_count > 0);
     2708                op->request_count -= 1;
     2709        } else {
     2710                SMB_ASSERT(op->pre_request_count > 0);
     2711                op->pre_request_count -= 1;
     2712        }
     2713}
     2714
    25552715static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req)
    25562716{
     
    25652725        req->subreq = NULL;
    25662726        TALLOC_FREE(req->async_te);
     2727
     2728        /* MS-SMB2: 3.3.4.1 Sending Any Outgoing Message */
     2729        smbd_smb2_request_reply_update_counts(req);
    25672730
    25682731        if (req->do_encryption &&
  • vendor/current/source3/smbd/trans2.c

    r988 r989  
    33783378                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit;
    33793379                        data_len = 18;
    3380                         df_ret = get_dfree_info(conn, filename, &bsize, &dfree,
    3381                                                 &dsize);
     3380                        df_ret = get_dfree_info(conn, &smb_fname, &bsize,
     3381                                                &dfree, &dsize);
    33823382                        if (df_ret == (uint64_t)-1) {
    33833383                                return map_nt_error_from_unix(errno);
     
    35293529                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit;
    35303530                        data_len = 24;
    3531                         df_ret = get_dfree_info(conn, filename, &bsize, &dfree,
    3532                                                 &dsize);
     3531                        df_ret = get_dfree_info(conn, &smb_fname, &bsize,
     3532                                                &dfree, &dsize);
    35333533                        if (df_ret == (uint64_t)-1) {
    35343534                                return map_nt_error_from_unix(errno);
     
    35633563                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit;
    35643564                        data_len = 32;
    3565                         df_ret = get_dfree_info(conn, filename, &bsize, &dfree,
    3566                                                 &dsize);
     3565                        df_ret = get_dfree_info(conn, &smb_fname, &bsize,
     3566                                                &dfree, &dsize);
    35673567                        if (df_ret == (uint64_t)-1) {
    35683568                                return map_nt_error_from_unix(errno);
     
    41534153                        /* Here is where we must switch to posix pathname processing... */
    41544154                        if (xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
    4155                                 lp_set_posix_pathnames();
     4155                                (void)lp_set_posix_pathnames(true);
    41564156                                mangle_change_to_posix();
    41574157                        }
     
    57015701                        if (info_level == SMB_QUERY_FILE_UNIX_BASIC ||
    57025702                                        info_level == SMB_QUERY_FILE_UNIX_INFO2 ||
    5703                                         info_level == SMB_QUERY_FILE_UNIX_LINK) {
     5703                                        info_level == SMB_QUERY_FILE_UNIX_LINK ||
     5704                                        req->posix_pathnames) {
    57045705                                ucf_flags |= UCF_UNIX_NAME_LOOKUP;
    57055706                        }
     
    57625763                        }
    57635764
    5764                         if (INFO_LEVEL_IS_UNIX(info_level)) {
     5765                        if (INFO_LEVEL_IS_UNIX(info_level) || req->posix_pathnames) {
    57655766                                /* Always do lstat for UNIX calls. */
    57665767                                if (SMB_VFS_LSTAT(conn, smb_fname_base) != 0) {
     
    58085809                }
    58095810
    5810                 if (INFO_LEVEL_IS_UNIX(info_level)) {
     5811                if (INFO_LEVEL_IS_UNIX(info_level) || req->posix_pathnames) {
    58115812                        /* Always do lstat for UNIX calls. */
    58125813                        if (SMB_VFS_LSTAT(conn, smb_fname)) {
  • vendor/current/source3/smbd/vfs.c

    r988 r989  
    594594        len -= fsp->fsp_name->st.st_ex_size;
    595595        len /= 1024; /* Len is now number of 1k blocks needed. */
    596         space_avail = get_dfree_info(conn, fsp->fsp_name->base_name,
    597                                     &bsize, &dfree, &dsize);
     596        space_avail =
     597            get_dfree_info(conn, fsp->fsp_name, &bsize, &dfree, &dsize);
    598598        if (space_avail == (uint64_t)-1) {
    599599                return -1;
Note: See TracChangeset for help on using the changeset viewer.