Skip to content

Commit 4e36e1b

Browse files
committed
exmdb: have update_folder_permission.ROW_ADD replace colliding ACEs
kdb2mt can emit EXM packets into the GXMT stream that instruct mt2exm to invoke the ``update_folder_permissions`` RPC with a row of type ROW_ADD. This directly translates to an sqlite INSERT query, which then falls on its face if the ACE already exists. I thought about bitwise-OR-ing the previous and new bits, but alas, Exchange had other ideas. References: DESK-3567, DESK-3805
1 parent 63ac003 commit 4e36e1b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

exch/exmdb/folder.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,9 +2069,13 @@ static bool ufp_add(const TPROPVAL_ARRAY &propvals, db_conn_ptr &pdb,
20692069
if (num == nullptr)
20702070
return true;
20712071
auto permission = permission_adjust(*num, !b_freebusy);
2072+
/*
2073+
* EXC2019 does REPLACE. So I guess that is our excuse for doing the
2074+
* same, even if it overwrites preexisting permissions.
2075+
*/
20722076
if (NULL == pstmt) {
20732077
char sql_string[128];
2074-
snprintf(sql_string, std::size(sql_string), "INSERT INTO permissions"
2078+
snprintf(sql_string, std::size(sql_string), "REPLACE INTO permissions"
20752079
" (folder_id, username, permission) VALUES"
20762080
" (%llu, ?, ?)", LLU{fid_val});
20772081
pstmt = pdb->prep(sql_string);

0 commit comments

Comments
 (0)