Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Mar 2017 20:46:16 -0800
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r308996 - head/lib/libfetch
Message-ID:  <93505FD7-FB42-4BD5-834C-6F73EFD9B1CF@gmail.com>
In-Reply-To: <201611221330.uAMDU7fg052989@repo.freebsd.org>
References:  <201611221330.uAMDU7fg052989@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Nov 22, 2016, at 05:30, Dag-Erling Sm=C3=B8rgrav <des@freebsd.org> =
wrote:
>=20
> Author: des
> Date: Tue Nov 22 13:30:07 2016
> New Revision: 308996
> URL: https://svnweb.freebsd.org/changeset/base/308996
>=20
> Log:
>  Refactor fetch_connect() and fetch_bind() to improve readability and =
avoid
>  repeating the same DNS lookups.
>=20
>  MFC after:	3 weeks
>=20
> Modified:
>  head/lib/libfetch/common.c
>  head/lib/libfetch/common.h
>  head/lib/libfetch/ftp.c
>=20
> Modified: head/lib/libfetch/common.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/lib/libfetch/common.c	Tue Nov 22 13:24:57 2016	=
(r308995)
> +++ head/lib/libfetch/common.c	Tue Nov 22 13:30:07 2016	=
(r308996)
> @@ -1,5 +1,5 @@
> /*-
> - * Copyright (c) 1998-2014 Dag-Erling Sm=C3=B8rgrav
> + * Copyright (c) 1998-2016 Dag-Erling Sm=C3=B8rgrav
>  * Copyright (c) 2013 Michael Gmelin <freebsd@grem.de>
>  * All rights reserved.
>  *
> @@ -241,27 +241,83 @@ fetch_ref(conn_t *conn)
>=20
>=20
> /*
> + * Resolve an address
> + */
> +struct addrinfo *
> +fetch_resolve(const char *addr, int port, int af)
> +{
> +	char hbuf[256], sbuf[8];
> +	struct addrinfo hints, *res;
> +	const char *sep, *host, *service;
> +	int err, len;
> +
> +	/* split address if necessary */
> +	err =3D EAI_SYSTEM;
> +	if ((sep =3D strchr(addr, ':')) !=3D NULL) {

Hi Bjoern,
	Shouldn=E2=80=99t this be strrchr instead of strchr since =
you=E2=80=99re scanning for the service from the right side of the host, =
e.g. =E2=80=9Cfoo:service=E2=80=9D or =E2=80=9C[::1]:service=E2=80=9D? =
This code would match index 3 in the first example, but it would match =
index 2 in the second example.
Thanks,
-Ngie

--Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYxNKYAAoJEPWDqSZpMIYV3J0QALZxTlr5dYE2gmWTfsURk/Py
nUPfo5voDiFEZPDtkQZ1uXL5cydYirByBZxRDTFLqOxzSfaro5xLC512w4aOD5Fv
LL4GyH+nVYLfEi4Wo3j7JxR81QMCDpVgGFCuk5cA1c3yvV7v0F8hAfDhNekMEY6k
nkO7gUmAL3pOW7NSjeotI8/kVal0nKRVvkg3+QlLbHZixNhThXuhLgIZSaYOjEan
1fUmEyHdGRuzCp7DELjXEvElCaycZe7jSEWHDJydw2VJvVYb3RQQv8nHuGmA3yq9
tvUagd5wd+sCy4l9hXanrzuZs7D8O5MHvQXCUoH/rMUKtjfOs7l9AZdpWf9wFmz9
NmHL0BMxrbRJ+UN/N6eH+dqK8j9YuV8G+b+5C0S2e3llY+pnyGNnAcv2h/ouWgUy
H6zrrJJHU/ZNP28QtEvgYVedWHQprTLVmfah5I9evQ723kL6mNtmRCZVTgx+IfoB
VvwVITru8DcYs63B5IU4B09bnguIg4MtnHpMIIu5f36CibfBGFV+kUzvsgiVqZGY
4IgXqByjDFUL8DwGlTEOZiU0z+z3KfETCw23XpWCmPRPnyY6nJxitL4UpuPBUQGj
aLj+Xojq2jiSC7/mgmxO/WSRf0h/tQxcDnEa3C2CKcn4DIP6z8aF1fyo+njJDHsu
o1djBBUk1kk188glJp3b
=lVHI
-----END PGP SIGNATURE-----

--Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93505FD7-FB42-4BD5-834C-6F73EFD9B1CF>