Report forwarded to Martin Schulze <joey@debian.org>:
Bug#24900; Package cfingerd.   Martin Schulze  Subject: Bug#24900: cfingerd uses wrong line ends (rfc violation) Reply-To: jbj@image.dk, 24900-maintonly@bugs.debian.org Resent-From: "Jakob Bűhm Jensen" Resent-To: Martin Schulze Resent-Date: Wed, 22 Jul 1998 22:18:08 GMT Resent-Message-ID: Resent-Sender: iwj@debian.org X-Debian-PR-Message: report 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: X-Loop: owner@bugs.debian.org Received: via spool by maintonly@bugs.debian.org id=M.90114584819774 (code M ref -1); Wed, 22 Jul 1998 22:18:08 GMT Message-ID: <35B6648A.C44FE76E@image.dk> Date: Thu, 23 Jul 1998 00:15:38 +0200 From: "Jakob Bűhm Jensen" X-Mailer: Mozilla 4.03 [en] (Win95; I) MIME-Version: 1.0 To: maintonly@bugs.debian.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Package: cfingerd Version: 1.3.2-11 Severity: wishlist This is an upstream bug, it is bad but hard to fix. RFC1288 clearly specifies that 2.2. Data format Any data transferred MUST be in ASCII format, with no parity, and with lines ending in CRLF (ASCII 13 followed by ASCII 10). This excludes other character formats such as EBCDIC, etc. This also means that any characters between ASCII 128 and ASCII 255 should truly be international data, not 7-bit ASCII with the parity bit set. BSD fingerd does this right by explicitly using a conversion loop. cfingerd sends line feeds only and does not provide any one point in the source code where this can be fixed. One possible workaround could be to use a modified copy of BSD fingerd to invoke cfingerd -e in place of finger, but I have my doubts as to the security implications. This was discovered when studying the source code and was subsequently confirmed using netcat (echo root | /usr/bin/nc -o hexdump localhost finger) to see the line ends directly. I am now using Debian 2.0 kernel 2.0.33 (compiled by me) libc-2.0.7. -- This message is hastily written, please ignore any unpleasant wordings, do not consider it a binding commitment, even if its phrasing may indicate so. Its contents may be deliberately or accidentally untrue. Trademarks and other things belong to their owners, if any.   Acknowledgement sent to jbj@image.dk:
New bug report received and forwarded. Copy sent to Martin Schulze <joey@debian.org>.   -t  From: owner@bugs.debian.org (Ian Jackson) To: jbj@image.dk Subject: Bug#24900: Acknowledgement of maintainer-only report (cfingerd uses wrong line ends (rfc violation)) Message-ID: In-Reply-To: <35B6648A.C44FE76E@image.dk> References: <35B6648A.C44FE76E@image.dk> X-Debian-PR-Message: ack-maintonly 24900 Thank you for the problem report you have sent regarding Debian. This is an automatically generated reply, to let you know your message has been received. It is being forwarded to the developers (but not the mailing list, as you requested) for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): Martin Schulze If you wish to submit further information on your problem, please send it to 24900-maintonly@bugs.debian.org (and *not* to maintonly@bugs.debian.org). Please do not reply to the address at the top of this message, unless you wish to report a problem with the bug-tracking system. Ian Jackson (administrator, Debian bugs database)   Received: (at maintonly) by bugs.debian.org; 22 Jul 1998 22:17:28 +0000 Received: (qmail 19770 invoked from network); 22 Jul 1998 22:17:27 -0000 Received: from www200.image.dk (194.234.58.146) by debian.novare.net with SMTP; 22 Jul 1998 22:17:27 -0000 Received: from image.dk (pm30-47.image.dk [194.234.173.239]) by www200.image.dk (8.9.0/8.8.5) with ESMTP id AAA31105 for ; Thu, 23 Jul 1998 00:17:11 +0200 Message-ID: <35B6648A.C44FE76E@image.dk> Date: Thu, 23 Jul 1998 00:15:38 +0200 From: "Jakob Bűhm Jensen" Reply-To: jbj@image.dk X-Mailer: Mozilla 4.03 [en] (Win95; I) MIME-Version: 1.0 To: maintonly@bugs.debian.org Subject: cfingerd uses wrong line ends (rfc violation) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Package: cfingerd Version: 1.3.2-11 Severity: wishlist This is an upstream bug, it is bad but hard to fix. RFC1288 clearly specifies that 2.2. Data format Any data transferred MUST be in ASCII format, with no parity, and with lines ending in CRLF (ASCII 13 followed by ASCII 10). This excludes other character formats such as EBCDIC, etc. This also means that any characters between ASCII 128 and ASCII 255 should truly be international data, not 7-bit ASCII with the parity bit set. BSD fingerd does this right by explicitly using a conversion loop. cfingerd sends line feeds only and does not provide any one point in the source code where this can be fixed. One possible workaround could be to use a modified copy of BSD fingerd to invoke cfingerd -e in place of finger, but I have my doubts as to the security implications. This was discovered when studying the source code and was subsequently confirmed using netcat (echo root | /usr/bin/nc -o hexdump localhost finger) to see the line ends directly. I am now using Debian 2.0 kernel 2.0.33 (compiled by me) libc-2.0.7. -- This message is hastily written, please ignore any unpleasant wordings, do not consider it a binding commitment, even if its phrasing may indicate so. Its contents may be deliberately or accidentally untrue. Trademarks and other things belong to their owners, if any.   Noted your statement that bug has been forwarded to Martin Schulze <joey@infodrom.north.de>. Request was from Martin Schulze <joey@finlandia.Infodrom.North.DE> to control@bugs.debian.org.   Received: (at control) by bugs.debian.org; 19 Dec 1998 17:32:55 +0000 Received: (qmail 7594 invoked from network); 19 Dec 1998 17:32:54 -0000 Received: from gimli.informatik.uni-oldenburg.de (134.106.1.10) by master.debian.org with SMTP; 19 Dec 1998 17:32:54 -0000 Received: from finlandia.Infodrom.North.DE ([134.106.121.3]) by gimli.Informatik.Uni-Oldenburg.DE (Smail3.1.29.1) id ; Sat, 19 Dec 98 18:33 CET Received: at Infodrom Oldenburg (/\##/\ Smail-3.2.0.102 1998-Aug-2 #2) by finlandia.Infodrom.North.DE via smail from stdin id for control@bugs.debian.org; Sat, 19 Dec 1998 18:32:39 +0100 (CET) Date: Sat, 19 Dec 1998 18:32:38 +0100 From: Martin Schulze To: control@bugs.debian.org Subject: fwd Message-ID: <19981219183238.F742@finlandia.artis.uni-oldenburg.de> Reply-To: Martin Schulze Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.17i forwarded 24900 Martin Schulze thanks -- Those who don't understand Unix are condemned to reinvent it, poorly.   Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#24900; Package cfingerd.   debian-bugs-dist@lists.debian.orgMartin Schulze  X-Loop: owner@bugs.debian.org Subject: Bug#24900: cfingerd: Patch for #24900 Reply-To: Jarek =?UTF-8?Q?Kami=C5=84ski?= , 24900@bugs.debian.org Resent-From: Jarek =?UTF-8?Q?Kami=C5=84ski?= Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Martin Schulze Resent-Date: Fri, 27 Oct 2006 17:33:23 +0000 Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: X-Debian-PR-Source: cfingerd Received: via spool by 24900-submit@bugs.debian.org id=B24900.116196976728051 (code B ref 24900); Fri, 27 Oct 2006 17:33:23 +0000 Received: (at 24900) by bugs.debian.org; 27 Oct 2006 17:22:47 +0000 Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVPq-0007Hg-OM; Fri, 27 Oct 2006 10:22:47 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 76331A6B9D; Fri, 27 Oct 2006 19:21:14 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?UTF-8?Q?Kami=C5=84ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?UTF-8?Q?J=C4=99drzej?= Potoniec , control@bugs.debian.org Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Acknowledgement sent to Jarek KamiƄski <jarek@vilo.eu.org>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>.   -t  Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.417 (Entity 5.417) Content-Type: text/plain; charset=utf-8 X-Loop: owner@bugs.debian.org From: owner@bugs.debian.org (Debian Bug Tracking System) To: Jarek =?UTF-8?Q?Kami=C5=84ski?= Subject: Bug#24900: Info received (cfingerd: Patch for #24900) Message-Id: References: <20061027164304.GA23240@Omega.vilo.eu.org> <35B6648A.C44FE76E@image.dk> X-Debian-PR-Message: ack-info 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Source: cfingerd Reply-To: 24900@bugs.debian.org Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the package maintainer(s) and to other interested parties to accompany the original report. Your message has been sent to the package maintainer(s): Martin Schulze If you wish to continue to submit further information on this problem, please send it to 24900@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Debian bug tracking system administrator (administrator, Debian Bugs database)   Received: (at 24900) by bugs.debian.org; 27 Oct 2006 17:22:47 +0000 From jarek@Omega.vilo.eu.org Fri Oct 27 10:22:47 2006 Return-path: Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVPq-0007Hg-OM; Fri, 27 Oct 2006 10:22:47 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 76331A6B9D; Fri, 27 Oct 2006 19:21:14 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?iso-8859-2?Q?Kami=F1ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?iso-8859-2?Q?J=EAdrzej?= Potoniec , control@bugs.debian.org Subject: cfingerd: Patch for #24900 Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> Reply-To: Jarek =?iso-8859-2?Q?Kami=F1ski?= MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Tags added: patch Request was from Jarek KamiƄski <jarek@Omega.vilo.eu.org> to control@bugs.debian.org.   Received: (at control) by bugs.debian.org; 27 Oct 2006 17:22:47 +0000 From jarek@Omega.vilo.eu.org Fri Oct 27 10:22:47 2006 Return-path: Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVPq-0007Hg-OM; Fri, 27 Oct 2006 10:22:47 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 76331A6B9D; Fri, 27 Oct 2006 19:21:14 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?iso-8859-2?Q?Kami=F1ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?iso-8859-2?Q?J=EAdrzej?= Potoniec , control@bugs.debian.org Subject: cfingerd: Patch for #24900 Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> Reply-To: Jarek =?iso-8859-2?Q?Kami=F1ski?= MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) Delivered-To: control@bugs.debian.org X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#24900; Package cfingerd.   debian-bugs-dist@lists.debian.orgMartin Schulze  X-Loop: owner@bugs.debian.org Subject: Bug#24900: cfingerd: Patch for #24900 Reply-To: Jarek =?UTF-8?Q?Kami=C5=84ski?= , 24900@bugs.debian.org Resent-From: Jarek =?UTF-8?Q?Kami=C5=84ski?= Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Martin Schulze Resent-Date: Fri, 27 Oct 2006 18:03:09 +0000 Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: report 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: patch X-Debian-PR-Source: cfingerd Received: via spool by 24900-submit@bugs.debian.org id=B24900.116197130516869 (code B ref 24900); Fri, 27 Oct 2006 18:03:09 +0000 Received: (at 24900) by bugs.debian.org; 27 Oct 2006 17:48:25 +0000 Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVod-0004Ic-FT; Fri, 27 Oct 2006 10:48:24 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 28FFDA6BB0; Fri, 27 Oct 2006 19:22:27 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?UTF-8?Q?Kami=C5=84ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?UTF-8?Q?J=C4=99drzej?= Potoniec , control@bugs.debian.org Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Acknowledgement sent to Jarek KamiƄski <jarek@vilo.eu.org>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>.   -t  Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.417 (Entity 5.417) Content-Type: text/plain; charset=utf-8 X-Loop: owner@bugs.debian.org From: owner@bugs.debian.org (Debian Bug Tracking System) To: Jarek =?UTF-8?Q?Kami=C5=84ski?= Subject: Bug#24900: Info received (cfingerd: Patch for #24900) Message-Id: References: <20061027164304.GA23240@Omega.vilo.eu.org> <35B6648A.C44FE76E@image.dk> X-Debian-PR-Message: ack-info 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: patch X-Debian-PR-Source: cfingerd Reply-To: 24900@bugs.debian.org Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the package maintainer(s) and to other interested parties to accompany the original report. Your message has been sent to the package maintainer(s): Martin Schulze If you wish to continue to submit further information on this problem, please send it to 24900@bugs.debian.org, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the Bug-tracking system. Debian bug tracking system administrator (administrator, Debian Bugs database)   Received: (at 24900) by bugs.debian.org; 27 Oct 2006 17:48:25 +0000 From jarek@Omega.vilo.eu.org Fri Oct 27 10:48:25 2006 Return-path: Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVod-0004Ic-FT; Fri, 27 Oct 2006 10:48:24 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 28FFDA6BB0; Fri, 27 Oct 2006 19:22:27 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?iso-8859-2?Q?Kami=F1ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?iso-8859-2?Q?J=EAdrzej?= Potoniec , control@bugs.debian.org Subject: cfingerd: Patch for #24900 Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> Reply-To: Jarek =?iso-8859-2?Q?Kami=F1ski?= MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Tags added: patch Request was from Jarek KamiƄski <jarek@Omega.vilo.eu.org> to control@bugs.debian.org.   Received: (at control) by bugs.debian.org; 27 Oct 2006 17:48:25 +0000 From jarek@Omega.vilo.eu.org Fri Oct 27 10:48:24 2006 Return-path: Received: from nat-215-94.man.bydgoszcz.pl ([212.122.215.94] helo=widok.wavelan.pl ident=postfix) by spohr.debian.org with esmtp (Exim 4.50) id 1GdVod-0004Ic-FT; Fri, 27 Oct 2006 10:48:24 -0700 Received: from Solo.mshome.net (Omega.wavelan.pl [192.168.3.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by widok.wavelan.pl (Postfix) with ESMTP id 28FFDA6BB0; Fri, 27 Oct 2006 19:22:27 +0200 (CEST) Received: by Solo.mshome.net (Postfix, from userid 502) id 0F9CD542FC; Fri, 27 Oct 2006 18:43:05 +0200 (CEST) Date: Fri, 27 Oct 2006 18:43:04 +0200 From: Jarek =?iso-8859-2?Q?Kami=F1ski?= To: Debian Bug Tracking System <24900@bugs.debian.org> Cc: =?iso-8859-2?Q?J=EAdrzej?= Potoniec , control@bugs.debian.org Subject: cfingerd: Patch for #24900 Message-ID: <20061027164304.GA23240@Omega.vilo.eu.org> Reply-To: Jarek =?iso-8859-2?Q?Kami=F1ski?= MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline X-Reportbug-Version: 3.30 User-Agent: mutt-ng/devel-r804 (Debian) Delivered-To: control@bugs.debian.org X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Level: X-Spam-Status: No, hits=-0.3 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2005_01_02 --gatW/ieO32f1wygP Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable tags 24900 patch quit Package: cfingerd Followup-For: Bug #24900 Hello, Attached patch fixing #24900. It makes it different way, than we discussed on IRC: 18:05 There are two answers. 18:05 Both require work. 18:05 (a) fix all printfs 18:06 (b) don't use printf but a wrapper that will insert \r wheneve= r it sees \n Fixing all printfs isn't enough, because of -e cfingerd option. Just (b) also wouldn't be enough, because cfingerd may call external programs or read external files. (b) + loop similar to attached near all reads from other sources will be correct way, but much harder to implement, as it requires playing with va_* (for wrapper around printf() ) and locating all external files and program accesses. Instead my patch implements strange at first look idea - forks another process correcting all \ns to \rs. It works fine on my homebox, but isn't fully tested. I'll upload it soon to ftp://vilo.eu.org/debian-vilo/pool/main/c/cfingerd/ and test in more complex environment. I hope it will be useful ;-) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-ck11 Locale: LANG=3Dpl_PL, LC_CTYPE=3Dpl_PL (charmap=3DISO-8859-2) (ignored: LC_= ALL set to pl_PL) Versions of packages cfingerd depends on: ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii netbase 4.27 Basic TCP/IP networking system cfingerd recommends no packages. -- no debconf information --=20 Linux jest darmowy, je=B6li tw=F3j czas nie przedstawia =BFadnej warto= =B6ci. Je=B6li jest co=B6 warty(czas), Linux jest po prostu ta=F1szy od innych. Jarek Kami=F1ski gg# 453620 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="cfingerd-rfc.patch" Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -ur cfingerd-1.4.3/CREDITS cfingerd-1.4.3/CREDITS - --- cfingerd-1.4.3/CREDITS 1999-08-29 19:45:44.000000000 +0200 +++ cfingerd-1.4.3/CREDITS 2006-10-27 18:17:26.000000000 +0200 @@ -76,3 +76,6 @@ =20 Alexey M. Zelkin - Support for FreeBSD + +Jarek Kami=F1ski + - Basic work-around for RFC compliance (sending "\r\n") diff -upr cfingerd-1.4.3/src/main.c cfingerd-1.4.3/src/main.c - --- cfingerd-1.4.3/src/main.c 2006-10-22 18:18:13.000000000 +0200 +++ cfingerd-1.4.3/src/main.c 2006-10-27 18:15:34.000000000 +0200 @@ -231,6 +231,41 @@ int main(int argc, char *argv[]) if ((!local_finger) && !emulated) check_rejected(remote_addr); =20 + /* If sending data to the net convert all \n to \r\n to be RFC complia= nt */ + if (!emulated) { + int pfd[2]; + if (!pipe(pfd)) { + pid_t pid =3D fork(); + if (pid > 0) { /* parent */ + close(pfd[0]); + if(dup2(pfd[1], fileno(stdout)) < 0) exit(1); + close(pfd[1]); + } + else if (pid =3D=3D 0) { /* child -- do conversion */ + close(pfd[1]); + char buf1[256], buf2[sizeof(buf1)*2]; + ssize_t retval; + while ( ( retval =3D read(pfd[0], &buf1, sizeof(buf1)) ) > 0) { + char *wsk1 =3D buf1; char *wsk2 =3D buf2; + ssize_t i; + for (i =3D 0; i < retval; ++i) { + switch (*wsk1) { + case '\r': break; /* Do not send "\r\r" -- + important when forwarding + queries to other cfingerds */ + case '\n': *(wsk2++) =3D '\r'; + default: *(wsk2++) =3D *wsk1; + } + ++wsk1; + } + write(fileno(stdout), buf2, wsk2 - buf2); + } + _exit (0); + } + /* else -- fork() has not succeed -- send original output */ + } + } + /* Check the finger information coming in and return its type */ un_type =3D process_username(username); =20 @@ -287,3 +322,4 @@ int main(int argc, char *argv[]) * tab-width: 8 * End: */ +/* vi: set sw=3D4: */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjImt9nrbF3mbcARAoMiAJ4uMWFLLAoGY3IFythcVQXFvLNBkgCfdF7B zOMW2vvxD2KNV1L6XC1ln7w=3D =3Dnp0d -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFQjcYt9nrbF3mbcARAvKRAJ9H8l6kxWyFaJpkM31vP1bNAQ8eJwCfVDX6 rfXw0yakEwFo+RwGwr/MMto= =KVC0 -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--   Tags added: upstream Request was from Martin Schulze <joey@infodrom.org> to control@bugs.debian.org.   Received: (at control) by bugs.debian.org; 25 Feb 2008 09:47:08 +0000 From joey@finlandia.infodrom.north.de Mon Feb 25 09:47:08 2008 X-Spam-Checker-Version: SpamAssassin 3.1.4-bugs.debian.org_2005_01_02 (2006-07-26) on rietz.debian.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=4.0 tests=BAYES_00,ONEWORD, VALID_BTS_CONTROL autolearn=no version=3.1.4-bugs.debian.org_2005_01_02 Return-path: Received: from luonnotar.infodrom.org ([217.114.79.202] ident=postfix) by rietz.debian.org with esmtp (Exim 4.63) (envelope-from ) id 1JTZvQ-0000vW-Fa for control@bugs.debian.org; Mon, 25 Feb 2008 09:47:08 +0000 Received: by luonnotar.infodrom.org (Postfix, from userid 10) id 6C00B648EB6; Mon, 25 Feb 2008 10:47:07 +0100 (CET) Received: by finlandia.home.infodrom.org (Postfix, from userid 501) id EA025DDE30; Mon, 25 Feb 2008 10:42:54 +0100 (CET) Date: Mon, 25 Feb 2008 10:42:54 +0100 From: Martin Schulze To: control@bugs.debian.org Subject: tidy Message-ID: <20080225094254.GF6746@finlandia.home.infodrom.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Delivered-To: control@bugs.debian.org tags 24900 upstream thanks -- Given enough thrust pigs will fly, but it's not necessarily a good idea. Please always Cc to me when replying to me on the lists.   Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#24900; Package cfingerd.   debian-bugs-dist@lists.debian.orgMartin Schulze  X-Loop: owner@bugs.debian.org Subject: Bug#24900: Don't settle for less Reply-To: Marlene Pittman , 24900@bugs.debian.org Resent-From: Marlene Pittman Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Martin Schulze Resent-Date: Mon, 08 Sep 2008 11:54:09 +0000 Resent-Message-ID: Resent-Sender: owner@bugs.debian.org X-Debian-PR-Message: followup 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: upstream patch X-Debian-PR-Source: cfingerd Received: via spool by 24900-submit@bugs.debian.org id=B24900.122087468324198 (code B ref 24900); Mon, 08 Sep 2008 11:54:09 +0000 Received: (at 24900) by bugs.debian.org; 8 Sep 2008 11:51:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rietz.debian.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=4.0 tests=HS_INDEX_PARAM,MULTALT, RDNS_NONE autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: from [78.174.69.184] (helo=localhost.alphared.com) by rietz.debian.org with smtp (Exim 4.63) (envelope-from ) id 1KcfH7-0005yw-6k; Mon, 08 Sep 2008 11:51:22 +0000 Delivered-To: To: 24900@bugs.debian.org Cc: 24950@bugs.debian.org, 32579@bugs.debian.org, 35358@bugs.debian.org, 35358-forwarded@bugs.debian.org, 37050@bugs.debian.org, 41685@bugs.debian.org, 42158@bugs.debian.org, 51909@bugs.debian.org, 51909-forwarded@bugs.debian.org Received: by 10.143.260.17 with SMTP id x15cs283907muq; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received: by 10.121.235.10 with SMTP id c90mr2915968ybg.191.1109460517368; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received: from n11.bullet.mail.mud.yahoo.com (n31.bullet.mail.mud.yahoo.com [78.174.69.184]) by mx.google.com with SMTP id 5si2674079ywl.4.2008.08.22.29.07.54; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received-SPF: pass (google.com: domain of Hanna83@absolutenow.com designates 78.174.69.184 as permitted sender) client-ip=78.174.69.184; DomainKey-Status: good (test mode) Authentication-Results: mx.google.com; spf=pass (google.com: domain of Hanna83@absolutenow.com designates 78.174.69.184 as permitted sender) smtp.mail=Hanna83@absolutenow.com; domainkeys=pass (test mode) header.From=Hanna83@absolutenow.com Received: from [68.142.148.215] by n21.bullet.mail.mud.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [76.13.11.20] by t2.bullet.mud.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [76.13.11.156] by t0.bullet.mail.ac2.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [78.174.69.184] by omp124.mail.ac3.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 740663.40105.bm@omp463.mail.ac5.yahoo.com Received: (qmail 6584 invoked by uid 60001); Mon, 08 Sep 2008 07:51:33 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=ihWzks80rHLG2ivVUaQPEXNLo4wgqDhrcm6Rkszt1xmi5378J9BYUgeq89p536hb8rJbwPm2qbi1buQG7xoX/x/SARs9U230cGGsMiUdcluKkVSO/IotEBEllWLaNHxwovoFIqpc15SGZJWPXxoN8LTbePt1nfIHxiIWaSPxPEI=; X-YMail-OSG: YtddQHAVM1k9YpfA3KLhDQewHq.RJqx18aZqsveLtPdrMk.QMS.wQ3di48gZXCttVcg-- Received: from [78.174.69.184] by web56974.mail.sp1.yahoo.com via HTTP; Mon, 08 Sep 2008 07:51:33 -0500 PDT X-Mailer: YahooMailRC/2462.21 YahooMailWebService/0.0.961.4 Date: Mon, 08 Sep 2008 07:51:33 -0500 (PDT) From: Marlene Pittman To: To: 24900@bugs.debian.org Cc: 24950@bugs.debian.org, 32579@bugs.debian.org, 35358@bugs.debian.org, 35358-forwarded@bugs.debian.org, 37050@bugs.debian.org, 41685@bugs.debian.org, 42158@bugs.debian.org, 51909@bugs.debian.org, 51909-forwarded@bugs.debian.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1761366887-1219460752=:76606" Message-ID: <957395.77559.qm@web60541.mail.sp1.yahoo.com> --0-1761366887-1219460752=:76606 Content-Type: text/plain; charset=us-ascii Women like big ones, Grinning Ear to Ear. http://dbz.downmove.com?fih --0-1761366887-1219460752=:76606 Content-Type: text/html; charset=us-ascii
Seen on t.v, Gain more length.
http://www.cnn.com/health.news/enlarge?62082

