Share ignore and storing % tokens in a tdb
Nicolas.Williams at wdr.com
Mon Jan 31 13:54:14 GMT 2000
On Mon, Jan 31, 2000 at 08:35:38AM -0500, David Collier-Brown wrote:
> Nicolas Williams wrote:
> | Actually, that would be useful: a share ignore parameter. It's value
> | might be a % token followed by a value such that if it does not
> | the token's value the share would be ignored.
> Cool! "ignore if = %m bozotron" would be read
> "ignore this share if %m is bozotron", much like
> the perl idiom. The cost would be a parser change
> to skip forward to the beginning of the next section
> and a loadparms.c change to invalidate the current
> section and clean up any data structures.
This would be nice... It would cut down on the need for includes.
> | Also, Luke's idea of storing % tokens in a tdb indexed by <PID vuid>
> | tuples is really neat. Not only will it allow the DCE/RPC daemons to
> | implement standard_sub_basic() correctly, but it could even be used
> | user commands run via the preexec/postexec/open/close/etc...
> | (this would require a user-level program for retrieving data from a
> | as well as a separate library for C programs to use to access the
> TDB in
> | question).
> Hmmn: if all the commands which ran external programs
> did "requoting" of all their parameters, and selected
> the right values by <pid vuid>, methinks the common
> case would be covered.
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.
int safe_quote(char * dst, char * src, int n)
/* pseudo code */
for ( c=*str ; str != NULL && n ; str++ )
if (n < 2)
*dst++ = '\';
*dst++ = c;
strncpy(dst, quoted_meta_chars[c], n);
n -= quoted_meta_chars_length[c]);
*dst++ = *str;
> The general case would indeed require a library for
> user programs to call.
Yes, but I was thinking of a tool akin to pkgparam(1) (from Solaris
packages). The library would be useful for those who are willing to
write C code. The rest can only be counted on to dabble in Shell scripts
(hmmm, a C lib could be interfaced to Perl5/Tcl/whatever too!).
/usr/local/bin/share_tdb $SMBD_PID $SHARE_VUID fetch %m | read SRV_NAME
/usr/local/bin/share_tdb $SMBD_PID $SHARE_VUID fetch %f | read FILE
Now "$FILE" is pretty safe to use in a shell script.
> [No, I don't really think smb.conf should be a perl dialect.
> I find perl a bit too write-only (;-))]
-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