- Fix PT_I8 support in libocpf: PT_I8 support was incorrectly
authorJulien Kerihuel <j.kerihuel@openchange.org>
Fri, 28 May 2010 13:15:58 +0000 (13:15 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Fri, 28 May 2010 13:15:58 +0000 (13:15 +0000)
processed as PT_DOUBLE and prevented properties with 0x0014 proptag
(e.g. PR_PARENT_FID) to be added properly to ocpf files.

- Add PR_PARENT_FID to the set of properties when creating folders

libocpf/lex.l
libocpf/ocpf.y
libocpf/ocpf_api.c
libocpf/ocpf_write.c
mapiproxy/servers/default/emsmdb/oxcfold.c

index 45daa6f6129de22e95a419d82de6025006710079..9dd87db293c9b990547369fef0e9acdad57b0ad5 100644 (file)
@@ -1,7 +1,7 @@
 /*
    OpenChange OCPF (OpenChange Property File) implementation.
 
-   Copyright (C) Julien Kerihuel 2008.
+   Copyright (C) Julien Kerihuel 2008-2010
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -72,6 +72,7 @@ PT_STRING8    { return kw_PT_STRING8; }
 PT_UNICODE     { return kw_PT_UNICODE; }
 PT_SHORT       { return kw_PT_SHORT; }
 PT_LONG                { return kw_PT_LONG; }
+PT_I8          { return kw_PT_I8; }
 PT_SYSTIME     { return kw_PT_SYSTIME; }
 PT_BOOLEAN     { return kw_PT_BOOLEAN; }
 PT_MV_STRING8  { return kw_PT_MV_STRING8; }
@@ -282,7 +283,7 @@ D0x[0-9A-Fa-f]+     {char *e, *y = yytext + 1;
                          if(e == y) 
                            error_message("malformed constant (%s)", yytext); 
                          else
-                           return DOUBLE;
+                           return I8;
 
                        }
 [A-Za-z][-A-Za-z0-9_]* {
index 3598c032cd094f5820a67653c4e4edd11d9fff8e..304ad64632ceed81e4ab50b76222d119cf472d47 100644 (file)
@@ -1,7 +1,7 @@
 /*
    OpenChange OCPF (OpenChange Property File) implementation.
 
-   Copyright (C) Julien Kerihuel 2008.
+   Copyright (C) Julien Kerihuel 2008-2010.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ uint8_t                       recip_type;
 %token <b> BOOLEAN
 %token <s> SHORT
 %token <l> INTEGER
-%token <d> DOUBLE
+%token <d> I8
 %token <name> IDENTIFIER
 %token <name> STRING
 %token <nameW> UNICODE
@@ -79,6 +79,7 @@ uint8_t                       recip_type;
 %token kw_PT_UNICODE
 %token kw_PT_SHORT
 %token kw_PT_LONG
+%token kw_PT_I8
 %token kw_PT_SYSTIME
 %token kw_PT_MV_STRING8
 %token kw_PT_BINARY
@@ -134,7 +135,7 @@ Folder              :
                                error_message("%s", "duplicated FOLDER\n");
                        }
                }
-               | kw_FOLDER DOUBLE
+               | kw_FOLDER I8
                {
                        if (folderset == false) {
                                ocpf_folder_add(NULL, $2, NULL);
@@ -220,7 +221,7 @@ propvalue   : STRING
                | SHORT         { lpProp.i = $1; type = PT_SHORT; }
                | INTEGER       { lpProp.l = $1; type = PT_LONG; }
                | BOOLEAN       { lpProp.b = $1; type = PT_BOOLEAN; }
-               | DOUBLE        { lpProp.d = $1; type = PT_DOUBLE; }
+               | I8            { lpProp.d = $1; type = PT_I8; }
                | SYSTIME
                {
                        ocpf_add_filetime($1, &lpProp.ft);
@@ -368,6 +369,11 @@ proptype   : kw_PT_STRING8
                        memset(&nprop, 0, sizeof (struct ocpf_nprop));
                        nprop.propType = PT_LONG; 
                }
+               | kw_PT_I8
+               {
+                       memset(&nprop, 0, sizeof (struct ocpf_nprop));
+                       nprop.propType = PT_I8;
+               }
                | kw_PT_BOOLEAN
                {
                        memset(&nprop, 0, sizeof (struct ocpf_nprop));
index 114061bb56030d0014b46e72659b4eace1903ef3..3dd2b47668217b85832915d4c65934e7fa84f5a8 100644 (file)
@@ -1,7 +1,7 @@
 /*
    OpenChange OCPF (OpenChange Property File) implementation.
 
-   Copyright (C) Julien Kerihuel 2008.
+   Copyright (C) Julien Kerihuel 2008-2010.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -132,7 +132,7 @@ int ocpf_set_propvalue(TALLOC_CTX *mem_ctx, const void **value, uint16_t proptyp
        case PT_ERROR:
                *value = talloc_memdup(mem_ctx, (const void *)&lpProp.err, sizeof (uint32_t));
                return OCPF_SUCCESS;
-       case PT_DOUBLE:
+       case PT_I8:
                *value = talloc_memdup(mem_ctx, (const void *)&lpProp.d, sizeof (uint64_t));
                return OCPF_SUCCESS;
        case PT_SYSTIME:
index ebbd25a41e789443836fd492c2944f0b13af0149..2ea4c3d3067e5edd19706477b4c3a7fdc13d94d5 100644 (file)
@@ -1,7 +1,7 @@
 /*
    OpenChange OCPF (OpenChange Property File) implementation.
 
-   Copyright (C) Julien Kerihuel 2008.
+   Copyright (C) Julien Kerihuel 2008-2010.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -303,8 +303,8 @@ static char *ocpf_write_property(bool *found, uint32_t ulPropTag, const void *va
                line = talloc_asprintf(ocpf->mem_ctx, "B\"%s\"\n", (*((const uint8_t *)value) == true) ? "true" : "false");
                *found = true;
                break;
-       case PT_DOUBLE:
-               line = talloc_asprintf(ocpf->mem_ctx, "D0x%"PRIx64"\n", *(const uint64_t *)value);
+       case PT_I8:
+               line = talloc_asprintf(ocpf->mem_ctx, "D0x%.16"PRIx64"\n", *(const uint64_t *)value);
                *found = true;
                break;
        case PT_SYSTIME:
@@ -536,7 +536,7 @@ _PUBLIC_ int ocpf_write_commit(void)
        talloc_free(line);
 
        /* folder id */
-       line = talloc_asprintf(ocpf->mem_ctx, "FOLDER D0x%"PRIx64"\n\n", ocpf->folder);
+       line = talloc_asprintf(ocpf->mem_ctx, "FOLDER D0x%.16"PRIx64"\n\n", ocpf->folder);
        len = fwrite(line, strlen(line), 1, fp);
        talloc_free(line);
 
index e2fabcd53a4cce8981c8e7493fa79ed54c7f467e..dba5a03de1c844de04d2a106016fefc5f96510c0 100644 (file)
@@ -571,6 +571,7 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopCreateFolder(TALLOC_CTX *mem_ctx,
        
        /* Step 3. Turn CreateFolder parameters into MAPI property array */
        aRow = libmapiserver_ROP_request_to_properties(mem_ctx, (void *)&mapi_req->u.mapi_CreateFolder, op_MAPI_CreateFolder);
+       aRow->lpProps = add_SPropValue(mem_ctx, aRow->lpProps, &(aRow->cValues), PR_PARENT_FID, (void *)(&parent_fid));
 
        /* Step 4. Do effective work here */
        mapistore = emsmdbp_is_mapistore(parent);