From c6a06043f720aa5206780ec272ba8feb4ad08ec5 Mon Sep 17 00:00:00 2001 From: spz Date: Sat, 19 Apr 2014 05:19:38 +0000 Subject: Pullup ticket #4380 - requested by tron net/rsync: security patch Revisions pulled up: - net/rsync/Makefile 1.93 - net/rsync/distinfo 1.39 - net/rsync/patches/patch-authenticate.c 1.1 ------------------------------------------------------------------- Module Name: pkgsrc Committed By: tron Date: Fri Apr 18 23:29:39 UTC 2014 Modified Files: pkgsrc/net/rsync: Makefile distinfo Added Files: pkgsrc/net/rsync/patches: patch-authenticate.c Log Message: Add security patch from Samba GIT repository to address remote DoS vulnerability in rsync's daemon mode (CVE-2014-2855). To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 pkgsrc/net/rsync/Makefile cvs rdiff -u -r1.38 -r1.39 pkgsrc/net/rsync/distinfo cvs rdiff -u -r0 -r1.1 pkgsrc/net/rsync/patches/patch-authenticate.c --- net/rsync/Makefile | 3 +- net/rsync/distinfo | 3 +- net/rsync/patches/patch-authenticate.c | 77 ++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 net/rsync/patches/patch-authenticate.c diff --git a/net/rsync/Makefile b/net/rsync/Makefile index 2fc4a7c03d3..fcfefb2e8e9 100644 --- a/net/rsync/Makefile +++ b/net/rsync/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.92 2014/03/11 14:34:39 jperkin Exp $ +# $NetBSD: Makefile,v 1.92.2.1 2014/04/19 05:19:38 spz Exp $ DISTNAME= rsync-3.1.0 +PKGREVISION= 1 CATEGORIES= net MASTER_SITES= http://rsync.samba.org/ftp/rsync/ \ http://rsync.samba.org/ftp/rsync/old-versions/ \ diff --git a/net/rsync/distinfo b/net/rsync/distinfo index f85f274a10f..a08b99babd0 100644 --- a/net/rsync/distinfo +++ b/net/rsync/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.38 2013/10/02 18:06:19 adam Exp $ +$NetBSD: distinfo,v 1.38.4.1 2014/04/19 05:19:38 spz Exp $ SHA1 (rsync-3.1.0.tar.gz) = eb58ab04bcb6293da76b83f58327c038b23fcba3 RMD160 (rsync-3.1.0.tar.gz) = d072ab02c31468aa72270a4cf90b5865c5139e1b Size (rsync-3.1.0.tar.gz) = 883901 bytes SHA1 (patch-ab) = 98aa07a50314e3309b48f803d6febb1138eae1f2 +SHA1 (patch-authenticate.c) = ef3d52e587053a3ee1cc4149f272bf2270319c60 diff --git a/net/rsync/patches/patch-authenticate.c b/net/rsync/patches/patch-authenticate.c new file mode 100644 index 00000000000..29411eb4b51 --- /dev/null +++ b/net/rsync/patches/patch-authenticate.c @@ -0,0 +1,77 @@ +$NetBSD: patch-authenticate.c,v 1.1.2.2 2014/04/19 05:19:38 spz Exp $ + +Close the remote DoS vulnerability reported in CVE-2014-2855. + +Patch taken from Samba GIT repository: + +https://git.samba.org/?p=rsync.git;a=commitdiff;h=0dedfbce2c1b851684ba658861fe9d620636c56a + +--- authenticate.c.orig 2013-06-09 20:11:53.000000000 +0100 ++++ authenticate.c 2014-04-19 00:26:00.000000000 +0100 +@@ -102,15 +102,16 @@ + char pass2[MAX_DIGEST_LEN*2]; + const char *fname = lp_secrets_file(module); + STRUCT_STAT st; +- int fd, ok = 1; ++ int ok = 1; + int user_len = strlen(user); + int group_len = group ? strlen(group) : 0; + char *err; ++ FILE *fh; + +- if (!fname || !*fname || (fd = open(fname, O_RDONLY)) < 0) ++ if (!fname || !*fname || (fh = fopen(fname, "r")) == NULL) + return "no secrets file"; + +- if (do_fstat(fd, &st) == -1) { ++ if (do_fstat(fileno(fh), &st) == -1) { + rsyserr(FLOG, errno, "fstat(%s)", fname); + ok = 0; + } else if (lp_strict_modes(module)) { +@@ -123,29 +124,30 @@ + } + } + if (!ok) { +- close(fd); ++ fclose(fh); + return "ignoring secrets file"; + } + + if (*user == '#') { + /* Reject attempt to match a comment. */ +- close(fd); ++ fclose(fh); + return "invalid username"; + } + + /* Try to find a line that starts with the user (or @group) name and a ':'. */ + err = "secret not found"; +- while ((user || group) && read_line_old(fd, line, sizeof line, 1)) { +- const char **ptr, *s; ++ while ((user || group) && fgets(line, sizeof line, fh) != NULL) { ++ const char **ptr, *s = strtok(line, "\n\r"); + int len; +- if (*line == '@') { ++ if (!s) ++ continue; ++ if (*s == '@') { + ptr = &group; + len = group_len; +- s = line+1; ++ s++; + } else { + ptr = &user; + len = user_len; +- s = line; + } + if (!*ptr || strncmp(s, *ptr, len) != 0 || s[len] != ':') + continue; +@@ -158,7 +160,7 @@ + *ptr = NULL; /* Don't look for name again. */ + } + +- close(fd); ++ fclose(fh); + + memset(line, 0, sizeof line); + memset(pass2, 0, sizeof pass2); -- cgit v1.2.3