summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-07 22:03:24 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-07 22:03:24 +0200
commit0269bfa309f85aaf05f1451196ad2bd8c0b150ac (patch)
treee8b70f8c1a08ec06053d81571897b1af04b696ac /libpiano
parenteb46d942e5ecf50ff9f85ee62ea2fa454aa228fa (diff)
downloadpianobar-0269bfa309f85aaf05f1451196ad2bd8c0b150ac.tar.gz
pianobar-0269bfa309f85aaf05f1451196ad2bd8c0b150ac.tar.bz2
pianobar-0269bfa309f85aaf05f1451196ad2bd8c0b150ac.zip
SSL control proxy issue workaround
Some proxies refuse SSL connections. Make them usable by adding an option which disables the usage of SSL for the login.
Diffstat (limited to 'libpiano')
-rw-r--r--libpiano/src/main.c9
-rw-r--r--libpiano/src/piano.h3
2 files changed, 8 insertions, 4 deletions
diff --git a/libpiano/src/main.c b/libpiano/src/main.c
index 1839c0c..dcfa70f 100644
--- a/libpiano/src/main.c
+++ b/libpiano/src/main.c
@@ -171,8 +171,11 @@ void PianoDestroy (PianoHandle_t *ph) {
* @param piano handle
* @param username (utf-8 encoded)
* @param password (plaintext, utf-8 encoded)
+ * @param use ssl when logging in (1 = on, 0 = off), note that the password
+ * is not hashed and will be sent as plain-text!
*/
-PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password) {
+PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password,
+ char secureLogin) {
char url[PIANO_URL_BUFFER_SIZE];
char *requestStr = PianoEncryptString ("<?xml version=\"1.0\"?>"
"<methodCall><methodName>misc.sync</methodName>"
@@ -200,8 +203,8 @@ PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password) {
"<param><value><string>%s</string></value></param>"
"</params></methodCall>", time (NULL), user, password);
requestStr = PianoEncryptString (requestStrPlain);
- snprintf (url, sizeof (url), PIANO_SECURE_RPC_URL "rid=%s"
- "&method=authenticateListener", ph->routeId);
+ snprintf (url, sizeof (url), "%srid=%s&method=authenticateListener",
+ secureLogin ? PIANO_SECURE_RPC_URL : PIANO_RPC_URL, ph->routeId);
if ((ret = PianoHttpPost (ph->curlHandle, url, requestStr, &retStr)) ==
PIANO_RET_OK) {
diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h
index ce68c48..9945839 100644
--- a/libpiano/src/piano.h
+++ b/libpiano/src/piano.h
@@ -151,7 +151,8 @@ void PianoDestroyPlaylist (PianoHandle_t *ph);
void PianoDestroySearchResult (PianoSearchResult_t *searchResult);
void PianoDestroyStation (PianoStation_t *station);
void PianoDestroyStations (PianoHandle_t *ph);
-PianoReturn_t PianoConnect (PianoHandle_t *, char *, char *);
+PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password,
+ char secureLogin);
PianoReturn_t PianoGetStations (PianoHandle_t *ph);
PianoReturn_t PianoGetPlaylist (PianoHandle_t *ph, char *stationId);