update to libshout 2.2

from maintainer Moritz Grimm <gtgbr at gmx.net>
This commit is contained in:
sturm 2006-03-14 19:59:01 +00:00
parent 6a78b6f973
commit 238f6f0396
7 changed files with 48 additions and 200 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.7 2006/01/08 10:23:02 steven Exp $
# $OpenBSD: Makefile,v 1.8 2006/03/14 19:59:01 sturm Exp $
COMMENT= "library for communicating with an icecast server"
DISTNAME= libshout-2.1
PKGNAME= ${DISTNAME}p2
SHARED_LIBS= shout 4.0
DISTNAME= libshout-2.2
SHARED_LIBS= shout 5.0
CATEGORIES= net audio
HOMEPAGE= http://www.icecast.org/
@ -20,15 +19,17 @@ WANTLIB= m ogg
MASTER_SITES= http://downloads.xiph.org/releases/libshout/
LIB_DEPENDS= vorbis.4::audio/libvorbis
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED} --disable-pkgconfig \
--without-theora
SEPARATE_BUILD= simple
BUILD_DEPENDS= ::devel/pkgconfig \
speex.4::audio/speex
LIB_DEPENDS= vorbis.4::audio/libvorbis \
theora.1::multimedia/libtheora
FAKE_FLAGS= docdir='${PREFIX}/share/examples/libshout'
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
SEPARATE_BUILD= simple
USE_LIBTOOL= Yes
.include <bsd.port.mk>

View File

@ -1,4 +1,4 @@
MD5 (libshout-2.1.tar.gz) = ca6e98af87fd17c709821d9be82b37d5
RMD160 (libshout-2.1.tar.gz) = edcbf2c8111bd76ce27734513a4c483986ba2e7e
SHA1 (libshout-2.1.tar.gz) = c251d0791d807762957235442fa9b777f3f6068c
SIZE (libshout-2.1.tar.gz) = 455243
MD5 (libshout-2.2.tar.gz) = d5b273a072785ee14a85ff76f66850aa
RMD160 (libshout-2.2.tar.gz) = fb1697ce5e95a8e54168656d5a9a735cbb68c972
SHA1 (libshout-2.2.tar.gz) = e059116226d05758192575db2965017f28424860
SIZE (libshout-2.2.tar.gz) = 472875

View File

