Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 2004 22:13:56 +0800 (CST)
From:      Xin LI <delphij@frontfree.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        j@pureftpd.org
Subject:   ports/69098: [PATCH] pure-ftpd 1.0.19: Correct coredump on FreeBSD
Message-ID:  <20040715141356.816D511B22@beastie.frontfree.net>
Resent-Message-ID: <200407151420.i6FEKExO059456@freefall.freebsd.org>

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

>Number:         69098
>Category:       ports
>Synopsis:       [PATCH] pure-ftpd 1.0.19: Correct coredump on FreeBSD
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 15 14:20:14 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Xin LI
>Release:        FreeBSD 5.2-delphij i386
>Organization:
The FreeBSD Simplified Chinese Project
>Environment:
System: FreeBSD beastie.frontfree.net 5.2-delphij FreeBSD 5.2-delphij #80: Thu Jun 24 17:30:33 CST 2004 delphij@beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386

>Description:
	pure-pw no longer work when updated to pure-ftpd 1.0.19 due to a change of bsd-getopt-long.c
>How-To-Repeat:
	pure-pw useradd test -f test.db -u 500 -g 500 -d /var/tmp

	And we will get a SIGV and a core
>Fix:

	This is a hack which essentially backed out OpenBSD src/lib/libc/stdlib/getopt_long.c,v 1.15
carried in source distribution.
	Tested on FreeBSD 4.9

--- patch-pure-ftpd begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/ftp/pure-ftpd/Makefile,v
retrieving revision 1.46
diff -u -r1.46 Makefile
--- Makefile	25 Jun 2004 11:22:19 -0000	1.46
+++ Makefile	15 Jul 2004 14:09:49 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	pure-ftpd
 PORTVERSION=	1.0.19
+PORTREVISION=	1
 CATEGORIES=	ftp ipv6
 MASTER_SITES=	ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/ \
 		ftp://ftp2.fr.pureftpd.org/pub/mirrors/ftp.fr.pureftpd.org/pub/pure-ftpd/releases/ \
Index: files/patch-src_bsd-getopt_long.c
===================================================================
RCS file: /home/ncvs/ports/ftp/pure-ftpd/files/patch-src_bsd-getopt_long.c,v
retrieving revision 1.1
diff -u -r1.1 patch-src_bsd-getopt_long.c
--- files/patch-src_bsd-getopt_long.c	25 Jun 2004 11:22:19 -0000	1.1
+++ files/patch-src_bsd-getopt_long.c	15 Jul 2004 14:09:49 -0000
@@ -1,11 +1,21 @@
---- src/bsd-getopt_long.c.orig  Sun Jun 20 19:29:34 2004
-+++ src/bsd-getopt_long.c       Tue Jun 22 15:21:09 2004
-@@ -472,6 +472,8 @@
-                      *nargv[pure_optind + 1] != '-') {
-                      pure_optarg = nargv[++pure_optind];
-                  }
+--- src/bsd-getopt_long.c.orig	Mon Jun 21 01:29:56 2004
++++ src/bsd-getopt_long.c	Thu Jul 15 22:03:34 2004
+@@ -462,16 +462,8 @@
+                     fprintf(stderr, recargchar, optchar);
+                 pure_optopt = optchar;
+                 return BADARG;
+-            } else if (!(flags & FLAG_PERMUTE)) {
+-                /* 
+-                 * If permutation is disabled, we can accept an
+-                 * optional arg separated by whitespace so long
+-                 * as it does not start with a dash (-).
+-                 */
+-                 if (pure_optind + 1 < nargc && pure_optind + 1 > 0 &&
+-                     *nargv[pure_optind + 1] != '-') {
+-                     pure_optarg = nargv[++pure_optind];
+-                 }
 +            } else {
-+                    pure_optarg = nargv[pure_optind];       
++                pure_optarg = nargv[++pure_optind];
              }
          }
          pure_place = EMSG;
--- patch-pure-ftpd ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040715141356.816D511B22>