Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

File:
1 edited

Legend:

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

    r204 r228  
    5555        NTSTATUS ret = NT_STATUS_OK;
    5656        bool start_of_name_component = True;
     57        bool stream_started = false;
    5758
    5859        *p_last_component_contains_wcard = False;
    5960
    6061        while (*s) {
    61                 if (IS_PATH_SEP(*s,posix_path)) {
     62                if (stream_started) {
     63                        switch (*s) {
     64                        case '/':
     65                        case '\\':
     66                                return NT_STATUS_OBJECT_NAME_INVALID;
     67                        case ':':
     68                                if (s[1] == '\0') {
     69                                        return NT_STATUS_OBJECT_NAME_INVALID;
     70                                }
     71                                if (strchr_m(&s[1], ':')) {
     72                                        return NT_STATUS_OBJECT_NAME_INVALID;
     73                                }
     74                                if (StrCaseCmp(s, ":$DATA") != 0) {
     75                                        return NT_STATUS_INVALID_PARAMETER;
     76                                }
     77                                break;
     78                        }
     79                }
     80
     81                if (!stream_started && *s == ':') {
     82                        if (*p_last_component_contains_wcard) {
     83                                return NT_STATUS_OBJECT_NAME_INVALID;
     84                        }
     85                        /* stream names allow more characters than file names */
     86                        stream_started = true;
     87                        start_of_name_component = false;
     88                        posix_path = true;
     89
     90                        if (s[1] == '\0') {
     91                                return NT_STATUS_OBJECT_NAME_INVALID;
     92                        }
     93                }
     94
     95                if (!stream_started && IS_PATH_SEP(*s,posix_path)) {
    6296                        /*
    6397                         * Safe to assume is not the second part of a mb char
     
    122156                if (!(*s & 0x80)) {
    123157                        if (!posix_path) {
    124                                 if (*s <= 0x1f) {
     158                                if (*s <= 0x1f || *s == '|') {
    125159                                        return NT_STATUS_OBJECT_NAME_INVALID;
    126160                                }
     
    46004634        files_struct *fsp;
    46014635        NTSTATUS status;
    4602        
     4636
    46034637        START_PROFILE(SMBsplopen);
    46044638
     
    46154649        }
    46164650
    4617         /* Open for exclusive use, write only. */
    4618         status = print_fsp_open(conn, NULL, &fsp);
    4619 
    4620         if (!NT_STATUS_IS_OK(status)) {
     4651        status = file_new(conn, &fsp);
     4652        if(!NT_STATUS_IS_OK(status)) {
    46214653                reply_nterror(req, status);
    46224654                END_PROFILE(SMBsplopen);
     
    46244656        }
    46254657
     4658        /* Open for exclusive use, write only. */
     4659        status = print_fsp_open(conn, NULL, fsp);
     4660
     4661        if (!NT_STATUS_IS_OK(status)) {
     4662                file_free(fsp);
     4663                reply_nterror(req, status);
     4664                END_PROFILE(SMBsplopen);
     4665                return;
     4666        }
     4667
    46264668        reply_outbuf(req, 1, 0);
    46274669        SSVAL(req->outbuf,smb_vwv0,fsp->fnum);
    4628  
     4670
    46294671        DEBUG(3,("openprint fd=%d fnum=%d\n",
    46304672                 fsp->fh->fd, fsp->fnum));
     
    50475089                }
    50485090
    5049                 /* We only have veto files/directories. Recursive delete. */
    5050 
     5091                /* We only have veto files/directories.
     5092                 * Are we allowed to delete them ? */
     5093
     5094                if(!lp_recursive_veto_delete(SNUM(conn))) {
     5095                        TALLOC_FREE(dir_hnd);
     5096                        errno = ENOTEMPTY;
     5097                        goto err;
     5098                }
     5099
     5100                /* Do a recursive delete. */
    50515101                RewindDir(dir_hnd,&dirpos);
    50525102                while ((dname = ReadDirName(dir_hnd,&dirpos))) {
     
    50745124                        }
    50755125                        if(st.st_mode & S_IFDIR) {
    5076                                 if(lp_recursive_veto_delete(SNUM(conn))) {
    5077                                         if(!recursive_rmdir(ctx, conn, fullname))
    5078                                                 break;
     5126                                if(!recursive_rmdir(ctx, conn, fullname)) {
     5127                                        break;
    50795128                                }
    50805129                                if(SMB_VFS_RMDIR(conn,fullname) != 0) {
     
    55075556        }
    55085557
     5558        if(replace_if_exists && dst_exists) {
     5559                if (is_ntfs_stream_name(newname)) {
     5560                        return NT_STATUS_INVALID_PARAMETER;
     5561                }
     5562        }
     5563
    55095564        if (dst_exists) {
    55105565                struct file_id fileid = vfs_file_id_from_sbuf(conn, &sbuf1);
     
    55575612                        fsp->fsp_name,newname));
    55585613
     5614                notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
     5615
    55595616                rename_open_files(conn, lck, newname);
    5560 
    5561                 notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
    55625617
    55635618                /*
Note: See TracChangeset for help on using the changeset viewer.