From c1d152ca8aae539ba7fd546741d7ca70a2226fde Mon Sep 17 00:00:00 2001 From: "rafael@riseup.net" Date: Thu, 19 Jan 2012 01:07:30 +0000 Subject: [PATCH] fix for issue 56, Wrong icecast2 password isn't properly reporte, by flip.roque --- darkice/trunk/src/IceCast.cpp | 6 ++++++ darkice/trunk/src/IceCast2.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/darkice/trunk/src/IceCast.cpp b/darkice/trunk/src/IceCast.cpp index f00d659..839e1b4 100644 --- a/darkice/trunk/src/IceCast.cpp +++ b/darkice/trunk/src/IceCast.cpp @@ -199,10 +199,16 @@ IceCast :: sendLogin ( void ) throw ( Exception ) /* read the anticipated response: "OK" */ len = source->read( resp, STRBUF_SIZE); + reportEvent(5,resp); + if ( Util::strEq( resp, "ERROR - Bad Password",20) ) { throw Exception( __FILE__, __LINE__, "Icecast - wrong password"); } + if ( Util::strEq( resp, "ERROR - Mount Point Taken or Inv",32) ) { + throw Exception( __FILE__, __LINE__, + "Icecast - Mount point taken or invalid"); + } if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { return false; } diff --git a/darkice/trunk/src/IceCast2.cpp b/darkice/trunk/src/IceCast2.cpp index 66b6b76..4759760 100644 --- a/darkice/trunk/src/IceCast2.cpp +++ b/darkice/trunk/src/IceCast2.cpp @@ -81,6 +81,7 @@ static const char fileid[] = "$Id$"; *----------------------------------------------------------------------------*/ static const char responseOK[] = "HTTP/1.0 200"; static const char responseWrongPasswd[] = "HTTP/1.0 401"; +static const char responseForbidden[] = "HTTP/1.0 403"; /* =============================================== local function prototypes */ @@ -247,11 +248,18 @@ IceCast2 :: sendLogin ( void ) throw ( Exception ) } resp[lenExpected] = 0; + reportEvent(5,resp); + if ( Util::strEq( resp, responseWrongPasswd) ) { throw Exception( __FILE__, __LINE__, "Icecast2 - wrong password"); } + if ( Util::strEq( resp, responseForbidden) ) { + throw Exception( __FILE__, __LINE__, + "Icecast2 - forbidden. Is the mountpoint occupied, or maximum sources reached?"); + } + if ( !Util::strEq( resp, responseOK) ) { return false; }