Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/modules/onefs_open.c

    r596 r745  
    3434
    3535#include "includes.h"
     36#include "smbd/smbd.h"
    3637#include "onefs.h"
    3738#include "onefs_config.h"
     
    5556                              uint32_t oplock_request,
    5657                              uint64_t allocation_size,
     58                              uint32_t private_flags,
    5759                              struct security_descriptor *sd,
    5860                              struct ea_list *ea_list,
     
    313315                        True : False;
    314316        }
    315         fsp->print_file = False;
     317        fsp->print_file = NULL;
    316318        fsp->modified = False;
    317319        fsp->sent_oplock_break = NO_BREAK_SENT;
     
    326328
    327329        DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",
    328                  conn->server_info->unix_name,
     330                 conn->session_info->unix_name,
    329331                 smb_fname_str_dbg(smb_fname),
    330332                 BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write),
     
    358360                if (procid_is_me(&e->pid) && (e->op_mid == req->mid)) {
    359361                        DEBUG(0, ("Trying to defer an already deferred "
    360                                   "request: mid=%d, exiting\n", req->mid));
     362                                "request: mid=%llu, exiting\n",
     363                                (unsigned long long)req->mid));
    361364                        exit_server("attempt to defer a deferred request");
    362365                }
     
    366369
    367370        DEBUG(10,("defer_open_sharing_error: time [%u.%06u] adding deferred "
    368                   "open entry for mid %u\n",
     371                  "open entry for mid %llu\n",
    369372                  (unsigned int)request_time.tv_sec,
    370373                  (unsigned int)request_time.tv_usec,
    371                   (unsigned int)req->mid));
    372 
    373         if (!push_deferred_smb_message(req, request_time, timeout,
    374                                        (char *)state, sizeof(*state))) {
    375                 exit_server("push_deferred_smb_message failed");
     374                  (unsigned long long)req->mid));
     375
     376        if (!push_deferred_open_message_smb(req, request_time, timeout,
     377                                       state->id, (char *)state, sizeof(*state))) {
     378                exit_server("push_deferred_open_message_smb failed");
    376379        }
    377380        add_deferred_open(lck, req->mid, request_time, state->id);
     
    439442                                  uint32 new_dos_attributes,
    440443                                  int oplock_request,
     444                                  uint32_t private_flags,
    441445                                  struct security_descriptor *sd,
    442446                                  files_struct *fsp,
     
    456460        int info;
    457461        uint32 existing_dos_attributes = 0;
    458         struct pending_message_list *pml = NULL;
    459462        struct timeval request_time = timeval_zero();
    460463        struct share_mode_lock *lck = NULL;
     
    482485                           smb_fname_str_dbg(smb_fname)));
    483486
    484                 return print_fsp_open(req, conn, smb_fname->base_name,
    485                                       req->vuid, fsp);
     487                return print_spool_open(fsp, smb_fname->base_name,
     488                                        req->vuid);
    486489        }
    487490
     
    496499                new_dos_attributes = 0;
    497500        } else {
    498                 /* We add aARCH to this as this mode is only used if the file is
     501                /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is
    499502                 * created new. */
    500                 unx_mode = unix_mode(conn, new_dos_attributes | aARCH,
     503                unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE,
    501504                                     smb_fname, parent_dir);
    502505        }
     
    541544         */
    542545
    543         if ((req != NULL)
    544             && ((pml = get_open_deferred_message(req->mid)) != NULL)) {
    545                 struct deferred_open_record *state =
    546                         (struct deferred_open_record *)pml->private_data.data;
    547 
    548                 /* Remember the absolute time of the original
    549                    request with this mid. We'll use it later to
    550                    see if this has timed out. */
    551 
    552                 request_time = pml->request_time;
    553 
    554                 /* Remove the deferred open entry under lock. */
    555                 lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL,
    556                                           NULL);
    557                 if (lck == NULL) {
    558                         DEBUG(0, ("could not get share mode lock\n"));
    559                 } else {
    560                         del_deferred_open_entry(lck, req->mid);
    561                         TALLOC_FREE(lck);
    562                 }
    563 
    564                 /* Ensure we don't reprocess this message. */
    565                 remove_deferred_open_smb_message(req->mid);
    566 
    567                 /*
    568                  * When receiving a semlock_async_failure message, the
    569                  * deferred open will be marked as "failed". Returning
    570                  * INTERNAL_ERROR.
    571                  */
    572                 if (state->failed) {
    573                         DEBUG(0, ("onefs_open_file_ntcreate: "
    574                                   "semlock_async_failure detected!\n"));
    575                         return NT_STATUS_INTERNAL_ERROR;
     546        if (req) {
     547                void *ptr;
     548                if (get_deferred_open_message_state(req,
     549                                &request_time,
     550                                &ptr)) {
     551                        struct deferred_open_record *state = (struct deferred_open_record *)ptr;
     552
     553                        /* Remember the absolute time of the original
     554                           request with this mid. We'll use it later to
     555                           see if this has timed out. */
     556
     557                        /* Remove the deferred open entry under lock. */
     558                        remove_deferred_open_entry(state->id, req->mid);
     559
     560                        /* Ensure we don't reprocess this message. */
     561                        remove_deferred_open_message_smb(req->mid);
     562
     563                        /*
     564                         * When receiving a semlock_async_failure message, the
     565                         * deferred open will be marked as "failed". Returning
     566                         * INTERNAL_ERROR.
     567                         */
     568                        if (state->failed) {
     569                                DEBUG(0, ("onefs_open_file_ntcreate: "
     570                                          "semlock_async_failure detected!\n"));
     571                                return NT_STATUS_INTERNAL_ERROR;
     572                        }
    576573                }
    577574        }
     
    591588        /* Setup dos_attributes to be set by ifs_createfile */
    592589        if (lp_store_dos_attributes(SNUM(conn))) {
    593                 createfile_attributes = (new_dos_attributes | aARCH) &
     590                createfile_attributes = (new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE) &
    594591                    ~(FILE_ATTRIBUTE_NONINDEXED | FILE_ATTRIBUTE_COMPRESSED);
    595592        }
    596593
    597594        /* Ignore oplock requests if oplocks are disabled. */
    598         if (!lp_oplocks(SNUM(conn)) || global_client_failed_oplock_break ||
     595        if (!lp_oplocks(SNUM(conn)) ||
    599596            IS_VETO_OPLOCK_PATH(conn, smb_fname->base_name)) {
    600597                /* Mask off everything except the private Samba bits. */
     
    819816
    820817        fsp->share_access = share_access;
    821         fsp->fh->private_options = create_options;
     818        fsp->fh->private_options = private_flags;
    822819        fsp->access_mask = open_access_mask; /* We change this to the
    823820                                              * requested access_mask after
     
    993990
    994991                        /* Try to find dup fsp if possible. */
    995                         if (create_options &
     992                        if (private_flags &
    996993                            (NTCREATEX_OPTIONS_PRIVATE_DENY_DOS|
    997994                             NTCREATEX_OPTIONS_PRIVATE_DENY_FCB)) {
     
    12621259         */
    12631260
    1264         /* Record the options we were opened with. */
    1265         fsp->share_access = share_access;
    1266         fsp->fh->private_options = create_options;
    12671261        /*
    12681262         * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
     
    13171311        }
    13181312
    1319         set_share_mode(lck, fsp, conn->server_info->utok.uid, 0,
     1313        set_share_mode(lck, fsp, get_current_uid(conn),
     1314                        req ? req->mid : 0,
    13201315                       fsp->oplock_type);
    13211316
     
    14891484                file_attributes = 0;
    14901485        } else {
    1491                 mode = unix_mode(conn, aDIR, smb_dname, parent_dir);
     1486                mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir);
    14921487        }
    14931488
     
    16301625
    16311626        fsp->share_access = share_access;
    1632         fsp->fh->private_options = create_options;
     1627        fsp->fh->private_options = 0;
    16331628        /*
    16341629         * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
    16351630         */
    16361631        fsp->access_mask = access_mask | FILE_READ_ATTRIBUTES;
    1637         fsp->print_file = False;
     1632        fsp->print_file = NULL;
    16381633        fsp->modified = False;
    16391634        fsp->oplock_type = NO_OPLOCK;
     
    16731668        }
    16741669
    1675         set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK);
     1670        set_share_mode(lck, fsp, get_current_uid(conn),
     1671                req ? req->mid : 0, NO_OPLOCK);
    16761672
    16771673        /*
     
    17191715                                           uint32_t oplock_request,
    17201716                                           uint64_t allocation_size,
     1717                                           uint32_t private_flags,
    17211718                                           struct security_descriptor *sd,
    17221719                                           struct ea_list *ea_list,
     
    17331730                  "file_attributes = 0x%x, share_access = 0x%x, "
    17341731                  "create_disposition = 0x%x create_options = 0x%x "
    1735                   "oplock_request = 0x%x ea_list = 0x%p, sd = 0x%p, "
     1732                  "oplock_request = 0x%x private_flags = 0x%x "
     1733                  "ea_list = 0x%p, sd = 0x%p, "
    17361734                  "fname = %s\n",
    17371735                  (unsigned int)access_mask,
     
    17411739                  (unsigned int)create_options,
    17421740                  (unsigned int)oplock_request,
     1741                  (unsigned int)private_flags,
    17431742                  ea_list, sd, smb_fname_str_dbg(smb_fname)));
    17441743
     
    18241823                        NO_OPLOCK,                      /* oplock_request */
    18251824                        0,                              /* allocation_size */
     1825                        0,                              /* private_flags */
    18261826                        NULL,                           /* sd */
    18271827                        NULL,                           /* ea_list */
     
    20672067                           uint32_t oplock_request,
    20682068                           uint64_t allocation_size,
     2069                           uint32_t private_flags,
    20692070                           struct security_descriptor *sd,
    20702071                           struct ea_list *ea_list,
     
    20812082                  "file_attributes = 0x%x, share_access = 0x%x, "
    20822083                  "create_disposition = 0x%x create_options = 0x%x "
    2083                   "oplock_request = 0x%x "
     2084                  "oplock_request = 0x%x private_flags = 0x%x"
    20842085                  "root_dir_fid = 0x%x, ea_list = 0x%p, sd = 0x%p, "
    20852086                  "fname = %s\n",
     
    20902091                  (unsigned int)create_options,
    20912092                  (unsigned int)oplock_request,
     2093                  (unsigned int)private_flags,
    20922094                  (unsigned int)root_dir_fid,
    20932095                  ea_list, sd, smb_fname_str_dbg(smb_fname)));
     
    21082110        if (!NT_STATUS_IS_OK(status)) {
    21092111                goto fail;
     2112        }
     2113
     2114        if (is_ntfs_stream_smb_fname(smb_fname)) {
     2115                if (!(conn->fs_capabilities & FILE_NAMED_STREAMS)) {
     2116                        status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
     2117                        goto fail;
     2118                }
     2119
     2120                if (is_ntfs_default_stream_smb_fname(smb_fname)) {
     2121                        int ret;
     2122                        smb_fname->stream_name = NULL;
     2123                        /* We have to handle this error here. */
     2124                        if (create_options & FILE_DIRECTORY_FILE) {
     2125                                status = NT_STATUS_NOT_A_DIRECTORY;
     2126                                goto fail;
     2127                        }
     2128                        if (lp_posix_pathnames()) {
     2129                                ret = SMB_VFS_LSTAT(conn, smb_fname);
     2130                        } else {
     2131                                ret = SMB_VFS_STAT(conn, smb_fname);
     2132                        }
     2133
     2134                        if (ret == 0 && VALID_STAT_OF_DIR(smb_fname->st)) {
     2135                                status = NT_STATUS_FILE_IS_A_DIRECTORY;
     2136                                goto fail;
     2137                        }
     2138                }
    21102139        }
    21112140
     
    21212150                oplock_request,                         /* oplock_request */
    21222151                allocation_size,                        /* allocation_size */
     2152                private_flags,
    21232153                sd,                                     /* sd */
    21242154                ea_list,                                /* ea_list */
Note: See TracChangeset for help on using the changeset viewer.