fix for issue 56, Wrong icecast2 password isn't properly reporte, by flip.roque
This commit is contained in:
parent
c4677ec32e
commit
c1d152ca8a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue