Changeset 752 for trunk/server/librpc/ndr
- Timestamp:
- Nov 29, 2012, 2:06:31 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 746,748
- Property svn:mergeinfo changed
-
trunk/server/librpc/ndr/libndr.h
r745 r752 137 137 #define LIBNDR_FLAG_ALIGN8 (1<<24) 138 138 139 #define LIBNDR_ALIGN_FLAGS (LIBNDR_FLAG_ALIGN2|LIBNDR_FLAG_ALIGN4|LIBNDR_FLAG_ALIGN8) 139 #define LIBNDR_ALIGN_FLAGS ( 0 | \ 140 LIBNDR_FLAG_NOALIGN | \ 141 LIBNDR_FLAG_REMAINING | \ 142 LIBNDR_FLAG_ALIGN2 | \ 143 LIBNDR_FLAG_ALIGN4 | \ 144 LIBNDR_FLAG_ALIGN8 | \ 145 0) 140 146 141 147 #define LIBNDR_PRINT_ARRAY_HEX (1<<25) … … 569 575 enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size); 570 576 enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset); 577 enum ndr_err_code ndr_pull_charset_to_null(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset); 571 578 enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset); 572 579 -
trunk/server/librpc/ndr/ndr.c
r745 r752 381 381 (*pflags) &= ~LIBNDR_FLAG_NDR64; 382 382 } 383 if (new_flags & LIBNDR_FLAG_REMAINING) { 383 if (new_flags & LIBNDR_ALIGN_FLAGS) { 384 /* Ensure we only have the passed-in 385 align flag set in the new_flags, 386 remove any old align flag. */ 384 387 (*pflags) &= ~LIBNDR_ALIGN_FLAGS; 385 }386 if (new_flags & LIBNDR_ALIGN_FLAGS) {387 (*pflags) &= ~LIBNDR_FLAG_REMAINING;388 388 } 389 389 if (new_flags & LIBNDR_FLAG_NO_RELATIVE_REVERSE) { -
trunk/server/librpc/ndr/ndr_basic.c
r745 r752 1214 1214 1215 1215 /* 1216 push a DATA_BLOB onto the wire. 1217 */ 1216 * Push a DATA_BLOB onto the wire. 1217 * 1) When called with LIBNDR_FLAG_ALIGN* alignment flags set, push padding 1218 * bytes _only_. The length is determined by the alignment required and the 1219 * current ndr offset. 1220 * 2) When called with the LIBNDR_FLAG_REMAINING flag, push the byte array to 1221 * the ndr buffer. 1222 * 3) Otherwise, push a uint32 length _and_ a corresponding byte array to the 1223 * ndr buffer. 1224 */ 1218 1225 _PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) 1219 1226 { 1220 1227 if (ndr->flags & LIBNDR_FLAG_REMAINING) { 1221 1228 /* nothing to do */ 1222 } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1223 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1224 blob.length = 0; 1225 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1229 } else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) { 1230 if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1226 1231 blob.length = NDR_ALIGN(ndr, 2); 1227 1232 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { … … 1240 1245 1241 1246 /* 1242 pull a DATA_BLOB from the wire. 1243 */ 1247 * Pull a DATA_BLOB from the wire. 1248 * 1) when called with LIBNDR_FLAG_ALIGN* alignment flags set, pull padding 1249 * bytes _only_. The length is determined by the alignment required and the 1250 * current ndr offset. 1251 * 2) When called with the LIBNDR_FLAG_REMAINING flag, pull all remaining bytes 1252 * from the ndr buffer. 1253 * 3) Otherwise, pull a uint32 length _and_ a corresponding byte array from the 1254 * ndr buffer. 1255 */ 1244 1256 _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob) 1245 1257 { … … 1248 1260 if (ndr->flags & LIBNDR_FLAG_REMAINING) { 1249 1261 length = ndr->data_size - ndr->offset; 1250 } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1251 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1252 length = 0; 1253 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1262 } else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) { 1263 if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1254 1264 length = NDR_ALIGN(ndr, 2); 1255 1265 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { -
trunk/server/librpc/ndr/ndr_ntprinting.c
r745 r752 55 55 ptr = IVAL(ndr->data, ndr->offset); 56 56 if (ptr == 0) { 57 ndr->offset = ndr->offset + 4; 57 58 break; 58 59 } -
trunk/server/librpc/ndr/ndr_string.c
r745 r752 695 695 } 696 696 697 _PUBLIC_ enum ndr_err_code ndr_pull_charset_to_null(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset) 698 { 699 size_t converted_size; 700 uint32_t str_len; 701 702 if (length == 0) { 703 *var = talloc_strdup(ndr->current_mem_ctx, ""); 704 return NDR_ERR_SUCCESS; 705 } 706 707 if (NDR_BE(ndr) && chset == CH_UTF16) { 708 chset = CH_UTF16BE; 709 } 710 711 NDR_PULL_NEED_BYTES(ndr, length*byte_mul); 712 713 str_len = ndr_string_length(ndr->data+ndr->offset, byte_mul); 714 str_len = MIN(str_len, length); /* overrun protection */ 715 716 if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, 717 ndr->data+ndr->offset, str_len*byte_mul, 718 discard_const_p(void *, var), 719 &converted_size, false)) 720 { 721 return ndr_pull_error(ndr, NDR_ERR_CHARCNV, 722 "Bad character conversion"); 723 } 724 NDR_CHECK(ndr_pull_advance(ndr, length*byte_mul)); 725 726 return NDR_ERR_SUCCESS; 727 } 728 697 729 _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset) 698 730 {
Note:
See TracChangeset
for help on using the changeset viewer.