Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2020 19:24:21 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r547289 - in head/net/rdist6: . files
Message-ID:  <202009011924.081JOL0j048386@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Tue Sep  1 19:24:21 2020
New Revision: 547289
URL: https://svnweb.freebsd.org/changeset/ports/547289

Log:
  rdist6 fails to hardlink files with whitespace in them. This
  patch fixes that.
  
  PR:		247596
  Submitted by:	Andre Albsmeier <mail@fbsd.e4m.org>
  Reported by:	Andre Albsmeier <mail@fbsd.e4m.org>

Added:
  head/net/rdist6/files/patch-z-fix_ws_in_hardlinks   (contents, props changed)
Modified:
  head/net/rdist6/Makefile   (contents, props changed)

Modified: head/net/rdist6/Makefile
==============================================================================
--- head/net/rdist6/Makefile	Tue Sep  1 19:20:20 2020	(r547288)
+++ head/net/rdist6/Makefile	Tue Sep  1 19:24:21 2020	(r547289)
@@ -3,7 +3,7 @@
 
 PORTNAME=	rdist
 PORTVERSION=	6.1.5
-PORTREVISION=	6
+PORTREVISION=	7
 CATEGORIES=	net
 MASTER_SITES=	https://fossies.org/linux/misc/old/ \
 		http://www.magnicomp.com/download/rdist/

Added: head/net/rdist6/files/patch-z-fix_ws_in_hardlinks
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rdist6/files/patch-z-fix_ws_in_hardlinks	Tue Sep  1 19:24:21 2020	(r547289)
@@ -0,0 +1,70 @@
+--- src/server.c.ORI	2020-06-27 09:02:15.364442000 +0200
++++ src/server.c	2020-06-27 09:12:23.010090000 +0200
+@@ -1270,17 +1270,34 @@
+ 		return;
+ 	}
+ 
+-	oldname = strtok(cp, " ");
+-	if (oldname == NULL) {
+-		error("hardlink: oldname name not delimited");
+-		return;
+-	}
++{ unsigned int len;
+ 
+-	newname = strtok((char *)NULL, " ");
+-	if (newname == NULL) {
+-		error("hardlink: new name not specified");
+-		return;
+-	}
++  if( *( cp += strspn( cp, " " ) ) == '\0' ) {
++    error("hardlink: oldnamelen name not found");
++    return;
++  }
++
++  len = strtoul( cp, &cp, 10 );
++
++  if( *( cp += strspn( cp, " " ) ) == '\0' ) {
++    error("hardlink: oldname not found");
++    return;
++  }
++  oldname = cp;
++  if( strlen( cp ) < len + 2 ) {
++    error("hardlink: oldname too short or nothing following found");
++    return;
++  }
++  cp += len;
++  *cp++ = '\0';
++
++  if( *( cp += strspn( cp, " " ) ) == '\0' ) {
++    error("hardlink: newname not found");
++    return;
++  }
++
++  newname = cp;
++}
+ 
+ 	if (exptilde(expbuf, oldname) == NULL) {
+ 		error("hardlink: tilde expansion failed");
+--- src/client.c.ORI	2020-06-27 09:02:15.372720000 +0200
++++ src/client.c	2020-06-27 08:32:20.000000000 +0200
+@@ -359,16 +359,16 @@
+ 		 rname, lp->pathname, lp->src, lp->target);
+ 		 
+ 	if (*lp->target == CNULL)
+-		(void) sendcmd(C_RECVHARDLINK, "%o %s %s", 
+-			       opts, lp->pathname, rname);
++		(void) sendcmd(C_RECVHARDLINK, "%o %d %s %s", 
++			       opts, strlen(lp->pathname), lp->pathname, rname);
+ 	else {
+ 		lname = buff;
+ 		strcpy(lname, remfilename(lp->src, lp->target, 
+ 					  lp->pathname, rname, 
+ 					  destdir));
+ 		debugmsg(DM_MISC, "sendhardlink: lname=%s\n", lname);
+-		(void) sendcmd(C_RECVHARDLINK, "%o %s %s", 
+-			       opts, lname, rname);
++		(void) sendcmd(C_RECVHARDLINK, "%o %d %s %s", 
++			       opts, strlen(lname), lname, rname);
+ 	}
+ 
+ 	return(response());



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