--0-1761366887-1219460752=:76606--   Acknowledgement sent to Marlene Pittman <Hanna83@absolutenow.com>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>.   -t  Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.420 (Entity 5.420) Content-Type: text/plain; charset=utf-8 X-Loop: owner@bugs.debian.org From: owner@bugs.debian.org (Debian Bug Tracking System) To: Marlene Pittman Subject: Bug#24900: Info received (Don't settle for less) Message-ID: References: <957395.77559.qm@web60541.mail.sp1.yahoo.com> X-Debian-PR-Message: ack-info 24900 X-Debian-PR-Package: cfingerd X-Debian-PR-Keywords: upstream patch X-Debian-PR-Source: cfingerd Reply-To: 24900@bugs.debian.org Thank you for the additional information you have supplied regarding this Bug report. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): Martin Schulze If you wish to submit further information on this problem, please send it to 24900@bugs.debian.org, as before. Please do not send mail to owner@bugs.debian.org unless you wish to report a problem with the Bug-tracking system. --=20 24900: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D24900 Debian Bug Tracking System Contact owner@bugs.debian.org with problems   Received: (at 24900) by bugs.debian.org; 8 Sep 2008 11:51:23 +0000 From Hanna83@absolutenow.com Mon Sep 08 11:51:23 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rietz.debian.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=4.0 tests=HS_INDEX_PARAM,MULTALT, RDNS_NONE autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Return-path: Received: from [78.174.69.184] (helo=localhost.alphared.com) by rietz.debian.org with smtp (Exim 4.63) (envelope-from ) id 1KcfH7-0005yw-6k; Mon, 08 Sep 2008 11:51:22 +0000 Delivered-To: To: 24900@bugs.debian.org Cc: 24950@bugs.debian.org, 32579@bugs.debian.org, 35358@bugs.debian.org, 35358-forwarded@bugs.debian.org, 37050@bugs.debian.org, 41685@bugs.debian.org, 42158@bugs.debian.org, 51909@bugs.debian.org, 51909-forwarded@bugs.debian.org Received: by 10.143.260.17 with SMTP id x15cs283907muq; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received: by 10.121.235.10 with SMTP id c90mr2915968ybg.191.1109460517368; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received: from n11.bullet.mail.mud.yahoo.com (n31.bullet.mail.mud.yahoo.com [78.174.69.184]) by mx.google.com with SMTP id 5si2674079ywl.4.2008.08.22.29.07.54; Mon, 08 Sep 2008 07:51:33 -0500 (PDT) Received-SPF: pass (google.com: domain of Hanna83@absolutenow.com designates 78.174.69.184 as permitted sender) client-ip=78.174.69.184; DomainKey-Status: good (test mode) Authentication-Results: mx.google.com; spf=pass (google.com: domain of Hanna83@absolutenow.com designates 78.174.69.184 as permitted sender) smtp.mail=Hanna83@absolutenow.com; domainkeys=pass (test mode) header.From=Hanna83@absolutenow.com Received: from [68.142.148.215] by n21.bullet.mail.mud.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [76.13.11.20] by t2.bullet.mud.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [76.13.11.156] by t0.bullet.mail.ac2.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 Received: from [78.174.69.184] by omp124.mail.ac3.yahoo.com with NNFMP; Mon, 08 Sep 2008 07:51:33 -0500 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 740663.40105.bm@omp463.mail.ac5.yahoo.com Received: (qmail 6584 invoked by uid 60001); Mon, 08 Sep 2008 07:51:33 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=ihWzks80rHLG2ivVUaQPEXNLo4wgqDhrcm6Rkszt1xmi5378J9BYUgeq89p536hb8rJbwPm2qbi1buQG7xoX/x/SARs9U230cGGsMiUdcluKkVSO/IotEBEllWLaNHxwovoFIqpc15SGZJWPXxoN8LTbePt1nfIHxiIWaSPxPEI=; X-YMail-OSG: YtddQHAVM1k9YpfA3KLhDQewHq.RJqx18aZqsveLtPdrMk.QMS.wQ3di48gZXCttVcg-- Received: from [78.174.69.184] by web56974.mail.sp1.yahoo.com via HTTP; Mon, 08 Sep 2008 07:51:33 -0500 PDT X-Mailer: YahooMailRC/2462.21 YahooMailWebService/0.0.961.4 Date: Mon, 08 Sep 2008 07:51:33 -0500 (PDT) From: Marlene Pittman Subject: Don't settle for less To: To: 24900@bugs.debian.org Cc: 24950@bugs.debian.org, 32579@bugs.debian.org, 35358@bugs.debian.org, 35358-forwarded@bugs.debian.org, 37050@bugs.debian.org, 41685@bugs.debian.org, 42158@bugs.debian.org, 51909@bugs.debian.org, 51909-forwarded@bugs.debian.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1761366887-1219460752=:76606" Message-ID: <957395.77559.qm@web60541.mail.sp1.yahoo.com> --0-1761366887-1219460752=:76606 Content-Type: text/plain; charset=us-ascii Women like big ones, Grinning Ear to Ear. http://dbz.downmove.com?fih --0-1761366887-1219460752=:76606 Content-Type: text/html; charset=us-ascii
Seen on t.v, Gain more length.
http://www.cnn.com/health.news/enlarge?62082

--0-1761366887-1219460752=:76606--