From: Chris B. <buc...@us...> - 2010-11-10 20:30:43
|
Update of /cvsroot/sblim/sfcb In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2984 Modified Files: control.c msgqueue.c sfcb.cfg.pre.in ChangeLog NEWS contributions.txt Log Message: [ 3101154 ] Daemon clients failed SfcbLocal connect due to permission Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/sfcb/ChangeLog,v retrieving revision 1.632 retrieving revision 1.633 diff -u -d -r1.632 -r1.633 --- ChangeLog 8 Nov 2010 23:43:14 -0000 1.632 +++ ChangeLog 10 Nov 2010 20:30:32 -0000 1.633 @@ -1,3 +1,9 @@ +2010-11-10 Chris Buccella <buc...@li...> + + * control.c, msgqueue.c, sfcb.cfg.pre.in: + [ 3101154 ] Daemon clients failed SfcbLocal connect due to permission + (patch by Chris Poblete) + 2010-11-08 Chris Buccella <buc...@li...> * cimcClientSfcbLocal.c: Index: sfcb.cfg.pre.in =================================================================== RCS file: /cvsroot/sblim/sfcb/sfcb.cfg.pre.in,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- sfcb.cfg.pre.in 21 May 2010 21:25:56 -0000 1.23 +++ sfcb.cfg.pre.in 10 Nov 2010 20:30:32 -0000 1.24 @@ -78,6 +78,12 @@ ## Default is /tmp/sfcbLocalSocket #localSocketPath: /tmp/sfcbLocalSocket +## The group name to use to set permission for the named socket. This is +## useful for daemon clients where worker threads are running with permission +## different than the permission for the named socket. For example, sfcb may +## be running as root while a web server using sfcb may be running as daemon. +## Default is NULL which means no change to the default permission. +#socketPathGroupPerm: daemon ##---------------------------- Provider-Related ------------------------------- Index: contributions.txt =================================================================== RCS file: /cvsroot/sblim/sfcb/contributions.txt,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- contributions.txt 8 Nov 2010 23:43:14 -0000 1.58 +++ contributions.txt 10 Nov 2010 20:30:33 -0000 1.59 @@ -177,3 +177,4 @@ ------------------- 11/08/2010 [ 3101155 ] Failed to load provider libraries due to symbol conflicts 11/08/2010 [ 3101148 ] SfcbLocal method parameter type conversion and validation +11/10/2010 [ 3101154 ] Daemon clients failed SfcbLocal connect due to permission Index: NEWS =================================================================== RCS file: /cvsroot/sblim/sfcb/NEWS,v retrieving revision 1.559 retrieving revision 1.560 diff -u -d -r1.559 -r1.560 --- NEWS 8 Nov 2010 23:43:14 -0000 1.559 +++ NEWS 10 Nov 2010 20:30:33 -0000 1.560 @@ -7,6 +7,7 @@ - 3095884 Indication classes missing SystemName - 3101155 Failed to load provider libraries due to symbol conflicts - 3101148 SfcbLocal method parameter type conversion and validation +- 3101154 Daemon clients failed SfcbLocal connect due to permission Changes in 1.3.9 ================ Index: control.c =================================================================== RCS file: /cvsroot/sblim/sfcb/control.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- control.c 21 May 2010 21:25:56 -0000 1.33 +++ control.c 10 Nov 2010 20:30:32 -0000 1.34 @@ -110,6 +110,7 @@ {"certificateAuthLib", 0, "sfcCertificateAuthentication"}, {"localSocketPath", 0, "/tmp/sfcbLocalSocket"}, {"httpSocketPath", 0, "/tmp/sfcbHttpSocket"}, + {"socketPathGroupPerm", 0, NULL}, {"traceFile", 0, "stderr"}, {"traceLevel", 1, "0"}, Index: msgqueue.c =================================================================== RCS file: /cvsroot/sblim/sfcb/msgqueue.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- msgqueue.c 14 Apr 2010 19:17:07 -0000 1.36 +++ msgqueue.c 10 Nov 2010 20:30:32 -0000 1.37 @@ -32,7 +32,7 @@ #include <unistd.h> #include <stddef.h> #include "control.h" - +#include <grp.h> extern unsigned long exFlags; @@ -681,6 +681,7 @@ int nsocket,ssocket; unsigned int cl, notDone=1; char *path; + char *gperm = NULL; struct _msg { unsigned int size; @@ -711,6 +712,29 @@ perror("bind error"); return; } + + getControlChars("socketPathGroupPerm", &gperm); + if (NULL != gperm) { + struct group *objgperm; + if (NULL == (objgperm = getgrnam(gperm))) { + mlogf(M_INFO,M_SHOW,"--- localConnectServer getgrnam failed: %s\n", strerror(errno)); + } else { + // change the socket group ownership as requested + if (chown(path, getuid(), objgperm->gr_gid)) { + mlogf(M_INFO,M_SHOW,"--- localConnectServer chown failed: %s\n", strerror(errno)); + } else { + struct stat sobj; + // change the socket permission to allow group as requested + if (stat(path, &sobj)) { + mlogf(M_INFO,M_SHOW,"--- localConnectServer stat failed: %s\n", strerror(errno)); + } else { + if (chmod(path, (sobj.st_mode | S_IWGRP))) { + mlogf(M_INFO,M_SHOW,"--- localConnectServer chmod failed: %s\n", strerror(errno)); + } + } + } + } + } listen(ssocket,1); |