Add/Fix pull property support for PT_UNICODE and PT_CLSID (used by GetProps)
authorJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 16 Oct 2007 03:28:16 +0000 (03:28 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 16 Oct 2007 03:28:16 +0000 (03:28 +0000)
exchange.idl
libmapi/emsmdb.c

index b8c17a1c32d3b442a1d192e463124ac880cff746..dc20deb0931f1e851b0b6c8231527143feb04ae9 100644 (file)
@@ -715,15 +715,15 @@ System Attendant Private Interface
        } mapi_SGuidArray;
 
        typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
-               [case(PT_BOOLEAN)]      uint8                   b;
                [case(PT_I2)]           uint16                  i;
                [case(PT_LONG)]         uint32                  l;
                [case(PT_DOUBLE)]       dlong                   dbl;
-               [case(PT_I8)]           dlong                   d;
-               [case(PT_SYSTIME)]      FILETIME                ft;
                [case(PT_ERROR)]        uint32                  err;
+               [case(PT_BOOLEAN)]      uint8                   b;
+               [case(PT_I8)]           dlong                   d;
                [case(PT_STRING8)]      astring                 lpszA;
                [case(PT_UNICODE)][flag(STR_NULLTERM)] string   lpszW;
+               [case(PT_SYSTIME)]      FILETIME                ft;
                [case(PT_CLSID)]        GUID                    lpguid;
                [case(PT_BINARY)]       SBinary_short           bin;
                [case(0xFB)]            SBinary_short           bin;
index 420832ff65df7f7e278e81e5bae0df314bd72e6f..a021871646aa76d259cddc9f42a5f5418c66a8f7 100644 (file)
@@ -22,6 +22,7 @@
 #include <libmapi/proto_private.h>
 #include <gen_ndr/ndr_exchange.h>
 #include <gen_ndr/ndr_exchange_c.h>
+#include <gen_ndr/ndr_misc.h>
 
 #include <param.h>
 #include <credentials.h>
@@ -337,11 +338,13 @@ const void *pull_emsmdb_property(TALLOC_CTX *mem_ctx, uint32_t *offset, enum MAP
 {
        struct ndr_pull         *ndr;
        const char              *pt_string8;
+       const char              *pt_unicode;
        uint16_t                *pt_i2;
        uint64_t                *pt_i8;
        uint32_t                *pt_long;
        uint8_t                 *pt_boolean;
        struct FILETIME         *pt_filetime;
+       struct GUID             *pt_clsid;
        struct SBinary_short    pt_binary;
        struct SBinary          *sbin;
 
@@ -352,40 +355,48 @@ const void *pull_emsmdb_property(TALLOC_CTX *mem_ctx, uint32_t *offset, enum MAP
        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
 
        switch(tag & 0xFFFF) {
-       case PT_BOOLEAN:
-               pt_boolean = talloc_zero(mem_ctx, uint8_t);
-               ndr_pull_uint8(ndr, NDR_SCALARS, pt_boolean);
-               *offset = ndr->offset;
-               return (void *) pt_boolean;
        case PT_I2:
                pt_i2 = talloc_zero(mem_ctx, uint16_t);
                ndr_pull_uint16(ndr, NDR_SCALARS, pt_i2);
                *offset = ndr->offset;
                return (void *) pt_i2;
-       case PT_NULL:
        case PT_ERROR:
        case PT_LONG:
                pt_long = talloc_zero(mem_ctx, uint32_t);
                ndr_pull_uint32(ndr, NDR_SCALARS, pt_long);
                *offset = ndr->offset;
                return (void *) pt_long;
+       case PT_BOOLEAN:
+               pt_boolean = talloc_zero(mem_ctx, uint8_t);
+               ndr_pull_uint8(ndr, NDR_SCALARS, pt_boolean);
+               *offset = ndr->offset;
+               return (void *) pt_boolean;
        case PT_I8:
                pt_i8 = talloc_zero(mem_ctx, uint64_t);
                ndr_pull_hyper(ndr, NDR_SCALARS, pt_i8);
                *offset = ndr->offset;
                return (void *) pt_i8;
-       case PT_SYSTIME:
-               pt_filetime = talloc_zero(mem_ctx, struct FILETIME);
-               ndr_pull_hyper(ndr, NDR_SCALARS, (uint64_t*)pt_filetime);
-               *offset = ndr->offset;
-               return (void*) pt_filetime;
        case PT_UNICODE:
+               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+               ndr_pull_string(ndr, NDR_SCALARS, &pt_unicode);
+               *offset = ndr->offset;
+               return (const void *) pt_unicode;
        case PT_STRING8:
                ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
                ndr_pull_string(ndr, NDR_SCALARS, &pt_string8);
                *offset = ndr->offset;
                return (const void *) pt_string8;
-       case PT_OBJECT:
+       case PT_SYSTIME:
+               pt_filetime = talloc_zero(mem_ctx, struct FILETIME);
+               ndr_pull_hyper(ndr, NDR_SCALARS, (uint64_t *) pt_filetime);
+               *offset = ndr->offset;
+               return (void*) pt_filetime;
+       case PT_CLSID:
+               pt_clsid = talloc_zero(mem_ctx, struct GUID);
+               ndr_pull_GUID(ndr, NDR_SCALARS, pt_clsid);
+               *offset = ndr->offset;
+               return (void *) pt_clsid;
+       case 0xFB:
        case PT_BINARY:
                ndr_pull_SBinary_short(ndr, NDR_SCALARS, &pt_binary);
                *offset = ndr->offset;