Changeset 717

Show
Ignore:
Timestamp:
12/29/06 00:02:06 (2 years ago)
Author:
common
Message:

nepenthes

  • Nepenthes fix shellcodecheck
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/nepenthes-core/src/Nepenthes.cpp

    r699 r717  
    371371 
    372372 
     373        m_LogManager->registerTag(l_crit,   "crit"); 
     374        m_LogManager->registerTag(l_warn,   "warn"); 
     375        m_LogManager->registerTag(l_debug,  "debug"); 
     376        m_LogManager->registerTag(l_info,   "info"); 
     377        m_LogManager->registerTag(l_spam,   "spam"); 
     378        m_LogManager->registerTag(l_net,    "net"); 
     379        m_LogManager->registerTag(l_script, "script"); 
     380        m_LogManager->registerTag(l_shell,  "shell"); 
     381        m_LogManager->registerTag(l_mem,    "mem"); 
     382        m_LogManager->registerTag(l_sc,     "sc"); 
     383        m_LogManager->registerTag(l_dl,     "down"); 
     384        m_LogManager->registerTag(l_mgr,    "mgr"); 
     385        m_LogManager->registerTag(l_hlr,    "handler"); 
     386        m_LogManager->registerTag(l_dia,    "dia"); 
     387        m_LogManager->registerTag(l_sub,    "submit"); 
     388        m_LogManager->registerTag(l_ev,     "event"); 
     389        m_LogManager->registerTag(l_mod,    "module"); 
     390        m_LogManager->registerTag(l_stdtag, "fixme"); 
     391 
    373392        if ( opt.m_runMode != runFileCheck || opt.m_verbose ) 
    374393        { 
    375                 m_LogManager->registerTag(l_crit,   "crit"); 
    376                 m_LogManager->registerTag(l_warn,   "warn"); 
    377                 m_LogManager->registerTag(l_debug,  "debug"); 
    378                 m_LogManager->registerTag(l_info,   "info"); 
    379                 m_LogManager->registerTag(l_spam,   "spam"); 
    380                 m_LogManager->registerTag(l_net,    "net"); 
    381                 m_LogManager->registerTag(l_script, "script"); 
    382                 m_LogManager->registerTag(l_shell,  "shell"); 
    383                 m_LogManager->registerTag(l_mem,    "mem"); 
    384                 m_LogManager->registerTag(l_sc,     "sc"); 
    385                 m_LogManager->registerTag(l_dl,     "down"); 
    386                 m_LogManager->registerTag(l_mgr,    "mgr"); 
    387                 m_LogManager->registerTag(l_hlr,    "handler"); 
    388                 m_LogManager->registerTag(l_dia,    "dia"); 
    389                 m_LogManager->registerTag(l_sub,    "submit"); 
    390                 m_LogManager->registerTag(l_ev,     "event"); 
    391                 m_LogManager->registerTag(l_mod,    "module"); 
    392                 m_LogManager->registerTag(l_stdtag, "fixme"); 
    393394 
    394395                if ( opt.m_consoleTags ) 
     
    461462 
    462463 
    463         if ( opt.m_ringLogger == true ) 
    464         { 
    465                 string rlpath; 
    466                 try 
    467                 { 
    468                         rlpath = m_Config->getValString("nepenthes.logmanager.ring_logging_file"); 
     464        if ( opt.m_runMode != runFileCheck || opt.m_verbose ) 
     465        { 
     466 
     467                if ( opt.m_ringLogger == true ) 
     468                { 
     469                        string rlpath; 
     470                        try 
     471                        { 
     472                                rlpath = m_Config->getValString("nepenthes.logmanager.ring_logging_file"); 
     473                        } catch ( ... ) 
     474                        { 
     475                                logCrit("Could not find nepenthes.logmanager.ring_logging_file in Config\n"); 
     476                                return (false); 
     477                        } 
     478 
     479 
     480                        RingFileLogger *fl = new RingFileLogger(m_LogManager); 
     481 
     482                        fl->setLogFileFormat((char *)rlpath.c_str()); 
     483                        fl->setMaxFiles(5); 
     484                        fl->setMaxSize(1024 * 1024); 
     485 
     486                        if ( opt.m_diskTags ) 
     487                                m_LogManager->addLogger(fl, m_LogManager->parseTagString(opt.m_diskTags)); 
     488                        else 
     489                                m_LogManager->addLogger(fl, l_all); 
     490 
     491                } else 
     492                { 
     493                        string flpath; 
     494                        try 
     495                        { 
     496                                flpath = m_Config->getValString("nepenthes.logmanager.file_logging_file"); 
     497                        } catch ( ... ) 
     498                        { 
     499                                logCrit("Could not find nepenthes.logmanager.file_logging_file in Config\n"); 
     500                                return (false); 
     501                        } 
     502 
     503                        FileLogger *fl = new FileLogger(m_LogManager); 
     504                        fl->setLogFile(flpath.c_str()); 
     505                        if ( opt.m_diskTags ) 
     506                                m_LogManager->addLogger(fl, m_LogManager->parseTagString(opt.m_diskTags)); 
     507                        else 
     508                                m_LogManager->addLogger(fl, l_all); 
     509 
    469510                } 
    470                 catch ( ... ) 
    471                 { 
    472                         logCrit("Could not find nepenthes.logmanager.ring_logging_file in Config\n"); 
    473                         return false; 
    474                 } 
    475  
    476  
    477                 RingFileLogger *fl = new RingFileLogger(m_LogManager); 
    478  
    479                 fl->setLogFileFormat((char *)rlpath.c_str()); 
    480                 fl->setMaxFiles(5); 
    481                 fl->setMaxSize(1024 * 1024); 
    482  
    483                 if ( opt.m_diskTags ) 
    484                         m_LogManager->addLogger(fl, m_LogManager->parseTagString(opt.m_diskTags)); 
    485                 else 
    486                         m_LogManager->addLogger(fl, l_all); 
    487  
    488         } 
    489         else 
    490         { 
    491                 string flpath; 
    492                 try 
    493                 { 
    494                         flpath = m_Config->getValString("nepenthes.logmanager.file_logging_file"); 
    495                 } 
    496                 catch ( ... ) 
    497                 { 
    498                         logCrit("Could not find nepenthes.logmanager.file_logging_file in Config\n"); 
    499                         return false; 
    500                 } 
    501  
    502                 FileLogger *fl = new FileLogger(m_LogManager); 
    503                 fl->setLogFile(flpath.c_str()); 
    504                 if ( opt.m_diskTags ) 
    505                         m_LogManager->addLogger(fl, m_LogManager->parseTagString(opt.m_diskTags)); 
    506                 else 
    507                         m_LogManager->addLogger(fl, l_all); 
    508  
    509511        } 
    510512 
     
    681683                                 
    682684                        { 
    683                                 unlink(argv[opti]); 
     685                                if (unlink(argv[opti]) != 0) 
     686                                { 
     687                                        printf("could not remove file %s (%s)\n",argv[opti],strerror(errno)); 
     688                                } 
    684689                        } 
    685690 
     
    694699                        { 
    695700 
    696 #if !defined(CYGWIN)  && !defined(CYGWIN32) &&!defined(__CYGWIN__) || !defined(__CYGWIN32__
     701#if defined(d_type_IS_NOT_A_POSIX_SPEC
    697702                                if ( dirnode->d_type == 8 ) 
    698703#else 
     
    709714                                                 
    710715                                        { 
    711                                                 unlink(filepath.c_str()); 
     716                                                if (unlink(filepath.c_str()) != 0) 
     717                                                { 
     718                                                        printf("could not remove file %s (%s)\n",filepath.c_str(),strerror(errno)); 
     719                                                } 
    712720                                        } 
    713721                                }