From bd7f4e74451bcd2d9dcfbd1cd2098de7951ed583 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Sat, 5 Jul 2008 16:08:46 -0400 Subject: [PATCH] Reduced minimum password retry level from 6 to 3 Reinhold Schoeb reports that his 8800 device only lets him set a password retry range between 3 and 5, instead of the usual 10 that most devices have. --- ChangeLog | 4 ++++ src/common.h | 5 +++++ src/error.h | 4 ++-- src/m_ipmodem.cc | 7 ++----- src/socket.cc | 15 ++++++--------- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3acdfd4f..ef99ff0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ Release: version 0.13 - 2008/07/?? 2008/07/05 - removed old, unused spec file and scripts for bcharge-only release - fixed rpm build instructions in web docs + - reduced minimum password retry level from 6 to 3... Reinhold Schoeb + reports that his 8800 device only lets him set a password + retry range between 3 and 5, instead of the usual 10 that + most devices have. 2008/07/04 - added "known issues" section to main www doc page - fixed virtual function mis-name bug in btool's null parser diff --git a/src/common.h b/src/common.h index 9fd8ceb2..b62a7838 100644 --- a/src/common.h +++ b/src/common.h @@ -34,6 +34,11 @@ #define BLACKBERRY_CONFIGURATION 1 #define BLACKBERRY_DB_CLASS 0xff +// minimum number of password tries remaining at which Barry gives up +// for safety +#define BARRY_MIN_PASSWORD_TRIES 3 +#define BARRY_MIN_PASSWORD_TRIES_ASC "3" + namespace Barry { /// See also the LogLock class. diff --git a/src/error.h b/src/error.h index 30ae4fd9..ace737f1 100644 --- a/src/error.h +++ b/src/error.h @@ -53,8 +53,8 @@ public: /// - device rejected the available password /// - too few remaining tries left... Barry will refuse to keep /// trying passwords if there are fewer than -/// 6 tries remaining. In this case, out_of_tries() -/// will return true. +/// BARRY_MIN_PASSWORD_TRIES tries remaining. In this case, +/// out_of_tries() will return true. /// /// class BXEXPORT BadPassword : public Barry::Error diff --git a/src/m_ipmodem.cc b/src/m_ipmodem.cc index 29b8f856..8d534435 100644 --- a/src/m_ipmodem.cc +++ b/src/m_ipmodem.cc @@ -82,11 +82,8 @@ bool IpModem::SendPassword(const char *password) ddout("IPModem password request packet:\n" << data); // Check how many retries are left - if( data.GetData()[8] < 6 ) { - throw BadPassword("Fewer than 6 password tries " - "remaining in device. Refusing to proceed, " - "to avoid device zapping itself. Use a " - "Windows client, or re-cradle the device.", + if( data.GetData()[8] < BARRY_MIN_PASSWORD_TRIES ) { + throw BadPassword("Fewer than " BARRY_MIN_PASSWORD_TRIES_ASC " password tries remaining in device. Refusing to proceed, to avoid device zapping itself. Use a Windows client, or re-cradle the device.", data.GetData()[8], true); } diff --git a/src/socket.cc b/src/socket.cc index ba370b8f..ea43783f 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -453,15 +453,12 @@ SocketHandle SocketZero::Open(uint16_t socket, const char *password) throw BadPassword("No password specified.", m_remainingTries, false); } - // only allow password attempts if there are 6 or more - // tries remaining... we want to give the user at least - // 5 chances on a Windows machine before the device - // commits suicide. - if( m_remainingTries < 6 ) { - throw BadPassword("Fewer than 6 password tries " - "remaining in device. Refusing to proceed, " - "to avoid device zapping itself. Use a " - "Windows client, or re-cradle the device.", + // only allow password attempts if there are + // BARRY_MIN_PASSWORD_TRIES or more tries remaining... + // we want to give the user at least some chance on a + // Windows machine before the device commits suicide. + if( m_remainingTries < BARRY_MIN_PASSWORD_TRIES ) { + throw BadPassword("Fewer than " BARRY_MIN_PASSWORD_TRIES_ASC " password tries remaining in device. Refusing to proceed, to avoid device zapping itself. Use a Windows client, or re-cradle the device.", m_remainingTries, true); } -- 2.11.4.GIT