From stephen@wilberforce.math.missouri.edu  Tue Jul  5 01:13:23 2011
Return-Path: <stephen@wilberforce.math.missouri.edu>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D12F71065670
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Jul 2011 01:13:23 +0000 (UTC)
	(envelope-from stephen@wilberforce.math.missouri.edu)
Received: from wilberforce.math.missouri.edu (wilberforce.math.missouri.edu [128.206.184.213])
	by mx1.freebsd.org (Postfix) with ESMTP id 9BE668FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Jul 2011 01:13:23 +0000 (UTC)
Received: from wilberforce.math.missouri.edu (localhost [127.0.0.1])
	by wilberforce.math.missouri.edu (8.14.4/8.14.4) with ESMTP id p651DM0Q092846
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 4 Jul 2011 20:13:22 -0500 (CDT)
	(envelope-from stephen@wilberforce.math.missouri.edu)
Received: (from stephen@localhost)
	by wilberforce.math.missouri.edu (8.14.4/8.14.4/Submit) id p651DMfQ092845;
	Mon, 4 Jul 2011 20:13:22 -0500 (CDT)
	(envelope-from stephen)
Message-Id: <201107050113.p651DMfQ092845@wilberforce.math.missouri.edu>
Date: Mon, 4 Jul 2011 20:13:22 -0500 (CDT)
From: Stephen Montgomery-Smith <stephen@freebsd.org>
Reply-To: Stephen Montgomery-Smith <stephen@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: .csup/auth isn't read if the server name is not all lowercase.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         158652
>Category:       bin
>Synopsis:       [patch] csup(1): .csup/auth isn't read if the server name is not all lowercase.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brueffer
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 05 01:20:09 UTC 2011
>Closed-Date:    Sun Jan 29 15:42:39 UTC 2012
>Last-Modified:  Sun Jan 29 15:42:39 UTC 2012
>Originator:     Stephen Montgomery-Smith
>Release:        FreeBSD 8.2-STABLE i386
>Organization:
>Environment:
FreeBSD Current

	
>Description:
If you have something like "FreeBSD" in your .csup/auth file, then csup will claim that your auth file is faulty:

Parsing supfile "/usr/home/library/ctm/FreeBSD/CVSup_file"
Connecting to xxxxxxxx.freebsd.org
Cannot connect to ::::: Protocol not supported
Connected to ??.??.??.??
Server software version: SNAP_16_1h
MD5 authentication started
Unknown server "xxxxxxxx.freebsd.org". Fix your /home/library/.csup/auth

>How-To-Repeat:
	
>Fix:

	

--- csup/auth.c-old	2011-07-04 19:06:40.000000000 -0500
+++ csup/auth.c	2011-07-04 19:07:46.000000000 -0500
@@ -192,7 +192,7 @@
 			goto close;
 		}
 		/* Skip the rest of this line, it isn't what we are looking for. */
-		if (strcmp(auth->server, server) != 0)
+		if (strcasecmp(auth->server, server) != 0)
 			continue;
 		error = auth_parsetoken(&line, auth->client,
 		    sizeof(auth->client));

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: brueffer 
State-Changed-When: Tue Sep 13 22:35:43 CEST 2011 
State-Changed-Why:  
Committed, thanks! 


