示例#1
0
void KSSLD::cacheSaveToDisk() {
  KSSLCNode *node;

  for (node = certList.first(); node; node = certList.next()) {
    if (node->permanent || node->expires > QDateTime::currentDateTime()) {
      // First convert to a binary format and then write the kconfig entry
      // write the (CN, policy, cert) to KSimpleConfig
      cfg->setGroup(node->cert->getSubject());
      cfg->writeEntry("Certificate", node->cert->toString());
      cfg->writeEntry("Policy", node->policy);
      cfg->writeEntry("Expires", node->expires);
      cfg->writeEntry("Permanent", node->permanent);
      cfg->writeEntry("Hosts", node->hosts);
      // Also write the chain
      QStringList qsl;
      QPtrList<KSSLCertificate> cl = node->cert->chain().getChain();
      for (KSSLCertificate *c = cl.first(); c != 0; c = cl.next()) {
         //kdDebug() << "Certificate in chain: " <<  c->toString() << endl;
         qsl << c->toString();
      }
      cl.setAutoDelete(true);
      cfg->writeEntry("Chain", qsl);
    }
  }  

  cfg->sync();

  // insure proper permissions -- contains sensitive data
  QString cfgName(KGlobal::dirs()->findResource("config", "ksslpolicies"));
  if (!cfgName.isEmpty())
    ::chmod(QFile::encodeName(cfgName), 0600);
}
示例#2
0
文件: unicl.c 项目: dokterp/aldor
static void 
generateCommands()
{
	ConfigItemList lst = uclOptions;

	if (dbgLevel > 1) 
		printf("SysName: %s\n", uclSysName);

	if (dbgLevel > 3) {
		printf("[Config]\n");
		while (lst != listNil(ConfigItem)) {
			printf("\t`%s' = `%s'\n", 
			       cfgName(car(lst)), cfgVal(car(lst)));
			lst = cdr(lst);
		}
		printf("[C'est Tout]\n");

		printf("Compile Only: %s\n", uclState(uclIsCompileOnly));
		printf("Link Only:    %s\n", uclState(uclIsLink));
		printf("Optimize:     %s\n", uclState(uclOptimize));
		printf("Debug:        %s\n", uclState(uclDebug));
		printf("Profile:      %s\n", uclState(uclIsCompileOnly));
		printf("OutputDir:    %s\n", uclOutputDir ? uclOutputDir : "(null)");
		printf("OutputFile:   %s\n", uclOutputFile ? uclOutputFile : "(null)");
	}

	ccInitCommand();
	ccSetCommandName(uclGetCommandName());
	ccPushArguments(uclStartOptions);

	if (uclIsCompileOnly) {
		/* -D, -I, -U, -g, -O, -p, -o, -Wfnonstd */
		ccPushArguments(uclGetGeneralCompileOptions());
		ccPushArguments(uclCompileOnlyArguments());
		ccPushArgument(car(uclFileList));
		ccPushArguments(uclPostOptions);
	}
	else {
		ccPushArguments(uclGetPreLinkOptions());
		ccPushArguments(uclFileList);
		ccPushArguments(uclTwixtOptions);
		ccPushArguments(uclGetPostLinkOptions());
		ccPushArguments(uclPostOptions);
	}
	uclCommand = ccCompleteCommand();
}
示例#3
0
void CfgEmailClient::save(KConfig *)
{
    if(kmailCB->isChecked())
    {
        pSettings->setSetting(KEMailSettings::ClientProgram, QString::null);
        pSettings->setSetting(KEMailSettings::ClientTerminal, "false");
    }
    else
    {
        pSettings->setSetting(KEMailSettings::ClientProgram, txtEMailClient->text());
        pSettings->setSetting(KEMailSettings::ClientTerminal, (chkRunTerminal->isChecked()) ? "true" : "false");
    }

    // insure proper permissions -- contains sensitive data
    QString cfgName(KGlobal::dirs()->findResource("config", "emails"));
    if(!cfgName.isEmpty())
        ::chmod(QFile::encodeName(cfgName), 0600);

    kapp->dcopClient()->emitDCOPSignal("KDE_emailSettingsChanged()", QByteArray());

    emit changed(false);
}
示例#4
0
int main (int argc, char ** argv) {
    
    // check number of input parameters
    if(argc < 2){
        cerr<<"Needs the cfg file as agument --> exit "<<endl;
        return -1;
    }
        
    string cfgName(argv[1]);
    ConfigContainer cfgContainer;
    ConfigHandler* cHandler = nullptr;
    
    try
    {
        cHandler = new ConfigHandler(cfgName, cfgContainer);
        cHandler->readConfig();
        cHandler->writeConfig();
    }
    catch(...)
    {
        cout << "exit program" << endl;
        if(cHandler) delete cHandler;
        return(-1);
    }
    

    EventContainer eventContainer;
    EventReader reader(eventContainer, cfgContainer);
//     EventCleaner cleaner(eventContainer);
    EventSelecter selecter(eventContainer, cfgContainer.cutContainer);
    WeightCalc weightCalc(eventContainer);
    EventPlotter plotter(eventContainer, cfgContainer);
    
    for( unsigned int iSample = 0; iSample < cfgContainer.sampleContainer.reducedNames.size(); ++iSample) 
    {
        // Init fake weights
        if( (cfgContainer.sampleContainer.sampleType[iSample] == SampleType::FAKELEPTON || cfgContainer.sampleContainer.sampleType[iSample] == SampleType::MCFAKELEPTON) && cfgContainer.fakeContainer.fakeElectronFile != "" )
            weightCalc.initFakeWeight(&(cfgContainer.fakeContainer));
        
        for( unsigned int iSubSample = 0; iSubSample < cfgContainer.sampleContainer.sampleNames[iSample].size(); ++iSubSample) 
        {
            // Init DY weights
            if( cfgContainer.flipChargeDY && (cfgContainer.sampleContainer.sampleNames[iSample][iSubSample].find("DY") != string::npos || cfgContainer.sampleContainer.sampleNames[iSample][iSubSample].find("TTTo2L2Nu") != string::npos) )
                weightCalc.initDYWeight(reader);
            
            if( reader.setSample(iSample, iSubSample) )
            {   
                while( reader.fillNextEvent() )
                {
//                     cleaner.doCleaning();
//                     cleaner.doTrackJetsCleaning();
                    if( selecter.passCuts() )
                    {
                        weightCalc.setWeight(cfgContainer.sampleContainer.sampleType[iSample], cfgContainer.sampleContainer.sampleNames[iSample][iSubSample]);
//                         cout << "Event nr:\t" << eventContainer.eventNo() << "\tfake weigth:\t" << eventContainer.weight() << endl;
//                         cout << "lepton 1 pt cor:\t" << eventContainer.looseleptoncorrectedpt(0) << "lepton 2 pt cor:\t" << eventContainer.looseleptoncorrectedpt(1) << endl;
                        plotter.fill(iSample, iSubSample);
                    }
                }
            }
        }
    }
    string filename = "test.root";
    plotter.writeHist(filename);
    plotter.writePlots("png");
    
    delete cHandler;
}