Fix GCC warning Change-Id: I7ad142d9873d71e6791dfbbb1ebdff7a6b0f5371 Reviewed-on: https://weave-review.googlesource.com/2396 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/third_party/libuweave/src/macaroon.c b/third_party/libuweave/src/macaroon.c index aa775c2..80e5933 100644 --- a/third_party/libuweave/src/macaroon.c +++ b/third_party/libuweave/src/macaroon.c
@@ -135,8 +135,7 @@ /** Reset the result object to the lowest scope when encountering errors */ static void reset_validation_result(UwMacaroonValidationResult* result) { // Start from the largest scope or highest privilege - result->granted_scope = - (UwMacaroonCaveatScopeType)UW_MACAROON_CAVEAT_SCOPE_LOWEST_POSSIBLE; + result->granted_scope = 0; result->expiration_time = 0; result->weave_app_restricted = true; result->lan_session_id = NULL;
diff --git a/third_party/libuweave/src/macaroon_caveat.c b/third_party/libuweave/src/macaroon_caveat.c index 3b26b29..85d8bbb 100644 --- a/third_party/libuweave/src/macaroon_caveat.c +++ b/third_party/libuweave/src/macaroon_caveat.c
@@ -12,6 +12,9 @@ #include "src/macaroon_context.h" #include "src/macaroon_encoding.h" +// For security sanity checks +#define UW_MACAROON_CAVEAT_SCOPE_LOWEST_POSSIBLE 127 + static bool is_valid_caveat_type_(UwMacaroonCaveatType type) { switch (type) { case kUwMacaroonCaveatTypeNonce: @@ -507,7 +510,6 @@ case kUwMacaroonCaveatTypeScope: if (!uw_macaroon_caveat_get_value_uint_(caveat, &scope) || // Larger value means less priviledge - scope < UW_MACAROON_CAVEAT_SCOPE_HIGHEST_POSSIBLE || scope > UW_MACAROON_CAVEAT_SCOPE_LOWEST_POSSIBLE) { return false; }
diff --git a/third_party/libuweave/src/macaroon_caveat.h b/third_party/libuweave/src/macaroon_caveat.h index b6846e8..33f9d24 100644 --- a/third_party/libuweave/src/macaroon_caveat.h +++ b/third_party/libuweave/src/macaroon_caveat.h
@@ -33,10 +33,6 @@ kUwMacaroonCaveatTypeServerAuthenticationTokenV1 = 12289, // bstr (0x3001) } UwMacaroonCaveatType; -// For security sanity checks -#define UW_MACAROON_CAVEAT_SCOPE_HIGHEST_POSSIBLE 0 -#define UW_MACAROON_CAVEAT_SCOPE_LOWEST_POSSIBLE 127 - typedef enum { kUwMacaroonCaveatScopeTypeOwner = 2, kUwMacaroonCaveatScopeTypeManager = 8,