Responsible-Changed-From-To: freebsd-bugs->brueffer 
Responsible-Changed-By: brueffer 
Responsible-Changed-When: Tue Sep 13 22:35:43 CEST 2011 
Responsible-Changed-Why:  
MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158652 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/158652: commit references a PR
Date: Tue, 13 Sep 2011 20:33:42 +0000 (UTC)

 Author: brueffer
 Date: Tue Sep 13 20:33:27 2011
 New Revision: 225535
 URL: http://svn.freebsd.org/changeset/base/225535
 
 Log:
   Fix csup to allow case insensitive server names in the auth file,
   just as advertised in the manpage.
   
   PR:		158652
   Submitted by:	stephen
   Approved by:	re (kib)
   MFC after:	1 week
 
 Modified:
   head/usr.bin/csup/auth.c
 
 Modified: head/usr.bin/csup/auth.c
 ==============================================================================
 --- head/usr.bin/csup/auth.c	Tue Sep 13 20:16:11 2011	(r225534)
 +++ head/usr.bin/csup/auth.c	Tue Sep 13 20:33:27 2011	(r225535)
 @@ -192,7 +192,7 @@ auth_lookuprecord(char *server, struct s
  			goto close;
  		}
  		/* Skip the rest of this line, it isn't what we are looking for. */
 -		if (strcmp(auth->server, server) != 0)
 +		if (strcasecmp(auth->server, server) != 0)
  			continue;
  		error = auth_parsetoken(&line, auth->client,
  		    sizeof(auth->client));
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/158652: commit references a PR
Date: Sun, 29 Jan 2012 14:55:48 +0000 (UTC)

 Author: marius
 Date: Sun Jan 29 14:55:38 2012
 New Revision: 230744
 URL: http://svn.freebsd.org/changeset/base/230744
 
 Log:
   o MFC: r204556, r204628
   
     Move csup away from contrib/ and into usr.bin/. Software is no longer
     contributed, and main development is happening in the FreeBSD repo.
   
   o MFC: r204558
   
     Unmark authentication support as a TODO item.
   
   o MFC: r204629
   
     Remove unused include path.
   
   o MFC: r204639
   
     Include CURDIR in case the makefile is not run from the same directory.
   
   o MFC: r204664
   
     Fix spelling.
   
   o MFC: r206621
   
     Add and expand $FreeBSD$ keyword to allow committing to this file.
   
   o MFC: r206622 (partial)
   
     mdoc: order prologue macros consistently by Dd/Dt/Os
   
     Although groff_mdoc(7) gives another impression, this is the ordering
     most widely used and also required by mdocml/mandoc.
   
   o MFC: r208291 (partial)
   
     mdoc: consistently spell our email addresses <foo@FreeBSD.org>
   
   o MFC: r210874
   
     Don't point users at the old csup homepage.
   
   o MFC: r213300
   
     If an RCS file is truncated, rcsfile_getdelta() will return NULL.  Instead
     of faulting, check for NULL.  However, returning an error would cause csup
     to just abort the entire update.  Instead, break out of the loop and
     return ok.  The attempts to update the file will trigger a MD5 failure which
     will cause csup to download the entire file as a fixup.
   
   o MFC: r213573 (partial)
   
     mdoc: drop redundant .Pp and .LP calls
   
     They have no effect when coming in pairs, or before .Bl/.Bd
   
   o MFC: r216370 (partial)
   
     Remove the advertising clause from UCB copyrighted files in usr.bin.  This
     is in accordance with the information provided at
     ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
   
     Also add $FreeBSD$ to a few files to keep svn happy.
   
   o MFC: r216542
   
     Signal that data should not be modified.
   
   o MFC: r217858
   
     Remove dead code.
   
   o MFC: r225535
   
     Fix csup to allow case insensitive server names in the auth file,
     just as advertised in the manpage.
   
     PR:	158652
   
   o MFC: r225536
   
     Fix typos in error messages.
   
   o MFC: r225979
   
     Update the comment to reflect what is actually going on.
   
   o MFC: r225980
   
     Handle the situation where fixups_close() has been called but more fixups
     are still available on the queue.
   
   o MFC: r228625
   
     In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
     shared secret, and use long long format to snprintf a time_t.
   
   o MFC: r228626
   
     In usr.bin/csup/proto.c, use the correct printf length modifier to print
     an off_t.
   
   o MFC: r228667
   
     In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the
     corresponding printf length modifier.
   
   o MFC: r228857
   
     On FreeBSD just use the MD5 implementation of libmd rather than that of
     libcrypto so we don't need to relinquish csup when world is built without
     OpenSSL.
 
 Added:
   stable/8/usr.bin/csup/README
      - copied unchanged from r204556, head/usr.bin/csup/README
   stable/8/usr.bin/csup/TODO
      - copied, changed from r204556, head/usr.bin/csup/TODO
   stable/8/usr.bin/csup/attrstack.c
      - copied unchanged from r204556, head/usr.bin/csup/attrstack.c
   stable/8/usr.bin/csup/attrstack.h
      - copied unchanged from r204556, head/usr.bin/csup/attrstack.h
   stable/8/usr.bin/csup/auth.c
      - copied, changed from r204556, head/usr.bin/csup/auth.c
   stable/8/usr.bin/csup/auth.h
      - copied unchanged from r204556, head/usr.bin/csup/auth.h
   stable/8/usr.bin/csup/config.c
      - copied unchanged from r204556, head/usr.bin/csup/config.c
   stable/8/usr.bin/csup/config.h
      - copied unchanged from r204556, head/usr.bin/csup/config.h
   stable/8/usr.bin/csup/cpasswd.1   (contents, props changed)
      - copied, changed from r204556, head/usr.bin/csup/cpasswd.1
   stable/8/usr.bin/csup/cpasswd.sh
      - copied unchanged from r204556, head/usr.bin/csup/cpasswd.sh
   stable/8/usr.bin/csup/csup.1
      - copied, changed from r204556, head/usr.bin/csup/csup.1
   stable/8/usr.bin/csup/detailer.c
      - copied unchanged from r204556, head/usr.bin/csup/detailer.c
   stable/8/usr.bin/csup/detailer.h
      - copied unchanged from r204556, head/usr.bin/csup/detailer.h
   stable/8/usr.bin/csup/diff.c
      - copied unchanged from r204556, head/usr.bin/csup/diff.c
   stable/8/usr.bin/csup/diff.h
      - copied unchanged from r204556, head/usr.bin/csup/diff.h
   stable/8/usr.bin/csup/fattr.c
      - copied unchanged from r204556, head/usr.bin/csup/fattr.c
   stable/8/usr.bin/csup/fattr.h
      - copied unchanged from r204556, head/usr.bin/csup/fattr.h
   stable/8/usr.bin/csup/fattr_bsd.h
      - copied unchanged from r204556, head/usr.bin/csup/fattr_bsd.h
   stable/8/usr.bin/csup/fattr_posix.h
      - copied unchanged from r204556, head/usr.bin/csup/fattr_posix.h
   stable/8/usr.bin/csup/fixups.c
      - copied, changed from r204556, head/usr.bin/csup/fixups.c
   stable/8/usr.bin/csup/fixups.h
      - copied unchanged from r204556, head/usr.bin/csup/fixups.h
   stable/8/usr.bin/csup/fnmatch.c
      - copied, changed from r204556, head/usr.bin/csup/fnmatch.c
   stable/8/usr.bin/csup/fnmatch.h
      - copied, changed from r204556, head/usr.bin/csup/fnmatch.h
   stable/8/usr.bin/csup/globtree.c
      - copied unchanged from r204556, head/usr.bin/csup/globtree.c
   stable/8/usr.bin/csup/globtree.h
      - copied unchanged from r204556, head/usr.bin/csup/globtree.h
   stable/8/usr.bin/csup/idcache.c
      - copied unchanged from r204556, head/usr.bin/csup/idcache.c
   stable/8/usr.bin/csup/idcache.h
      - copied unchanged from r204556, head/usr.bin/csup/idcache.h
   stable/8/usr.bin/csup/keyword.c
      - copied unchanged from r204556, head/usr.bin/csup/keyword.c
   stable/8/usr.bin/csup/keyword.h
      - copied unchanged from r204556, head/usr.bin/csup/keyword.h
   stable/8/usr.bin/csup/lex.rcs.c
      - copied unchanged from r204556, head/usr.bin/csup/lex.rcs.c
   stable/8/usr.bin/csup/lister.c
      - copied unchanged from r204556, head/usr.bin/csup/lister.c
   stable/8/usr.bin/csup/lister.h
      - copied unchanged from r204556, head/usr.bin/csup/lister.h
   stable/8/usr.bin/csup/main.c
      - copied, changed from r204556, head/usr.bin/csup/main.c
   stable/8/usr.bin/csup/main.h
      - copied unchanged from r204556, head/usr.bin/csup/main.h
   stable/8/usr.bin/csup/misc.c
      - copied, changed from r204556, head/usr.bin/csup/misc.c
   stable/8/usr.bin/csup/misc.h
      - copied, changed from r204556, head/usr.bin/csup/misc.h
   stable/8/usr.bin/csup/mux.c
      - copied unchanged from r204556, head/usr.bin/csup/mux.c
   stable/8/usr.bin/csup/mux.h
      - copied unchanged from r204556, head/usr.bin/csup/mux.h
   stable/8/usr.bin/csup/parse.y
      - copied unchanged from r204556, head/usr.bin/csup/parse.y
   stable/8/usr.bin/csup/pathcomp.c
      - copied unchanged from r204556, head/usr.bin/csup/pathcomp.c
   stable/8/usr.bin/csup/pathcomp.h
      - copied unchanged from r204556, head/usr.bin/csup/pathcomp.h
   stable/8/usr.bin/csup/proto.c
      - copied, changed from r204556, head/usr.bin/csup/proto.c
   stable/8/usr.bin/csup/proto.h
      - copied unchanged from r204556, head/usr.bin/csup/proto.h
   stable/8/usr.bin/csup/queue.h
      - copied unchanged from r204556, head/usr.bin/csup/queue.h
   stable/8/usr.bin/csup/rcsfile.c
      - copied, changed from r204556, head/usr.bin/csup/rcsfile.c
   stable/8/usr.bin/csup/rcsfile.h
      - copied, changed from r204556, head/usr.bin/csup/rcsfile.h
   stable/8/usr.bin/csup/rcsparse.c
      - copied, changed from r204556, head/usr.bin/csup/rcsparse.c
   stable/8/usr.bin/csup/rcsparse.h
      - copied unchanged from r204556, head/usr.bin/csup/rcsparse.h
   stable/8/usr.bin/csup/rcstokenizer.h
      - copied unchanged from r204556, head/usr.bin/csup/rcstokenizer.h
   stable/8/usr.bin/csup/rcstokenizer.l
      - copied unchanged from r204556, head/usr.bin/csup/rcstokenizer.l
   stable/8/usr.bin/csup/rsyncfile.c
      - copied unchanged from r204556, head/usr.bin/csup/rsyncfile.c
   stable/8/usr.bin/csup/rsyncfile.h
      - copied unchanged from r204556, head/usr.bin/csup/rsyncfile.h
   stable/8/usr.bin/csup/status.c
      - copied unchanged from r204556, head/usr.bin/csup/status.c
   stable/8/usr.bin/csup/status.h
      - copied unchanged from r204556, head/usr.bin/csup/status.h
   stable/8/usr.bin/csup/stream.c
      - copied unchanged from r204556, head/usr.bin/csup/stream.c
   stable/8/usr.bin/csup/stream.h
      - copied unchanged from r204556, head/usr.bin/csup/stream.h
   stable/8/usr.bin/csup/threads.c
      - copied unchanged from r204556, head/usr.bin/csup/threads.c
   stable/8/usr.bin/csup/threads.h
      - copied unchanged from r204556, head/usr.bin/csup/threads.h
   stable/8/usr.bin/csup/token.h
      - copied unchanged from r204556, head/usr.bin/csup/token.h
   stable/8/usr.bin/csup/token.l
      - copied unchanged from r204556, head/usr.bin/csup/token.l
   stable/8/usr.bin/csup/updater.c
      - copied, changed from r204556, head/usr.bin/csup/updater.c
   stable/8/usr.bin/csup/updater.h
      - copied unchanged from r204556, head/usr.bin/csup/updater.h
 Modified:
   stable/8/usr.bin/Makefile
   stable/8/usr.bin/csup/Makefile
 Directory Properties:
   stable/8/usr.bin/   (props changed)
   stable/8/usr.bin/apply/   (props changed)
   stable/8/usr.bin/ar/   (props changed)
   stable/8/usr.bin/awk/   (props changed)
   stable/8/usr.bin/biff/   (props changed)
   stable/8/usr.bin/c89/   (props changed)
   stable/8/usr.bin/c99/   (props changed)
   stable/8/usr.bin/calendar/   (props changed)
   stable/8/usr.bin/catman/   (props changed)
   stable/8/usr.bin/checknr/   (props changed)
   stable/8/usr.bin/chpass/Makefile   (props changed)
   stable/8/usr.bin/column/   (props changed)
   stable/8/usr.bin/comm/   (props changed)
   stable/8/usr.bin/compress/   (props changed)
   stable/8/usr.bin/cpio/   (props changed)
   stable/8/usr.bin/cpuset/   (props changed)
   stable/8/usr.bin/csup/   (props changed)
   stable/8/usr.bin/du/   (props changed)
   stable/8/usr.bin/ee/   (props changed)
   stable/8/usr.bin/enigma/   (props changed)
   stable/8/usr.bin/fetch/   (props changed)
   stable/8/usr.bin/find/   (props changed)
   stable/8/usr.bin/finger/   (props changed)
   stable/8/usr.bin/fold/   (props changed)
   stable/8/usr.bin/fstat/   (props changed)
   stable/8/usr.bin/gcore/   (props changed)
   stable/8/usr.bin/getopt/   (props changed)
   stable/8/usr.bin/gzip/   (props changed)
   stable/8/usr.bin/hexdump/   (props changed)
   stable/8/usr.bin/indent/   (props changed)
   stable/8/usr.bin/ipcs/   (props changed)
   stable/8/usr.bin/jot/   (props changed)
   stable/8/usr.bin/kdump/   (props changed)
   stable/8/usr.bin/killall/   (props changed)
   stable/8/usr.bin/ktrace/   (props changed)
   stable/8/usr.bin/lastcomm/   (props changed)
   stable/8/usr.bin/ldd/   (props changed)
   stable/8/usr.bin/less/   (props changed)
   stable/8/usr.bin/lex/   (props changed)
   stable/8/usr.bin/limits/   (props changed)
   stable/8/usr.bin/locale/   (props changed)
   stable/8/usr.bin/locate/   (props changed)
   stable/8/usr.bin/lock/   (props changed)
   stable/8/usr.bin/lockf/   (props changed)
   stable/8/usr.bin/logger/   (props changed)
   stable/8/usr.bin/look/   (props changed)
   stable/8/usr.bin/m4/   (props changed)
   stable/8/usr.bin/mail/   (props changed)
   stable/8/usr.bin/make/   (props changed)
   stable/8/usr.bin/makewhatis/   (props changed)
   stable/8/usr.bin/minigzip/   (props changed)
   stable/8/usr.bin/ncal/   (props changed)
   stable/8/usr.bin/netstat/   (props changed)
   stable/8/usr.bin/nfsstat/   (props changed)
   stable/8/usr.bin/pathchk/   (props changed)
   stable/8/usr.bin/perror/   (props changed)
   stable/8/usr.bin/printf/   (props changed)
   stable/8/usr.bin/procstat/   (props changed)
   stable/8/usr.bin/rlogin/   (props changed)
   stable/8/usr.bin/rpcgen/   (props changed)
   stable/8/usr.bin/rpcinfo/   (props changed)
   stable/8/usr.bin/rs/   (props changed)
   stable/8/usr.bin/ruptime/   (props changed)
   stable/8/usr.bin/script/   (props changed)
   stable/8/usr.bin/sed/   (props changed)
   stable/8/usr.bin/showmount/   (props changed)
   stable/8/usr.bin/sockstat/   (props changed)
   stable/8/usr.bin/split/   (props changed)
   stable/8/usr.bin/stat/   (props changed)
   stable/8/usr.bin/su/   (props changed)
   stable/8/usr.bin/systat/   (props changed)
   stable/8/usr.bin/tail/   (props changed)
   stable/8/usr.bin/tar/   (props changed)
   stable/8/usr.bin/tftp/   (props changed)
   stable/8/usr.bin/tip/   (props changed)
   stable/8/usr.bin/top/   (props changed)
   stable/8/usr.bin/touch/   (props changed)
   stable/8/usr.bin/tr/   (props changed)
   stable/8/usr.bin/truss/   (props changed)
   stable/8/usr.bin/uname/   (props changed)
   stable/8/usr.bin/unifdef/   (props changed)
   stable/8/usr.bin/uniq/   (props changed)
   stable/8/usr.bin/unzip/   (props changed)
   stable/8/usr.bin/usbhidaction/   (props changed)
   stable/8/usr.bin/usbhidctl/   (props changed)
   stable/8/usr.bin/uudecode/   (props changed)
   stable/8/usr.bin/vmstat/   (props changed)
   stable/8/usr.bin/w/   (props changed)
   stable/8/usr.bin/wall/   (props changed)
   stable/8/usr.bin/whois/   (props changed)
   stable/8/usr.bin/xargs/   (props changed)
   stable/8/usr.bin/xinstall/   (props changed)
   stable/8/usr.bin/xlint/   (props changed)
   stable/8/usr.bin/xz/   (props changed)
   stable/8/usr.bin/yacc/   (props changed)
 
 Modified: stable/8/usr.bin/Makefile
 ==============================================================================
 --- stable/8/usr.bin/Makefile	Sun Jan 29 14:55:20 2012	(r230743)
 +++ stable/8/usr.bin/Makefile	Sun Jan 29 14:55:38 2012	(r230744)
 @@ -281,10 +281,11 @@ _hesinfo=	hesinfo
  .if ${MK_OPENSSL} != "no"
  _chkey=		chkey
  _newkey=	newkey
 +.endif
 +
  .if ${MK_LIBTHR} != "no"
  _csup=		csup
  .endif
 -.endif
  
  .if ${MK_LOCATE} != "no"
  _locate=	locate
 
 Modified: stable/8/usr.bin/csup/Makefile
 ==============================================================================
 --- stable/8/usr.bin/csup/Makefile	Sun Jan 29 14:55:20 2012	(r230743)
 +++ stable/8/usr.bin/csup/Makefile	Sun Jan 29 14:55:38 2012	(r230744)
 @@ -1,9 +1,8 @@
  # $FreeBSD$
  
 -.PATH: ${.CURDIR}/../../contrib/csup
 -
  PROG=	csup
  SRCS=	attrstack.c \
 +	auth.c \
  	config.c \
  	detailer.c \
  	diff.c \
 @@ -30,11 +29,14 @@ SRCS=	attrstack.c \
  	token.l \
  	updater.c
  
 -CFLAGS+= -I. -I${.CURDIR}/../../contrib/csup
 +CFLAGS+= -I. -I${.CURDIR}
  CFLAGS+= -DHAVE_FFLAGS -DNDEBUG
  WARNS?=	1
  
 -DPADD=	${LIBCRYPTO} ${LIBZ} ${LIBPTHREAD}
 -LDADD=	-lcrypto -lz -lpthread
 +DPADD=	${LIBMD} ${LIBZ} ${LIBPTHREAD}
 +LDADD=	-lmd -lz -lpthread
 +
 +SCRIPTS=	cpasswd.sh
 +MAN=		csup.1 cpasswd.1
  
  .include <bsd.prog.mk>
 
 Copied: stable/8/usr.bin/csup/README (from r204556, head/usr.bin/csup/README)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/README	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/README)
 @@ -0,0 +1,39 @@
 +$FreeBSD$
 +
 +Authors
 +-------
 +
 +CVSup was originally written in Modula-3 by
 +	John Polstra <jdp@polstra.com>.
 +
 +Csup is a rewrite of CVSup in C.  It has been mostly written by
 +	Maxime Henrion <mux@FreeBSD.org>.
 +
 +A few contributors have helped him in his task and they are listed here in
 +alphabetical order :
 +
 +	Olivier Houchard <cognet@FreeBSD.org>
 +	Ulf Lilleengen <lulf@kerneled.org>
 +	Christoph Mathys <cmathys@bluewin.ch>	(Google SoC Project)
 +	Etienne Vidal <etienne.vidal@gmail.com>
 +
 +
 +Building & Installing
 +---------------------
 +
 +Csup should build and run fine under any *BSD OS (that includes FreeBSD,
 +NetBSD, OpenBSD and DragonFlyBSD), as well as Linux and Darwin.  If you
 +have a problem building from source, drop me a mail!
 +
 +There is one Makefile specifically tailored for *BSD systems named
 +Makefile and another one that is gmake-specific for Darwin and Linux
 +users named GNUmakefile.  You don't really need to worry about that
 +since whatever your "make" command is, it should pick up the correct
 +Makefile.
 +
 +As usual, to build the source code, just run "make".  Once this is done,
 +just run "make install" to install the binary and manual page.
 +
 +Be warned however that if the packaging system of your OS knows about
 +csup, it is certainly better to install it from there rather than by
 +hand, so that it can then be properly deinstalled.
 
 Copied and modified: stable/8/usr.bin/csup/TODO (from r204556, head/usr.bin/csup/TODO)
 ==============================================================================
 --- head/usr.bin/csup/TODO	Tue Mar  2 07:26:07 2010	(r204556, copy source)
 +++ stable/8/usr.bin/csup/TODO	Sun Jan 29 14:55:38 2012	(r230744)
 @@ -18,9 +18,8 @@ BUGS:
  MISSING FEATURES:
  
  - Add support for shell commands sent by the server.
 -- Add missing support for various CVSup options : -D, -a (requires
 -  authentication support), -e and -E (requires shell commands support)
 -  and the destDir parameter.
 +- Add missing support for various CVSup options : -D, -e and -E (requires
 +  shell commands support) and the destDir parameter.
  - For now, this code should build fine on FreeBSD, NetBSD, OpenBSD,
    Linux and Darwin.  Solaris support would also be nice at some point.
  - Implement some new useful options : the ability to generate CVS
 
 Copied: stable/8/usr.bin/csup/attrstack.c (from r204556, head/usr.bin/csup/attrstack.c)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/attrstack.c	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/attrstack.c)
 @@ -0,0 +1,90 @@
 +/*-
 + * Copyright (c) 2006, Maxime Henrion <mux@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $Id$
 + */
 +
 +#include <assert.h>
 +#include <stdlib.h>
 +
 +#include "attrstack.h"
 +#include "fattr.h"
 +#include "misc.h"
 +
 +#define	ATTRSTACK_DEFSIZE	16	/* Initial size of the stack. */
 +
 +struct attrstack {
 +	struct fattr **stack;
 +	size_t cur;
 +	size_t size;
 +};
 +
 +struct attrstack *
 +attrstack_new(void)
 +{
 +	struct attrstack *as;
 +
 +	as = xmalloc(sizeof(struct attrstack));
 +	as->stack = xmalloc(sizeof(struct fattr *) * ATTRSTACK_DEFSIZE);
 +	as->size = ATTRSTACK_DEFSIZE;
 +	as->cur = 0;
 +	return (as);
 +}
 +
 +struct fattr *
 +attrstack_pop(struct attrstack *as)
 +{
 +
 +	assert(as->cur > 0);
 +	return (as->stack[--as->cur]);
 +}
 +
 +void
 +attrstack_push(struct attrstack *as, struct fattr *fa)
 +{
 +
 +	if (as->cur >= as->size) {
 +		as->size *= 2;
 +		as->stack = xrealloc(as->stack,
 +		    sizeof(struct fattr *) * as->size);
 +	}
 +	as->stack[as->cur++] = fa;
 +}
 +
 +size_t
 +attrstack_size(struct attrstack *as)
 +{
 +
 +	return (as->cur);
 +}
 +
 +void
 +attrstack_free(struct attrstack *as)
 +{
 +
 +	assert(as->cur == 0);
 +	free(as->stack);
 +	free(as);
 +}
 
 Copied: stable/8/usr.bin/csup/attrstack.h (from r204556, head/usr.bin/csup/attrstack.h)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/attrstack.h	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/attrstack.h)
 @@ -0,0 +1,40 @@
 +/*-
 + * Copyright (c) 2006, Maxime Henrion <mux@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $Id$
 + */
 +#ifndef _ATTRSTACK_H_
 +#define _ATTRSTACK_H_
 +
 +struct fattr;
 +struct attrstack;
 +
 +struct attrstack	*attrstack_new(void);
 +void			 attrstack_push(struct attrstack *, struct fattr *);
 +struct fattr		*attrstack_pop(struct attrstack *);
 +size_t			 attrstack_size(struct attrstack *);
 +void			 attrstack_free(struct attrstack *);
 +
 +#endif /* !_ATTRSTACK_H_ */
 
 Copied and modified: stable/8/usr.bin/csup/auth.c (from r204556, head/usr.bin/csup/auth.c)
 ==============================================================================
 --- head/usr.bin/csup/auth.c	Tue Mar  2 07:26:07 2010	(r204556, copy source)
 +++ stable/8/usr.bin/csup/auth.c	Sun Jan 29 14:55:38 2012	(r230744)
 @@ -35,7 +35,6 @@
  #include <netinet/in.h>
  
  #include <ctype.h>
 -#include <openssl/md5.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 @@ -147,7 +146,7 @@ auth_domd5auth(struct config *config)
  			lprintf(-1, "Server failed to authenticate itself to client\n");
  			return (STATUS_FAILURE);
  		}
 -		lprintf(2, "MD5 authentication successfull\n");
 +		lprintf(2, "MD5 authentication successful\n");
  		return (STATUS_SUCCESS);
  	}
  	if (strcmp(cmd, "!") == 0) {
 @@ -188,22 +187,22 @@ auth_lookuprecord(char *server, struct s
  		error = auth_parsetoken(&line, auth->server,
  		    sizeof(auth->server));
  		if (error != STATUS_SUCCESS) {
 -			lprintf(-1, "%s:%d Missng client name\n", authfile, linenum);
 +			lprintf(-1, "%s:%d Missing client name\n", authfile, linenum);
  			goto close;
  		}
  		/* Skip the rest of this line, it isn't what we are looking for. */
 -		if (strcmp(auth->server, server) != 0)
 +		if (strcasecmp(auth->server, server) != 0)
  			continue;
  		error = auth_parsetoken(&line, auth->client,
  		    sizeof(auth->client));
  		if (error != STATUS_SUCCESS) {
 -			lprintf(-1, "%s:%d Missng password\n", authfile, linenum);
 +			lprintf(-1, "%s:%d Missing password\n", authfile, linenum);
  			goto close;
  		}
  		error = auth_parsetoken(&line, auth->password,
  		    sizeof(auth->password));
  		if (error != STATUS_SUCCESS) {
 -			lprintf(-1, "%s:%d Missng comment\n", authfile, linenum);
 +			lprintf(-1, "%s:%d Missing comment\n", authfile, linenum);
  			goto close;
  		}
  		stream_close(s);
 @@ -254,7 +253,7 @@ auth_makesecret(struct srvrecord *auth, 
  	MD5_Update(&md5, ":", 1);
  	MD5_Update(&md5, auth->password, strlen(auth->password));
  	MD5_Final(md5sum, &md5);
 -	memset(secret, 0, sizeof(secret));
 +	memset(secret, 0, MD5_CHARS_MAX);
  	strcpy(secret, md5salt);
  	auth_readablesum(md5sum, secret + strlen(md5salt));
  }
 @@ -302,8 +301,9 @@ auth_makechallenge(struct config *config
  	}
  	gettimeofday(&tv, NULL);
  	MD5_Init(&md5);
 -	snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d",
 -	    inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid);
 +	snprintf(buf, sizeof(buf), "%s:%jd:%ld:%ld:%d:%d",
 +	    inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec,
 +	    random(), pid, ppid);
  	MD5_Update(&md5, buf, strlen(buf));
  	MD5_Final(md5sum, &md5);
  	auth_readablesum(md5sum, challenge);
 
 Copied: stable/8/usr.bin/csup/auth.h (from r204556, head/usr.bin/csup/auth.h)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/auth.h	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/auth.h)
 @@ -0,0 +1,38 @@
 +/*-
 + * Copyright (c) 2003-2007, Petar Zhivkov Petrov <pesho.petrov@gmail.com>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $FreeBSD$
 + */
 +#ifndef _AUTH_H_
 +#define _AUTH_H_
 +
 +#define	AUTHFILE	".csup/auth" /* user home relative */
 +
 +struct config;
 +
 +int auth_login(struct config *);
 +
 +#endif /* !_AUTH_H_ */
 +
 
 Copied: stable/8/usr.bin/csup/config.c (from r204556, head/usr.bin/csup/config.c)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/config.c	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/config.c)
 @@ -0,0 +1,579 @@
 +/*-
 + * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $FreeBSD$
 + */
 +
 +#include <sys/types.h>
 +#include <sys/stat.h>
 +
 +#include <errno.h>
 +#include <fcntl.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>
 +#include <unistd.h>
 +
 +#include "config.h"
 +#include "globtree.h"
 +#include "keyword.h"
 +#include "misc.h"
 +#include "parse.h"
 +#include "stream.h"
 +#include "token.h"
 +
 +static int		 config_parse_refusefiles(struct coll *);
 +static int		 config_parse_refusefile(struct coll *, char *);
 +
 +extern FILE *yyin;
 +
 +/* These are globals because I can't think of a better way with yacc. */
 +static STAILQ_HEAD(, coll) colls;
 +static struct coll *cur_coll;
 +static struct coll *defaults;
 +static struct coll *ovcoll;
 +static int ovmask;
 +static const char *cfgfile;
 +
 +/*
 + * Extract all the configuration information from the config
 + * file and some command line parameters.
 + */
 +struct config *
 +config_init(const char *file, struct coll *override, int overridemask)
 +{
 +	struct config *config;
 +	struct coll *coll;
 +	size_t slen;
 +	char *prefix;
 +	int error;
 +	mode_t mask;
 +
 +	config = xmalloc(sizeof(struct config));
 +	memset(config, 0, sizeof(struct config));
 +	STAILQ_INIT(&colls);
 +
 +	defaults = coll_new(NULL);
 +	/* Set the default umask. */
 +	mask = umask(0);
 +	umask(mask);
 +	defaults->co_umask = mask;
 +	ovcoll = override;
 +	ovmask = overridemask;
 +
 +	/* Extract a list of collections from the configuration file. */
 +	cur_coll = coll_new(defaults);
 +	yyin = fopen(file, "r");
 +	if (yyin == NULL) {
 +		lprintf(-1, "Cannot open \"%s\": %s\n", file, strerror(errno));
 +		goto bad;
 +	}
 +	cfgfile = file;
 +	error = yyparse();
 +	fclose(yyin);
 +	if (error)
 +		goto bad;
 +
 +	memcpy(&config->colls, &colls, sizeof(colls));
 +	if (STAILQ_EMPTY(&config->colls)) {
 +		lprintf(-1, "Empty supfile\n");
 +		goto bad;
 +	}
 +
 +	/* Fixup the list of collections. */
 +	STAILQ_FOREACH(coll, &config->colls, co_next) {
 + 		if (coll->co_base == NULL)
 +			coll->co_base = xstrdup("/usr/local/etc/cvsup");
 +		if (coll->co_colldir == NULL)
 +			coll->co_colldir = "sup";
 +		if (coll->co_prefix == NULL) {
 +			coll->co_prefix = xstrdup(coll->co_base);
 +		/*
 +		 * If prefix is not an absolute pathname, it is
 +		 * interpreted relative to base.
 +		 */
 +		} else if (coll->co_prefix[0] != '/') {
 +			slen = strlen(coll->co_base);
 +			if (slen > 0 && coll->co_base[slen - 1] != '/')
 +				xasprintf(&prefix, "%s/%s", coll->co_base,
 +				    coll->co_prefix);
 +			else
 +				xasprintf(&prefix, "%s%s", coll->co_base,
 +				    coll->co_prefix);
 +			free(coll->co_prefix);
 +			coll->co_prefix = prefix;
 +		}
 +		coll->co_prefixlen = strlen(coll->co_prefix);
 +		/* Determine whether to checksum RCS files or not. */
 +		if (coll->co_options & CO_EXACTRCS)
 +			coll->co_options |= CO_CHECKRCS;
 +		else
 +			coll->co_options &= ~CO_CHECKRCS;
 +		/* In recent versions, we always try to set the file modes. */
 +		coll->co_options |= CO_SETMODE;
 +		coll->co_options |= CO_NORSYNC;
 +		error = config_parse_refusefiles(coll);
 +		if (error)
 +			goto bad;
 +	}
 +
 +	coll_free(cur_coll);
 +	coll_free(defaults);
 +	config->host = STAILQ_FIRST(&config->colls)->co_host;
 +	return (config);
 +bad:
 +	coll_free(cur_coll);
 +	coll_free(defaults);
 +	config_free(config);
 +	return (NULL);
 +}
 +
 +int
 +config_checkcolls(struct config *config)
 +{
 +	char linkname[4];
 +	struct stat sb;
 +	struct coll *coll;
 +	int error, numvalid, ret;
 +
 +	numvalid = 0;
 +	STAILQ_FOREACH(coll, &config->colls, co_next) {
 +		error = stat(coll->co_prefix, &sb);
 +		if (error || !S_ISDIR(sb.st_mode)) {
 +			/* Skip this collection, and warn about it unless its
 +			   prefix is a symbolic link pointing to "SKIP". */
 +			coll->co_options |= CO_SKIP;
 +			ret = readlink(coll->co_prefix, linkname,
 +			    sizeof(linkname));
 +			if (ret != 4 || memcmp(linkname, "SKIP", 4) != 0) {
 +				lprintf(-1,"Nonexistent prefix \"%s\" for "
 +				    "%s/%s\n", coll->co_prefix, coll->co_name,
 +				    coll->co_release);
 +			}
 +			continue;
 +		}
 +		numvalid++;
 +	}
 +	return (numvalid);
 +}
 +
 +static int
 +config_parse_refusefiles(struct coll *coll)
 +{
 +	char *collstem, *suffix, *supdir, *path;
 +	int error;
 +
 +	if (coll->co_colldir[0] == '/')
 +		supdir = xstrdup(coll->co_colldir);
 +	else
 +		xasprintf(&supdir, "%s/%s", coll->co_base, coll->co_colldir);
 +
 +	/* First, the global refuse file that applies to all collections. */
 +	xasprintf(&path, "%s/refuse", supdir);
 +	error = config_parse_refusefile(coll, path);
 +	free(path);
 +	if (error) {
 +		free(supdir);
 +		return (error);
 +	}
 +
 +	/* Next the per-collection refuse files that applies to all release/tag
 +	   combinations. */
 +	xasprintf(&collstem, "%s/%s/refuse", supdir, coll->co_name);
 +	free(supdir);
 +	error = config_parse_refusefile(coll, collstem);
 +	if (error) {
 +		free(collstem);
 +		return (error);
 +	}
 +
 +	/* Finally, the per-release and per-tag refuse file. */
 +	suffix = coll_statussuffix(coll);
 +	if (suffix != NULL) {
 +		xasprintf(&path, "%s%s", collstem, suffix);
 +		free(suffix);
 +		error = config_parse_refusefile(coll, path);
 +		free(path);
 +	}
 +	free(collstem);
 +	return (error);
 +}
 +
 +/*
 + * Parses a "refuse" file, and records the relevant information in
 + * coll->co_refusals.  If the file does not exist, it is silently
 + * ignored.
 + */
 +static int
 +config_parse_refusefile(struct coll *coll, char *path)
 +{
 +	struct stream *rd;
 +	char *cp, *line, *pat;
 +
 +	rd = stream_open_file(path, O_RDONLY);
 +	if (rd == NULL)
 +		return (0);
 +	while ((line = stream_getln(rd, NULL)) != NULL) {
 +		pat = line;
 +		for (;;) {
 +			/* Trim leading whitespace. */
 +			pat += strspn(pat, " \t");
 +			if (pat[0] == '\0')
 +				break;
 +			cp = strpbrk(pat, " \t");
 +			if (cp != NULL)
 +				*cp = '\0';
 +			pattlist_add(coll->co_refusals, pat);
 +			if (cp == NULL)
 +				break;
 +			pat = cp + 1;
 +		}
 +	}
 +	if (!stream_eof(rd)) {
 +		stream_close(rd);
 +		lprintf(-1, "Read failure from \"%s\": %s\n", path,
 +		    strerror(errno));
 +		return (-1);
 +	}
 +	stream_close(rd);
 +	return (0);
 +}
 +
 +void
 +config_free(struct config *config)
 +{
 +	struct coll *coll;
 +
 +	while (!STAILQ_EMPTY(&config->colls)) {
 +		coll = STAILQ_FIRST(&config->colls);
 +		STAILQ_REMOVE_HEAD(&config->colls, co_next);
 +		coll_free(coll);
 +	}
 +	if (config->server != NULL)
 +		stream_close(config->server);
 +	if (config->laddr != NULL)
 +		free(config->laddr);
 +	free(config);
 +}
 +
 +/* Create a new collection, inheriting options from the default collection. */
 +struct coll *
 +coll_new(struct coll *def)
 +{
 +	struct coll *new;
 +
 +	new = xmalloc(sizeof(struct coll));
 +	memset(new, 0, sizeof(struct coll));
 +	if (def != NULL) {
 +		new->co_options = def->co_options;
 +		new->co_umask = def->co_umask;
 +		if (def->co_host != NULL)
 +			new->co_host = xstrdup(def->co_host);
 +		if (def->co_base != NULL)
 +			new->co_base = xstrdup(def->co_base);
 +		if (def->co_date != NULL)
 +			new->co_date = xstrdup(def->co_date);
 +		if (def->co_prefix != NULL)
 +			new->co_prefix = xstrdup(def->co_prefix);
 +		if (def->co_release != NULL)
 +			new->co_release = xstrdup(def->co_release);
 +		if (def->co_tag != NULL)
 +			new->co_tag = xstrdup(def->co_tag);
 +		if (def->co_listsuffix != NULL)
 +			new->co_listsuffix = xstrdup(def->co_listsuffix);
 +	} else {
 +		new->co_tag = xstrdup(".");
 +		new->co_date = xstrdup(".");
 +	}
 +	new->co_keyword = keyword_new();
 +	new->co_accepts = pattlist_new();
 +	new->co_refusals = pattlist_new();
 +	new->co_attrignore = FA_DEV | FA_INODE;
 +	return (new);
 +}
 +
 +void
 +coll_override(struct coll *coll, struct coll *from, int mask)
 +{
 +	size_t i;
 +	int newoptions, oldoptions;
 +
 +	newoptions = from->co_options & mask;
 +	oldoptions = coll->co_options & (CO_MASK & ~mask);
 +
 +	if (from->co_release != NULL) {
 +		if (coll->co_release != NULL)
 +			free(coll->co_release);
 +		coll->co_release = xstrdup(from->co_release);
 +	}
 +	if (from->co_host != NULL) {
 +		if (coll->co_host != NULL)
 +			free(coll->co_host);
 +		coll->co_host = xstrdup(from->co_host);
 +	}
 +	if (from->co_base != NULL) {
 +		if (coll->co_base != NULL)
 +			free(coll->co_base);
 +		coll->co_base = xstrdup(from->co_base);
 +	}
 +	if (from->co_colldir != NULL)
 +		coll->co_colldir = from->co_colldir;
 +	if (from->co_prefix != NULL) {
 +		if (coll->co_prefix != NULL)
 +			free(coll->co_prefix);
 +		coll->co_prefix = xstrdup(from->co_prefix);
 +	}
 +	if (newoptions & CO_CHECKOUTMODE) {
 +		if (from->co_tag != NULL) {
 +			if (coll->co_tag != NULL)
 +				free(coll->co_tag);
 +			coll->co_tag = xstrdup(from->co_tag);
 +		}
 +		if (from->co_date != NULL) {
 +			if (coll->co_date != NULL)
 +				free(coll->co_date);
 +			coll->co_date = xstrdup(from->co_date);
 +		}
 +	}
 +	if (from->co_listsuffix != NULL) {
 +		if (coll->co_listsuffix != NULL)
 +			free(coll->co_listsuffix);
 +		coll->co_listsuffix = xstrdup(from->co_listsuffix);
 +	}
 +	for (i = 0; i < pattlist_size(from->co_accepts); i++) {
 +		pattlist_add(coll->co_accepts,
 +		    pattlist_get(from->co_accepts, i));
 +	}
 +	for (i = 0; i < pattlist_size(from->co_refusals); i++) {
 +		pattlist_add(coll->co_refusals,
 +		    pattlist_get(from->co_refusals, i));
 +	}
 +	coll->co_options = oldoptions | newoptions;
 +}
 +
 +char *
 +coll_statussuffix(struct coll *coll)
 +{
 +	const char *tag;
 +	char *suffix;
 +
 +	if (coll->co_listsuffix != NULL) {
 +		xasprintf(&suffix, ".%s", coll->co_listsuffix);
 +	} else if (coll->co_options & CO_USERELSUFFIX) {
 +		if (coll->co_tag == NULL)
 +			tag = ".";
 +		else
 +			tag = coll->co_tag;
 +		if (coll->co_release != NULL) {
 +			if (coll->co_options & CO_CHECKOUTMODE) {
 +				xasprintf(&suffix, ".%s:%s",
 +				    coll->co_release, tag);
 +			} else {
 +				xasprintf(&suffix, ".%s", coll->co_release);
 +			}
 +		} else if (coll->co_options & CO_CHECKOUTMODE) {
 +			xasprintf(&suffix, ":%s", tag);
 +		}
 +	} else
 +		suffix = NULL;
 +	return (suffix);
 +}
 +
 +char *
 +coll_statuspath(struct coll *coll)
 +{
 +	char *path, *suffix;
 +
 +	suffix = coll_statussuffix(coll);
 +	if (suffix != NULL) {
 +		if (coll->co_colldir[0] == '/')
 +			xasprintf(&path, "%s/%s/checkouts%s", coll->co_colldir,
 +			    coll->co_name, suffix);
 +		else
 +			xasprintf(&path, "%s/%s/%s/checkouts%s", coll->co_base,
 +			    coll->co_colldir, coll->co_name, suffix);
 +	} else {
 +		if (coll->co_colldir[0] == '/')
 +			xasprintf(&path, "%s/%s/checkouts", coll->co_colldir,
 +			    coll->co_name);
 +		else
 +			xasprintf(&path, "%s/%s/%s/checkouts", coll->co_base,
 +			    coll->co_colldir, coll->co_name);
 +	}
 +	free(suffix);
 +	return (path);
 +}
 +
 +void
 +coll_add(char *name)
 +{
 +	struct coll *coll;
 +
 +	cur_coll->co_name = name;
 +	coll_override(cur_coll, ovcoll, ovmask);
 +	if (cur_coll->co_release == NULL) {
 +		lprintf(-1, "Release not specified for collection "
 +		    "\"%s\"\n", cur_coll->co_name);
 +		exit(1);
 +	}
 +	if (cur_coll->co_host == NULL) {
 +		lprintf(-1, "Host not specified for collection "
 +		    "\"%s\"\n", cur_coll->co_name);
 +		exit(1);
 +	}
 +	if (!STAILQ_EMPTY(&colls)) {
 +		coll = STAILQ_LAST(&colls, coll, co_next);
 +		if (strcmp(coll->co_host, cur_coll->co_host) != 0) {
 +			lprintf(-1, "All \"host\" fields in the supfile "
 +			    "must be the same\n");
 +			exit(1);
 +		}
 +	}
 +	STAILQ_INSERT_TAIL(&colls, cur_coll, co_next);
 +	cur_coll = coll_new(defaults);
 +}
 +
 +void
 +coll_free(struct coll *coll)
 +{
 +
 +	if (coll == NULL)
 +		return;
 +	if (coll->co_host != NULL)
 +		free(coll->co_host);
 +	if (coll->co_base != NULL)
 +		free(coll->co_base);
 +	if (coll->co_date != NULL)
 +		free(coll->co_date);
 +	if (coll->co_prefix != NULL)
 +		free(coll->co_prefix);
 +	if (coll->co_release != NULL)
 +		free(coll->co_release);
 +	if (coll->co_tag != NULL)
 +		free(coll->co_tag);
 +	if (coll->co_cvsroot != NULL)
 +		free(coll->co_cvsroot);
 +	if (coll->co_name != NULL)
 +		free(coll->co_name);
 +	if (coll->co_listsuffix != NULL)
 +		free(coll->co_listsuffix);
 +	keyword_free(coll->co_keyword);
 +	if (coll->co_dirfilter != NULL)
 +		globtree_free(coll->co_dirfilter);
 +	if (coll->co_dirfilter != NULL)
 +		globtree_free(coll->co_filefilter);
 +	if (coll->co_norsync != NULL)
 +		globtree_free(coll->co_norsync);
 +	if (coll->co_accepts != NULL)
 +		pattlist_free(coll->co_accepts);
 +	if (coll->co_refusals != NULL)
 +		pattlist_free(coll->co_refusals);
 +	free(coll);
 +}
 +
 +void
 +coll_setopt(int opt, char *value)
 +{
 +	struct coll *coll;
 +	int error, mask;
 +
 +	coll = cur_coll;
 +	switch (opt) {
 +	case PT_HOST:
 +		if (coll->co_host != NULL)
 +			free(coll->co_host);
 +		coll->co_host = value;
 +		break;
 +	case PT_BASE:
 +		if (coll->co_base != NULL)
 +			free(coll->co_base);
 +		coll->co_base = value;
 +		break;
 +	case PT_DATE:
 +		if (coll->co_date != NULL)
 +			free(coll->co_date);
 +		coll->co_date = value;
 +		coll->co_options |= CO_CHECKOUTMODE;
 +		break;
 +	case PT_PREFIX:
 +		if (coll->co_prefix != NULL)
 +			free(coll->co_prefix);
 +		coll->co_prefix = value;
 +		break;
 +	case PT_RELEASE:
 +		if (coll->co_release != NULL)
 +			free(coll->co_release);
 +		coll->co_release = value;
 +		break;
 +	case PT_TAG:
 +		if (coll->co_tag != NULL)
 +			free(coll->co_tag);
 +		coll->co_tag = value;
 +		coll->co_options |= CO_CHECKOUTMODE;
 +		break;
 +	case PT_LIST:
 +		if (strchr(value, '/') != NULL) {
 +			lprintf(-1, "Parse error in \"%s\": \"list\" suffix "
 +			    "must not contain slashes\n", cfgfile);
 +			exit(1);
 +		}
 +		if (coll->co_listsuffix != NULL)
 +			free(coll->co_listsuffix);
 +		coll->co_listsuffix = value;
 +		break;
 +	case PT_UMASK:
 +		error = asciitoint(value, &mask, 8);
 +		free(value);
 +		if (error) {
 +			lprintf(-1, "Parse error in \"%s\": Invalid "
 +			    "umask value\n", cfgfile);
 +			exit(1);
 +		}
 +		coll->co_umask = mask;
 +		break;
 +	case PT_USE_REL_SUFFIX:
 +		coll->co_options |= CO_USERELSUFFIX;
 +		break;
 +	case PT_DELETE:
 +		coll->co_options |= CO_DELETE | CO_EXACTRCS;
 +		break;
 +	case PT_COMPRESS:
 +		coll->co_options |= CO_COMPRESS;
 +		break;
 +	case PT_NORSYNC:
 +		coll->co_options |= CO_NORSYNC;
 +		break;
 +	}
 +}
 +
 +/* Set "coll" as being the default collection. */
 +void
 +coll_setdef(void)
 +{
 +
 +	coll_free(defaults);
 +	defaults = cur_coll;
 +	cur_coll = coll_new(defaults);
 +}
 
 Copied: stable/8/usr.bin/csup/config.h (from r204556, head/usr.bin/csup/config.h)
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ stable/8/usr.bin/csup/config.h	Sun Jan 29 14:55:38 2012	(r230744, copy of r204556, head/usr.bin/csup/config.h)
 @@ -0,0 +1,127 @@
 +/*-
 + * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * $FreeBSD$
 + */
 +#ifndef _CONFIG_H_
 +#define _CONFIG_H_
 +
 +#include <sys/types.h>
 +#include <sys/socket.h>
 +
 +#include <time.h>
 +
 +#include "fattr.h"
 +#include "queue.h"
 +#include "misc.h"
 +
 +/*
 + * Collection options.
 + */
 +#define	CO_BACKUP		0x00000001
 +#define	CO_DELETE		0x00000002
 +#define	CO_KEEP			0x00000004
 +#define	CO_OLD			0x00000008
 +#define	CO_UNLINKBUSY		0x00000010
 +#define	CO_NOUPDATE		0x00000020
 +#define	CO_COMPRESS		0x00000040
 +#define	CO_USERELSUFFIX		0x00000080
 +#define	CO_EXACTRCS		0x00000100
 +#define	CO_CHECKRCS		0x00000200
 +#define	CO_SKIP			0x00000400
 +#define	CO_CHECKOUTMODE		0x00000800
 +#define	CO_NORSYNC		0x00001000
 +#define	CO_KEEPBADFILES		0x00002000
 +#define	CO_EXECUTE		0x00004000
 +#define	CO_SETOWNER		0x00008000
 +#define	CO_SETMODE		0x00010000
 +#define	CO_SETFLAGS		0x00020000
 +#define	CO_NORCS		0x00040000
 +#define	CO_STRICTCHECKRCS	0x00080000
 +#define	CO_TRUSTSTATUSFILE	0x00100000
 +#define	CO_DODELETESONLY	0x00200000
 +#define	CO_DETAILALLRCSFILES	0x00400000
 +
 +#define	CO_MASK			0x007fffff
 +
 +/* Options that the server is allowed to set. */
 
 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: marius 
State-Changed-When: Sun Jan 29 15:42:16 UTC 2012 
State-Changed-Why:  
Close; this now MFC'ed down to stable/8. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158652 
>Unformatted:
