33// This file is part of Gromox.
44#include < cstdint>
55#include < cstdlib>
6+ #include < vector>
67#include < gromox/exmdb_client.hpp>
78#include < gromox/exmdb_rpc.hpp>
89#include < gromox/paths.h>
@@ -15,6 +16,42 @@ namespace exmdb_client = exmdb_client_remote;
1516
1617static alloc_context g_alloc_mgr;
1718
19+ static int t_2209 (const char *dir)
20+ {
21+ static constexpr uint64_t v_zero = 0 ;
22+ static constexpr BINARY v_binzero = {0 , {.pc = deconst (" " )}};
23+ const TAGGED_PROPVAL pvd[] = {
24+ {PR_COMMENT, deconst (" acomment" )},
25+ };
26+ TAGGED_PROPVAL qvd[std::size (pvd)+4 ]{};
27+ const TPROPVAL_ARRAY pvals = {std::size (pvd), deconst (pvd)};
28+ TPROPVAL_ARRAY qvals = {0 , deconst (qvd)};
29+ std::vector<uint16_t > original_indices;
30+ PROBLEM_ARRAY problems{};
31+
32+ for (size_t i = 0 ; i < pvals.count ; ++i) {
33+ const auto &pv = pvals.ppropval [i];
34+ if (pv.proptag == PR_ACCESS) {
35+ problems.emplace_back (i, pv.proptag , ecAccessDenied);
36+ } else {
37+ qvals.ppropval [qvals.count ++] = pv;
38+ original_indices.push_back (i);
39+ }
40+ }
41+ qvals.emplace_back (PidTagChangeNumber, &v_zero);
42+ qvals.emplace_back (PR_CHANGE_KEY, &v_binzero);
43+ qvals.emplace_back (PR_PREDECESSOR_CHANGE_LIST, &v_binzero);
44+ qvals.emplace_back (PROP_TAG (PT_I8, 0 ), &v_zero);
45+
46+ if (!exmdb_client::set_folder_properties (dir, CP_UTF8,
47+ rop_util_make_eid_ex (1 , PRIVATE_FID_ROOT), &qvals, &problems)) {
48+ mlog (LV_ERR, " set_folder_properties failed unexpectedly" );
49+ return EXIT_FAILURE;
50+ }
51+ problems.transform (original_indices);
52+ return EXIT_SUCCESS;
53+ }
54+
1855int main (int argc, char **argv)
1956{
2057 exmdb_rpc_alloc = [](size_t z) { return g_alloc_mgr.alloc (z); };
@@ -43,5 +80,6 @@ int main(int argc, char **argv)
4380 TPROPVAL_ARRAY props{};
4481 if (!exmdb_client::get_store_properties (g_storedir, CP_UTF8, &ptags, &props))
4582 mlog (LV_ERR, " get_store_properties failed unexpectedly" );
46- return 0 ;
83+
84+ return t_2209 (g_storedir);
4785}
0 commit comments