Re: Question regarding -s option of rrdcached

Sebastian Harl <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
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 <[email protected]> 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

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkw83BkACgkQEFEKc4UBx/z0FACfb2UeKOg0SnUE4K8xoNAIN2XT
cOIAnRYrxgDNYrGJRjq4unJ62MnLuZKB
=b4wf
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.