From owner-freebsd-ports Mon May 7 10:19:56 2001 Delivered-To: freebsd-ports@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id E55A537B422 for ; Mon, 7 May 2001 10:19:51 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 49856 invoked by uid 1000); 7 May 2001 17:18:03 -0000 Date: Mon, 7 May 2001 20:18:03 +0300 From: Peter Pentchev To: ports@FreeBSD.org Subject: new port of a utility to safely quote program args Message-ID: <20010507201803.M39862@ringworld.oblivion.bg> Mail-Followup-To: ports@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 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 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