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

Bernard Li bernard at vanhpc.org
Tue Jul 13 20:33:57 CEST 2010


Hi Sebastian:

On Tue, Jul 13, 2010 at 11:21 AM, Sebastian Harl <sh at tokkee.org> wrote:

> Yep, *I* consider this to be a bug. I'll send a patch in a minute. That
> patch will also make sure that the -m and -P options will affect the
> default socket as well.
>
> I'll leave it up to Tobi to decide whether this is to be considered a
> bug or a new feature, though, and whether the patch should be applied to
> the 1.4 branch or trunk respectively.
>
> Anyway, please note that (cuz of time constraints) I did *NOT* test the
> patch yet. Some feedback (testing all three command line options) would
> be greatly appreciated.`

Great, I can do some quick testing and send some feedback.

>> 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?

> No objections from my side ;-) You should be careful to get all
> combinations of (not) changed user and group ownerships right, though.

Will do.

Thanks,

Bernard



More information about the rrd-developers mailing list