Ignore:
Timestamp:
Jul 2, 2011, 4:01:14 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update vendor to version 3.5.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/trans2.c

    r587 r597  
    31573157
    31583158                        /* access check */
    3159                         if (conn->server_info->utok.uid != sec_initial_uid()) {
     3159                        if (conn->server_info->utok.uid != sec_initial_uid() &&
     3160                                        !conn->admin_user) {
    31603161                                DEBUG(0,("set_user_quota: access_denied "
    31613162                                         "service [%s] user [%s]\n",
     
    36443645
    36453646                                /* access check */
    3646                                 if ((conn->server_info->utok.uid != sec_initial_uid())
     3647                                if (((conn->server_info->utok.uid != sec_initial_uid()) && !conn->admin_user)
    36473648                                    ||!CAN_WRITE(conn)) {
    36483649                                        DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
     
    70457046        wire_open_mode &= ~SMB_ACCMODE;
    70467047
    7047         if((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL)) == (SMB_O_CREAT | SMB_O_EXCL)) {
    7048                 create_disp = FILE_CREATE;
    7049         } else if((wire_open_mode & (SMB_O_CREAT | SMB_O_TRUNC)) == (SMB_O_CREAT | SMB_O_TRUNC)) {
    7050                 create_disp = FILE_OVERWRITE_IF;
    7051         } else if((wire_open_mode & SMB_O_CREAT) == SMB_O_CREAT) {
    7052                 create_disp = FILE_OPEN_IF;
    7053         } else if ((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL | SMB_O_TRUNC)) == 0) {
    7054                 create_disp = FILE_OPEN;
    7055         } else {
    7056                 DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n",
    7057                         (unsigned int)wire_open_mode ));
    7058                 return NT_STATUS_INVALID_PARAMETER;
     7048        /* First take care of O_CREAT|O_EXCL interactions. */
     7049        switch (wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL)) {
     7050                case (SMB_O_CREAT | SMB_O_EXCL):
     7051                        /* File exists fail. File not exist create. */
     7052                        create_disp = FILE_CREATE;
     7053                        break;
     7054                case SMB_O_CREAT:
     7055                        /* File exists open. File not exist create. */
     7056                        create_disp = FILE_OPEN_IF;
     7057                        break;
     7058                case 0:
     7059                        /* File exists open. File not exist fail. */
     7060                        create_disp = FILE_OPEN;
     7061                        break;
     7062                case SMB_O_EXCL:
     7063                        /* O_EXCL on its own without O_CREAT is undefined. */
     7064                default:
     7065                        DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n",
     7066                                (unsigned int)wire_open_mode ));
     7067                        return NT_STATUS_INVALID_PARAMETER;
     7068        }
     7069
     7070        /* Next factor in the effects of O_TRUNC. */
     7071        wire_open_mode &= ~(SMB_O_CREAT | SMB_O_EXCL);
     7072
     7073        if (wire_open_mode & SMB_O_TRUNC) {
     7074                switch (create_disp) {
     7075                        case FILE_CREATE:
     7076                                /* (SMB_O_CREAT | SMB_O_EXCL | O_TRUNC) */
     7077                                /* Leave create_disp alone as
     7078                                   (O_CREAT|O_EXCL|O_TRUNC) == (O_CREAT|O_EXCL)
     7079                                */
     7080                                /* File exists fail. File not exist create. */
     7081                                break;
     7082                        case FILE_OPEN_IF:
     7083                                /* SMB_O_CREAT | SMB_O_TRUNC */
     7084                                /* File exists overwrite. File not exist create. */
     7085                                create_disp = FILE_OVERWRITE_IF;
     7086                                break;
     7087                        case FILE_OPEN:
     7088                                /* SMB_O_TRUNC */
     7089                                /* File exists overwrite. File not exist fail. */
     7090                                create_disp = FILE_OVERWRITE;
     7091                                break;
     7092                        default:
     7093                                /* Cannot get here. */
     7094                                smb_panic("smb_posix_open: logic error");
     7095                                return NT_STATUS_INVALID_PARAMETER;
     7096                }
    70597097        }
    70607098
Note: See TracChangeset for help on using the changeset viewer.