Ignore:
Timestamp:
May 27, 2009, 11:39:15 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.9

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

Legend:

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

    r232 r233  
    168168****************************************************************************/
    169169
    170 static NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
     170NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
    171171{
    172172        struct stream_struct *stream_info;
     
    468468        struct timespec ts[2];
    469469        NTSTATUS status;
     470        int ret = -1;
    470471
    471472        ZERO_STRUCT(sbuf);
     
    482483        /* Ensure we have a valid stat struct for the source. */
    483484        if (fsp->fh->fd != -1) {
    484                 if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
    485                         return map_nt_error_from_unix(errno);
    486                 }
     485                ret = SMB_VFS_FSTAT(fsp, &sbuf);
    487486        } else {
    488                 if (SMB_VFS_STAT(fsp->conn,fsp->fsp_name,&sbuf) == -1) {
    489                         return map_nt_error_from_unix(errno);
    490                 }
     487                if (fsp->posix_open) {
     488                        ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name,&sbuf);
     489                } else {
     490                        ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name,&sbuf);
     491                }
     492        }
     493
     494        if (ret == -1) {
     495                return map_nt_error_from_unix(errno);
    491496        }
    492497
     
    576581
    577582        saved_status4 = update_write_time_on_close(fsp);
     583        if (NT_STATUS_EQUAL(saved_status4, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
     584                /* Someone renamed the file or a parent directory containing
     585                 * this file. We can't do anything about this, we don't have
     586                 * an "update timestamp by fd" call in POSIX. Eat the error. */
     587
     588                saved_status4 = NT_STATUS_OK;
     589        }
    578590
    579591        if (NT_STATUS_IS_OK(status)) {
  • branches/samba-3.2.x/source/smbd/dnsregister.c

    r133 r233  
    110110
    111111        if (dns_state == NULL) {
    112                 *dns_state_ptr = dns_state = talloc(NULL, struct dns_reg_state);
     112                dns_state = talloc_zero(NULL, struct dns_reg_state);
     113                *dns_state_ptr = dns_state;
    113114                if (dns_state == NULL) {
    114115                        return;
  • branches/samba-3.2.x/source/smbd/dosmode.c

    r232 r233  
    335335                        p = path;
    336336                }
    337                
    338                 if (p[0] == '.' && p[1] != '.' && p[1] != 0) {
     337
     338                /* Only . and .. are not hidden. */
     339                if (p[0] == '.' && !((p[1] == '\0') ||
     340                                (p[1] == '.' && p[2] == '\0'))) {
    339341                        result |= aHIDDEN;
    340342                }
     
    387389                        p = path;
    388390                }
    389                
    390                 if (p[0] == '.' && p[1] != '.' && p[1] != 0) {
     391
     392                /* Only . and .. are not hidden. */
     393                if (p[0] == '.' && !((p[1] == '\0') ||
     394                                (p[1] == '.' && p[2] == '\0'))) {
    391395                        result |= aHIDDEN;
    392396                }
  • branches/samba-3.2.x/source/smbd/open.c

    r232 r233  
    11941194        bool posix_open = False;
    11951195        bool new_file_created = False;
     1196        bool clear_ads = false;
    11961197        struct file_id id;
    11971198        NTSTATUS fsp_open = NT_STATUS_ACCESS_DENIED;
     
    13261327                         * exist create. */
    13271328                        flags2 |= (O_CREAT | O_TRUNC);
     1329                        clear_ads = true;
    13281330                        break;
    13291331
     
    13321334                         * exist create. */
    13331335                        flags2 |= (O_CREAT | O_TRUNC);
     1336                        clear_ads = true;
    13341337                        break;
    13351338
     
    13561359                        }
    13571360                        flags2 |= O_TRUNC;
     1361                        clear_ads = true;
    13581362                        break;
    13591363
     
    17871791
    17881792        SMB_ASSERT(lck != NULL);
     1793
     1794        /* Delete streams if create_disposition requires it */
     1795        if (file_existed && clear_ads && !is_ntfs_stream_name(fname)) {
     1796                status = delete_all_streams(conn, fname);
     1797                if (!NT_STATUS_IS_OK(status)) {
     1798                        TALLOC_FREE(lck);
     1799                        fd_close(fsp);
     1800                        return status;
     1801                }
     1802        }
    17891803
    17901804        /* note that we ignore failure for the following. It is
  • branches/samba-3.2.x/source/smbd/posix_acls.c

    r232 r233  
    40644064        SMB_ACL_T def_acl = NULL;
    40654065
    4066         if (num_def_acls && !S_ISDIR(psbuf->st_mode)) {
    4067                 DEBUG(5,("set_unix_posix_default_acl: Can't set default ACL on non-directory file %s\n", fname ));
    4068                 errno = EISDIR;
    4069                 return False;
     4066        if (!S_ISDIR(psbuf->st_mode)) {
     4067                if (num_def_acls) {
     4068                        DEBUG(5,("set_unix_posix_default_acl: Can't set default ACL on non-directory file %s\n", fname ));
     4069                        errno = EISDIR;
     4070                        return False;
     4071                } else {
     4072                        return True;
     4073                }
    40704074        }
    40714075
  • branches/samba-3.2.x/source/smbd/process.c

    r232 r233  
    10341034/* 0x31 */ { NULL, NULL, 0 },
    10351035/* 0x32 */ { "SMBtrans2",reply_trans2, AS_USER | CAN_IPC },
    1036 /* 0x33 */ { "SMBtranss2",reply_transs2, AS_USER},
     1036/* 0x33 */ { "SMBtranss2",reply_transs2, AS_USER | CAN_IPC},
    10371037/* 0x34 */ { "SMBfindclose",reply_findclose,AS_USER},
    10381038/* 0x35 */ { "SMBfindnclose",reply_findnclose,AS_USER},
  • branches/samba-3.2.x/source/smbd/reply.c

    r232 r233  
    7979                }
    8080
    81                 if (!stream_started && *s == ':') {
     81                if (!posix_path && !stream_started && *s == ':') {
    8282                        if (*p_last_component_contains_wcard) {
    8383                                return NT_STATUS_OBJECT_NAME_INVALID;
    8484                        }
    85                         /* stream names allow more characters than file names */
     85                        /* Stream names allow more characters than file names.
     86                           We're overloading posix_path here to allow a wider
     87                           range of characters. If stream_started is true this
     88                           is still a Windows path even if posix_path is true.
     89                           JRA.
     90                        */
    8691                        stream_started = true;
    8792                        start_of_name_component = false;
  • branches/samba-3.2.x/source/smbd/server.c

    r232 r233  
    14021402
    14031403        if (*lp_rootdir()) {
    1404                 if (sys_chroot(lp_rootdir()) == 0)
    1405                         DEBUG(2,("Changed root to %s\n", lp_rootdir()));
     1404                if (sys_chroot(lp_rootdir()) != 0) {
     1405                        DEBUG(0,("Failed to change root to %s\n", lp_rootdir()));
     1406                        exit(1);
     1407                }
     1408                if (chdir("/") == -1) {
     1409                        DEBUG(0,("Failed to chdir to / on chroot to %s\n", lp_rootdir()));
     1410                        exit(1);
     1411                }
     1412                DEBUG(0,("Changed root to %s\n", lp_rootdir()));
    14061413        }
    14071414
  • branches/samba-3.2.x/source/smbd/trans2.c

    r232 r233  
    49724972
    49734973static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
     4974                                files_struct *fsp,
    49744975                                const char *fname,
    49754976                                SMB_STRUCT_STAT *psbuf,
     
    49804981        }
    49814982
     4983        if (fsp) {
     4984                if (fsp->base_fsp) {
     4985                        fname = fsp->base_fsp->fsp_name;
     4986                } else {
     4987                        fname = fsp->fsp_name;
     4988                }
     4989        }
     4990               
    49824991        if (dosmode) {
    49834992                if (S_ISDIR(psbuf->st_mode)) {
     
    57045713        dosmode = IVAL(pdata,32);
    57055714        status = smb_set_file_dosmode(conn,
    5706                                         fname,
    5707                                         psbuf,
    5708                                         dosmode);
     5715                                fsp,
     5716                                fname,
     5717                                psbuf,
     5718                                dosmode);
     5719
    57095720        if (!NT_STATUS_IS_OK(status)) {
    57105721                return status;
Note: See TracChangeset for help on using the changeset viewer.