Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 14d66bf8988361107689f9ce2e9a8abf > files > 2

netcat-openbsd-1.89-5.mga3.src.rpm

Index: netcat-openbsd-1.89/netcat.c
===================================================================
--- netcat-openbsd-1.89.orig/netcat.c	2008-01-22 20:39:46.000000000 -0500
+++ netcat-openbsd-1.89/netcat.c	2008-01-22 20:42:35.000000000 -0500
@@ -127,7 +127,7 @@
 	struct servent *sv;
 	socklen_t len;
 	struct sockaddr_storage cliaddr;
-	char *proxy;
+	char *proxy = NULL;
 	const char *proxyhost = "", *proxyport = NULL;
 	struct addrinfo proxyhints;
 
@@ -800,14 +800,12 @@
 			obuf[1] = DONT;
 		if ((*p == DO) || (*p == DONT))
 			obuf[1] = WONT;
-		if (obuf) {
-			p++;
-			obuf[2] = *p;
-			obuf[3] = '\0';
-			if (atomicio(vwrite, nfd, obuf, 3) != 3)
-				warn("Write Error!");
-			obuf[0] = '\0';
-		}
+		p++;
+		obuf[2] = *p;
+		obuf[3] = '\0';
+		if (atomicio(vwrite, nfd, obuf, 3) != 3)
+			warn("Write Error!");
+		obuf[0] = '\0';
 	}
 }
 
Index: netcat-openbsd-1.89/socks.c
===================================================================
--- netcat-openbsd-1.89.orig/socks.c	2008-01-22 20:36:26.000000000 -0500
+++ netcat-openbsd-1.89/socks.c	2008-01-22 20:39:46.000000000 -0500
@@ -169,11 +169,11 @@
 		buf[2] = SOCKS_NOAUTH;
 		cnt = atomicio(vwrite, proxyfd, buf, 3);
 		if (cnt != 3)
-			err(1, "write failed (%d/3)", cnt);
+			err(1, "write failed (%d/3)", (int)cnt);
 
 		cnt = atomicio(read, proxyfd, buf, 2);
 		if (cnt != 2)
-			err(1, "read failed (%d/3)", cnt);
+			err(1, "read failed (%d/3)", (int)cnt);
 
 		if (buf[1] == SOCKS_NOMETHOD)
 			errx(1, "authentication method negotiation failed");
@@ -222,11 +222,11 @@
 
 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
 		if (cnt != wlen)
-			err(1, "write failed (%d/%d)", cnt, wlen);
+			err(1, "write failed (%d/%d)", (int)cnt, (int)wlen);
 
 		cnt = atomicio(read, proxyfd, buf, 10);
 		if (cnt != 10)
-			err(1, "read failed (%d/10)", cnt);
+			err(1, "read failed (%d/10)", (int)cnt);
 		if (buf[1] != 0)
 			errx(1, "connection failed, SOCKS error %d", buf[1]);
 	} else if (socksv == 4) {
@@ -244,11 +244,11 @@
 
 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
 		if (cnt != wlen)
-			err(1, "write failed (%d/%d)", cnt, wlen);
+			err(1, "write failed (%d/%d)", (int)cnt, (int)wlen);
 
 		cnt = atomicio(read, proxyfd, buf, 8);
 		if (cnt != 8)
-			err(1, "read failed (%d/8)", cnt);
+			err(1, "read failed (%d/8)", (int)cnt);
 		if (buf[1] != 90)
 			errx(1, "connection failed, SOCKS error %d", buf[1]);
 	} else if (socksv == -1) {
@@ -260,39 +260,39 @@
 
 		/* Try to be sane about numeric IPv6 addresses */
 		if (strchr(host, ':') != NULL) {
-			r = snprintf(buf, sizeof(buf),
+			r = snprintf((char*)buf, sizeof(buf),
 			    "CONNECT [%s]:%d HTTP/1.0\r\n",
 			    host, ntohs(serverport));
 		} else {
-			r = snprintf(buf, sizeof(buf),
+			r = snprintf((char*)buf, sizeof(buf),
 			    "CONNECT %s:%d HTTP/1.0\r\n",
 			    host, ntohs(serverport));
 		}
 		if (r == -1 || (size_t)r >= sizeof(buf))
 			errx(1, "hostname too long");
-		r = strlen(buf);
+		r = strlen((char*)buf);
 
 		cnt = atomicio(vwrite, proxyfd, buf, r);
 		if (cnt != r)
-			err(1, "write failed (%d/%d)", cnt, r);
+			err(1, "write failed (%d/%d)", (int)cnt, (int)r);
 
 		if (authretry > 1) {
 			char resp[1024];
 
 			proxypass = getproxypass(proxyuser, proxyhost);
-			r = snprintf(buf, sizeof(buf), "%s:%s",
+			r = snprintf((char*)buf, sizeof(buf), "%s:%s",
 			    proxyuser, proxypass);
 			if (r == -1 || (size_t)r >= sizeof(buf) ||
-			    b64_ntop(buf, strlen(buf), resp,
+			    b64_ntop(buf, strlen((char*)buf), resp,
 			    sizeof(resp)) == -1)
 				errx(1, "Proxy username/password too long");
-			r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
+			r = snprintf((char*)buf, sizeof((char*)buf), "Proxy-Authorization: "
 			    "Basic %s\r\n", resp);
 			if (r == -1 || (size_t)r >= sizeof(buf))
 				errx(1, "Proxy auth response too long");
-			r = strlen(buf);
+			r = strlen((char*)buf);
 			if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r)
-				err(1, "write failed (%d/%d)", cnt, r);
+				err(1, "write failed (%d/%d)", (int)cnt, r);
 		}
 
 		/* Terminate headers */
@@ -300,22 +300,22 @@
 			err(1, "write failed (2/%d)", r);
 
 		/* Read status reply */
-		proxy_read_line(proxyfd, buf, sizeof(buf));
+		proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
 		if (proxyuser != NULL &&
-		    strncmp(buf, "HTTP/1.0 407 ", 12) == 0) {
+		    strncmp((char*)buf, "HTTP/1.0 407 ", 12) == 0) {
 			if (authretry > 1) {
 				fprintf(stderr, "Proxy authentication "
 				    "failed\n");
 			}
 			close(proxyfd);
 			goto again;
-		} else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
-		    strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
+		} else if (strncmp((char*)buf, "HTTP/1.0 200 ", 12) != 0 &&
+		    strncmp((char*)buf, "HTTP/1.1 200 ", 12) != 0)
 			errx(1, "Proxy error: \"%s\"", buf);
 
 		/* Headers continue until we hit an empty line */
 		for (r = 0; r < HTTP_MAXHDRS; r++) {
-			proxy_read_line(proxyfd, buf, sizeof(buf));
+			proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
 			if (*buf == '\0')
 				break;
 		}