Changeset 596 for trunk/server/librpc/ndr
- Timestamp:
- Jul 2, 2011, 3:35:33 PM (14 years ago)
- Location:
- trunk/server/librpc/ndr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/librpc/ndr/ndr.c
r414 r596 1106 1106 } 1107 1107 if (!(ndr->flags & LIBNDR_FLAG_RELATIVE_REVERSE)) { 1108 uint32_t relative_offset; 1109 size_t pad; 1110 size_t align = 1; 1111 1112 if (ndr->offset < ndr->relative_base_offset) { 1113 return ndr_push_error(ndr, NDR_ERR_BUFSIZE, 1114 "ndr_push_relative_ptr2_start ndr->offset(%u) < ndr->relative_base_offset(%u)", 1115 ndr->offset, ndr->relative_base_offset); 1116 } 1117 1118 relative_offset = ndr->offset - ndr->relative_base_offset; 1119 1120 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1121 align = 1; 1122 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1123 align = 2; 1124 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { 1125 align = 4; 1126 } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) { 1127 align = 8; 1128 } 1129 1130 pad = ndr_align_size(relative_offset, align); 1131 if (pad) { 1132 NDR_CHECK(ndr_push_zero(ndr, pad)); 1133 } 1134 1108 1135 return ndr_push_relative_ptr2(ndr, p); 1109 1136 } … … 1172 1199 correct_offset = ndr->relative_end_offset - len; 1173 1200 1174 /* TODO: remove this hack and let the idl use FLAG_ALIGN2 explicit */ 1175 align = 2; 1176 1177 if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1201 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1202 align = 1; 1203 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1178 1204 align = 2; 1179 1205 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { -
trunk/server/librpc/ndr/ndr_basic.c
r414 r596 1012 1012 _PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) 1013 1013 { 1014 if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1015 if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1014 if (ndr->flags & LIBNDR_FLAG_REMAINING) { 1015 /* nothing to do */ 1016 } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1017 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1018 blob.length = 0; 1019 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1016 1020 blob.length = NDR_ALIGN(ndr, 2); 1017 1021 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { … … 1022 1026 NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length); 1023 1027 data_blob_clear(&blob); 1024 } else if (!(ndr->flags & LIBNDR_FLAG_REMAINING)){1028 } else { 1025 1029 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length)); 1026 1030 } … … 1036 1040 uint32_t length = 0; 1037 1041 1038 if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1039 if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1042 if (ndr->flags & LIBNDR_FLAG_REMAINING) { 1043 length = ndr->data_size - ndr->offset; 1044 } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) { 1045 if (ndr->flags & LIBNDR_FLAG_NOALIGN) { 1046 length = 0; 1047 } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) { 1040 1048 length = NDR_ALIGN(ndr, 2); 1041 1049 } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) { … … 1047 1055 length = ndr->data_size - ndr->offset; 1048 1056 } 1049 } else if (ndr->flags & LIBNDR_FLAG_REMAINING) {1050 length = ndr->data_size - ndr->offset;1051 1057 } else { 1052 1058 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length)); -
trunk/server/librpc/ndr/ndr_spoolss_buf.c
r429 r596 1383 1383 return NDR_ERR_SUCCESS; 1384 1384 } 1385 1386 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r) 1387 { 1388 struct tm tm; 1389 time_t t; 1390 char *str; 1391 1392 tm.tm_sec = r->second; 1393 tm.tm_min = r->minute; 1394 tm.tm_hour = r->hour; 1395 tm.tm_mday = r->day; 1396 tm.tm_mon = r->month - 1; 1397 tm.tm_year = r->year - 1900; 1398 tm.tm_wday = r->day_of_week; 1399 tm.tm_yday = 0; 1400 tm.tm_isdst = -1; 1401 1402 t = mktime(&tm); 1403 1404 str = timestring(ndr, t); 1405 1406 ndr_print_struct(ndr, name, "spoolss_Time"); 1407 ndr->depth++; 1408 ndr_print_string(ndr, "", str); 1409 ndr->depth--; 1410 talloc_free(str); 1411 } 1412 1413 _PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type) 1414 { 1415 switch(type) { 1416 case REG_NONE: 1417 return 0; 1418 case REG_SZ: 1419 return LIBNDR_FLAG_ALIGN2; 1420 case REG_EXPAND_SZ: 1421 return LIBNDR_FLAG_ALIGN2; 1422 case REG_BINARY: 1423 return 0; 1424 case REG_DWORD: 1425 return LIBNDR_FLAG_ALIGN4; 1426 case REG_DWORD_BIG_ENDIAN: 1427 return LIBNDR_FLAG_ALIGN4; 1428 case REG_LINK: 1429 return 0; 1430 case REG_MULTI_SZ: 1431 return LIBNDR_FLAG_ALIGN2; 1432 case REG_RESOURCE_LIST: 1433 return LIBNDR_FLAG_ALIGN2; 1434 case REG_FULL_RESOURCE_DESCRIPTOR: 1435 return LIBNDR_FLAG_ALIGN4; 1436 case REG_RESOURCE_REQUIREMENTS_LIST: 1437 return LIBNDR_FLAG_ALIGN2; 1438 case REG_QWORD: 1439 return LIBNDR_FLAG_ALIGN8; 1440 } 1441 1442 return 0; 1443 } -
trunk/server/librpc/ndr/ndr_spoolss_buf.h
r429 r596 52 52 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r); 53 53 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r); 54 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r); 55 _PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type); 54 56 55 57 #undef _PRINTF_ATTRIBUTE
Note:
See TracChangeset
for help on using the changeset viewer.