Changeset 317
- Timestamp:
- Mar 15, 2011, 8:54:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/sh_calls.h
r315 r317 40 40 #endif 41 41 42 int sh_calls_set_sub (const char * str); 42 void sh_calls_enable_sub(); 43 int sh_calls_set_sub (const char * str); 43 44 44 45 long int retry_stat (const char * file, int line, … … 46 47 long int retry_fstat(const char * file, int line, 47 48 int filed, struct stat *buf); 49 long int retry_lstat_ns(const char * file, int line, 50 const char *file_name, struct stat *buf); 48 51 long int retry_lstat(const char * file, int line, 49 52 const char *file_name, struct stat *buf); -
trunk/src/samhain.c
r310 r317 983 983 pid_t * pidlist; 984 984 int i; 985 985 #ifdef WCONTINUED 986 int wflags = WNOHANG|WUNTRACED|WCONTINUED; 987 #else 988 int wflags = WNOHANG|WUNTRACED; 989 #endif 986 990 987 991 fullpath = strdup (SH_INSTALL_PATH); … … 1030 1034 times = 0; 1031 1035 while (times < 300) { 1032 respid = waitpid(pid, &status, WNOHANG|WUNTRACED);1036 respid = waitpid(pid, &status, wflags); 1033 1037 if ((pid_t)-1 == respid) 1034 1038 { … … 1473 1477 BREAKEXIT(sh_readconf_read); 1474 1478 (void) sh_readconf_read (); 1479 1480 sh_calls_enable_sub(); 1475 1481 1476 1482 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) -
trunk/src/sh_calls.c
r315 r317 242 242 } 243 243 244 static int sh_enable_use_sub = 0; 245 246 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 247 static int sh_use_sub = 1; 248 #else 244 249 static int sh_use_sub = 0; 250 #endif 251 252 void sh_calls_enable_sub() 253 { 254 sh_enable_use_sub = 1; 255 return; 256 } 245 257 246 258 int sh_calls_set_sub (const char * str) 247 259 { 248 return sh_util_flagval(str, &sh_use_sub); 260 int ret = sh_util_flagval(str, &sh_use_sub); 261 262 if ((ret == 0) && (!sh_use_sub)) 263 { 264 sh_kill_sub(); 265 } 266 return ret; 267 } 268 269 long int retry_lstat_ns(const char * file, int line, 270 const char *file_name, struct stat *buf) 271 { 272 int error; 273 long int val_retry = -1; 274 char errbuf[SH_ERRBUF_SIZE]; 275 276 SL_ENTER(_("retry_lstat_ns")); 277 278 do { 279 val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/; 280 } while (val_retry < 0 && errno == EINTR); 281 282 error = errno; 283 if (val_retry < 0) { 284 (void) sh_error_message(error, aud_err_message, 64); 285 sh_error_handle ((-1), file, line, error, MSG_ERR_LSTAT, 286 sh_error_message(error, errbuf, sizeof(errbuf)), 287 file_name ); 288 } 289 errno = error; 290 291 SL_RETURN(val_retry, _("retry_lstat_ns")); 249 292 } 250 293 … … 258 301 SL_ENTER(_("retry_lstat")); 259 302 260 if (sh_use_sub )303 if (sh_use_sub && sh_enable_use_sub) 261 304 { 262 305 val_retry = sh_sub_lstat (file_name, buf); … … 290 333 SL_ENTER(_("retry_stat")); 291 334 292 if (sh_use_sub )335 if (sh_use_sub && sh_enable_use_sub) 293 336 { 294 337 val_retry = sh_sub_stat (file_name, buf); -
trunk/src/sh_suidchk.c
r257 r317 193 193 /* Recursively descend into the directory to make sure that 194 194 * there is no symlink in the path. 195 * 196 * Use retry_lstat_ns() here because we cannot chdir the subprocess 197 * that does the lstat(). 195 198 */ 196 199 static int do_truncate_int (char * path, int depth) … … 226 229 { 227 230 *q = '\0'; 228 if (0 != retry_lstat (FIL__, __LINE__, path, &one))231 if (0 != retry_lstat_ns(FIL__, __LINE__, path, &one)) 229 232 { 230 233 SH_MUTEX_LOCK(mutex_thread_nolog); … … 260 263 } 261 264 *q = '/'; 262 if (0 != retry_lstat (FIL__, __LINE__, ".", &two))265 if (0 != retry_lstat_ns(FIL__, __LINE__, ".", &two)) 263 266 { 264 267 sh_error_handle ((-1), FIL__, __LINE__, errno, … … 288 291 if (*path == '\0') 289 292 return -1; 290 if (0 != retry_lstat (FIL__, __LINE__, path, &one))293 if (0 != retry_lstat_ns(FIL__, __LINE__, path, &one)) 291 294 { 292 295 SH_MUTEX_LOCK(mutex_thread_nolog);
Note:
See TracChangeset
for help on using the changeset viewer.