Share ignore and storing % tokens in a tdb

Nicolas Williams Nicolas.Williams at
Mon Jan 31 18:03:15 GMT 2000

On Mon, Jan 31, 2000 at 12:55:20PM -0500, David Collier-Brown wrote:
> Nicolas Williams wrote:
> > Is there a function that will safely quote any shell metacharacters in a
> > string such that that string can then be placed in double quotes and
> > passed to /bin/sh -c?? I think we could use such a function, but I
> > wonder how simple it would be.
> 	I wrote one once for C (actually B!) quotes,
> 	and it was mildly hairy. 
> 	Hmmn: or is it???
> 	I suspect we want to evaluate all the `` and $var
> 	constructs, so that the program called gets the right
> 	information, and just protect against tokens like
> 	"foo bar" turning into multiples...
> 	Does that make sense? That would make:
> 		open hook = scriptName %U "weegle woggle" 
> 	should turn into 
> 		popen("scriptName \"%U\" \"weegle woggle\"" ,"r");

Right, with the value of %U having been run through the safe_quote()
function so it is safe (if %U contains embedded double quotes then
those need to be quoted!). This is just what I meant.

Hmmm, I just tested it and it seems that the only meta-character that
needs to be quoted with \ is " if you then place the string in double
quotes. Alternatively you can \ escape every meta-character (and control
and white-space chars too!) and not double quote the result.

So a safe_quote() function should be easy to implement; watch for one
later today or tomorrow...

> --dave

BTW, what's wrong with the Samba lists? The archives are not updating,
so I can't read any new posts...

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the samba-technical mailing list