Update macaroon lib with version supporting empty strings Use "" for delegation to the device owner. Change-Id: Ibb4a1da07817eebcbe8b0675381f98af3fdbe947 Reviewed-on: https://weave-review.googlesource.com/2391 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/privet/auth_manager.cc b/src/privet/auth_manager.cc index f3d32f5..3c08071 100644 --- a/src/privet/auth_manager.cc +++ b/src/privet/auth_manager.cc
@@ -405,7 +405,7 @@ TimestampCaveat issued{now}; ServiceCaveat client{owner == RootClientTokenOwner::kCloud ? "google.com" - : "privet"}; + : ""}; return CreateMacaroonToken( auth_secret_, now, {
diff --git a/src/privet/auth_manager_unittest.cc b/src/privet/auth_manager_unittest.cc index 2adb1c2..d88d033 100644 --- a/src/privet/auth_manager_unittest.cc +++ b/src/privet/auth_manager_unittest.cc
@@ -146,7 +146,7 @@ } TEST_F(AuthManagerTest, GetRootClientAuthToken) { - EXPECT_EQ("WCaDQxkgAUYIGhudoQBIDEZwcml2ZXRQ5aV4jIdY2JGosyU0APnQpA==", + EXPECT_EQ("WCCDQxkgAUYIGhudoQBCDEBQZgRhYq78I8GtFUZHNBbfGw==", Base64Encode( auth_.GetRootClientAuthToken(RootClientTokenOwner::kClient))); } @@ -160,7 +160,7 @@ TEST_F(AuthManagerTest, GetRootClientAuthTokenDifferentTime) { auto new_time = clock_.Now() + base::TimeDelta::FromDays(15); EXPECT_CALL(clock_, Now()).WillRepeatedly(Return(new_time)); - EXPECT_EQ("WCaDQxkgAUYIGhuxZ4BIDEZwcml2ZXRQsDNy7gcfJT/yvRs3/q40oA==", + EXPECT_EQ("WCCDQxkgAUYIGhuxZ4BCDEBQjO+OTbjjTzZ/Dvk66nfQqg==", Base64Encode( auth_.GetRootClientAuthToken(RootClientTokenOwner::kClient))); } @@ -168,7 +168,7 @@ TEST_F(AuthManagerTest, GetRootClientAuthTokenDifferentSecret) { AuthManager auth{kSecret2, {}, kSecret1, &clock_}; EXPECT_EQ( - "WCaDQxkgAUYIGhudoQBIDEZwcml2ZXRQKw9xcidyzrelxUkgkLmv1g==", + "WCCDQxkgAUYIGhudoQBCDEBQ2MZF8YXv5pbtmMxwz9VtLA==", Base64Encode(auth.GetRootClientAuthToken(RootClientTokenOwner::kClient))); }
diff --git a/third_party/libuweave/src/macaroon_caveat.c b/third_party/libuweave/src/macaroon_caveat.c index a2b26dc..3b26b29 100644 --- a/third_party/libuweave/src/macaroon_caveat.c +++ b/third_party/libuweave/src/macaroon_caveat.c
@@ -102,7 +102,7 @@ uint8_t* buffer, size_t buffer_size, UwMacaroonCaveat* new_caveat) { - if (str == NULL || str_len == 0 || buffer == NULL || buffer_size == 0 || + if ((str == NULL && str_len != 0) || buffer == NULL || buffer_size == 0 || new_caveat == NULL || uw_macaroon_caveat_creation_get_buffsize_(type, str_len) > buffer_size) { return false;