Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source4/ntvfs/posix
Files:
3 added
1 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/ntvfs/posix/pvfs_acl.c

    r740 r988  
    2121
    2222#include "includes.h"
     23#include "system/passwd.h"
    2324#include "auth/auth.h"
    2425#include "vfs_posix.h"
     
    2728#include "param/param.h"
    2829#include "../lib/util/unix_privs.h"
    29 
    30 #if defined(UID_WRAPPER)
    31 #if !defined(UID_WRAPPER_REPLACE) && !defined(UID_WRAPPER_NOT_REPLACE)
    32 #define UID_WRAPPER_REPLACE
    33 #include "../uid_wrapper/uid_wrapper.h"
    34 #endif
    35 #else
    36 #define uwrap_enabled() 0
    37 #endif
     30#include "lib/util/samba_modules.h"
    3831
    3932/* the list of currently registered ACL backends */
     
    9083}
    9184
    92 NTSTATUS pvfs_acl_init(struct loadparm_context *lp_ctx)
     85NTSTATUS pvfs_acl_init(void)
    9386{
    9487        static bool initialized = false;
     
    10194        initialized = true;
    10295
    103         shared_init = load_samba_modules(NULL, lp_ctx, "pvfs_acl");
     96        shared_init = load_samba_modules(NULL, "pvfs_acl");
    10497
    10598        run_init_functions(static_init);
     
    159152        mode_t mode;
    160153        struct id_map *ids;
    161         struct composite_context *ctx;
    162154
    163155        *psd = security_descriptor_initialise(req);
     
    178170        ids[1].sid = NULL;
    179171
    180         ctx = wbc_xids_to_sids_send(pvfs->wbc_ctx, ids, 2, ids);
    181         NT_STATUS_HAVE_NO_MEMORY(ctx);
    182 
    183         status = wbc_xids_to_sids_recv(ctx, &ids);
     172        status = wbc_xids_to_sids(pvfs->ntvfs->ctx->event_ctx, ids, 2);
    184173        NT_STATUS_NOT_OK_RETURN(status);
    185174
     
    276265                sd->sacl = NULL;
    277266        }
     267}
     268
     269static bool pvfs_privileged_access(uid_t uid)
     270{
     271        uid_t euid;
     272
     273        if (uid_wrapper_enabled()) {
     274                setenv("UID_WRAPPER_MYUID", "1", 1);
     275        }
     276
     277        euid = geteuid();
     278
     279        if (uid_wrapper_enabled()) {
     280                unsetenv("UID_WRAPPER_MYUID");
     281        }
     282
     283        return (uid == euid);
    278284}
    279285
     
    295301        gid_t new_gid = -1;
    296302        struct id_map *ids;
    297         struct composite_context *ctx;
    298303
    299304        if (pvfs->acl_ops != NULL) {
     
    326331                if (!dom_sid_equal(sd->owner_sid, new_sd->owner_sid)) {
    327332                        ids->sid = new_sd->owner_sid;
    328                         ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx, ids, 1, ids);
    329                         NT_STATUS_HAVE_NO_MEMORY(ctx);
    330                         status = wbc_sids_to_xids_recv(ctx, &ids);
     333                        status = wbc_sids_to_xids(pvfs->ntvfs->ctx->event_ctx,
     334                                                  ids, 1);
    331335                        NT_STATUS_NOT_OK_RETURN(status);
    332336
     
    338342                sd->owner_sid = new_sd->owner_sid;
    339343        }
     344
    340345        if (secinfo_flags & SECINFO_GROUP) {
    341346                if (!(access_mask & SEC_STD_WRITE_OWNER)) {
     
    344349                if (!dom_sid_equal(sd->group_sid, new_sd->group_sid)) {
    345350                        ids->sid = new_sd->group_sid;
    346                         ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx, ids, 1, ids);
    347                         NT_STATUS_HAVE_NO_MEMORY(ctx);
    348                         status = wbc_sids_to_xids_recv(ctx, &ids);
     351                        status = wbc_sids_to_xids(pvfs->ntvfs->ctx->event_ctx,
     352                                                  ids, 1);
    349353                        NT_STATUS_NOT_OK_RETURN(status);
    350354
     
    357361                sd->group_sid = new_sd->group_sid;
    358362        }
     363
    359364        if (secinfo_flags & SECINFO_DACL) {
    360365                if (!(access_mask & SEC_STD_WRITE_DAC)) {
     
    363368                sd->dacl = new_sd->dacl;
    364369                pvfs_translate_generic_bits(sd->dacl);
    365         }
     370                sd->type |= SEC_DESC_DACL_PRESENT;
     371        }
     372
    366373        if (secinfo_flags & SECINFO_SACL) {
    367374                if (!(access_mask & SEC_FLAG_SYSTEM_SECURITY)) {
     
    370377                sd->sacl = new_sd->sacl;
    371378                pvfs_translate_generic_bits(sd->sacl);
     379                sd->type |= SEC_DESC_SACL_PRESENT;
     380        }
     381
     382        if (secinfo_flags & SECINFO_PROTECTED_DACL) {
     383                if (new_sd->type & SEC_DESC_DACL_PROTECTED) {
     384                        sd->type |= SEC_DESC_DACL_PROTECTED;
     385                } else {
     386                        sd->type &= ~SEC_DESC_DACL_PROTECTED;
     387                }
     388        }
     389
     390        if (secinfo_flags & SECINFO_PROTECTED_SACL) {
     391                if (new_sd->type & SEC_DESC_SACL_PROTECTED) {
     392                        sd->type |= SEC_DESC_SACL_PROTECTED;
     393                } else {
     394                        sd->type &= ~SEC_DESC_SACL_PROTECTED;
     395                }
    372396        }
    373397
     
    389413                }
    390414                if (errno == EPERM) {
    391                         if (uwrap_enabled()) {
     415                        if (pvfs_privileged_access(name->st.st_uid)) {
    392416                                ret = 0;
    393417                        } else {
     
    484508        }
    485509        ngroups = getgroups(0, NULL);
    486         if (ngroups == 0) {
     510        if (ngroups <= 0) {
    487511                return false;
    488512        }
     
    515539                                       uint32_t *access_mask)
    516540{
    517         uid_t uid = geteuid();
    518         uint32_t max_bits = SEC_RIGHTS_FILE_READ | SEC_FILE_ALL;
     541        uint32_t max_bits = 0;
    519542        struct security_token *token = req->session_info->security_token;
    520543
     
    523546        }
    524547
    525         if (name == NULL || uid == name->st.st_uid) {
    526                 max_bits |= SEC_STD_ALL;
    527         } else if (security_token_has_privilege(token, SEC_PRIV_RESTORE)) {
    528                 max_bits |= SEC_STD_DELETE;
    529         }
    530 
    531         if (name == NULL ||
    532             (name->st.st_mode & S_IWOTH) ||
    533             ((name->st.st_mode & S_IWGRP) &&
    534              pvfs_group_member(pvfs, name->st.st_gid))) {
    535                 max_bits |= SEC_STD_ALL;
    536         }
    537 
    538         if (uwrap_enabled()) {
    539                 /* when running with the uid wrapper, files will be created
    540                    owned by the ruid, but we may have a different simulated
    541                    euid. We need to force the permission bits as though the
    542                    files owner matches the euid */
    543                 max_bits |= SEC_STD_ALL;
     548        if (name == NULL) {
     549                max_bits |= SEC_RIGHTS_FILE_ALL | SEC_STD_ALL;
     550        } else if (pvfs_privileged_access(name->st.st_uid)) {
     551                /* use the IxUSR bits */
     552                if ((name->st.st_mode & S_IWUSR)) {
     553                        max_bits |= SEC_RIGHTS_FILE_ALL | SEC_STD_ALL;
     554                } else if ((name->st.st_mode & (S_IRUSR | S_IXUSR))) {
     555                        max_bits |= SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_EXECUTE | SEC_STD_ALL;
     556                }
     557        } else if (pvfs_group_member(pvfs, name->st.st_gid)) {
     558                /* use the IxGRP bits */
     559                if ((name->st.st_mode & S_IWGRP)) {
     560                        max_bits |= SEC_RIGHTS_FILE_ALL | SEC_STD_ALL;
     561                } else if ((name->st.st_mode & (S_IRGRP | S_IXGRP))) {
     562                        max_bits |= SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_EXECUTE | SEC_STD_ALL;
     563                }
     564        } else {
     565                /* use the IxOTH bits */
     566                if ((name->st.st_mode & S_IWOTH)) {
     567                        max_bits |= SEC_RIGHTS_FILE_ALL | SEC_STD_ALL;
     568                } else if ((name->st.st_mode & (S_IROTH | S_IXOTH))) {
     569                        max_bits |= SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_EXECUTE | SEC_STD_ALL;
     570                }
    544571        }
    545572
     
    564591
    565592        if (*access_mask & ~max_bits) {
    566                 DEBUG(0,(__location__ " denied access to '%s' - wanted 0x%08x but got 0x%08x (missing 0x%08x)\n",
     593                DEBUG(5,(__location__ " denied access to '%s' - wanted 0x%08x but got 0x%08x (missing 0x%08x)\n",
    567594                         name?name->full_name:"(new file)", *access_mask, max_bits, *access_mask & ~max_bits));
    568595                return NT_STATUS_ACCESS_DENIED;
    569596        }
    570597
    571         if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
     598        if (pvfs->ntvfs->ctx->protocol < PROTOCOL_SMB2_02) {
    572599                /* on SMB, this bit is always granted, even if not
    573600                   asked for */
     
    596623
    597624        /* on SMB2 a blank access mask is always denied */
    598         if (pvfs->ntvfs->ctx->protocol == PROTOCOL_SMB2 &&
     625        if (pvfs->ntvfs->ctx->protocol >= PROTOCOL_SMB2_02 &&
    599626            *access_mask == 0) {
    600627                return NT_STATUS_ACCESS_DENIED;
     
    622649        /* expand the generic access bits to file specific bits */
    623650        *access_mask = pvfs_translate_mask(*access_mask);
    624         if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
     651        if (pvfs->ntvfs->ctx->protocol < PROTOCOL_SMB2_02) {
    625652                *access_mask &= ~SEC_FILE_READ_ATTRIBUTE;
    626653        }
     
    647674        status = se_access_check(sd, token, *access_mask, access_mask);
    648675        talloc_free(acl);
     676
     677        /* if we used a NT acl, then allow access override if the
     678           share allows for posix permission override
     679        */
     680        if (NT_STATUS_IS_OK(status)) {
     681                name->allow_override = (pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) != 0;
     682        }
     683
    649684done:
    650         if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
     685        if (pvfs->ntvfs->ctx->protocol < PROTOCOL_SMB2_02) {
    651686                /* on SMB, this bit is always granted, even if not
    652687                   asked for */
     
    746781        }
    747782
    748         if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
     783        if (pvfs->ntvfs->ctx->protocol < PROTOCOL_SMB2_02) {
    749784                /* on SMB, this bit is always granted, even if not
    750785                   asked for */
     
    775810        }
    776811
    777         return pvfs_access_check_simple(pvfs, req, parent, access_mask);
     812        status = pvfs_access_check_simple(pvfs, req, parent, access_mask);
     813        if (NT_STATUS_IS_OK(status) && parent->allow_override) {
     814                name->allow_override = true;
     815        }
     816        return status;
    778817}
    779818
     
    899938        struct security_descriptor *parent_sd, *sd;
    900939        struct id_map *ids;
    901         struct composite_context *ctx;
    902940        TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
    903941
     
    905943
    906944        acl = talloc(req, struct xattr_NTACL);
    907         NT_STATUS_HAVE_NO_MEMORY_AND_FREE(acl, tmp_ctx);
     945        if (acl == NULL) {
     946                TALLOC_FREE(tmp_ctx);
     947                return NT_STATUS_NO_MEMORY;
     948        }
    908949
    909950        status = pvfs_acl_load(pvfs, parent, -1, acl);
     
    912953                return NT_STATUS_OK;
    913954        }
    914         NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx);
     955        if (!NT_STATUS_IS_OK(status)) {
     956                TALLOC_FREE(tmp_ctx);
     957                return status;
     958        }
    915959
    916960        switch (acl->version) {
     
    933977        /* create the new sd */
    934978        sd = security_descriptor_initialise(req);
    935         NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sd, tmp_ctx);
     979        if (sd == NULL) {
     980                TALLOC_FREE(tmp_ctx);
     981                return NT_STATUS_NO_MEMORY;
     982        }
    936983
    937984        ids = talloc_array(sd, struct id_map, 2);
    938         NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids, tmp_ctx);
     985        if (ids == NULL) {
     986                TALLOC_FREE(tmp_ctx);
     987                return NT_STATUS_NO_MEMORY;
     988        }
    939989
    940990        ids[0].xid.id = geteuid();
     
    948998        ids[1].status = ID_UNKNOWN;
    949999
    950         ctx = wbc_xids_to_sids_send(pvfs->wbc_ctx, ids, 2, ids);
    951         NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ctx, tmp_ctx);
    952 
    953         status = wbc_xids_to_sids_recv(ctx, &ids);
    954         NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx);
     1000        status = wbc_xids_to_sids(pvfs->ntvfs->ctx->event_ctx, ids, 2);
     1001        if (!NT_STATUS_IS_OK(status)) {
     1002                TALLOC_FREE(tmp_ctx);
     1003                return status;
     1004        }
    9551005
    9561006        sd->owner_sid = talloc_steal(sd, ids[0].sid);
     
    9611011        /* fill in the aces from the parent */
    9621012        status = pvfs_acl_inherit_aces(pvfs, parent_sd, sd, container);
    963         NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx);
     1013        if (!NT_STATUS_IS_OK(status)) {
     1014                TALLOC_FREE(tmp_ctx);
     1015                return status;
     1016        }
    9641017
    9651018        /* if there is nothing to inherit then we fallback to the
  • vendor/current/source4/ntvfs/posix/pvfs_acl_nfs4.c

    r740 r988  
    2727#include "libcli/security/security.h"
    2828
     29NTSTATUS pvfs_acl_nfs4_init(void);
     30
    2931#define ACE4_IDENTIFIER_GROUP 0x40
    3032
     
    4143        int i, num_ids;
    4244        struct id_map *ids;
    43         struct composite_context *ctx;
    4445
    4546        acl = talloc_zero(mem_ctx, struct nfs4acl);
     
    9091        /* Allocate memory for the sids from the security descriptor to be on
    9192         * the safe side. */
    92         ctx = wbc_xids_to_sids_send(pvfs->wbc_ctx, sd, num_ids, ids);
    93         NT_STATUS_HAVE_NO_MEMORY(ctx);
    94         status = wbc_xids_to_sids_recv(ctx, &ids);
     93        status = wbc_xids_to_sids(pvfs->ntvfs->ctx->event_ctx, ids, num_ids);
    9594        NT_STATUS_NOT_OK_RETURN(status);
    9695
     
    123122        TALLOC_CTX *tmp_ctx;
    124123        struct id_map *ids;
    125         struct composite_context *ctx;
    126124
    127125        tmp_ctx = talloc_new(pvfs);
     
    158156        }
    159157
    160         ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx,ids, acl.a_count, ids);
    161         if (ctx == NULL) {
    162                 talloc_free(tmp_ctx);
    163                 return NT_STATUS_NO_MEMORY;
    164         }
    165         status = wbc_sids_to_xids_recv(ctx, &ids);
     158        status = wbc_sids_to_xids(pvfs->ntvfs->ctx->event_ctx, ids,
     159                                  acl.a_count);
    166160        if (!NT_STATUS_IS_OK(status)) {
    167161                talloc_free(tmp_ctx);
  • vendor/current/source4/ntvfs/posix/pvfs_acl_xattr.c

    r740 r988  
    2424#include "../lib/util/unix_privs.h"
    2525#include "librpc/gen_ndr/ndr_xattr.h"
     26
     27NTSTATUS pvfs_acl_xattr_init(void);
    2628
    2729/*
  • vendor/current/source4/ntvfs/posix/pvfs_dirlist.c

    r414 r988  
    200200                (*ofs) = DIR_OFFSET_DOTDOT;
    201201                dir->offset = *ofs;
    202                 if (ms_fnmatch(dir->pattern, ".", protocol) == 0) {
     202                if (ms_fnmatch_protocol(dir->pattern, ".", protocol) == 0) {
    203203                        dcache_add(dir, ".");
    204204                        return ".";
     
    209209                (*ofs) = DIR_OFFSET_BASE;
    210210                dir->offset = *ofs;
    211                 if (ms_fnmatch(dir->pattern, "..", protocol) == 0) {
     211                if (ms_fnmatch_protocol(dir->pattern, "..", protocol) == 0) {
    212212                        dcache_add(dir, "..");
    213213                        return "..";
     
    229229                }
    230230
    231                 if (ms_fnmatch(dir->pattern, dname, protocol) != 0) {
     231                if (ms_fnmatch_protocol(dir->pattern, dname, protocol) != 0) {
    232232                        char *short_name = pvfs_short_name_component(dir->pvfs, dname);
    233233                        if (short_name == NULL ||
    234                             ms_fnmatch(dir->pattern, short_name, protocol) != 0) {
     234                            ms_fnmatch_protocol(dir->pattern, short_name, protocol) != 0) {
    235235                                talloc_free(short_name);
    236236                                continue;
  • vendor/current/source4/ntvfs/posix/pvfs_fileinfo.c

    r740 r988  
    8282        name->dos.alloc_size = pvfs_round_alloc_size(pvfs, name->st.st_size);
    8383        name->dos.nlink = name->st.st_nlink;
    84         name->dos.ea_size = 4;
    85         if (pvfs->ntvfs->ctx->protocol == PROTOCOL_SMB2) {
     84        name->dos.ea_size = 4;  /* TODO: Fill this in without hitting the stream bad in pvfs_doseas_load() */
     85        if (pvfs->ntvfs->ctx->protocol >= PROTOCOL_SMB2_02) {
    8686                /* SMB2 represents a null EA with zero bytes */
    8787                name->dos.ea_size = 0;
  • vendor/current/source4/ntvfs/posix/pvfs_fsinfo.c

    r740 r988  
    202202                return NT_STATUS_OK;
    203203
     204        case RAW_QFS_SECTOR_SIZE_INFORMATION:
     205                fs->sector_size_info.out.logical_bytes_per_sector = block_size;
     206                fs->sector_size_info.out.phys_bytes_per_sector_atomic
     207                                                                = block_size;
     208                fs->sector_size_info.out.phys_bytes_per_sector_perf
     209                                                                = block_size;
     210                fs->sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic
     211                                                                = block_size;
     212                fs->sector_size_info.out.flags
     213                                        = QFS_SSINFO_FLAGS_ALIGNED_DEVICE
     214                                | QFS_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE;
     215                fs->sector_size_info.out.byte_off_sector_align = 0;
     216                fs->sector_size_info.out.byte_off_partition_align = 0;
     217                return NT_STATUS_OK;
     218
    204219        default:
    205220                break;
  • vendor/current/source4/ntvfs/posix/pvfs_ioctl.c

    r414 r988  
    2222#include "includes.h"
    2323#include "vfs_posix.h"
    24 #include "libcli/raw/ioctl.h"
     24#include "../libcli/smb/smb_constants.h"
    2525
    2626/*
  • vendor/current/source4/ntvfs/posix/pvfs_lock.c

    r740 r988  
    4040        }
    4141
    42         return brl_locktest(pvfs->brl_context,
     42        return brlock_locktest(pvfs->brl_context,
    4343                            f->brl_handle,
    4444                            smbpid,
     
    7171        /* undo the locks we just did */
    7272        for (i--;i>=0;i--) {
    73                 brl_unlock(pvfs->brl_context,
     73                brlock_unlock(pvfs->brl_context,
    7474                           f->brl_handle,
    7575                           locks[i].pid,
     
    117117        /* we don't retry on a cancel */
    118118        if (reason == PVFS_WAIT_CANCEL) {
    119                 if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
     119                if (pvfs->ntvfs->ctx->protocol < PROTOCOL_SMB2_02) {
    120120                        status = NT_STATUS_FILE_LOCK_CONFLICT;
    121121                } else {
     
    128128                 * FILE_LOCK_CONFLICT in the error case
    129129                 */
    130                 status = brl_lock(pvfs->brl_context,
     130                status = brlock_lock(pvfs->brl_context,
    131131                                  f->brl_handle,
    132132                                  locks[pending->pending_lock].pid,
     
    144144        if (NT_STATUS_IS_OK(status) || timed_out) {
    145145                NTSTATUS status2;
    146                 status2 = brl_remove_pending(pvfs->brl_context,
     146                status2 = brlock_remove_pending(pvfs->brl_context,
    147147                                             f->brl_handle, pending);
    148148                if (!NT_STATUS_IS_OK(status2)) {
     
    178178                }
    179179
    180                 status = brl_lock(pvfs->brl_context,
     180                status = brlock_lock(pvfs->brl_context,
    181181                                  f->brl_handle,
    182182                                  locks[i].pid,
     
    226226                DEBUG(5,("pvfs_lock: removing %.0f locks on close\n",
    227227                         (double)f->lock_count));
    228                 brl_close(f->pvfs->brl_context, f->brl_handle);
     228                brlock_close(f->pvfs->brl_context, f->brl_handle);
    229229                f->lock_count = 0;
    230230        }
     
    325325
    326326                pending->end_time =
    327                         timeval_current_ofs(lck->lockx.in.timeout/1000,
    328                                             1000*(lck->lockx.in.timeout%1000));
     327                        timeval_current_ofs_msec(lck->lockx.in.timeout);
    329328        }
    330329
     
    351350
    352351        for (i=0;i<lck->lockx.in.ulock_cnt;i++) {
    353                 status = brl_unlock(pvfs->brl_context,
     352                status = brlock_unlock(pvfs->brl_context,
    354353                                    f->brl_handle,
    355354                                    locks[i].pid,
     
    370369                }
    371370
    372                 status = brl_lock(pvfs->brl_context,
     371                status = brlock_lock(pvfs->brl_context,
    373372                                  f->brl_handle,
    374373                                  locks[i].pid,
     
    395394                        /* undo the locks we just did */
    396395                        for (i--;i>=0;i--) {
    397                                 brl_unlock(pvfs->brl_context,
     396                                brlock_unlock(pvfs->brl_context,
    398397                                           f->brl_handle,
    399398                                           locks[i].pid,
  • vendor/current/source4/ntvfs/posix/pvfs_mkdir.c

    r740 r988  
    5252        mode = pvfs_fileperms(pvfs, FILE_ATTRIBUTE_DIRECTORY);
    5353
    54         if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) {
     54        if (pvfs_sys_mkdir(pvfs, name->full_name, mode, name->allow_override) == -1) {
    5555                return pvfs_map_errno(pvfs, errno);
    5656        }
     
    7070        status = pvfs_acl_inherit(pvfs, req, name, -1);
    7171        if (!NT_STATUS_IS_OK(status)) {
    72                 pvfs_sys_rmdir(pvfs, name->full_name);
     72                pvfs_sys_rmdir(pvfs, name->full_name, name->allow_override);
    7373                return status;
    7474        }
     
    7979                                         md->t2mkdir.in.eas);
    8080        if (!NT_STATUS_IS_OK(status)) {
    81                 pvfs_sys_rmdir(pvfs, name->full_name);
     81                pvfs_sys_rmdir(pvfs, name->full_name, name->allow_override);
    8282                return status;
    8383        }
     
    128128        mode = pvfs_fileperms(pvfs, FILE_ATTRIBUTE_DIRECTORY);
    129129
    130         if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) {
     130        if (pvfs_sys_mkdir(pvfs, name->full_name, mode, name->allow_override) == -1) {
    131131                return pvfs_map_errno(pvfs, errno);
    132132        }
     
    137137        status = pvfs_acl_inherit(pvfs, req, name, -1);
    138138        if (!NT_STATUS_IS_OK(status)) {
    139                 pvfs_sys_rmdir(pvfs, name->full_name);
     139                pvfs_sys_rmdir(pvfs, name->full_name, name->allow_override);
    140140                return status;
    141141        }
     
    180180        }
    181181
    182         if (pvfs_sys_rmdir(pvfs, name->full_name) == -1) {
     182        if (pvfs_sys_rmdir(pvfs, name->full_name, name->allow_override) == -1) {
    183183                /* some olders systems don't return ENOTEMPTY to rmdir() */
    184184                if (errno == EEXIST) {
  • vendor/current/source4/ntvfs/posix/pvfs_notify.c

    r740 r988  
    110110           would free the request, and the ntvfs modules above us
    111111           could use it, so call it on the next event */
    112         event_add_timed(req->ctx->event_ctx,
     112        tevent_add_timer(req->ctx->event_ctx,
    113113                        req, timeval_zero(), pvfs_notify_send_next, req);
    114114}
     
    279279        pending->info = info;
    280280
    281         DLIST_ADD_END(f->notify_buffer->pending, pending, struct notify_pending *);
     281        DLIST_ADD_END(f->notify_buffer->pending, pending);
    282282
    283283        /* if the buffer is empty then start waiting */
  • vendor/current/source4/ntvfs/posix/pvfs_open.c

    r740 r988  
    7474                                         delete_path, nt_errstr(status)));
    7575                        }
    76                         if (pvfs_sys_rmdir(h->pvfs, delete_path) != 0) {
     76                        if (pvfs_sys_rmdir(h->pvfs, delete_path, h->name->allow_override) != 0) {
    7777                                DEBUG(0,("pvfs_dir_handle_destructor: failed to rmdir '%s' - %s\n",
    7878                                         delete_path, strerror(errno)));
     
    345345                mode_t mode = pvfs_fileperms(pvfs, attrib);
    346346
    347                 if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) {
     347                if (pvfs_sys_mkdir(pvfs, name->full_name, mode, name->allow_override) == -1) {
    348348                        return pvfs_map_errno(pvfs,errno);
    349349                }
     
    433433
    434434cleanup_delete:
    435         pvfs_sys_rmdir(pvfs, name->full_name);
     435        pvfs_sys_rmdir(pvfs, name->full_name, name->allow_override);
    436436        return status;
    437437}
     
    515515                                         delete_path, nt_errstr(status)));
    516516                        }
    517                         if (pvfs_sys_unlink(h->pvfs, delete_path) != 0) {
     517                        if (pvfs_sys_unlink(h->pvfs, delete_path, h->name->allow_override) != 0) {
    518518                                DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n",
    519519                                         delete_path, strerror(errno)));
     
    591591        }
    592592
    593         h = brl_create_handle(mem_ctx, ntvfs, &key);
     593        h = brlock_create_handle(mem_ctx, ntvfs, &key);
    594594        NT_STATUS_HAVE_NO_MEMORY(h);
    595595
     
    678678
    679679        /* create the file */
    680         fd = pvfs_sys_open(pvfs, name->full_name, flags | O_CREAT | O_EXCL| O_NONBLOCK, mode);
     680        fd = pvfs_sys_open(pvfs, name->full_name, flags | O_CREAT | O_EXCL| O_NONBLOCK, mode, name->allow_override);
    681681        if (fd == -1) {
    682682                return pvfs_map_errno(pvfs, errno);
     
    718718                status = pvfs_access_maximal_allowed(pvfs, req, name,
    719719                                                     &io->generic.out.maximal_access);
    720                 NT_STATUS_NOT_OK_RETURN(status);
     720                if (!NT_STATUS_IS_OK(status)) {
     721                        goto cleanup_delete;
     722                }
    721723        }
    722724
     
    857859cleanup_delete:
    858860        close(fd);
    859         pvfs_sys_unlink(pvfs, name->full_name);
     861        pvfs_sys_unlink(pvfs, name->full_name, name->allow_override);
    860862        return status;
    861863}
     
    11751177                                             pvfs->oplock_break_timeout,
    11761178                                             0);
    1177                 end_time = timeval_current_ofs(0, (pvfs->sharing_violation_delay*4)/5);
     1179                end_time = timeval_current_ofs_usec((pvfs->sharing_violation_delay*4)/5);
    11781180                end_time = timeval_min(final_timeout, &end_time);
    11791181        } else {
     
    12851287
    12861288        /* what does this bit really mean?? */
    1287         if (req->ctx->protocol == PROTOCOL_SMB2 &&
     1289        if (req->ctx->protocol >= PROTOCOL_SMB2_02 &&
    12881290            access_mask == SEC_STD_SYNCHRONIZE) {
    12891291                return NT_STATUS_ACCESS_DENIED;
     
    15031505         */
    15041506        if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE &&
    1505             req->ctx->protocol == PROTOCOL_SMB2) {
     1507            req->ctx->protocol >= PROTOCOL_SMB2_02) {
    15061508                del_on_close = true;
    15071509        } else {
     
    15501552
    15511553        /* do the actual open */
    1552         fd = pvfs_sys_open(pvfs, f->handle->name->full_name, flags | O_NONBLOCK, 0);
     1554        fd = pvfs_sys_open(pvfs, f->handle->name->full_name, flags | O_NONBLOCK, 0, name->allow_override);
    15531555        if (fd == -1) {
    15541556                status = pvfs_map_errno(f->pvfs, errno);
     
    15701572        f->handle->fd = fd;
    15711573
    1572         status = brl_count(f->pvfs->brl_context, f->brl_handle, &count);
     1574        status = brlock_count(f->pvfs->brl_context, f->brl_handle, &count);
    15731575        if (!NT_STATUS_IS_OK(status)) {
    15741576                talloc_free(lck);
     
    16361638                if (f->handle->name->st.st_mode != mode &&
    16371639                    f->handle->name->dos.attrib != attrib &&
    1638                     pvfs_sys_fchmod(pvfs, fd, mode) == -1) {
     1640                    pvfs_sys_fchmod(pvfs, fd, mode, name->allow_override) == -1) {
    16391641                        talloc_free(lck);
    16401642                        return pvfs_map_errno(pvfs, errno);
  • vendor/current/source4/ntvfs/posix/pvfs_oplock.c

    r414 r988  
    3333        struct timeval break_to_level_II;
    3434        struct timeval break_to_none;
    35         struct messaging_context *msg_ctx;
     35        struct imessaging_context *msg_ctx;
    3636};
    3737
     
    159159}
    160160
    161 static void pvfs_oplock_break_dispatch(struct messaging_context *msg,
     161static void pvfs_oplock_break_dispatch(struct imessaging_context *msg,
    162162                                       void *private_data, uint32_t msg_type,
    163163                                       struct server_id src, DATA_BLOB *data)
     
    170170
    171171        /* we need to check that this one is for us. See
    172            messaging_send_ptr() for the other side of this.
     172           imessaging_send_ptr() for the other side of this.
    173173         */
    174174        if (data->length == sizeof(struct opendb_oplock_break)) {
     
    193193static int pvfs_oplock_destructor(struct pvfs_oplock *opl)
    194194{
    195         messaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl);
     195        imessaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl);
    196196        return 0;
    197197}
     
    229229        opl->msg_ctx    = f->pvfs->ntvfs->ctx->msg_ctx;
    230230
    231         status = messaging_register(opl->msg_ctx,
     231        status = imessaging_register(opl->msg_ctx,
    232232                                    opl,
    233233                                    MSG_NTVFS_OPLOCK_BREAK,
  • vendor/current/source4/ntvfs/posix/pvfs_qfileinfo.c

    r740 r988  
    103103                        if (strcasecmp_m(eas->eas[i].name.s,
    104104                                       ealist->eas[j].name) == 0) {
     105                                if (ealist->eas[j].value.length == 0) {
     106                                        continue;
     107                                }
    105108                                eas->eas[i].value = ealist->eas[j].value;
    106109                                break;
     
    135138                eas->eas[eas->num_eas].flags = 0;
    136139                eas->eas[eas->num_eas].name.s = ealist->eas[i].name;
     140                if (ealist->eas[i].value.length == 0) {
     141                        continue;
     142                }
    137143                eas->eas[eas->num_eas].value = ealist->eas[i].value;
    138144                eas->num_eas++;
     
    150156{
    151157        switch (info->generic.level) {
    152         case RAW_FILEINFO_GENERIC:
    153                 return NT_STATUS_INVALID_LEVEL;
    154 
    155158        case RAW_FILEINFO_GETATTR:
    156159                info->getattr.out.attrib     = name->dos.attrib;
     
    226229        case RAW_FILEINFO_NAME_INFO:
    227230        case RAW_FILEINFO_NAME_INFORMATION:
    228                 if (req->ctx->protocol == PROTOCOL_SMB2) {
     231                if (req->ctx->protocol >= PROTOCOL_SMB2_02) {
    229232                        /* strange that SMB2 doesn't have this */
    230233                        return NT_STATUS_NOT_SUPPORTED;
     
    334337                NT_STATUS_HAVE_NO_MEMORY(info->all_info2.out.fname.s);
    335338                return NT_STATUS_OK;
     339
     340        case RAW_FILEINFO_GENERIC:
     341        case RAW_FILEINFO_UNIX_BASIC:
     342        case RAW_FILEINFO_UNIX_INFO2:
     343        case RAW_FILEINFO_UNIX_LINK:
     344                return NT_STATUS_INVALID_LEVEL;
    336345        }
    337346
  • vendor/current/source4/ntvfs/posix/pvfs_read.c

    r740 r988  
    6060
    6161        maxcnt = rd->readx.in.maxcnt;
    62         if (maxcnt > 2*UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2) {
     62        if (maxcnt > 2*UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2_02) {
    6363                DEBUG(3,(__location__ ": Invalid SMB maxcnt 0x%x\n", maxcnt));
    6464                return NT_STATUS_INVALID_PARAMETER;
     
    9797
    9898        /* only SMB2 honors mincnt */
    99         if (req->ctx->protocol == PROTOCOL_SMB2) {
     99        if (req->ctx->protocol >= PROTOCOL_SMB2_02) {
    100100                if (rd->readx.in.mincnt > ret ||
    101101                    (ret == 0 && maxcnt > 0)) {
  • vendor/current/source4/ntvfs/posix/pvfs_rename.c

    r740 r988  
    3838        NTSTATUS status;
    3939
    40         if (pvfs_sys_rename(pvfs, name1->full_name, name2) == -1) {
     40        if (pvfs_sys_rename(pvfs, name1->full_name, name2,
     41                            name1->allow_override) == -1) {
    4142                return pvfs_map_errno(pvfs, errno);
    4243        }
     
    625626                status = pvfs_access_check_parent(pvfs, req, name2, SEC_DIR_ADD_FILE);
    626627                NT_STATUS_NOT_OK_RETURN(status);
    627                 return pvfs_copy_file(pvfs, name1, name2);
     628                return pvfs_copy_file(pvfs, name1, name2, name1->allow_override && name2->allow_override);
    628629
    629630        case RENAME_FLAG_MOVE_CLUSTER_INFORMATION:
  • vendor/current/source4/ntvfs/posix/pvfs_resolve.c

    r740 r988  
    519519        (*name)->exists = false;
    520520        (*name)->stream_exists = false;
     521        (*name)->allow_override = false;
    521522
    522523        if (!(pvfs->fs_attribs & FS_ATTR_NAMED_STREAMS)) {
     
    525526
    526527        /* SMB2 doesn't allow a leading slash */
    527         if (req->ctx->protocol == PROTOCOL_SMB2 &&
     528        if (req->ctx->protocol >= PROTOCOL_SMB2_02 &&
    528529            *cifs_name == '\\') {
    529530                return NT_STATUS_INVALID_PARAMETER;
     
    631632        (*name)->stream_name = NULL;
    632633        (*name)->stream_id = 0;
     634        (*name)->allow_override = false;
    633635
    634636        status = pvfs_fill_dos_info(pvfs, *name, flags, -1);
     
    693695        if (h->have_opendb_entry) {
    694696                struct odb_lock *lck;
    695                 char *name = NULL;
     697                const char *name = NULL;
    696698
    697699                lck = odb_lock(h, h->pvfs->odb_context, &h->odb_locking_key);
     
    704706                }
    705707
    706                 status = odb_get_path(lck, (const char **) &name);
     708                status = odb_get_path(lck, &name);
    707709                if (NT_STATUS_IS_OK(status)) {
    708710                        /*
     
    718720                                char *new_orig;
    719721                                char *delim;
     722                                char *full_name = discard_const_p(char, name);
    720723
    721724                                delim = strrchr(name, '/');
     
    746749                                talloc_free(h->name->original_name);
    747750                                talloc_free(h->name->full_name);
    748                                 h->name->full_name = talloc_steal(h->name, name);
     751                                h->name->full_name = talloc_steal(h->name, full_name);
    749752                                h->name->original_name = new_orig;
    750753                        }
     
    816819        (*name)->stream_name = NULL;
    817820        (*name)->stream_id = 0;
     821        (*name)->allow_override = false;
    818822
    819823        status = pvfs_fill_dos_info(pvfs, *name, PVFS_RESOLVE_NO_OPENDB, -1);
  • vendor/current/source4/ntvfs/posix/pvfs_search.c

    r740 r988  
    6262        if (search->handle == INVALID_SEARCH_HANDLE) return;
    6363        talloc_free(search->te);
    64         search->te = event_add_timed(ev, search,
     64        search->te = tevent_add_timer(ev, search,
    6565                                     timeval_current_ofs(search->pvfs->search.inactivity_time, 0),
    6666                                     pvfs_search_timer, search);
     
    222222
    223223        case RAW_SEARCH_DATA_GENERIC:
    224                 break;
     224        case RAW_SEARCH_DATA_UNIX_INFO:
     225        case RAW_SEARCH_DATA_UNIX_INFO2:
     226                return NT_STATUS_INVALID_LEVEL;
    225227        }
    226228
  • vendor/current/source4/ntvfs/posix/pvfs_setfileinfo.c

    r740 r988  
    131131        /* renames are only allowed within a directory */
    132132        if (strchr_m(info->rename_information.in.new_name, '\\') &&
    133             (req->ctx->protocol != PROTOCOL_SMB2)) {
     133            (req->ctx->protocol < PROTOCOL_SMB2_02)) {
    134134                return NT_STATUS_NOT_SUPPORTED;
    135135        }
     
    144144           but I suspect it is just uninitialised memory */
    145145        if (info->rename_information.in.root_fid != 0 &&
    146             (req->ctx->protocol != PROTOCOL_SMB2)) {
     146            (req->ctx->protocol < PROTOCOL_SMB2_02)) {
    147147                return NT_STATUS_INVALID_PARAMETER;
    148148        }
    149149
    150150        /* construct the fully qualified windows name for the new file name */
    151         if (req->ctx->protocol == PROTOCOL_SMB2) {
     151        if (req->ctx->protocol >= PROTOCOL_SMB2_02) {
    152152                /* SMB2 sends the full path of the new name */
    153153                new_name = talloc_asprintf(req, "\\%s", info->rename_information.in.new_name);
     
    368368
    369369        case RAW_SFILEINFO_EA_SET:
    370                 return pvfs_setfileinfo_ea_set(pvfs, h->name, h->fd, 
     370                return pvfs_setfileinfo_ea_set(pvfs, h->name, h->fd,
    371371                                               info->ea_set.in.num_eas,
    372372                                               info->ea_set.in.eas);
     
    420420                h->position = info->position_information.in.position;
    421421                break;
     422
     423        case RAW_SFILEINFO_FULL_EA_INFORMATION:
     424                return pvfs_setfileinfo_ea_set(pvfs, h->name, h->fd,
     425                                info->full_ea_information.in.eas.num_eas,
     426                                info->full_ea_information.in.eas.eas);
    422427
    423428        case RAW_SFILEINFO_MODE_INFORMATION:
     
    535540                mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
    536541                if (!(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
    537                         if (pvfs_sys_fchmod(pvfs, h->fd, mode) == -1) {
     542                        if (pvfs_sys_fchmod(pvfs, h->fd, mode, h->name->allow_override) == -1) {
    538543                                return pvfs_map_errno(pvfs, errno);
    539544                        }
     
    860865        if (newstats.dos.attrib != name->dos.attrib) {
    861866                mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
    862                 if (pvfs_sys_chmod(pvfs, name->full_name, mode) == -1) {
     867                if (pvfs_sys_chmod(pvfs, name->full_name, mode, name->allow_override) == -1) {
    863868                        return pvfs_map_errno(pvfs, errno);
    864869                }
  • vendor/current/source4/ntvfs/posix/pvfs_sys.c

    r740 r988  
    197197                return NULL;
    198198        }
     199
    199200        ctx->old_wd = talloc_strdup(ctx, cwd);
     201        free(cwd);
     202
    200203        if (ctx->old_wd == NULL) {
    201                 free(cwd);
    202204                talloc_free(ctx);
    203205                return NULL;
     
    257259  wrap open for system override
    258260*/
    259 int pvfs_sys_open(struct pvfs_state *pvfs, const char *filename, int flags, mode_t mode)
     261int pvfs_sys_open(struct pvfs_state *pvfs, const char *filename, int flags, mode_t mode, bool allow_override)
    260262{
    261263        int fd, ret;
     
    268270        fd = open(filename, flags, mode);
    269271        if (fd != -1 ||
    270             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     272            !allow_override ||
    271273            errno != EACCES) {
    272274                return fd;
     
    367369  wrap unlink for system override
    368370*/
    369 int pvfs_sys_unlink(struct pvfs_state *pvfs, const char *filename)
     371int pvfs_sys_unlink(struct pvfs_state *pvfs, const char *filename, bool allow_override)
    370372{
    371373        int ret;
     
    377379        ret = unlink(filename);
    378380        if (ret != -1 ||
    379             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     381            !allow_override ||
    380382            errno != EACCES) {
    381383                return ret;
     
    406408{
    407409        int fd = open(path, PVFS_NOFOLLOW | O_RDONLY);
     410        int posix_errno = errno;
    408411        if (fd != -1) {
    409412                close(fd);
    410413                return false;
    411414        }
    412         return (errno == ELOOP);
     415
     416#if defined(ENOTSUP) && defined(OSF1)
     417        /* handle special Tru64 errno */
     418        if (errno == ENOTSUP) {
     419                posix_errno = ELOOP;
     420        }
     421#endif /* ENOTSUP */
     422
     423#ifdef EFTYPE
     424        /* fix broken NetBSD errno */
     425        if (errno == EFTYPE) {
     426                posix_errno = ELOOP;
     427        }
     428#endif /* EFTYPE */
     429
     430        /* fix broken FreeBSD errno */
     431        if (errno == EMLINK) {
     432                posix_errno = ELOOP;
     433        }
     434
     435        return (posix_errno == ELOOP);
    413436}
    414437
     
    416439  wrap rename for system override
    417440*/
    418 int pvfs_sys_rename(struct pvfs_state *pvfs, const char *name1, const char *name2)
     441int pvfs_sys_rename(struct pvfs_state *pvfs, const char *name1, const char *name2, bool allow_override)
    419442{
    420443        int ret;
     
    426449        ret = rename(name1, name2);
    427450        if (ret != -1 ||
    428             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     451            !allow_override ||
    429452            errno != EACCES) {
    430453                return ret;
     
    481504  wrap mkdir for system override
    482505*/
    483 int pvfs_sys_mkdir(struct pvfs_state *pvfs, const char *dirname, mode_t mode)
     506int pvfs_sys_mkdir(struct pvfs_state *pvfs, const char *dirname, mode_t mode, bool allow_override)
    484507{
    485508        int ret;
     
    491514        ret = mkdir(dirname, mode);
    492515        if (ret != -1 ||
    493             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     516            !allow_override ||
    494517            errno != EACCES) {
    495518                return ret;
     
    513536        if (ret == -1) {
    514537                rmdir(dirname);
    515                 talloc_free(ctx);
    516                 errno = saved_errno;
    517                 return -1;
    518         }
    519 
    520         talloc_free(ctx);
    521         return ret;
    522 }
    523 
    524 
    525 /*
    526   wrap rmdir for system override
    527 */
    528 int pvfs_sys_rmdir(struct pvfs_state *pvfs, const char *dirname)
    529 {
    530         int ret;
    531         struct pvfs_sys_ctx *ctx;
    532         int saved_errno, orig_errno;
    533 
    534         orig_errno = errno;
    535 
    536         ret = rmdir(dirname);
    537         if (ret != -1 ||
    538             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
    539             errno != EACCES) {
    540                 return ret;
    541         }
    542 
    543         saved_errno = errno;
    544 
    545         ctx = pvfs_sys_pushdir(pvfs, &dirname);
    546         if (ctx == NULL) {
    547                 errno = saved_errno;
    548                 return -1;
    549         }
    550 
    551         ret = rmdir(dirname);
    552         if (ret == -1) {
    553538                talloc_free(ctx);
    554539                errno = saved_errno;
     
    561546}
    562547
    563 /*
    564   wrap fchmod for system override
    565 */
    566 int pvfs_sys_fchmod(struct pvfs_state *pvfs, int fd, mode_t mode)
     548
     549/*
     550  wrap rmdir for system override
     551*/
     552int pvfs_sys_rmdir(struct pvfs_state *pvfs, const char *dirname, bool allow_override)
    567553{
    568554        int ret;
     
    572558        orig_errno = errno;
    573559
    574         ret = fchmod(fd, mode);
     560        ret = rmdir(dirname);
    575561        if (ret != -1 ||
    576             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     562            !allow_override ||
    577563            errno != EACCES) {
    578564                return ret;
     
    581567        saved_errno = errno;
    582568
    583         ctx = pvfs_sys_pushdir(pvfs, NULL);
    584         if (ctx == NULL) {
    585                 errno = saved_errno;
    586                 return -1;
    587         }
    588 
    589         ret = fchmod(fd, mode);
     569        ctx = pvfs_sys_pushdir(pvfs, &dirname);
     570        if (ctx == NULL) {
     571                errno = saved_errno;
     572                return -1;
     573        }
     574
     575        ret = rmdir(dirname);
    590576        if (ret == -1) {
    591577                talloc_free(ctx);
     
    599585}
    600586
    601 
    602 /*
    603   wrap chmod for system override
    604 */
    605 int pvfs_sys_chmod(struct pvfs_state *pvfs, const char *filename, mode_t mode)
     587/*
     588  wrap fchmod for system override
     589*/
     590int pvfs_sys_fchmod(struct pvfs_state *pvfs, int fd, mode_t mode, bool allow_override)
    606591{
    607592        int ret;
     
    611596        orig_errno = errno;
    612597
    613         ret = chmod(filename, mode);
     598        ret = fchmod(fd, mode);
    614599        if (ret != -1 ||
    615             !(pvfs->flags & PVFS_FLAG_PERM_OVERRIDE) ||
     600            !allow_override ||
    616601            errno != EACCES) {
    617602                return ret;
     
    620605        saved_errno = errno;
    621606
    622         ctx = pvfs_sys_pushdir(pvfs, &filename);
    623         if (ctx == NULL) {
    624                 errno = saved_errno;
    625                 return -1;
    626         }
    627 
    628         ret = chmod(filename, mode);
     607        ctx = pvfs_sys_pushdir(pvfs, NULL);
     608        if (ctx == NULL) {
     609                errno = saved_errno;
     610                return -1;
     611        }
     612
     613        ret = fchmod(fd, mode);
    629614        if (ret == -1) {
    630615                talloc_free(ctx);
     
    637622        return ret;
    638623}
     624
     625
     626/*
     627  wrap chmod for system override
     628*/
     629int pvfs_sys_chmod(struct pvfs_state *pvfs, const char *filename, mode_t mode, bool allow_override)
     630{
     631        int ret;
     632        struct pvfs_sys_ctx *ctx;
     633        int saved_errno, orig_errno;
     634
     635        orig_errno = errno;
     636
     637        ret = chmod(filename, mode);
     638        if (ret != -1 ||
     639            !allow_override ||
     640            errno != EACCES) {
     641                return ret;
     642        }
     643
     644        saved_errno = errno;
     645
     646        ctx = pvfs_sys_pushdir(pvfs, &filename);
     647        if (ctx == NULL) {
     648                errno = saved_errno;
     649                return -1;
     650        }
     651
     652        ret = chmod(filename, mode);
     653        if (ret == -1) {
     654                talloc_free(ctx);
     655                errno = saved_errno;
     656                return -1;
     657        }
     658
     659        talloc_free(ctx);
     660        errno = orig_errno;
     661        return ret;
     662}
  • vendor/current/source4/ntvfs/posix/pvfs_unlink.c

    r740 r988  
    124124
    125125        /* finally try the actual unlink */
    126         if (pvfs_sys_unlink(pvfs, name->full_name) == -1) {
     126        if (pvfs_sys_unlink(pvfs, name->full_name, name->allow_override) == -1) {
    127127                status = pvfs_map_errno(pvfs, errno);
    128128        }
  • vendor/current/source4/ntvfs/posix/pvfs_util.c

    r740 r988  
    4141{
    4242        NTSTATUS status;
    43         status = map_nt_error_from_unix(unix_errno);
     43        status = map_nt_error_from_unix_common(unix_errno);
    4444        DEBUG(10,(__location__ " mapped unix errno %d -> %s\n", unix_errno, nt_errstr(status)));
    4545        return status;
     
    9191NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs,
    9292                        struct pvfs_filename *name1,
    93                         struct pvfs_filename *name2)
     93                        struct pvfs_filename *name2,
     94                        bool allow_override)
    9495{
    9596        int fd1, fd2;
     
    103104        }
    104105
    105         fd1 = pvfs_sys_open(pvfs, name1->full_name, O_RDONLY, 0);
     106        fd1 = pvfs_sys_open(pvfs, name1->full_name, O_RDONLY, 0, allow_override);
    106107        if (fd1 == -1) {
    107108                talloc_free(buf);
     
    109110        }
    110111
    111         fd2 = pvfs_sys_open(pvfs, name2->full_name, O_CREAT|O_EXCL|O_WRONLY, 0);
     112        fd2 = pvfs_sys_open(pvfs, name2->full_name, O_CREAT|O_EXCL|O_WRONLY, 0, allow_override);
    112113        if (fd2 == -1) {
    113114                close(fd1);
     
    134135                        close(fd2);
    135136                        talloc_free(buf);
    136                         pvfs_sys_unlink(pvfs, name2->full_name);
     137                        pvfs_sys_unlink(pvfs, name2->full_name, allow_override);
    137138                        if (ret2 == -1) {
    138139                                return pvfs_map_errno(pvfs, errno);
     
    146147
    147148        mode = pvfs_fileperms(pvfs, name1->dos.attrib);
    148         if (pvfs_sys_fchmod(pvfs, fd2, mode) == -1) {
     149        if (pvfs_sys_fchmod(pvfs, fd2, mode, allow_override) == -1) {
    149150                status = pvfs_map_errno(pvfs, errno);
    150151                close(fd2);
    151                 pvfs_sys_unlink(pvfs, name2->full_name);
     152                pvfs_sys_unlink(pvfs, name2->full_name, allow_override);
    152153                return status;
    153154        }
     
    159160        if (!NT_STATUS_IS_OK(status)) {
    160161                close(fd2);
    161                 pvfs_sys_unlink(pvfs, name2->full_name);
     162                pvfs_sys_unlink(pvfs, name2->full_name, allow_override);
    162163                return status;
    163164        }
  • vendor/current/source4/ntvfs/posix/pvfs_wait.c

    r740 r988  
    3434        void *private_data;
    3535        int msg_type;
    36         struct messaging_context *msg_ctx;
     36        struct imessaging_context *msg_ctx;
    3737        struct tevent_context *ev;
    3838        struct ntvfs_request *req;
     
    5757  receive a completion message for a wait
    5858*/
    59 static void pvfs_wait_dispatch(struct messaging_context *msg,
     59static void pvfs_wait_dispatch(struct imessaging_context *msg,
    6060                               void *private_data, uint32_t msg_type,
    6161                               struct server_id src, DATA_BLOB *data)
     
    6767
    6868        /* we need to check that this one is for us. See
    69            messaging_send_ptr() for the other side of this.
     69           imessaging_send_ptr() for the other side of this.
    7070         */
    7171        if (data->length == sizeof(void *)) {
     
    117117{
    118118        if (pwait->msg_type != -1) {
    119                 messaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait);
     119                imessaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait);
    120120        }
    121121        DLIST_REMOVE(pwait->pvfs->wait_list, pwait);
     
    157157        if (!timeval_is_zero(&end_time)) {
    158158                /* setup a timer */
    159                 event_add_timed(pwait->ev, pwait, end_time, pvfs_wait_timeout, pwait);
     159                tevent_add_timer(pwait->ev, pwait, end_time, pvfs_wait_timeout, pwait);
    160160        }
    161161
     
    163163           type */
    164164        if (msg_type != -1) {
    165                 messaging_register(pwait->msg_ctx,
     165                imessaging_register(pwait->msg_ctx,
    166166                                   pwait,
    167167                                   msg_type,
  • vendor/current/source4/ntvfs/posix/pvfs_write.c

    r414 r988  
    6565        }
    6666
    67         tv = timeval_current_ofs(0, pvfs->writetime_delay);
     67        tv = timeval_current_ofs_usec(pvfs->writetime_delay);
    6868
    6969        h->write_time.update_triggered = true;
    7070        h->write_time.update_on_close = true;
    71         h->write_time.update_event = event_add_timed(pvfs->ntvfs->ctx->event_ctx,
     71        h->write_time.update_event = tevent_add_timer(pvfs->ntvfs->ctx->event_ctx,
    7272                                                     h, tv,
    7373                                                     pvfs_write_time_update_handler,
    7474                                                     h);
    7575        if (!h->write_time.update_event) {
    76                 DEBUG(0,("Failed event_add_timed\n"));
     76                DEBUG(0,("Failed tevent_add_timer\n"));
    7777        }
    7878}
  • vendor/current/source4/ntvfs/posix/pvfs_xattr.c

    r740 r988  
    2525#include "librpc/gen_ndr/ndr_xattr.h"
    2626#include "param/param.h"
     27#include "ntvfs/posix/posix_eadb_proto.h"
    2728
    2829/*
     
    8283{
    8384        if (pvfs->ea_db) {
    84                 return delete_xattr_tdb(pvfs, attr_name, fname, fd);
     85                return delete_posix_eadb(pvfs, attr_name, fname, fd);
    8586        }
    8687        return delete_xattr_system(pvfs, attr_name, fname, fd);
     
    9394{
    9495        if (pvfs->ea_db) {
    95                 return unlink_xattr_tdb(pvfs, fname);
     96                return unlink_posix_eadb(pvfs, fname);
    9697        }
    9798        return unlink_xattr_system(pvfs, fname);
     
    284285        NTSTATUS status;
    285286        ZERO_STRUCTP(eas);
     287
     288        if (name->stream_name) {
     289                /* We don't support EAs on streams */
     290                return NT_STATUS_INVALID_PARAMETER;
     291        }
     292
    286293        if (!(pvfs->flags & PVFS_FLAG_XATTR_ENABLE)) {
    287294                return NT_STATUS_OK;
  • vendor/current/source4/ntvfs/posix/python/pyxattr_native.c

    r740 r988  
    2222#include "includes.h"
    2323#include "librpc/ndr/libndr.h"
    24 #include "lib/util/wrap_xattr.h"
     24#include "system/filesys.h"
     25
     26void initxattr_native(void);
    2527
    2628static PyObject *py_is_xattr_supported(PyObject *self)
     
    3739        char *filename, *attribute;
    3840        int ret = 0;
    39         int blobsize;
     41        Py_ssize_t blobsize;
    4042        DATA_BLOB blob;
    4143
     
    4547
    4648        blob.length = blobsize;
    47         ret = wrap_setxattr(filename, attribute, blob.data, blob.length, 0);
     49        ret = setxattr(filename, attribute, blob.data, blob.length, 0);
    4850        if( ret < 0 ) {
    4951                if (errno == ENOTSUP) {
     
    6769                return NULL;
    6870        mem_ctx = talloc_new(NULL);
    69         len = wrap_getxattr(filename,attribute,NULL,0);
     71        len = getxattr(filename,attribute,NULL,0);
    7072        if( len < 0 ) {
    7173                if (errno == ENOTSUP) {
     
    7981        /* check length ... */
    8082        buf = talloc_zero_array(mem_ctx, char, len);
    81         len = wrap_getxattr(filename, attribute, buf, len);
     83        len = getxattr(filename, attribute, buf, len);
    8284        if( len < 0 ) {
    8385                if (errno == ENOTSUP) {
     
    9799        { "wrap_getxattr", (PyCFunction)py_wrap_getxattr, METH_VARARGS,
    98100                "wrap_getxattr(filename,attribute) -> blob\n"
    99                 "Retreive given attribute on the given file." },
     101                "Retrieve given attribute on the given file." },
    100102        { "wrap_setxattr", (PyCFunction)py_wrap_setxattr, METH_VARARGS,
    101103                "wrap_setxattr(filename,attribute,value)\n"
  • vendor/current/source4/ntvfs/posix/python/pyxattr_tdb.c

    r740 r988  
    2121#include <Python.h>
    2222#include "includes.h"
     23#include "system/filesys.h"
    2324#include <tdb.h>
    24 #include "lib/util/tdb_wrap.h"
     25#include "lib/tdb_wrap/tdb_wrap.h"
    2526#include "librpc/ndr/libndr.h"
    26 #include "lib/util/wrap_xattr.h"
    27 #include "ntvfs/posix/vfs_posix.h"
     27#include "ntvfs/posix/posix_eadb.h"
    2828#include "libcli/util/pyerrors.h"
     29#include "param/pyparam.h"
     30#include "lib/dbwrap/dbwrap.h"
     31#include "lib/dbwrap/dbwrap_open.h"
     32#include "lib/dbwrap/dbwrap_tdb.h"
     33#include "source3/lib/xattr_tdb.h"
     34
     35void initxattr_tdb(void);
    2936
    3037static PyObject *py_is_xattr_supported(PyObject *self)
     
    3744        char *filename, *attribute, *tdbname;
    3845        DATA_BLOB blob;
    39         int blobsize;
    40         NTSTATUS status;
     46        Py_ssize_t blobsize;
     47        int ret;
    4148        TALLOC_CTX *mem_ctx;
    42         struct tdb_wrap *eadb;
     49        struct loadparm_context *lp_ctx;
     50        struct db_context *eadb = NULL;
     51        struct file_id id;
     52        struct stat sbuf;
    4353
    4454        if (!PyArg_ParseTuple(args, "ssss#", &tdbname, &filename, &attribute,
     
    4858        blob.length = blobsize;
    4959        mem_ctx = talloc_new(NULL);
    50         eadb = tdb_wrap_open(mem_ctx, tdbname, 50000,
    51                                 TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
     60
     61        lp_ctx = py_default_loadparm_context(mem_ctx);
     62        eadb = db_open_tdb(mem_ctx, tdbname, 50000,
     63                           lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT),
     64                           O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
     65                           DBWRAP_FLAG_NONE);
    5266
    5367        if (eadb == NULL) {
     
    5670                return NULL;
    5771        }
    58         status = push_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, -1,
    59                                                                          &blob);
    60         if (!NT_STATUS_IS_OK(status)) {
    61                 PyErr_FromNTSTATUS(status);
     72
     73        ret = stat(filename, &sbuf);
     74        if (ret < 0) {
     75                PyErr_SetFromErrno(PyExc_IOError);
     76                talloc_free(mem_ctx);
     77                return NULL;
     78        }
     79
     80        ZERO_STRUCT(id);
     81        id.devid = sbuf.st_dev;
     82        id.inode = sbuf.st_ino;
     83
     84        ret = xattr_tdb_setattr(eadb, &id, attribute, blob.data, blob.length, 0);
     85        if (ret < 0) {
     86                PyErr_SetFromErrno(PyExc_TypeError);
    6287                talloc_free(mem_ctx);
    6388                return NULL;
     
    7196        char *filename, *attribute, *tdbname;
    7297        TALLOC_CTX *mem_ctx;
     98        struct loadparm_context *lp_ctx;
    7399        DATA_BLOB blob;
    74         PyObject *ret;
    75         NTSTATUS status;
    76         struct tdb_wrap *eadb = NULL;
     100        PyObject *ret_obj;
     101        int ret;
     102        ssize_t xattr_size;
     103        struct db_context *eadb = NULL;
     104        struct file_id id;
     105        struct stat sbuf;
    77106
    78107        if (!PyArg_ParseTuple(args, "sss", &tdbname, &filename, &attribute))
     
    80109
    81110        mem_ctx = talloc_new(NULL);
    82         eadb = tdb_wrap_open(mem_ctx, tdbname, 50000,
    83                                 TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
     111
     112        lp_ctx = py_default_loadparm_context(mem_ctx);
     113        eadb = db_open_tdb(mem_ctx, tdbname, 50000,
     114                           lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT),
     115                           O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
     116                           DBWRAP_FLAG_NONE);
     117
    84118        if (eadb == NULL) {
    85119                PyErr_SetFromErrno(PyExc_IOError);
     
    87121                return NULL;
    88122        }
    89         status = pull_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename,
    90                                                                          -1, 100, &blob);
    91         if (!NT_STATUS_IS_OK(status) || blob.length < 0) {
    92                 PyErr_FromNTSTATUS(status);
     123
     124        ret = stat(filename, &sbuf);
     125        if (ret < 0) {
     126                PyErr_SetFromErrno(PyExc_IOError);
    93127                talloc_free(mem_ctx);
    94128                return NULL;
    95129        }
    96         ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
     130
     131        ZERO_STRUCT(id);
     132        id.devid = sbuf.st_dev;
     133        id.inode = sbuf.st_ino;
     134
     135        xattr_size = xattr_tdb_getattr(eadb, mem_ctx, &id, attribute, &blob);
     136        if (xattr_size < 0) {
     137                PyErr_SetFromErrno(PyExc_TypeError);
     138                talloc_free(mem_ctx);
     139                return NULL;
     140        }
     141        ret_obj = PyString_FromStringAndSize((char *)blob.data, xattr_size);
    97142        talloc_free(mem_ctx);
    98         return ret;
     143        return ret_obj;
    99144}
    100145
     
    102147        { "wrap_getxattr", (PyCFunction)py_wrap_getxattr, METH_VARARGS,
    103148                "wrap_getxattr(filename,attribute) -> blob\n"
    104                 "Retreive given attribute on the given file." },
     149                "Retrieve given attribute on the given file." },
    105150        { "wrap_setxattr", (PyCFunction)py_wrap_setxattr, METH_VARARGS,
    106151                "wrap_setxattr(filename,attribute,value)\n"
  • vendor/current/source4/ntvfs/posix/vfs_posix.c

    r740 r988  
    2828#include "librpc/gen_ndr/security.h"
    2929#include <tdb.h>
    30 #include "lib/util/tdb_wrap.h"
     30#include "lib/tdb_wrap/tdb_wrap.h"
    3131#include "libcli/security/security.h"
    3232#include "lib/events/events.h"
     
    3939{
    4040        struct share_config *scfg = pvfs->ntvfs->ctx->config;
    41         const char *eadb;
     41        char *eadb;
     42        char *xattr_backend;
    4243        bool def_perm_override = false;
    4344
     
    114115                FS_ATTR_CASE_SENSITIVE_SEARCH |
    115116                FS_ATTR_CASE_PRESERVED_NAMES |
    116                 FS_ATTR_UNICODE_ON_DISK |
    117                 FS_ATTR_SPARSE_FILES;
     117                FS_ATTR_UNICODE_ON_DISK;
    118118
    119119        /* allow xattrs to be stored in a external tdb */
    120         eadb = share_string_option(scfg, PVFS_EADB, NULL);
     120        eadb = share_string_option(pvfs, scfg, PVFS_EADB, NULL);
    121121        if (eadb != NULL) {
    122                 pvfs->ea_db = tdb_wrap_open(pvfs, eadb, 50000, 
    123                                             TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
     122                pvfs->ea_db = tdb_wrap_open(
     123                        pvfs, eadb, 50000,
     124                        lpcfg_tdb_flags(pvfs->ntvfs->ctx->lp_ctx, TDB_DEFAULT),
     125                        O_RDWR|O_CREAT, 0600);
     126                TALLOC_FREE(eadb);
    124127                if (pvfs->ea_db != NULL) {
    125128                        pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
     
    147150
    148151        /* enable an ACL backend */
    149         pvfs->acl_ops = pvfs_acl_backend_byname(share_string_option(scfg, PVFS_ACL, "xattr"));
     152        xattr_backend = share_string_option(pvfs, scfg, PVFS_ACL, "xattr");
     153        pvfs->acl_ops = pvfs_acl_backend_byname(xattr_backend);
     154        TALLOC_FREE(xattr_backend);
    150155}
    151156
     
    213218         *       but currently we don't have a lp_ctx there
    214219         */
    215         status = pvfs_acl_init(ntvfs->ctx->lp_ctx);
     220        status = pvfs_acl_init();
    216221        NT_STATUS_NOT_OK_RETURN(status);
    217222
     
    220225
    221226        /* for simplicity of path construction, remove any trailing slash now */
    222         base_directory = talloc_strdup(pvfs, share_string_option(ntvfs->ctx->config, SHARE_PATH, ""));
     227        base_directory = share_string_option(pvfs, ntvfs->ctx->config, SHARE_PATH, "");
    223228        NT_STATUS_HAVE_NO_MEMORY(base_directory);
    224229        if (strcmp(base_directory, "/") != 0) {
     
    250255        ntvfs->private_data = pvfs;
    251256
    252         pvfs->brl_context = brl_init(pvfs,
     257        pvfs->brl_context = brlock_init(pvfs,
    253258                                     pvfs->ntvfs->ctx->server_id,
    254259                                     pvfs->ntvfs->ctx->lp_ctx,
     
    271276                                           pvfs->ntvfs->ctx->config);
    272277
    273         pvfs->wbc_ctx = wbc_init(pvfs,
    274                                  pvfs->ntvfs->ctx->msg_ctx,
    275                                  pvfs->ntvfs->ctx->event_ctx);
    276         if (pvfs->wbc_ctx == NULL) {
    277                 return NT_STATUS_INTERNAL_DB_CORRUPTION;
    278         }
    279 
    280278        /* allocate the search handle -> ptr tree */
    281279        pvfs->search.idtree = idr_init(pvfs);
     
    373371       
    374372        /* fill in all the operations */
    375         ops.connect = pvfs_connect;
    376         ops.disconnect = pvfs_disconnect;
    377         ops.unlink = pvfs_unlink;
    378         ops.chkpath = pvfs_chkpath;
    379         ops.qpathinfo = pvfs_qpathinfo;
    380         ops.setpathinfo = pvfs_setpathinfo;
    381         ops.open = pvfs_open;
    382         ops.mkdir = pvfs_mkdir;
    383         ops.rmdir = pvfs_rmdir;
    384         ops.rename = pvfs_rename;
    385         ops.copy = pvfs_copy;
    386         ops.ioctl = pvfs_ioctl;
    387         ops.read = pvfs_read;
    388         ops.write = pvfs_write;
    389         ops.seek = pvfs_seek;
    390         ops.flush = pvfs_flush;
    391         ops.close = pvfs_close;
    392         ops.exit = pvfs_exit;
    393         ops.lock = pvfs_lock;
    394         ops.setfileinfo = pvfs_setfileinfo;
    395         ops.qfileinfo = pvfs_qfileinfo;
    396         ops.fsinfo = pvfs_fsinfo;
    397         ops.lpq = pvfs_lpq;
    398         ops.search_first = pvfs_search_first;
    399         ops.search_next = pvfs_search_next;
    400         ops.search_close = pvfs_search_close;
    401         ops.trans = pvfs_trans;
    402         ops.logoff = pvfs_logoff;
    403         ops.async_setup = pvfs_async_setup;
    404         ops.cancel = pvfs_cancel;
    405         ops.notify = pvfs_notify;
     373        ops.connect_fn = pvfs_connect;
     374        ops.disconnect_fn = pvfs_disconnect;
     375        ops.unlink_fn = pvfs_unlink;
     376        ops.chkpath_fn = pvfs_chkpath;
     377        ops.qpathinfo_fn = pvfs_qpathinfo;
     378        ops.setpathinfo_fn = pvfs_setpathinfo;
     379        ops.open_fn = pvfs_open;
     380        ops.mkdir_fn = pvfs_mkdir;
     381        ops.rmdir_fn = pvfs_rmdir;
     382        ops.rename_fn = pvfs_rename;
     383        ops.copy_fn = pvfs_copy;
     384        ops.ioctl_fn = pvfs_ioctl;
     385        ops.read_fn = pvfs_read;
     386        ops.write_fn = pvfs_write;
     387        ops.seek_fn = pvfs_seek;
     388        ops.flush_fn = pvfs_flush;
     389        ops.close_fn = pvfs_close;
     390        ops.exit_fn = pvfs_exit;
     391        ops.lock_fn = pvfs_lock;
     392        ops.setfileinfo_fn = pvfs_setfileinfo;
     393        ops.qfileinfo_fn = pvfs_qfileinfo;
     394        ops.fsinfo_fn = pvfs_fsinfo;
     395        ops.lpq_fn = pvfs_lpq;
     396        ops.search_first_fn = pvfs_search_first;
     397        ops.search_next_fn = pvfs_search_next;
     398        ops.search_close_fn = pvfs_search_close;
     399        ops.trans_fn = pvfs_trans;
     400        ops.logoff_fn = pvfs_logoff;
     401        ops.async_setup_fn = pvfs_async_setup;
     402        ops.cancel_fn = pvfs_cancel;
     403        ops.notify_fn = pvfs_notify;
    406404
    407405        /* register ourselves with the NTVFS subsystem. We register
  • vendor/current/source4/ntvfs/posix/vfs_posix.h

    r740 r988  
    4848        struct odb_context *odb_context;
    4949        struct notify_context *notify_context;
    50         struct wbc_context *wbc_ctx;
    5150
    5251        /* a list of pending async requests. Needed to support
     
    132131        bool exists;          /* true if the base filename exists */
    133132        bool stream_exists;   /* true if the stream exists */
     133        bool allow_override;
    134134        struct stat st;
    135135        struct pvfs_dos_fileinfo dos;
     
    205205        struct brl_handle *brl_handle;
    206206
    207         /* a count of active locks - used to avoid calling brl_close on
     207        /* a count of active locks - used to avoid calling brlock_close on
    208208           file close */
    209209        uint64_t lock_count;
  • vendor/current/source4/ntvfs/posix/wscript_build

    r740 r988  
    44        source='pvfs_acl.c',
    55        autoproto='vfs_acl_proto.h',
    6         deps='events',
     6        deps='events samba-modules',
    77        )
    88
     
    3232
    3333bld.SAMBA_MODULE('ntvfs_posix',
    34         source='vfs_posix.c pvfs_util.c pvfs_search.c pvfs_dirlist.c pvfs_fileinfo.c pvfs_unlink.c pvfs_mkdir.c pvfs_open.c pvfs_read.c pvfs_flush.c pvfs_write.c pvfs_fsinfo.c pvfs_qfileinfo.c pvfs_setfileinfo.c pvfs_rename.c pvfs_resolve.c pvfs_shortname.c pvfs_lock.c pvfs_oplock.c pvfs_wait.c pvfs_seek.c pvfs_ioctl.c pvfs_xattr.c pvfs_streams.c pvfs_notify.c pvfs_sys.c xattr_system.c xattr_tdb.c',
     34        source='vfs_posix.c pvfs_util.c pvfs_search.c pvfs_dirlist.c pvfs_fileinfo.c pvfs_unlink.c pvfs_mkdir.c pvfs_open.c pvfs_read.c pvfs_flush.c pvfs_write.c pvfs_fsinfo.c pvfs_qfileinfo.c pvfs_setfileinfo.c pvfs_rename.c pvfs_resolve.c pvfs_shortname.c pvfs_lock.c pvfs_oplock.c pvfs_wait.c pvfs_seek.c pvfs_ioctl.c pvfs_xattr.c pvfs_streams.c pvfs_notify.c pvfs_sys.c xattr_system.c',
    3535        autoproto='vfs_posix_proto.h',
    3636        subsystem='ntvfs',
    3737        init_function='ntvfs_posix_init',
    38         deps='NDR_XATTR wrap_xattr ntvfs_common MESSAGING LIBWBCLIENT_OLD pvfs_acl pvfs_aio',
     38        deps='NDR_XATTR attr ntvfs_common MESSAGING LIBWBCLIENT_OLD pvfs_acl pvfs_aio posix_eadb',
    3939        internal_module=True
    4040        )
     
    4343bld.SAMBA_PYTHON('python_xattr_native',
    4444        source='python/pyxattr_native.c',
    45         deps='ndr ldb samdb credentials pyparam_util wrap_xattr attr',
     45        deps='ndr ldb samdb samba-credentials pyparam_util attr',
    4646        realname='samba/xattr_native.so'
    4747        )
    4848
     49bld.SAMBA_LIBRARY('posix_eadb',
     50                  source='posix_eadb.c',
     51                  deps='tdb tdb-wrap samba-util',
     52                  autoproto='posix_eadb_proto.h',
     53                  private_library=True)
     54
     55bld.SAMBA_PYTHON('python_posix_eadb',
     56        source='python/pyposix_eadb.c',
     57        deps='pyparam_util posix_eadb tdb',
     58        realname='samba/posix_eadb.so'
     59        )
    4960
    5061bld.SAMBA_PYTHON('python_xattr_tdb',
    51         source='python/pyxattr_tdb.c xattr_tdb.c',
    52         deps='ndr ldb pyparam_util share attr',
     62        source='python/pyxattr_tdb.c',
     63        deps='pyparam_util xattr_tdb',
    5364        realname='samba/xattr_tdb.so'
    5465        )
  • vendor/current/source4/ntvfs/posix/xattr_system.c

    r414 r988  
    2222#include "includes.h"
    2323#include "vfs_posix.h"
    24 #include "../lib/util/wrap_xattr.h"
    2524
    2625/*
     
    4443again:
    4544        if (fd != -1) {
    46                 ret = wrap_fgetxattr(fd, attr_name, blob->data, estimated_size);
     45                ret = fgetxattr(fd, attr_name, blob->data, estimated_size);
    4746        } else {
    48                 ret = wrap_getxattr(fname, attr_name, blob->data, estimated_size);
     47                ret = getxattr(fname, attr_name, blob->data, estimated_size);
    4948        }
    5049        if (ret == -1 && errno == ERANGE) {
     
    105104
    106105        if (fd != -1) {
    107                 ret = wrap_fsetxattr(fd, attr_name, blob->data, blob->length, 0);
     106                ret = fsetxattr(fd, attr_name, blob->data, blob->length, 0);
    108107        } else {
    109                 ret = wrap_setxattr(fname, attr_name, blob->data, blob->length, 0);
     108                ret = setxattr(fname, attr_name, blob->data, blob->length, 0);
    110109        }
    111110        if (ret == -1) {
     
    126125
    127126        if (fd != -1) {
    128                 ret = wrap_fremovexattr(fd, attr_name);
     127                ret = fremovexattr(fd, attr_name);
    129128        } else {
    130                 ret = wrap_removexattr(fname, attr_name);
     129                ret = removexattr(fname, attr_name);
    131130        }
    132131        if (ret == -1) {
Note: See TracChangeset for help on using the changeset viewer.