Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Update libfetch to latest version from head
Baptiste Daroussin committed 10 years ago
commit abc80cd534d18b7306096ab043f59049a19b0a4e
parent 6673dd9
3 files changed +10 -20
modified external/libfetch/common.c
@@ -218,7 +218,9 @@ conn_t *
fetch_reopen(int sd)
{
	conn_t *conn;
+
#ifdef SO_NOSIGPIPE
	int opt = 1;
+
#endif

	/* allocate and fill connection structure */
	if ((conn = calloc(1, sizeof(*conn))) == NULL)
@@ -677,9 +679,7 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose)
{
	long ssl_ctx_options;

-
	ssl_ctx_options = SSL_OP_ALL | SSL_OP_NO_TICKET;
-
	if (getenv("SSL_ALLOW_SSL2") == NULL)
-
		ssl_ctx_options |= SSL_OP_NO_SSLv2;
+
	ssl_ctx_options = SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_TICKET;
	if (getenv("SSL_ALLOW_SSL3") == NULL)
		ssl_ctx_options |= SSL_OP_NO_SSLv3;
	if (getenv("SSL_NO_TLS1") != NULL)
modified external/libfetch/ftp.c
@@ -772,7 +772,6 @@ ftp_transfer(conn_t *conn, const char *oper, const char *file,
		if (bindaddr != NULL && *bindaddr != '\0' &&
		    fetch_bind(sd, sa.ss_family, bindaddr) != 0)
			goto sysouch;
-

		if (connect(sd, (struct sockaddr *)&sa, l) == -1)
			goto sysouch;

modified external/libfetch/http.c
@@ -1330,7 +1330,6 @@ static int
http_authorize(conn_t *conn, const char *hdr, http_auth_challenges_t *cs,
	       http_auth_params_t *parms, struct url *url)
{
-
	http_auth_challenge_t *basic = NULL;
	http_auth_challenge_t *digest = NULL;
	int i;

@@ -1340,10 +1339,8 @@ http_authorize(conn_t *conn, const char *hdr, http_auth_challenges_t *cs,
		return (-1);
	}

-
	/* Look for a Digest and a Basic challenge */
+
	/* Look for a Digest */
	for (i = 0; i < cs->count; i++) {
-
		if (cs->challenges[i]->scheme == HTTPAS_BASIC)
-
			basic = cs->challenges[i];
		if (cs->challenges[i]->scheme == HTTPAS_DIGEST)
			digest = cs->challenges[i];
	}
@@ -1626,10 +1623,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us,
			http_auth_params_t aparams;
			init_http_auth_params(&aparams);
			if (*purl->user || *purl->pwd) {
-
				aparams.user = purl->user ?
-
					strdup(purl->user) : strdup("");
-
				aparams.password = purl->pwd?
-
					strdup(purl->pwd) : strdup("");
+
				aparams.user = strdup(purl->user);
+
				aparams.password = strdup(purl->pwd);
			} else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL &&
				   *p != '\0') {
				if (http_authfromenv(p, &aparams) < 0) {
@@ -1655,10 +1650,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us,
			http_auth_params_t aparams;
			init_http_auth_params(&aparams);
			if (*url->user || *url->pwd) {
-
				aparams.user = url->user ?
-
					strdup(url->user) : strdup("");
-
				aparams.password = url->pwd ?
-
					strdup(url->pwd) : strdup("");
+
				aparams.user = strdup(url->user);
+
				aparams.password = strdup(url->pwd);
			} else if ((p = getenv("HTTP_AUTH")) != NULL &&
				   *p != '\0') {
				if (http_authfromenv(p, &aparams) < 0) {
@@ -1667,10 +1660,8 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us,
				}
			} else if (fetchAuthMethod &&
				   fetchAuthMethod(url) == 0) {
-
				aparams.user = url->user ?
-
					strdup(url->user) : strdup("");
-
				aparams.password = url->pwd ?
-
					strdup(url->pwd) : strdup("");
+
				aparams.user = strdup(url->user);
+
				aparams.password = strdup(url->pwd);
			} else {
				http_seterr(HTTP_NEED_AUTH);
				goto ouch;