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

Sebastian Harl sh at tokkee.org
Tue Jul 13 20:21:37 CEST 2010


Hi Bernard,

On Fri, Jul 09, 2010 at 07:02:42PM -0700, Bernard Li wrote:
> I understand that the new '-s' option for rrdcached will change the
> group ownership of the socket specified by -l following the -s
> argument, eg:
> 
> # rrdcached -s rrdcached -l unix:/tmp/rrdcached.socket
> 
> would change the group ownership of the socket to group 'rrdcached'.
> 
> However, if I specify -s without -l, I would expect the default socket
> created by rrdcached would have the ownership changed, like:
> 
> # rrdcached -s rrdcached
> 
> The default socket created is still owned by user 'root'.
> 
> Is this considered a bug?

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.`

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

> Finally, would people object to having a new option where you can
> change the user ownership of the socket?

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

HTH,
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/1c6cea87/attachment-0001.pgp 


More information about the rrd-developers mailing list