summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-03-23 14:05:36 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-03-23 14:05:36 +0000
commit4df9e85d81cc21b82cb6e13a4bcf05716f80f0ae (patch)
treef10c9b1157a988412e19bfcb9b5bd8937b801ad9 /usr.sbin
parentc81a8a8e2acb769b8be703eed237c749dbf39318 (diff)
allow scp://hostname/~user/subdir to work
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index c0de7177b8b..03fa9bdda3f 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SCP.pm,v 1.24 2010/07/02 11:50:50 espie Exp $
+# $OpenBSD: SCP.pm,v 1.25 2011/03/23 14:05:35 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -205,12 +205,18 @@ sub abort_batch()
print "\nABORTED $token\n";
}
+sub expand_tilde
+{
+ my $arg = shift;
+ return (getpwnam($arg))[7]."/";
+}
local $_;
while (<STDIN>) {
chomp;
if (m/^LIST\s+(.*)$/o) {
my $dname = $1;
+ $dname =~ s/^\/\~(.*?)\//expand_tilde($1)/e;
batch(sub {
my $d;
if (opendir($d, $dname)) {
@@ -229,6 +235,7 @@ while (<STDIN>) {
});
} elsif (m/^GET\s+(.*)$/o) {
my $fname = $1;
+ $fname =~ s/^\/\~(.*?)\//expand_tilde($1)/e;
batch(sub {
if (open(my $fh, '<', $fname)) {
my $size = (stat $fh)[7];