@ -1,36 +0,0 @@
$OpenBSD: patch-src_avl_avl_c,v 1.4 2005/04/19 20:23:44 sturm Exp $
--- src/avl/avl.c.orig Mon Jul 5 22:44:13 2004
+++ src/avl/avl.c Tue Apr 19 22:18:54 2005
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "avl.h"
@@ -1063,9 +1064,11 @@ typedef struct _link_node {
static char balance_chars[3] = {'\\', '-', '/'};
static int
-default_key_printer (char * buffer, void * key)
+default_key_printer (char * buffer, size_t size, void * key)
{
- return sprintf (buffer, "%p", key);
+ snprintf (buffer, size, "%p", key);
+
+ return strlen(buffer);
}
/*
@@ -1108,8 +1111,8 @@ print_node (avl_key_printer_fun_type key
link_node * link)
{
char buffer[256];
- unsigned int width;
- width = key_printer (buffer, node->key);
+ size_t width;
+ width = key_printer (buffer, sizeof(buffer), node->key);
if (node->right) {
link_node here;

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_avl_avl_h,v 1.1 2005/04/19 20:07:11 sturm Exp $
--- src/avl/avl.h.orig Sun Apr 17 02:44:39 2005
+++ src/avl/avl.h Sun Apr 17 02:45:06 2005
@@ -55,7 +55,7 @@ typedef int (*avl_key_compare_fun_type)
typedef int (*avl_iter_fun_type) (void * key, void * iter_arg);
typedef int (*avl_iter_index_fun_type) (unsigned long index, void * key, void * iter_arg);
typedef int (*avl_free_key_fun_type) (void * key);
-typedef int (*avl_key_printer_fun_type) (char *, void *);
+typedef int (*avl_key_printer_fun_type) (char *, size_t, void *);
/*
* <compare_fun> and <compare_arg> let us associate a particular compare

View File

@ -1,53 +1,32 @@
$OpenBSD: patch-src_shout_c,v 1.1 2005/04/19 20:07:11 sturm Exp $
--- src/shout.c.orig Sun Apr 17 12:25:25 2005
+++ src/shout.c Sun Apr 17 12:51:32 2005
@@ -489,7 +489,7 @@ int shout_set_mount(shout_t *self, const
if (!(self->mount = malloc(len)))
return self->error = SHOUTERR_MALLOC;
$OpenBSD: patch-src_shout_c,v 1.2 2006/03/14 19:59:01 sturm Exp $
--- src/shout.c.orig Tue Jan 3 19:56:39 2006
+++ src/shout.c Fri Jan 6 12:30:31 2006
@@ -165,6 +165,8 @@ int shout_close(shout_t *self)
if (self->close)
self->close(self);
- sprintf (self->mount, "%s%s", mount[0] == '/' ? "" : "/", mount);
+ snprintf (self->mount, len, "%s%s", mount[0] == '/' ? "" : "/", mount);
+ self->close = NULL;
+ self->send = NULL;
sock_close(self->socket);
self->state = SHOUT_STATE_UNCONNECTED;
self->starttime = 0;
@@ -183,6 +185,9 @@ int shout_send(shout_t *self, const unsi
if (self->state != SHOUT_STATE_CONNECTED)
return self->error = SHOUTERR_UNCONNECTED;
return self->error = SHOUTERR_SUCCESS;
}
@@ -1145,6 +1145,7 @@ static char *http_basic_authorization(sh
{
char *out, *in;
int len;
+ int ret;
+ if (self->send == NULL)
+ return self->error = SHOUTERR_NOCONNECT;
+
if (self->starttime <= 0)
self->starttime = timing_get_time();
if (!self || !self->user || !self->password)
return NULL;
@@ -1152,7 +1153,11 @@ static char *http_basic_authorization(sh
len = strlen(self->user) + strlen(self->password) + 2;
if (!(in = malloc(len)))
return NULL;
- sprintf(in, "%s:%s", self->user, self->password);
+ ret = snprintf(in, len, "%s:%s", self->user, self->password);
+ if (ret == -1 || ret >= len) {
+ free(in);
+ return NULL;
+ }
out = _shout_util_base64_encode(in);
free(in);
@@ -202,6 +207,9 @@ ssize_t shout_send_raw(shout_t *self, co
if (self->state != SHOUT_STATE_CONNECTED)
return SHOUTERR_UNCONNECTED;
@@ -1161,10 +1166,15 @@ static char *http_basic_authorization(sh
free(out);
return NULL;
}
- sprintf(in, "Authorization: Basic %s\r\n", out);
- free(out);
-
- return in;
+ ret = snprintf(in, len, "Authorization: Basic %s\r\n", out);
+ if (ret == -1 || ret >= len) {
+ free(in);
+ free(out);
+ return NULL;
+ } else {
+ free(out);
+ return in;
+ }
}
+ if (self->send == NULL)
+ return self->error = SHOUTERR_NOCONNECT;
+
self->error = SHOUTERR_SUCCESS;
static int parse_response(shout_t *self)
/* send immediately if possible (should be the common case) */

View File

@ -1,86 +0,0 @@
$OpenBSD: patch-src_util_c,v 1.2 2005/08/22 23:25:39 pvalchev Exp $
--- src/util.c.orig Sun Mar 21 05:03:34 2004
+++ src/util.c Fri Aug 19 21:04:04 2005
@@ -254,6 +254,7 @@ char *_shout_util_dict_urlencode(util_di
char *res, *tmp;
char *enc;
int start = 1;
+ size_t buflen;
for (res = NULL; dict; dict = dict->next) {
/* encode key */
@@ -265,21 +266,39 @@ char *_shout_util_dict_urlencode(util_di
return NULL;
}
if (start) {
- if (!(res = malloc(strlen(enc) + 1))) {
+ int ret;
+
+ buflen = strlen(enc) + 1;
+ if ((res = malloc(buflen)) == NULL) {
free(enc);
return NULL;
}
- sprintf(res, "%s", enc);
+ ret = snprintf(res, buflen, "%s", enc);
+ if (ret == -1 || ret >= buflen) {
+ free(enc);
+ free(res);
+ return NULL;
+ }
free(enc);
start = 0;
} else {
- if (!(tmp = realloc(res, strlen(res) + strlen(enc) + 2))) {
+ buflen = strlen(res) + strlen(enc) + 2;
+ if ((tmp = realloc(res, buflen)) == NULL) {
free(enc);
free(res);
return NULL;
- } else
+ } else {
+ int ret;
+
res = tmp;
- sprintf(res + strlen(res), "%c%s", delim, enc);
+ ret = snprintf(res + strlen(res), buflen - strlen(res),
+ "%c%s", delim, enc);
+ if (ret == -1 || ret >= buflen - strlen(res)) {
+ free(enc);
+ free(res);
+ return NULL;
+ }
+ }
free(enc);
}
@@ -291,14 +310,25 @@ char *_shout_util_dict_urlencode(util_di
return NULL;
}
- if (!(tmp = realloc(res, strlen(res) + strlen(enc) + 2))) {
+ buflen = strlen(res) + strlen(enc) + 2;
+ if ((tmp = realloc(res, buflen)) == NULL) {
free(enc);
free(res);
return NULL;
- } else
+ } else {
+ int ret;
+ size_t reslen;
res = tmp;
- sprintf(res + strlen(res), "=%s", enc);
- free(enc);
+ reslen = strlen(res);
+ ret = snprintf(res + reslen, buflen - reslen, "=%s", enc);
+ if (ret == -1 || ret >= buflen - reslen) {
+ free(enc);
+ free(res);
+ return NULL;
+ }
+ free(enc);
+ enc = NULL;
+ }
}
return res;

View File

@ -1,13 +1,15 @@
@comment $OpenBSD: PLIST,v 1.4 2005/02/27 19:14:40 naddy Exp $
bin/shout-config
@comment $OpenBSD: PLIST,v 1.5 2006/03/14 19:59:01 sturm Exp $
include/shout/
include/shout/shout.h
lib/libshout.a
lib/libshout.la
lib/pkgconfig/
lib/pkgconfig/shout.pc
share/aclocal/
share/aclocal/shout.m4
share/examples/libshout/
@comment share/examples/libshout/COPYING
@comment share/examples/libshout/NEWS
@comment share/examples/libshout/README
share/examples/libshout/example.c
share/examples/libshout/nonblocking.c