Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2001 20:18:03 +0300
From:      Peter Pentchev <roam@orbitel.bg>
To:        ports@FreeBSD.org
Subject:   new port of a utility to safely quote program args
Message-ID:  <20010507201803.M39862@ringworld.oblivion.bg>

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

Just wondering if anyone knows of something like the attached port,
or I should just go ahead and commit it.

It is a utility that executes a given command after unquoting a specified
list of arguments.  Quite handy in automated scripts (e.g. CGI) written
in languages that do not provide an interface to the exec(3) family -
consider a case when a PHP script needs to invoke the vpopmail vadduser
utility through a sudo invocation, and only use the system() function;
a nightmare of slashes could be avoided with something like:

sudo -u vpopmail unquote 1:2 vadduser 7465737475736572 245061737325

..to actually add a user 'testuser' with a pass '$Pass%'.

Okay, so there might be easier ways to do that; but why not have
a generalized tool? :)

So.. is there something like this already available, or should I go ahead
and commit this?

G'luck,
Peter

-- 
This would easier understand fewer had omitted.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	unquote
#	unquote/Makefile
#	unquote/distinfo
#	unquote/pkg-comment
#	unquote/pkg-descr
#	unquote/pkg-plist
#
echo c - unquote
mkdir -p unquote > /dev/null 2>&1
echo x - unquote/Makefile
sed 's/^X//' >unquote/Makefile << 'END-of-unquote/Makefile'
X# New ports collection makefile for:	unquote
X# Date created:		5 May 2000
X# Whom:			roam@FreeBSD.org
X#
X# $FreeBSD$
X#
X
XPORTNAME=	unquote
XPORTVERSION=	1.0.b1
XCATEGORIES=	devel
XMASTER_SITES=	http://ringwraith.online.bg/~roam/devel/misc/unquote/ \
X		http://people.FreeBSD.org/~roam/devel/misc/unquote/
XDISTNAME=	${PORTNAME}-${PORTVERSION:S/.b/pre/}
X
XMAINTAINER=	roam@FreeBSD.org
X
XWRKSRC=		${WRKDIR}/${PORTNAME}
X
XMAN1=		unquote.1
X
XMAKE_ENV+=	NOMANCOMPRESS=yes
X.if		!defined(NO_RELEASE)
XMAKE_ENV+=	RELEASE=yes
X.endif
X
X.include <bsd.port.mk>
END-of-unquote/Makefile
echo x - unquote/distinfo
sed 's/^X//' >unquote/distinfo << 'END-of-unquote/distinfo'
XMD5 (unquote-1.0pre1.tar.gz) = 3b854d815172b856a84adb4a4b530c3d
END-of-unquote/distinfo
echo x - unquote/pkg-comment
sed 's/^X//' >unquote/pkg-comment << 'END-of-unquote/pkg-comment'
XExecute a command with safely quoted arguments
END-of-unquote/pkg-comment
echo x - unquote/pkg-descr
sed 's/^X//' >unquote/pkg-descr << 'END-of-unquote/pkg-descr'
Xunquote executes a command after unquoting a specified list of arguments,
Xso that arbitrary characters may be passed in command-line arguments.
X
XAuthor:		Peter Pentchev <roam@orbitel.bg>
XWWW:		http://ringwraith.online.bg/~roam/misc/unquote/
END-of-unquote/pkg-descr
echo x - unquote/pkg-plist
sed 's/^X//' >unquote/pkg-plist << 'END-of-unquote/pkg-plist'
Xbin/unquote
END-of-unquote/pkg-plist
exit


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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