Add libgcrypt CFLAGS to %.o target

(upstream git commit db4c66b2956a4da2745f16131fe573962c3fcbfb)

Fix ambiguous error message "Invalid Partner Login" on wrong
email address/password failure
(upstream git commit 81bf363ac69e0036562434ca0e7153c3e624c8c3)

Move mutex initalization to main thread
(upstream git commit ed7b2597a439c27e60d0b4cec85e801c9099173c)
This commit is contained in:
dcoppa 2012-05-28 09:47:00 +00:00
parent 27f4c3dc4f
commit bc214f6fe3
7 changed files with 115 additions and 8 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.39 2012/05/22 18:39:42 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.40 2012/05/28 09:47:00 dcoppa Exp $
SHARED_ONLY = Yes
COMMENT = console client for pandora
DISTNAME = pianobar-2012.05.06
REVISION = 2
REVISION = 3
EXTRACT_SUFX = .tar.bz2
CATEGORIES = audio

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-Makefile,v 1.16 2012/05/10 11:23:18 dcoppa Exp $
$OpenBSD: patch-Makefile,v 1.17 2012/05/28 09:47:00 dcoppa Exp $
Use pkg-config for libmad and gnutls
(upstream git commit eee4424677964ddc5b0f01d120db71f160a7c9e1)
@ -6,8 +6,11 @@ Use pkg-config for libmad and gnutls
Correct LDFLAGS for pianobar/libpiano linking
(upstream git commit c9aff4f4ceddc70b8b98ca8d5d248eac6be2619f)
Add libgcrypt CFLAGS to %.o target
(upstream git commit db4c66b2956a4da2745f16131fe573962c3fcbfb)
--- Makefile.orig Sun May 6 16:33:54 2012
+++ Makefile Thu May 10 13:12:13 2012
+++ Makefile Mon May 28 11:01:24 2012
@@ -6,15 +6,8 @@ LIBDIR:=${PREFIX}/lib
INCDIR:=${PREFIX}/include
MANDIR:=${PREFIX}/share/man
@ -88,7 +91,8 @@ Correct LDFLAGS for pianobar/libpiano linking
- @${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
+ ${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
${LIBFAAD_CFLAGS} ${LIBMAD_CFLAGS} ${LIBGNUTLS_CFLAGS} \
${LIBJSONC_CFLAGS} -c -o $@ $<
- ${LIBJSONC_CFLAGS} -c -o $@ $<
+ ${LIBGCRYPT_CFLAGS} ${LIBJSONC_CFLAGS} -c -o $@ $<
# create position independent code (for shared libraries)
%.lo: %.c

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-src_libpiano_piano_c,v 1.7 2012/05/28 09:47:00 dcoppa Exp $
Fix ambiguous error message "Invalid Partner Login" on wrong
email address/password failure
(upstream git commit 81bf363ac69e0036562434ca0e7153c3e624c8c3)
--- src/libpiano/piano.c.orig Sun May 6 16:33:54 2012
+++ src/libpiano/piano.c Mon May 28 10:51:30 2012
@@ -250,6 +250,10 @@ const char *PianoErrorToStr (PianoReturn_t ret) {
return "Out of memory.";
break;
+ case PIANO_RET_INVALID_LOGIN:
+ return "Wrong email address or password.";
+ break;
+
/* pandora error messages */
case PIANO_RET_P_INTERNAL:
return "Internal error.";

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_libpiano_piano_h,v 1.3 2012/05/28 09:47:00 dcoppa Exp $
Fix ambiguous error message "Invalid Partner Login" on wrong
email address/password failure
(upstream git commit 81bf363ac69e0036562434ca0e7153c3e624c8c3)
--- src/libpiano/piano.h.orig Sun May 6 16:33:54 2012
+++ src/libpiano/piano.h Mon May 28 10:59:07 2012
@@ -244,6 +244,7 @@ typedef enum {
PIANO_RET_INVALID_RESPONSE = 2,
PIANO_RET_CONTINUE_REQUEST = 3,
PIANO_RET_OUT_OF_MEMORY = 4,
+ PIANO_RET_INVALID_LOGIN = 5,
PIANO_RET_P_INTERNAL = PIANO_RET_OFFSET+0,
PIANO_RET_P_API_VERSION_NOT_SUPPORTED = PIANO_RET_OFFSET+11,

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-src_libpiano_response_c,v 1.1 2012/05/28 09:47:00 dcoppa Exp $
Fix ambiguous error message "Invalid Partner Login" on wrong
email address/password failure
(upstream git commit 81bf363ac69e0036562434ca0e7153c3e624c8c3)
--- src/libpiano/response.c.orig Sun May 6 16:33:54 2012
+++ src/libpiano/response.c Mon May 28 10:51:30 2012
@@ -100,6 +100,17 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoR
ret = PIANO_RET_INVALID_RESPONSE;
} else {
ret = json_object_get_int (code)+PIANO_RET_OFFSET;
+
+ if (ret == PIANO_RET_P_INVALID_PARTNER_LOGIN &&
+ req->type == PIANO_REQUEST_LOGIN) {
+ PianoRequestDataLogin_t *reqData = req->data;
+ if (reqData->step == 1) {
+ /* return value is ambiguous, as both, partnerLogin and
+ * userLogin return INVALID_PARTNER_LOGIN. Fix that to provide
+ * better error messages. */
+ ret = PIANO_RET_INVALID_LOGIN;
+ }
+ }
}
json_object_put (j);

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-src_main_c,v 1.9 2012/05/28 09:47:00 dcoppa Exp $
Move mutex initalization to main thread
(upstream git commit ed7b2597a439c27e60d0b4cec85e801c9099173c)
--- src/main.c.orig Sun May 6 16:33:54 2012
+++ src/main.c Mon May 28 10:51:30 2012
@@ -206,6 +206,7 @@ static void BarMainStartPlayback (BarApp_t *app, pthre
app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume);
app->player.audioFormat = app->playlist->audioFormat;
app->player.settings = &app->settings;
+ pthread_mutex_init (&app->player.pauseMutex, NULL);
/* throw event */
BarUiStartEventCmd (&app->settings, "songstart",
@@ -233,6 +234,7 @@ static void BarMainPlayerCleanup (BarApp_t *app, pthre
/* FIXME: pthread_join blocks everything if network connection
* is hung up e.g. */
pthread_join (*playerThread, &threadRet);
+ pthread_mutex_destroy (&app->player.pauseMutex);
/* don't continue playback if thread reports error */
if (threadRet != (void *) PLAYER_RET_OK) {

View File

@ -1,9 +1,12 @@
$OpenBSD: patch-src_player_c,v 1.9 2012/05/22 18:39:42 ajacoutot Exp $
$OpenBSD: patch-src_player_c,v 1.10 2012/05/28 09:47:00 dcoppa Exp $
Add missing include
--- src/player.c.orig Tue Mar 20 14:47:07 2012
+++ src/player.c Tue Mar 20 14:54:05 2012
Move mutex initalization to main thread
(upstream git commit ed7b2597a439c27e60d0b4cec85e801c9099173c)
--- src/player.c.orig Sun May 6 16:33:54 2012
+++ src/player.c Mon May 28 10:51:30 2012
@@ -28,6 +28,7 @@ THE SOFTWARE.
#include <math.h>
#include <stdint.h>
@ -12,3 +15,19 @@ Add missing include
#include <arpa/inet.h>
#include "player.h"
@@ -421,7 +422,6 @@ void *BarPlayerThread (void *data) {
WaitressReturn_t wRet = WAITRESS_RET_ERR;
/* init handles */
- pthread_mutex_init (&player->pauseMutex, NULL);
player->waith.data = (void *) player;
/* extraHeaders will be initialized later */
player->waith.extraHeaders = extraHeaders;
@@ -500,7 +500,6 @@ void *BarPlayerThread (void *data) {
ao_close(player->audioOutDevice);
WaitressFree (&player->waith);
- pthread_mutex_destroy (&player->pauseMutex);
free (player->buffer);
player->mode = PLAYER_FINISHED_PLAYBACK;