Changeset 989 for vendor/current/librpc/rpc
- Timestamp:
- Nov 25, 2016, 8:04:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/librpc/rpc/dcerpc_util.c
r988 r989 96 96 uint16_t auth_length; 97 97 uint32_t tmp_length; 98 uint32_t max_pad_len = 0; 98 99 99 100 ZERO_STRUCTP(auth); 100 101 if (_auth_length != NULL) { 101 102 *_auth_length = 0; 103 104 if (auth_data_only) { 105 return NT_STATUS_INTERNAL_ERROR; 106 } 107 } else { 108 if (!auth_data_only) { 109 return NT_STATUS_INTERNAL_ERROR; 110 } 102 111 } 103 112 … … 148 157 ZERO_STRUCTP(auth); 149 158 return ndr_map_error2ntstatus(ndr_err); 159 } 160 161 /* 162 * Make sure the padding would not exceed 163 * the frag_length. 164 * 165 * Here we assume at least 24 bytes for the 166 * payload specific header the value of 167 * DCERPC_{REQUEST,RESPONSE}_LENGTH. 168 * 169 * We use this also for BIND_*, ALTER_* and AUTH3 pdus. 170 * 171 * We need this check before we ignore possible 172 * invalid values. See also bug #11982. 173 * 174 * This check is mainly used to generate the correct 175 * error for BIND_*, ALTER_* and AUTH3 pdus. 176 * 177 * We always have the 'if (data_and_pad < auth->auth_pad_length)' 178 * protection for REQUEST and RESPONSE pdus, where the 179 * auth_pad_length field is actually used by the caller. 180 */ 181 tmp_length = DCERPC_REQUEST_LENGTH; 182 tmp_length += DCERPC_AUTH_TRAILER_LENGTH; 183 tmp_length += pkt->auth_length; 184 if (tmp_length < pkt->frag_length) { 185 max_pad_len = pkt->frag_length - tmp_length; 186 } 187 if (max_pad_len < auth->auth_pad_length) { 188 DEBUG(1, (__location__ ": ERROR: pad length to large. " 189 "max %u got %u\n", 190 (unsigned)max_pad_len, 191 (unsigned)auth->auth_pad_length)); 192 talloc_free(ndr); 193 ZERO_STRUCTP(auth); 194 return NT_STATUS_RPC_PROTOCOL_ERROR; 195 } 196 197 /* 198 * This is a workarround for a bug in old 199 * Samba releases. For BIND_ACK <= 3.5.x 200 * and for ALTER_RESP <= 4.2.x (see bug #11061) 201 * 202 * See also bug #11982. 203 */ 204 if (auth_data_only && data_and_pad == 0 && 205 auth->auth_pad_length > 0) { 206 /* 207 * we need to ignore invalid auth_pad_length 208 * values for BIND_*, ALTER_* and AUTH3 pdus. 209 */ 210 auth->auth_pad_length = 0; 150 211 } 151 212
Note:
See TracChangeset
for help on using the changeset viewer.