Changeset 599 for trunk/server/source3/smbd/trans2.c
- Timestamp:
- Jul 6, 2011, 8:21:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/smbd/trans2.c
r590 r599 3170 3170 3171 3171 /* access check */ 3172 if (conn->server_info->utok.uid != sec_initial_uid()) { 3172 if (conn->server_info->utok.uid != sec_initial_uid() && 3173 !conn->admin_user) { 3173 3174 DEBUG(0,("set_user_quota: access_denied " 3174 3175 "service [%s] user [%s]\n", … … 3657 3658 3658 3659 /* access check */ 3659 if (( conn->server_info->utok.uid != sec_initial_uid())3660 if (((conn->server_info->utok.uid != sec_initial_uid()) && !conn->admin_user) 3660 3661 ||!CAN_WRITE(conn)) { 3661 3662 DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n", … … 7067 7068 wire_open_mode &= ~SMB_ACCMODE; 7068 7069 7069 if((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL)) == (SMB_O_CREAT | SMB_O_EXCL)) { 7070 create_disp = FILE_CREATE; 7071 } else if((wire_open_mode & (SMB_O_CREAT | SMB_O_TRUNC)) == (SMB_O_CREAT | SMB_O_TRUNC)) { 7072 create_disp = FILE_OVERWRITE_IF; 7073 } else if((wire_open_mode & SMB_O_CREAT) == SMB_O_CREAT) { 7074 create_disp = FILE_OPEN_IF; 7075 } else if ((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL | SMB_O_TRUNC)) == 0) { 7076 create_disp = FILE_OPEN; 7077 } else { 7078 DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n", 7079 (unsigned int)wire_open_mode )); 7080 return NT_STATUS_INVALID_PARAMETER; 7070 /* First take care of O_CREAT|O_EXCL interactions. */ 7071 switch (wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL)) { 7072 case (SMB_O_CREAT | SMB_O_EXCL): 7073 /* File exists fail. File not exist create. */ 7074 create_disp = FILE_CREATE; 7075 break; 7076 case SMB_O_CREAT: 7077 /* File exists open. File not exist create. */ 7078 create_disp = FILE_OPEN_IF; 7079 break; 7080 case 0: 7081 /* File exists open. File not exist fail. */ 7082 create_disp = FILE_OPEN; 7083 break; 7084 case SMB_O_EXCL: 7085 /* O_EXCL on its own without O_CREAT is undefined. */ 7086 default: 7087 DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n", 7088 (unsigned int)wire_open_mode )); 7089 return NT_STATUS_INVALID_PARAMETER; 7090 } 7091 7092 /* Next factor in the effects of O_TRUNC. */ 7093 wire_open_mode &= ~(SMB_O_CREAT | SMB_O_EXCL); 7094 7095 if (wire_open_mode & SMB_O_TRUNC) { 7096 switch (create_disp) { 7097 case FILE_CREATE: 7098 /* (SMB_O_CREAT | SMB_O_EXCL | O_TRUNC) */ 7099 /* Leave create_disp alone as 7100 (O_CREAT|O_EXCL|O_TRUNC) == (O_CREAT|O_EXCL) 7101 */ 7102 /* File exists fail. File not exist create. */ 7103 break; 7104 case FILE_OPEN_IF: 7105 /* SMB_O_CREAT | SMB_O_TRUNC */ 7106 /* File exists overwrite. File not exist create. */ 7107 create_disp = FILE_OVERWRITE_IF; 7108 break; 7109 case FILE_OPEN: 7110 /* SMB_O_TRUNC */ 7111 /* File exists overwrite. File not exist fail. */ 7112 create_disp = FILE_OVERWRITE; 7113 break; 7114 default: 7115 /* Cannot get here. */ 7116 smb_panic("smb_posix_open: logic error"); 7117 return NT_STATUS_INVALID_PARAMETER; 7118 } 7081 7119 } 7082 7120
Note:
See TracChangeset
for help on using the changeset viewer.