Ignore:
Timestamp:
Jul 2, 2011, 3:35:33 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update trunk to 3.5.8

Location:
trunk/server/librpc/ndr
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/librpc/ndr/ndr.c

    r414 r596  
    11061106        }
    11071107        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
    11081135                return ndr_push_relative_ptr2(ndr, p);
    11091136        }
     
    11721199        correct_offset = ndr->relative_end_offset - len;
    11731200
    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) {
    11781204                align = 2;
    11791205        } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
  • trunk/server/librpc/ndr/ndr_basic.c

    r414 r596  
    10121012_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
    10131013{
    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) {
    10161020                        blob.length = NDR_ALIGN(ndr, 2);
    10171021                } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
     
    10221026                NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length);
    10231027                data_blob_clear(&blob);
    1024         } else if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
     1028        } else {
    10251029                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
    10261030        }
     
    10361040        uint32_t length = 0;
    10371041
    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) {
    10401048                        length = NDR_ALIGN(ndr, 2);
    10411049                } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
     
    10471055                        length = ndr->data_size - ndr->offset;
    10481056                }
    1049         } else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
    1050                 length = ndr->data_size - ndr->offset;
    10511057        } else {
    10521058                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
  • trunk/server/librpc/ndr/ndr_spoolss_buf.c

    r429 r596  
    13831383        return NDR_ERR_SUCCESS;
    13841384}
     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  
    5252enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
    5353enum 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);
    5456
    5557#undef _PRINTF_ATTRIBUTE
Note: See TracChangeset for help on using the changeset viewer.