[prev in list] [next in list] [prev in thread] [next in thread] 

List:       trousers-tech
Subject:    [TrouSerS-tech] tcsd_conf.c patch
From:       Wyllys Ingersoll <wyllys.ingersoll () sun ! com>
Date:       2008-12-09 14:17:36
Message-ID: 493E7E00.3030708 () sun ! com
[Download RAW message or body]

Changes:
* Do not enforce the uid/gid checking on the tcsd.conf file for Solaris 
becuase
  it runs as root with reduced privileges instead of as tss:tss.



["tcsd_conf.c.patch" (text/plain)]

*** src/tcsd/tcsd_conf.c.old	Thu Aug 30 14:57:42 2007
--- src/tcsd/tcsd_conf.c	Fri Dec  5 11:35:30 2008
***************
*** 678,691 ****
--- 678,701 ----
  conf_file_init(struct tcsd_config *conf)
  {
  	FILE *f = NULL;
+ #ifndef __sun__
  	struct stat stat_buf;
  	struct group *grp;
  	struct passwd *pw;
  	mode_t mode = (S_IRUSR|S_IWUSR);
+ #endif /* __sun__ */
  	TSS_RESULT result;
  
  	init_tcsd_config(conf);
  
+ #ifdef __sun__
+ 	/*
+ 	 * Solaris runs as root:sys but with reduced privileges
+ 	 * so we don't need to create a new user/group and also so
+ 	 * we can later add auditing support.  The permissions on
+ 	 * the tcsd configuration file are not checked on Solaris.
+ 	 */
+ #else
  	/* look for a config file, create if it doesn't exist */
  	if (stat(TCSD_CONFIG_FILE, &stat_buf) == -1) {
  		if (errno == ENOENT) {
***************
*** 736,741 ****
--- 746,752 ----
  		LogError("TCSD config file (%s) must be mode 0600", TCSD_CONFIG_FILE);
  		return TCSERR(TSS_E_INTERNAL_ERROR);
  	}
+ #endif /* __sun__ */
  
  	if ((f = fopen(TCSD_CONFIG_FILE, "r")) == NULL) {
  		LogError("fopen(%s): %s", TCSD_CONFIG_FILE, strerror(errno));
***************
*** 789,795 ****
  	} else if (((stat_buf.st_mode & 0777) ^ mode) != 0) {
  		/* This path is likely to be hit since open &'s mode with ~umask */
  		LogInfo("resetting mode of %s from %o to: %o", tcsd_options.system_ps_dir,
! 			stat_buf.st_mode, mode);
  		if (chmod(tcsd_options.system_ps_dir, mode) == -1) {
  			LogError("chmod(%s) failed: %s", tcsd_options.system_ps_dir,
  				 strerror(errno));
--- 800,806 ----
  	} else if (((stat_buf.st_mode & 0777) ^ mode) != 0) {
  		/* This path is likely to be hit since open &'s mode with ~umask */
  		LogInfo("resetting mode of %s from %o to: %o", tcsd_options.system_ps_dir,
! 			(unsigned int)stat_buf.st_mode, (unsigned int)mode);
  		if (chmod(tcsd_options.system_ps_dir, mode) == -1) {
  			LogError("chmod(%s) failed: %s", tcsd_options.system_ps_dir,
  				 strerror(errno));


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

_______________________________________________
TrouSerS-tech mailing list
TrouSerS-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/trousers-tech


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic