Ignore:
Timestamp:
Nov 12, 2012, 5:09:31 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: update branche to 3.5.13

Location:
branches/samba-3.5.x/source3/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.5.x/source3/lib/ctdbd_conn.c

    r429 r733  
    11321132        struct ctdbd_traverse_state state;
    11331133
     1134        become_root();
    11341135        status = ctdbd_init_connection(NULL, &conn);
     1136        unbecome_root();
    11351137        if (!NT_STATUS_IS_OK(status)) {
    11361138                DEBUG(0, ("ctdbd_init_connection failed: %s\n",
  • branches/samba-3.5.x/source3/lib/recvfile.c

    r664 r733  
    3333 * as we're below the Samba vfs layer.
    3434 *
    35  * If tofd is -1 we just drain the incoming socket of count
    36  * bytes without writing to the outgoing fd.
    37  * If a write fails we do the same (to cope with disk full)
    38  * errors.
    39  *
    4035 * Returns -1 on short reads from fromfd (read error)
    4136 * and sets errno.
    4237 *
    4338 * Returns number of bytes written to 'tofd'
    44  * or thrown away if 'tofd == -1'.
    4539 * return != count then sets errno.
    4640 * Returns count if complete success.
     
    9993                num_written = 0;
    10094
    101                 while (num_written < read_ret) {
     95                /* Don't write any more after a write error. */
     96                while (tofd != -1 && (num_written < read_ret)) {
    10297                        ssize_t write_ret;
    10398
    104                         if (tofd == -1) {
    105                                 write_ret = read_ret;
    106                         } else {
    107                                 /* Write to file - ignore EINTR. */
    108                                 write_ret = sys_write(tofd,
    109                                                 buffer + num_written,
    110                                                 read_ret - num_written);
    111 
    112                                 if (write_ret <= 0) {
    113                                         /* write error - stop writing. */
    114                                         tofd = -1;
    115                                         saved_errno = errno;
    116                                         continue;
    117                                 }
     99                        /* Write to file - ignore EINTR. */
     100                        write_ret = sys_write(tofd,
     101                                        buffer + num_written,
     102                                        read_ret - num_written);
     103
     104                        if (write_ret <= 0) {
     105                                /* write error - stop writing. */
     106                                tofd = -1;
     107                                if (total_written == 0) {
     108                                        /* Ensure we return
     109                                           -1 if the first
     110                                           write failed. */
     111                                        total_written = -1;
     112                                }
     113                                saved_errno = errno;
     114                                break;
    118115                        }
    119116
     
    217214
    218215 done:
    219         if (total_written < count) {
     216        if (count) {
    220217                int saved_errno = errno;
    221                 if (drain_socket(fromfd, count-total_written) !=
    222                                 count-total_written) {
     218                if (drain_socket(fromfd, count) != count) {
    223219                        /* socket is dead. */
    224220                        return -1;
     
    246242/*****************************************************************
    247243 Throw away "count" bytes from the client socket.
     244 Returns count or -1 on error.
    248245*****************************************************************/
    249246
    250247ssize_t drain_socket(int sockfd, size_t count)
    251248{
    252         return default_sys_recvfile(sockfd, -1, (SMB_OFF_T)-1, count);
    253 }
     249        size_t total = 0;
     250        size_t bufsize = MIN(TRANSFER_BUF_SIZE,count);
     251        char *buffer = NULL;
     252
     253        if (count == 0) {
     254                return 0;
     255        }
     256
     257        buffer = SMB_MALLOC_ARRAY(char, bufsize);
     258        if (buffer == NULL) {
     259                return -1;
     260        }
     261
     262        while (total < count) {
     263                ssize_t read_ret;
     264                size_t toread = MIN(bufsize,count - total);
     265
     266                /* Read from socket - ignore EINTR. */
     267                read_ret = sys_read(sockfd, buffer, toread);
     268                if (read_ret <= 0) {
     269                        /* EOF or socket error. */
     270                        free(buffer);
     271                        return -1;
     272                }
     273                total += read_ret;
     274        }
     275
     276        free(buffer);
     277        return count;
     278}
  • branches/samba-3.5.x/source3/lib/util_seaccess.c

    r599 r733  
    159159        int i;
    160160        uint32_t bits_remaining;
     161        uint32_t explicitly_denied_bits = 0;
    161162
    162163        *access_granted = access_desired;
     
    224225                case SEC_ACE_TYPE_ACCESS_DENIED:
    225226                case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
    226                         if (bits_remaining & ace->access_mask) {
    227                                 return NT_STATUS_ACCESS_DENIED;
    228                         }
     227                        explicitly_denied_bits |= (bits_remaining & ace->access_mask);
    229228                        break;
    230229                default:        /* Other ACE types not handled/supported */
     
    232231                }
    233232        }
     233
     234        bits_remaining |= explicitly_denied_bits;
    234235
    235236done:
Note: See TracChangeset for help on using the changeset viewer.