Changeset 228 for branches/samba-3.2.x/source/smbd/reply.c
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/smbd/reply.c
r204 r228 55 55 NTSTATUS ret = NT_STATUS_OK; 56 56 bool start_of_name_component = True; 57 bool stream_started = false; 57 58 58 59 *p_last_component_contains_wcard = False; 59 60 60 61 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)) { 62 96 /* 63 97 * Safe to assume is not the second part of a mb char … … 122 156 if (!(*s & 0x80)) { 123 157 if (!posix_path) { 124 if (*s <= 0x1f ) {158 if (*s <= 0x1f || *s == '|') { 125 159 return NT_STATUS_OBJECT_NAME_INVALID; 126 160 } … … 4600 4634 files_struct *fsp; 4601 4635 NTSTATUS status; 4602 4636 4603 4637 START_PROFILE(SMBsplopen); 4604 4638 … … 4615 4649 } 4616 4650 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)) { 4621 4653 reply_nterror(req, status); 4622 4654 END_PROFILE(SMBsplopen); … … 4624 4656 } 4625 4657 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 4626 4668 reply_outbuf(req, 1, 0); 4627 4669 SSVAL(req->outbuf,smb_vwv0,fsp->fnum); 4628 4670 4629 4671 DEBUG(3,("openprint fd=%d fnum=%d\n", 4630 4672 fsp->fh->fd, fsp->fnum)); … … 5047 5089 } 5048 5090 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. */ 5051 5101 RewindDir(dir_hnd,&dirpos); 5052 5102 while ((dname = ReadDirName(dir_hnd,&dirpos))) { … … 5074 5124 } 5075 5125 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; 5079 5128 } 5080 5129 if(SMB_VFS_RMDIR(conn,fullname) != 0) { … … 5507 5556 } 5508 5557 5558 if(replace_if_exists && dst_exists) { 5559 if (is_ntfs_stream_name(newname)) { 5560 return NT_STATUS_INVALID_PARAMETER; 5561 } 5562 } 5563 5509 5564 if (dst_exists) { 5510 5565 struct file_id fileid = vfs_file_id_from_sbuf(conn, &sbuf1); … … 5557 5612 fsp->fsp_name,newname)); 5558 5613 5614 notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname); 5615 5559 5616 rename_open_files(conn, lck, newname); 5560 5561 notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);5562 5617 5563 5618 /*
Note:
See TracChangeset
for help on using the changeset viewer.