Xymon Mailing List Archive search

fix to 4.2.0 uid and gid checking

2 messages in this thread

list Bill Baker · Thu, 25 Sep 2008 13:12:17 -0400 ·
I attempted to use FILE uid and gid checking in hobbit-clients.cfg.  I
ran into the same problem listed below on an e-mail dating back to 2007.
There was not a thread that showed a correction to the problem so I
search your source code for the problem.  I found it in the module
client_config.c.  In your original 4.2.0 code, the +8 below were +6.
From what I can gleam from module client_config.c, the you had planned
to use "owner" and "group" until you realized that group was reserved,
so you switched to "ownerid" and "groupid".  The only problem was that
you did not change the parsing position for the input data.  


Bill

 
                                               uid = strtol(tok+8,
&eptr, 10);

                                                if (*eptr == '\0') {

                                                        /* All numeric
*/

                                                        currule->flags
|= FCHK_OWNERID;

 
currule->rule.fcheck.ownerid = uid;

                                                }

                                                else {

                                                        currule->flags
|= FCHK_OWNERSTR;

 
currule->rule.fcheck.ownerstr = strdup(tok+8);

                                                }

                                        }

                                        else if (strncasecmp(tok,
"groupid=", 8) == 0) {

                                                /* Cannot use "group"
because that is reserved */

                                                char *eptr;

                                                int uid;

 
                                                uid = strtol(tok+8,
&eptr, 10);

                                                if (*eptr == '\0') {

                                                        /* All numeric
*/

                                                        currule->flags
|= FCHK_GROUPID;

 
currule->rule.fcheck.groupid = uid;

                                                }

                                                else {

                                                        currule->flags
|= FCHK_GROUPSTR;

 
currule->rule.fcheck.groupstr = strdup(tok+8);

                                                }


##########


problem checking directory oid / gid


*	To: user-ae9b8668bcde@xymon.invalid 
*	Subject: problem checking directory oid / gid 
*	From: Joost van den Broek <user-5bf70bf7662e@xymon.invalid> 
*	Date: Sun, 18 Feb 2007 21:16:22 +0100 
*	User-agent: Thunderbird 2.0b2 (X11/20070209) 


size=2 width="100%" align=center> 
Hi,

 
I get the following status message:

 
/tmp
File is owned by user root  - should be d=root
File is owned by group root  - should be d=root

 
The config files contain:

 
hobbit-clients.cfg
FILE /tmp yellow type=dir ownerid=root groupid=root mode=1777

 
client-local.cfg
file:/tmp


Removing ownerid and groupid will give back a green status - what is
going wrong?

Thanks,


Joost

 
Confidentiality Notice: 
This is a transmission from a Winter Haven Hospital facility. This message and any attached documents may be confidential and contain information protected by state and federal medical privacy statutes. They are intended only for the use of the addressee. If you are not the intended recipient, any disclosure, copying, or distribution of this information is strictly prohibited. If you received this transmission in error, please accept our apologies and notify the sender.

This Outbound Message has been scanned for Viruses and objectionable content by McAfee Secure Internet Gateway.
list Greg L Hubbard · Thu, 25 Sep 2008 16:29:05 -0500 ·
Thanks Bill!  We don't often get complaints accompanied by solutions!
Most folks stop at the complaint.  Thank you very much for helping to
advance Hobbit!
 
GLH
quoted from Bill Baker


	From: Bill Baker [mailto:user-3f4e67101a5c@xymon.invalid] 
	Sent: Thursday, September 25, 2008 12:12 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] fix to 4.2.0 uid and gid checking
	
	
	I attempted to use FILE uid and gid checking in
hobbit-clients.cfg.  I ran into the same problem listed below on an
e-mail dating back to 2007.  There was not a thread that showed a
correction to the problem so I search your source code for the problem.
I found it in the module client_config.c.  In your original 4.2.0 code,
the +8 below were +6. From what I can gleam from module client_config.c,
the you had planned to use "owner" and "group" until you realized that
group was reserved, so you switched to "ownerid" and "groupid".  The
only problem was that you did not change the parsing position for the
input data.  


	Bill

	 
	                                               uid =
strtol(tok+8, &eptr, 10);

	                                                if (*eptr ==
'\0') {

	                                                        /* All
numeric */

	
currule->flags |= FCHK_OWNERID;

	
currule->rule.fcheck.ownerid = uid;

	                                                }

	                                                else {

	
currule->flags |= FCHK_OWNERSTR;

	
currule->rule.fcheck.ownerstr = strdup(tok+8);

	                                                }

	                                        }

	                                        else if
(strncasecmp(tok, "groupid=", 8) == 0) {

	                                                /* Cannot use
"group" because that is reserved */

	                                                char *eptr;

	                                                int uid;

	 
	                                                uid =
strtol(tok+8, &eptr, 10);

	                                                if (*eptr ==
'\0') {

	                                                        /* All
numeric */

	
currule->flags |= FCHK_GROUPID;

	
currule->rule.fcheck.groupid = uid;

	                                                }

	                                                else {

	
currule->flags |= FCHK_GROUPSTR;

	
currule->rule.fcheck.groupstr = strdup(tok+8);

	                                                }


	##########


	problem checking directory oid / gid

	
	*	To: user-ae9b8668bcde@xymon.invalid 
	*	Subject: problem checking directory oid / gid 
	*	From: Joost van den Broek <user-5bf70bf7662e@xymon.invalid> 
	*	Date: Sun, 18 Feb 2007 21:16:22 +0100 
	*	User-agent: Thunderbird 2.0b2 (X11/20070209) 

	
	size=2 width="100%" align=center> 
	Hi,

	 
	I get the following status message:

	 
	/tmp
	File is owned by user root  - should be d=root
	File is owned by group root  - should be d=root

	 
	The config files contain:

	 
	hobbit-clients.cfg
	FILE /tmp yellow type=dir ownerid=root groupid=root mode=1777

	 
	client-local.cfg
	file:/tmp

	
	Removing ownerid and groupid will give back a green status -
what is going wrong?

	Thanks,

	
	Joost

	 
	Confidentiality Notice: 
	This is a transmission from a Winter Haven Hospital facility.
This message and any attached documents may be confidential and contain
information protected by state and federal medical privacy statutes.
They are intended only for the use of the addressee. If you are not the
intended recipient, any disclosure, copying, or distribution of this
information is strictly prohibited. If you received this transmission in
error, please accept our apologies and notify the sender.
	
	This Outbound Message has been scanned for Viruses and
objectionable content by McAfee Secure Internet Gateway.