Ignore:
Timestamp:
May 20, 2009, 6:46:53 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.4

Location:
branches/samba-3.2.x/source/smbd
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/smbd/aio.c

    r133 r204  
    2525/* The signal we'll use to signify aio done. */
    2626#ifndef RT_SIGNAL_AIO
    27 #define RT_SIGNAL_AIO (SIGRTMIN+3)
     27#ifndef SIGRTMIN
     28#define SIGRTMIN        NSIG
     29#endif
     30#define RT_SIGNAL_AIO   (SIGRTMIN+3)
     31#endif
     32
     33#ifndef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR
     34#ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR
     35#define sival_int       sigval_int
     36#define sival_ptr       sigval_ptr
     37#endif
    2838#endif
    2939
     
    269279        a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
    270280
     281        become_root();
    271282        if (SMB_VFS_AIO_READ(fsp,a) == -1) {
    272283                DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
    273284                         "Error %s\n", strerror(errno) ));
    274285                delete_aio_ex(aio_ex);
    275                 return False;
    276         }
     286                unbecome_root();
     287                return False;
     288        }
     289        unbecome_root();
    277290
    278291        DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
     
    367380        a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
    368381
     382        become_root();
    369383        if (SMB_VFS_AIO_WRITE(fsp,a) == -1) {
    370384                DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
    371385                         "Error %s\n", strerror(errno) ));
    372386                delete_aio_ex(aio_ex);
    373                 return False;
    374         }
    375 
     387                unbecome_root();
     388                return False;
     389        }
     390        unbecome_root();
     391       
    376392        release_level_2_oplocks_on_change(fsp);
    377393
     
    576592        int err;
    577593
     594        if(!aio_ex) {
     595                DEBUG(3, ("handle_aio_completed: Non-existing aio_ex passed\n"));
     596                return false;
     597        }
     598
    578599        /* Ensure the operation has really completed. */
    579600        if (SMB_VFS_AIO_ERROR(aio_ex->fsp, &aio_ex->acb) == EINPROGRESS) {
  • branches/samba-3.2.x/source/smbd/build_options.c

    r201 r204  
    19931993        output(screen, "   HAVE_STAT_ST_ATIMENSEC\n");
    19941994#endif
     1995#ifdef HAVE_STAT_ST_BIRTHTIME
     1996        output(screen, "   HAVE_STAT_ST_BIRTHTIME\n");
     1997#endif
     1998#ifdef HAVE_STAT_ST_BIRTHTIMENSEC
     1999        output(screen, "   HAVE_STAT_ST_BIRTHTIMENSEC\n");
     2000#endif
     2001#ifdef HAVE_STAT_ST_BIRTHTIMESPEC
     2002        output(screen, "   HAVE_STAT_ST_BIRTHTIMESPEC\n");
     2003#endif
    19952004#ifdef HAVE_STAT_ST_BLKSIZE
    19962005        output(screen, "   HAVE_STAT_ST_BLKSIZE\n");
     
    20912100#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION
    20922101        output(screen, "   HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION\n");
     2102#endif
     2103#ifdef HAVE_STRUCT_SIGEVENT
     2104        output(screen, "   HAVE_STRUCT_SIGEVENT\n");
     2105#endif
     2106#ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR
     2107        output(screen, "   HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR\n");
     2108#endif
     2109#ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR
     2110        output(screen, "   HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR\n");
    20932111#endif
    20942112#ifdef HAVE_STRUCT_SOCKADDR
  • branches/samba-3.2.x/source/smbd/dosmode.c

    r149 r204  
    632632}
    633633
    634 /*******************************************************************
    635  Change a filetime - possibly allowing DOS semantics.
    636 *******************************************************************/
    637 
    638 bool set_write_time_path(connection_struct *conn, const char *fname,
    639                          struct file_id fileid, const struct timespec mtime,
    640                          bool overwrite)
     634/******************************************************************
     635 Force a "sticky" write time on a pathname. This will always be
     636 returned on all future write time queries and set on close.
     637******************************************************************/
     638
     639bool set_sticky_write_time_path(connection_struct *conn, const char *fname,
     640                         struct file_id fileid, const struct timespec mtime)
    641641{
    642642        if (null_timespec(mtime)) {
     
    644644        }
    645645
    646         if (!set_write_time(fileid, mtime, overwrite)) {
     646        if (!set_sticky_write_time(fileid, mtime)) {
    647647                return false;
    648648        }
    649649
    650         /* in the overwrite case the caller should trigger the notify */
    651         if (!overwrite) {
    652                 notify_fname(conn, NOTIFY_ACTION_MODIFIED,
    653                              FILE_NOTIFY_CHANGE_LAST_WRITE, fname);
    654         }
    655 
    656650        return true;
    657651}
    658652
    659 bool set_write_time_fsp(struct files_struct *fsp, const struct timespec mtime,
    660                         bool overwrite)
    661 {
    662         if (overwrite) {
    663                 fsp->write_time_forced = true;
    664                 TALLOC_FREE(fsp->update_write_time_event);
    665         }
    666 
    667         return set_write_time_path(fsp->conn, fsp->fsp_name, fsp->file_id,
    668                                    mtime, overwrite);
    669 }
     653/******************************************************************
     654 Force a "sticky" write time on an fsp. This will always be
     655 returned on all future write time queries and set on close.
     656******************************************************************/
     657
     658bool set_sticky_write_time_fsp(struct files_struct *fsp, const struct timespec mtime)
     659{
     660        fsp->write_time_forced = true;
     661        TALLOC_FREE(fsp->update_write_time_event);
     662
     663        return set_sticky_write_time_path(fsp->conn, fsp->fsp_name,
     664                        fsp->file_id, mtime);
     665}
     666
     667/******************************************************************
     668 Update a write time immediately, without the 2 second delay.
     669******************************************************************/
     670
     671bool update_write_time(struct files_struct *fsp)
     672{
     673        if (!set_write_time(fsp->file_id, timespec_current())) {
     674                return false;
     675        }
     676
     677        notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
     678                        FILE_NOTIFY_CHANGE_LAST_WRITE, fsp->fsp_name);
     679
     680        return true;
     681}
  • branches/samba-3.2.x/source/smbd/fileio.c

    r133 r204  
    177177                                      void *private_data)
    178178{
    179        files_struct *fsp = (files_struct *)private_data;
    180 
    181        /* Remove the timed event handler. */
    182        TALLOC_FREE(fsp->update_write_time_event);
    183        DEBUG(5, ("Update write time on %s\n", fsp->fsp_name));
    184 
    185        /* change the write time if not already changed by someoneelse */
    186        set_write_time_fsp(fsp, timespec_current(), false);
    187 }
     179        files_struct *fsp = (files_struct *)private_data;
     180
     181        /* Remove the timed event handler. */
     182        TALLOC_FREE(fsp->update_write_time_event);
     183        DEBUG(5, ("Update write time on %s\n", fsp->fsp_name));
     184
     185        /* change the write time if not already changed by someone else */
     186        update_write_time(fsp);
     187}
     188
     189/*********************************************************
     190 Schedule a write time update for WRITE_TIME_UPDATE_USEC_DELAY
     191 in the future.
     192*********************************************************/
    188193
    189194void trigger_write_time_update(struct files_struct *fsp)
     
    192197
    193198        if (fsp->write_time_forced) {
     199                /* No point - "sticky" write times
     200                 * in effect.
     201                 */
    194202                return;
    195203        }
    196204
    197205        if (fsp->update_write_time_triggered) {
     206                /*
     207                 * We only update the write time
     208                 * on the first write. After that
     209                 * no other writes affect this.
     210                 */
    198211                return;
    199212        }
     
    211224                                "update_write_time_handler",
    212225                                update_write_time_handler, fsp);
     226}
     227
     228void trigger_write_time_update_immediate(struct files_struct *fsp)
     229{
     230        if (fsp->write_time_forced) {
     231                /*
     232                 * No point - "sticky" write times
     233                 * in effect.
     234                 */
     235                return;
     236        }
     237
     238        TALLOC_FREE(fsp->update_write_time_event);
     239        DEBUG(5, ("Update write time immediate on %s\n", fsp->fsp_name));
     240
     241        fsp->update_write_time_triggered = true;
     242
     243        fsp->update_write_time_on_close = false;
     244        update_write_time(fsp);
    213245}
    214246
  • branches/samba-3.2.x/source/smbd/nttrans.c

    r136 r204  
    114114                                    + data_alignment_offset);
    115115
    116         /*
    117          * useable_space can never be more than max_send minus the
    118          * alignment offset.
    119          */
    120 
    121         useable_space = MIN(useable_space,
    122                                 max_send - (alignment_offset+data_alignment_offset));
    123 
     116        if (useable_space < 0) {
     117                DEBUG(0, ("send_nt_replies failed sanity useable_space "
     118                          "= %d!!!", useable_space));
     119                exit_server_cleanly("send_nt_replies: srv_send_smb failed.");
     120        }
    124121
    125122        while (params_to_send || data_to_send) {
     
    129126                 */
    130127
    131                 total_sent_thistime = params_to_send + data_to_send +
    132                                         alignment_offset + data_alignment_offset;
     128                total_sent_thistime = params_to_send + data_to_send;
    133129
    134130                /*
     
    138134                total_sent_thistime = MIN(total_sent_thistime, useable_space);
    139135
    140                 reply_outbuf(req, 18, total_sent_thistime);
     136                reply_outbuf(req, 18,
     137                             total_sent_thistime + alignment_offset
     138                             + data_alignment_offset);
    141139
    142140                /*
     
    265263                        DEBUG(0,("send_nt_replies failed sanity check pts = %d, dts = %d\n!!!",
    266264                                params_to_send, data_to_send));
    267                         return;
     265                        exit_server_cleanly("send_nt_replies: internal error");
    268266                }
    269267        }
     
    489487                        (unsigned int)root_dir_fid,
    490488                        fname));
     489
     490        /*
     491         * we need to remove ignored bits when they come directly from the client
     492         * because we reuse some of them for internal stuff
     493         */
     494        create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
    491495
    492496        /*
     
    900904#endif
    901905
     906        /*
     907         * we need to remove ignored bits when they come directly from the client
     908         * because we reuse some of them for internal stuff
     909         */
     910        create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
     911
    902912        /* Ensure the data_len is correct for the sd and ea values given. */
    903913        if ((ea_len + sd_len > data_count)
  • branches/samba-3.2.x/source/smbd/open.c

    r141 r204  
    18551855        /* Handle strange delete on close create semantics. */
    18561856        if ((create_options & FILE_DELETE_ON_CLOSE)
    1857             && (is_ntfs_stream_name(fname)
     1857            && (((conn->fs_capabilities & FILE_NAMED_STREAMS)
     1858                        && is_ntfs_stream_name(fname))
    18581859                || can_set_initial_delete_on_close(lck))) {
    18591860                status = can_set_delete_on_close(fsp, True, new_dos_attributes);
     
    21192120                 (unsigned int)file_attributes));
    21202121
    2121         if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && is_ntfs_stream_name(fname)) {
     2122        if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) &&
     2123                        (conn->fs_capabilities & FILE_NAMED_STREAMS) &&
     2124                        is_ntfs_stream_name(fname)) {
    21222125                DEBUG(2, ("open_directory: %s is a stream name!\n", fname));
    21232126                return NT_STATUS_NOT_A_DIRECTORY;
     
    26122615        if (create_options & FILE_OPEN_BY_FILE_ID) {
    26132616                status = NT_STATUS_NOT_SUPPORTED;
     2617                goto fail;
     2618        }
     2619
     2620        if (create_options & NTCREATEX_OPTIONS_INVALID_PARAM_MASK) {
     2621                status = NT_STATUS_INVALID_PARAMETER;
    26142622                goto fail;
    26152623        }
     
    29572965                         */
    29582966
    2959                         if (is_ntfs_stream_name(fname)) {
     2967                        if ((conn->fs_capabilities & FILE_NAMED_STREAMS) &&
     2968                                        is_ntfs_stream_name(fname)) {
    29602969                                status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
    29612970                                goto fail;
  • branches/samba-3.2.x/source/smbd/posix_acls.c

    r141 r204  
    34013401        }
    34023402
    3403         parent_sd->dacl->aces = new_ace;
    3404         parent_sd->dacl->num_aces = i;
    3405 
    3406         *pp_new_sd = parent_sd;
     3403        /* This sucks. psd should be const and we should
     3404         * be doing a deep-copy here. We're getting away
     3405         * with is as we know parent_sd is talloced off
     3406         * talloc_tos() as well as psd. JRA. */
     3407
     3408        psd->dacl->aces = new_ace;
     3409        psd->dacl->num_aces = i;
     3410        psd->type &= ~(SE_DESC_DACL_AUTO_INHERITED|
     3411                         SE_DESC_DACL_AUTO_INHERIT_REQ);
     3412
     3413        *pp_new_sd = psd;
    34073414        return status;
    34083415}
  • branches/samba-3.2.x/source/smbd/process.c

    r149 r204  
    165165        NTSTATUS status;
    166166
    167         memcpy(writeX_header, lenbuf, sizeof(lenbuf));
     167        memcpy(writeX_header, lenbuf, 4);
    168168
    169169        status = read_socket_with_timeout(
  • branches/samba-3.2.x/source/smbd/quotas.c

    r133 r204  
    545545        *dsize = D.dqb_bsoftlimit;
    546546
    547         if (D.dqb_curblocks == D.dqb_curblocks == 1)
     547        if (D.dqb_curblocks == 1)
    548548                *bsize = 512;
    549549
     
    11051105        *dsize = D.dqb_bsoftlimit;
    11061106
    1107         if (D.dqb_curblocks == D.dqb_curblocks == 1)
     1107        if (D.dqb_curblocks == 1)
    11081108                *bsize = DEV_BSIZE;
    11091109
  • branches/samba-3.2.x/source/smbd/reply.c

    r149 r204  
    31693169
    31703170                if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) {
    3171                         /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */
    3172                         if (errno == ENOSYS) {
     3171                        /* Returning ENOSYS or EINVAL means no data at all was sent.
     3172                           Do this as a normal read. */
     3173                        if (errno == ENOSYS || errno == EINVAL) {
    31733174                                goto normal_read;
    31743175                        }
     
    37833784                        return;
    37843785                }
    3785         } else
     3786                trigger_write_time_update_immediate(fsp);
     3787        } else {
    37863788                nwritten = write_file(req,fsp,data,startpos,numtowrite);
    3787  
     3789        }
     3790
    37883791        status = sync_file(conn, fsp, False);
    37893792        if (!NT_STATUS_IS_OK(status)) {
     
    70977100        int mode;
    70987101        files_struct *fsp;
     7102        struct timespec create_ts;
    70997103
    71007104        START_PROFILE(SMBgetattrE);
     
    71317135        reply_outbuf(req, 11, 0);
    71327136
    7133         srv_put_dos_date2((char *)req->outbuf, smb_vwv0,
    7134                           get_create_time(&sbuf,
    7135                                           lp_fake_dir_create_times(SNUM(conn))));
     7137        create_ts = get_create_timespec(&sbuf,
     7138                                  lp_fake_dir_create_times(SNUM(conn)));
     7139        srv_put_dos_date2((char *)req->outbuf, smb_vwv0, create_ts.tv_sec);
    71367140        srv_put_dos_date2((char *)req->outbuf, smb_vwv2, sbuf.st_atime);
    71377141        /* Should we check pending modtime here ? JRA */
  • branches/samba-3.2.x/source/smbd/sesssetup.c

    r133 r204  
    17401740        }
    17411741
    1742         nt_status = create_local_token(server_info);
    1743         if (!NT_STATUS_IS_OK(nt_status)) {
    1744                 DEBUG(10, ("create_local_token failed: %s\n",
    1745                            nt_errstr(nt_status)));
    1746                 data_blob_free(&nt_resp);
    1747                 data_blob_free(&lm_resp);
    1748                 data_blob_clear_free(&plaintext_password);
    1749                 reply_nterror(req, nt_status_squash(nt_status));
    1750                 END_PROFILE(SMBsesssetupX);
    1751                 return;
     1742        if (!server_info->ptok) {
     1743                nt_status = create_local_token(server_info);
     1744
     1745                if (!NT_STATUS_IS_OK(nt_status)) {
     1746                        DEBUG(10, ("create_local_token failed: %s\n",
     1747                                   nt_errstr(nt_status)));
     1748                        data_blob_free(&nt_resp);
     1749                        data_blob_free(&lm_resp);
     1750                        data_blob_clear_free(&plaintext_password);
     1751                        reply_nterror(req, nt_status_squash(nt_status));
     1752                        END_PROFILE(SMBsesssetupX);
     1753                        return;
     1754                }
    17521755        }
    17531756
  • branches/samba-3.2.x/source/smbd/trans2.c

    r154 r204  
    749749                                    + data_alignment_offset);
    750750
    751         /* useable_space can never be more than max_send minus the alignment offset. */
    752 
    753         useable_space = MIN(useable_space, max_send - (alignment_offset+data_alignment_offset));
     751        if (useable_space < 0) {
     752                DEBUG(0, ("send_trans2_replies failed sanity useable_space "
     753                          "= %d!!!", useable_space));
     754                exit_server_cleanly("send_trans2_replies: Not enough space");
     755        }
    754756
    755757        while (params_to_send || data_to_send) {
    756758                /* Calculate whether we will totally or partially fill this packet */
    757759
    758                 total_sent_thistime = params_to_send + data_to_send + alignment_offset + data_alignment_offset;
     760                total_sent_thistime = params_to_send + data_to_send;
    759761
    760762                /* We can never send more than useable_space */
     
    766768                 */
    767769
    768                 total_sent_thistime = MIN(total_sent_thistime, useable_space+ alignment_offset + data_alignment_offset);
    769 
    770                 reply_outbuf(req, 10, total_sent_thistime);
     770                total_sent_thistime = MIN(total_sent_thistime, useable_space);
     771
     772                reply_outbuf(req, 10, total_sent_thistime + alignment_offset
     773                             + data_alignment_offset);
    771774
    772775                /* Set total params and data to be sent */
     
    19471950                case SMB_FIND_FILE_UNIX:
    19481951                case SMB_FIND_FILE_UNIX_INFO2:
     1952                        /* Always use filesystem for UNIX mtime query. */
     1953                        ask_sharemode = false;
    19491954                        if (!lp_unix_extensions()) {
    19501955                                reply_nterror(req, NT_STATUS_INVALID_LEVEL);
     
    23042309                case SMB_FIND_FILE_UNIX:
    23052310                case SMB_FIND_FILE_UNIX_INFO2:
     2311                        /* Always use filesystem for UNIX mtime query. */
     2312                        ask_sharemode = false;
    23062313                        if (!lp_unix_extensions()) {
    23072314                                reply_nterror(req, NT_STATUS_INVALID_LEVEL);
     
    41414148        }
    41424149
    4143         if (!null_timespec(write_time_ts)) {
     4150        if (!null_timespec(write_time_ts) && !INFO_LEVEL_IS_UNIX(info_level)) {
    41444151                mtime_ts = write_time_ts;
    41454152        }
     
    48964903
    48974904                if (fsp != NULL) {
    4898                         set_write_time_fsp(fsp, ts[1], true);
     4905                        set_sticky_write_time_fsp(fsp, ts[1]);
    48994906                } else {
    4900                         set_write_time_path(conn, fname,
     4907                        set_sticky_write_time_path(conn, fname,
    49014908                                            vfs_file_id_from_sbuf(conn, psbuf),
    4902                                             ts[1], true);
     4909                                            ts[1]);
    49034910                }
    49044911        }
     
    49924999                        return map_nt_error_from_unix(errno);
    49935000                }
     5001                trigger_write_time_update_immediate(fsp);
    49945002                return NT_STATUS_OK;
    49955003        }
     
    50155023        }
    50165024
     5025        trigger_write_time_update_immediate(new_fsp);
    50175026        close_file(new_fsp,NORMAL_CLOSE);
    50185027        return NT_STATUS_OK;
     
    57405749                 * if there are no pending writes.
    57415750                 */
    5742                 trigger_write_time_update(fsp);
     5751                trigger_write_time_update_immediate(fsp);
    57435752                return NT_STATUS_OK;
    57445753        }
     
    57745783         * if there are no pending writes.
    57755784         */
    5776         trigger_write_time_update(new_fsp);
     5785        trigger_write_time_update_immediate(new_fsp);
    57775786
    57785787        close_file(new_fsp,NORMAL_CLOSE);
Note: See TracChangeset for help on using the changeset viewer.