[rrd-developers] Question regarding -s option of rrdcached

Sebastian Harl sh at tokkee.org
Tue Jul 13 23:35:21 CEST 2010


Hi,

On Tue, Jul 13, 2010 at 11:33:57AM -0700, Bernard Li wrote:
> On Tue, Jul 13, 2010 at 11:21 AM, Sebastian Harl <sh at tokkee.org> wrote:
> Great, I can do some quick testing and send some feedback.

Cool :-)

> >> Also, if you run the following as root:
> >>
> >> # rrdcached -s root -l unix:/tmp/rrdcached.socket
> >>
> >> the following block of code from rrd_daemon.c gets executed:
> >>
> >> 2544    if (sock->socket_group != (gid_t)-1)
> >> 2545    {
> >> 2546      if ( (chown(path, getuid(), sock->socket_group) != 0) ||
> >> 2547           (chmod(path, (S_IRUSR|S_IWUSR|S_IXUSR | S_IRGRP|S_IWGRP)) != 0) )
> >> 2548      {
> >> 2549        fprintf(stderr, "rrdcached: failed to set socket group
> >> permissions (%s)\n", strerror(errno));
> >> 2550      }
> >> 2551    }
> >>
> >> So I believe there is some issue with the comparison.
> >
> > I don't see a problem with that? What do you think is wrong about the
> > comparison? It'll fail if either chown() or chmod() returned an error
> > which is fine imho.
> 
> In the case of the root user, sock->socket_group = 0 and (gid_t)-1 is
> -1 so chown() and chmod() will always get executed -- is this the
> desired behaviour?

Well, in case you're running the program as root and then change the
group to "root", that step would be unnecessary. Anyway, I don't think
it's worth to handle that case differently. Is that what you meant? Did
you encounter any problems in that case?

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20100713/3cc7ce60/attachment.pgp 


More information about the rrd-developers mailing list