tags 646880 upstream confirmed
thanks

James Cameron wrote...

> pptpsetup preserves mode on /etc/ppp/chap-secrets, but uses root
> umask 0022 on /etc/ppp/peers/$TUNNEL, and group dip because of
> setgid bit on /etc/ppp/peers.
> 
> My perl is rusty.  As far as I can see, it would be a call to chmod
> after open, or a call to umask before open.  Latter seems easy, but
> overrides user choice.

The latter also avoids the situation when the file is world-readable for
a short moment. For the given situation that isn't really an issue,
still I'd prefer safe programming since you never know when people
consider your code a good example to borrow from, and things go downhill
from there.

Having said that:

> Patch attached, will be upstreamed after review.

That is almost the thing I was about to suggest, go for it.

And, when convenient, please replace the two-argument form of open as in

| open( FILE, ">>$chap_secrets_file" )

into the three-argument form

| open( FILE, ">>", $chap_secrets_file )

in all places. Since while the two-argument form is safe here, it might
introduce issues somewhere else.

Cheers,

    Christoph

Attachment: signature.asc
Description: Digital signature

Reply via email to