Ignore:
Timestamp:
Jun 9, 2016, 2:17:22 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: apply latest security patches to vendor

Location:
vendor/current/source3/librpc/rpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/librpc/rpc/dcerpc.h

    r917 r919  
    4040        enum dcerpc_AuthType auth_type;
    4141        enum dcerpc_AuthLevel auth_level;
     42        bool verified_bitmask1;
    4243
    4344        void *auth_ctx;
     45        uint32_t auth_context_id;
    4446
    4547        /* Only the client code uses these 3 for now */
     
    7173                                 const DATA_BLOB *credentials,
    7274                                 DATA_BLOB *blob);
    73 NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
    74                                  const DATA_BLOB *blob,
    75                                  struct dcerpc_auth *r,
    76                                  bool bigendian);
    7775NTSTATUS dcerpc_guess_sizes(struct pipe_auth_data *auth,
    7876                            size_t header_len, size_t data_left,
     
    8583                           struct ncacn_packet *pkt,
    8684                           DATA_BLOB *pkt_trailer,
    87                            size_t header_size,
    88                            DATA_BLOB *raw_pkt,
    89                            size_t *pad_len);
     85                           uint8_t header_size,
     86                           DATA_BLOB *raw_pkt);
    9087
    9188/* The following definitions come from librpc/rpc/rpc_common.c  */
  • vendor/current/source3/librpc/rpc/dcerpc_helpers.c

    r860 r919  
    211211
    212212/**
    213 * @brief Decodes a dcerpc_auth blob
    214 *
    215 * @param mem_ctx        The memory context on which to allocate the packet
    216 *                       elements
    217 * @param blob           The blob of data to decode
    218 * @param r              An empty dcerpc_auth structure, must not be NULL
    219 *
    220 * @return a NTSTATUS error code
    221 */
    222 NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
    223                                  const DATA_BLOB *blob,
    224                                  struct dcerpc_auth *r,
    225                                  bool bigendian)
    226 {
    227         enum ndr_err_code ndr_err;
    228         struct ndr_pull *ndr;
    229 
    230         ndr = ndr_pull_init_blob(blob, mem_ctx);
    231         if (!ndr) {
    232                 return NT_STATUS_NO_MEMORY;
    233         }
    234         if (bigendian) {
    235                 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
    236         }
    237 
    238         ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, r);
    239 
    240         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    241                 talloc_free(ndr);
    242                 return ndr_map_error2ntstatus(ndr_err);
    243         }
    244         talloc_free(ndr);
    245 
    246         if (DEBUGLEVEL >= 10) {
    247                 NDR_PRINT_DEBUG(dcerpc_auth, r);
    248         }
    249 
    250         return NT_STATUS_OK;
    251 }
    252 
    253 /**
    254213* @brief Calculate how much data we can in a packet, including calculating
    255214*        auth token and pad lengths.
     
    783742                                         auth->auth_level,
    784743                                         pad_len,
    785                                          1 /* context id. */,
     744                                         auth->auth_context_id,
    786745                                         &auth_blob,
    787746                                         &auth_info);
     
    845804* @param auth           The auth data for the connection
    846805* @param pkt            The actual ncacn_packet
    847 * @param pkt_trailer    The stub_and_verifier part of the packet
     806* @param pkt_trailer [in][out]  The stub_and_verifier part of the packet,
     807*                       the auth_trailer and padding will be removed.
    848808* @param header_size    The header size
    849809* @param raw_pkt        The whole raw packet data blob
    850 * @param pad_len        [out] The padding length used in the packet
    851810*
    852811* @return A NTSTATUS error code
     
    855814                           struct ncacn_packet *pkt,
    856815                           DATA_BLOB *pkt_trailer,
    857                            size_t header_size,
    858                            DATA_BLOB *raw_pkt,
    859                            size_t *pad_len)
     816                           uint8_t header_size,
     817                           DATA_BLOB *raw_pkt)
    860818{
    861819        struct schannel_state *schannel_auth;
     
    869827        DATA_BLOB data;
    870828
     829        /*
     830         * These check should be done in the caller.
     831         */
     832        SMB_ASSERT(raw_pkt->length == pkt->frag_length);
     833        SMB_ASSERT(header_size <= pkt->frag_length);
     834        SMB_ASSERT(pkt_trailer->length < pkt->frag_length);
     835        SMB_ASSERT((pkt_trailer->length + header_size) <= pkt->frag_length);
     836
    871837        switch (auth->auth_level) {
    872838        case DCERPC_AUTH_LEVEL_PRIVACY:
     
    882848                        break;
    883849                }
    884                 *pad_len = 0;
    885850                return NT_STATUS_OK;
    886851
     
    891856                        return NT_STATUS_INVALID_PARAMETER;
    892857                }
    893                 *pad_len = 0;
    894858                return NT_STATUS_OK;
    895859
     
    900864        }
    901865
    902         /* Paranioa checks for auth_length. */
    903         if (pkt->auth_length > pkt->frag_length) {
    904                 return NT_STATUS_INFO_LENGTH_MISMATCH;
    905         }
    906         if (((unsigned int)pkt->auth_length
    907              + DCERPC_AUTH_TRAILER_LENGTH < (unsigned int)pkt->auth_length) ||
    908             ((unsigned int)pkt->auth_length
    909              + DCERPC_AUTH_TRAILER_LENGTH < DCERPC_AUTH_TRAILER_LENGTH)) {
    910                 /* Integer wrap attempt. */
    911                 return NT_STATUS_INFO_LENGTH_MISMATCH;
     866        if (pkt->auth_length == 0) {
     867                return NT_STATUS_INVALID_PARAMETER;
    912868        }
    913869
     
    918874        }
    919875
     876        if (auth_info.auth_type != auth->auth_type) {
     877                return NT_STATUS_INVALID_PARAMETER;
     878        }
     879
     880        if (auth_info.auth_level != auth->auth_level) {
     881                return NT_STATUS_INVALID_PARAMETER;
     882        }
     883
     884        if (auth_info.auth_context_id != auth->auth_context_id) {
     885                return NT_STATUS_INVALID_PARAMETER;
     886        }
     887
     888        pkt_trailer->length -= auth_length;
    920889        data = data_blob_const(raw_pkt->data + header_size,
    921                                 pkt_trailer->length - auth_length);
    922         full_pkt = data_blob_const(raw_pkt->data,
    923                                 raw_pkt->length - auth_info.credentials.length);
     890                               pkt_trailer->length);
     891        full_pkt = data_blob_const(raw_pkt->data, raw_pkt->length);
     892        full_pkt.length -= auth_info.credentials.length;
    924893
    925894        switch (auth->auth_type) {
     
    997966         * are still both used in later calls */
    998967        if (auth->auth_level == DCERPC_AUTH_LEVEL_PRIVACY) {
     968                if (pkt_trailer->length != data.length) {
     969                        return NT_STATUS_INVALID_PARAMETER;
     970                }
    999971                memcpy(pkt_trailer->data, data.data, data.length);
    1000972        }
    1001973
    1002         *pad_len = auth_info.auth_pad_length;
     974        pkt_trailer->length -= auth_info.auth_pad_length;
    1003975        data_blob_free(&auth_info.credentials);
    1004976        return NT_STATUS_OK;
Note: See TracChangeset for help on using the changeset viewer.