ENGINE-348: forgot the flags expansion
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 01 Apr 2019 12:12:48 +0200
changeset 3424ba7efe8cfa2e
parent 3423 70b418f53ed6
child 3464 0e0f802640bb
ENGINE-348: forgot the flags expansion
src/pEpEngine.c
     1.1 --- a/src/pEpEngine.c	Fri Mar 29 16:43:47 2019 +0100
     1.2 +++ b/src/pEpEngine.c	Mon Apr 01 12:12:48 2019 +0200
     1.3 @@ -255,12 +255,12 @@
     1.4      // "     where address = ?1 and"
     1.5      // "           user_id = ?3),"
     1.6      // "    0)"
     1.7 -    // " ) | (?4 & 255)"
     1.8 +    // " ) | (?4 &255)"
     1.9      /* set_identity ignores previous flags, and doesn't filter machine flags */
    1.10          
    1.11  static const char *sql_set_identity_flags = 
    1.12      "update identity set flags = "
    1.13 -    "    ((?1 & 255) | (select flags from identity"
    1.14 +    "    ((?1 & 65535) | (select flags from identity"
    1.15      "                    where (case when (address = ?2) then (1)"
    1.16      "                                when (lower(address) = lower(?2)) then (1)"
    1.17      "                                when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"
    1.18 @@ -276,7 +276,7 @@
    1.19  
    1.20  static const char *sql_unset_identity_flags = 
    1.21      "update identity set flags = "
    1.22 -    "    ( ~(?1 & 255) & (select flags from identity"
    1.23 +    "    ( ~(?1 & 65535) & (select flags from identity"
    1.24      "                    where (case when (address = ?2) then (1)"
    1.25      "                                when (lower(address) = lower(?2)) then (1)"
    1.26      "                                when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"