[Debburn-changes] r458 - in cdrkit/trunk: . icedax
Eduard Bloch
blade at alioth.debian.org
Fri Nov 24 00:51:49 CET 2006
Author: blade
Date: 2006-11-24 00:51:49 +0100 (Fri, 24 Nov 2006)
New Revision: 458
Modified:
cdrkit/trunk/Changelog
cdrkit/trunk/TODO
cdrkit/trunk/icedax/toc.c
Log:
[ Lorenz Minder ]
* user output junk filter in icedax/toc.c
Modified: cdrkit/trunk/Changelog
===================================================================
--- cdrkit/trunk/Changelog 2006-11-23 23:29:51 UTC (rev 457)
+++ cdrkit/trunk/Changelog 2006-11-23 23:51:49 UTC (rev 458)
@@ -12,6 +12,9 @@
* big cleanup, phase I, getting rid from Cstyle function definitions in
applications
+ [ Lorenz Minder ]
+ * user output junk filter in icedax/toc.c
+
-- Eduard Bloch <blade at debian.org> Wed, 6 Sep 2006 22:05:30 +0200
cdrkit (1.0) RELEASED; urgency=low
Modified: cdrkit/trunk/TODO
===================================================================
--- cdrkit/trunk/TODO 2006-11-23 23:29:51 UTC (rev 457)
+++ cdrkit/trunk/TODO 2006-11-23 23:51:49 UTC (rev 458)
@@ -1,12 +1,11 @@
-1.0.x
- - find a good name for cdda2wav, follow the wodim procedure
- - fix lorinder's bug
+SOON:
- check documentation, debian/* documentation, FAQ, etc.pp.
- fix DVD-RW support (DVD+RW works, though, DVD-RW blanking works too)
- fix dirsplit -S, looses files
-1.1.x
+LATER:
+ - fix nread() callers, see toc.c:835
- check libparanoia, we may link dynamicaly with it. Quality? Portability?
- proper getnameinfo/inet_ntoa checks, see include/CMakeLists.txt
- find out why spawn.c breaks in WAIT_H while the WAIT_UNION check works quite well on sys/wait.h. See include/CMakeLists.txt comments.
Modified: cdrkit/trunk/icedax/toc.c
===================================================================
--- cdrkit/trunk/icedax/toc.c 2006-11-23 23:29:51 UTC (rev 457)
+++ cdrkit/trunk/icedax/toc.c 2006-11-23 23:51:49 UTC (rev 458)
@@ -813,10 +813,10 @@
#if defined USE_REMOTE
#include <pwd.h>
-int readn(register int fd, register char *ptr, register int nbytes);
-int writen(register int fd, register char *ptr, register int nbytes);
+static int readn(register int fd, register char *ptr, register int nbytes);
+static int writen(register int fd, register char *ptr, register int nbytes);
-int readn(register int fd, register char *ptr, register int nbytes)
+static int readn(register int fd, register char *ptr, register int nbytes)
{
int nread;
@@ -828,14 +828,20 @@
}
#endif
if (nread < 0) {
- perror("socket read error: ");
- fprintf(stderr, "fd=%d, ptr=%p, nbytes=%d\n", fd, ptr, nbytes);
+ perror("socket read error: ");
+ fprintf(stderr, "fd=%d, ptr=%p, nbytes=%d\n", fd, ptr, nbytes);
+ nread = 0; /* This is a distasteful hack, and we
+ should replace that w/ something sane ASAP. It
+ is here because none of the callers of readn()
+ actually check for error condition, but in
+ several places, the return value is assumed to
+ be nonnegative. */
}
return nread;
}
-int writen(register int fd, register char *ptr, register int nbytes)
+static int writen(register int fd, register char *ptr, register int nbytes)
{
int nleft, nwritten;
@@ -857,7 +863,18 @@
}
#define SOCKBUFF 2048
+
+static void filter_nonprintable(char *c, size_t l)
+{
+ size_t i;
+ for(i = 0; i < l; ++i) {
+ if(!isprint(c[i]) && !isspace(c[i])) {
+ c[i] = '_';
+ }
+ }
+}
+
int process_cddb_titles(int sock_fd, char *inbuff, int readbytes);
int process_cddb_titles(int sock_fd, char *inbuff, int readbytes)
{
@@ -1003,6 +1020,7 @@
int newbytes;
memmove(inbuff, inbuff+ind, readbytes);
newbytes = readn(sock_fd, inbuff+readbytes, SOCKBUFF-readbytes);
+ filter_nonprintable(inbuff+readbytes, newbytes);
if (newbytes <= 0)
break;
readbytes += newbytes;
@@ -1183,6 +1201,10 @@
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
if (strncmp(inbuff, "200 ", 4) && strncmp(inbuff, "201 ", 4)) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
+ inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff, readbytes);
fprintf(stderr, "bad status from freedb server during sign-on banner: %s\n", inbuff);
retval = -1;
goto errout;
@@ -1262,7 +1284,10 @@
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
if (strncmp(inbuff, "200 ", 4)) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff, readbytes);
fprintf(stderr, "bad status from freedb server during hello: %s\n", inbuff);
retval = -1;
goto signoff;
@@ -1273,7 +1298,10 @@
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
/* check for errors and maximum supported protocol level */
if (strncmp(inbuff, "201 ", 4) > 0) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff, readbytes);
fprintf(stderr, "bad status from freedb server during proto command: %s\n", inbuff);
retval = -1;
goto signoff;
@@ -1295,7 +1323,11 @@
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
/* check for errors and maximum supported protocol level */
if (strncmp(inbuff, "201 ", 4) > 0) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff,
+ readbytes);
fprintf(stderr, "bad status from freedb server during proto x: %s\n", inbuff);
retval = -1;
goto signoff;
@@ -1340,8 +1372,9 @@
/* strcpy(outbuff, "cddb query 03015501 1 296 344\n"); */
writen(sock_fd, outbuff, strlen(outbuff));
- readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
+ readbytes = readn(sock_fd, inbuff, sizeof(inbuff) - 1);
inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff, readbytes);
cat_offset = 4;
if (!strncmp(inbuff, "210 ", 4)
|| !strncmp(inbuff, "211 ", 4)) {
@@ -1397,7 +1430,10 @@
/* read status and first buffer size. */
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
+ filter_nonprintable(inbuff, readbytes);
if (strncmp(inbuff, "210 ", 4)) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
inbuff[readbytes] = '\0';
fprintf(stderr, "bad status from freedb server during read: %s\n", inbuff);
retval = -1;
@@ -1413,7 +1449,10 @@
writen(sock_fd, "quit\n", 5);
readbytes = readn(sock_fd, inbuff, sizeof(inbuff));
if (strncmp(inbuff, "230 ", 4)) {
+ if(readbytes == sizeof(inbuff))
+ --readbytes;
inbuff[readbytes] = '\0';
+ filter_nonprintable(inbuff, readbytes);
fprintf(stderr, "bad status from freedb server during quit: %s\n", inbuff);
goto errout;
}
More information about the Debburn-changes
mailing list