From 8cedb16f5de454319b06a971ece10a5d4134b570 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 22 Oct 2009 16:50:20 -0700 Subject: [PATCH] auth: cleaner about timestamp change --- src/auth/Auth.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/auth/Auth.cc b/src/auth/Auth.cc index c6c73f00fde7c..32e0e2d988322 100644 --- a/src/auth/Auth.cc +++ b/src/auth/Auth.cc @@ -251,7 +251,7 @@ bool verify_authorizer(KeyStore& keys, bufferlist::iterator& indata, AuthAuthorizeReply reply; // reply.trans_id = auth_msg.trans_id; reply.timestamp = auth_msg.now; - reply.timestamp += 1; + reply.timestamp.sec_ref() += 1; if (encode_encrypt(reply, ticket_info.session_key, reply_bl) < 0) return false; @@ -264,10 +264,15 @@ bool AuthAuthorizer::verify_reply(bufferlist::iterator& indata) { AuthAuthorizeReply reply; - if (decode_decrypt(reply, session_key, indata) < 0) + if (decode_decrypt(reply, session_key, indata) < 0) { + dout(0) << " coudln't decrypt auth reply" << dendl; return false; + } - if (timestamp + 1 != reply.timestamp) { + utime_t expect = timestamp; + expect.sec_ref() += 1; + if (expect != reply.timestamp) { + dout(0) << " bad ts got " << reply.timestamp << " expect " << expect << " sent " << timestamp << dendl; return false; } -- 2.39.5