[ISCS-devel] ISCS/spm/src spmmainform.cpp,1.221,1.222 spmmainform.h,1.131,1.132
Status: Beta
Brought to you by:
jsulliva
From: John A. S. I. <jsu...@us...> - 2004-10-28 01:27:05
|
Update of /cvsroot/iscs/ISCS/spm/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20027/spm/src Modified Files: spmmainform.cpp spmmainform.h Log Message: Began delete Resource functions Changed enabled column of security_policies database table to not null Index: spmmainform.h =================================================================== RCS file: /cvsroot/iscs/ISCS/spm/src/spmmainform.h,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** spmmainform.h 5 Sep 2004 05:16:59 -0000 1.131 --- spmmainform.h 28 Oct 2004 01:26:20 -0000 1.132 *************** *** 118,121 **** --- 118,122 ---- virtual void delAccessPolicyRows( const QValueList<int> & Rows ); virtual bool delDir( const QString d, bool DeleteBase ); + virtual bool delRes( const QString & ResID ); virtual bool delRG( QPtrList<QListViewItem> & DelRGs ); virtual void delRGRes(); Index: spmmainform.cpp =================================================================== RCS file: /cvsroot/iscs/ISCS/spm/src/spmmainform.cpp,v retrieving revision 1.221 retrieving revision 1.222 diff -C2 -d -r1.221 -r1.222 *** spmmainform.cpp 13 Oct 2004 01:50:22 -0000 1.221 --- spmmainform.cpp 28 Oct 2004 01:26:19 -0000 1.222 *************** *** 10814,10817 **** --- 10814,10898 ---- //====================================================== + bool SPMMainForm::delRes( const QString & ResID ) + { + bool BestMatch, Must121; + int TTLValue; + QString Proto, Port, PEPName, PEPNameDB, NATif; + IPRange RRange, NRange; + IPPairChange IPPair; + QValueList<IPPairChange> IPPairs; + + so->Sql = "select actualrange, rip1.lowbin, rip1.highbin, rip1.lownatbin, rip1.highnatbin, rip1.natif, rip1.must_one_to_one, protocol, port, r1.publicttl, servers_ip.bestmatch, pep from all_res_ipranges, servers_ip, services, resources_ip r1 left join resource_ipranges rip1 on rip1.resid=r1.resid left join resources_ip r2 on r1.service!='' and r1.rangelist='' and r2.server=r1.server and r1.service='' left join resource_ipranges rip2 on r2.resid is not null and rip2.resid=r2.resid where r1.resid='" + ResID + "' and services.name=r1.service and fqdn=r1.server and ((rip1.resid is not null and lowbinary=rip1.lowbin and highbinary=rip1.highbin) or (rip2.resid is not null and lowbinary=rip2.lowbin and highbinary=rip2.highbin));"; + // We chose to pull BestMatch from servers_ip rather than all_res_ipranges just in case we remove that column from all_res_ipranges in the future + if ( ! so->sqlExec( so->SQEdit2, "all_res_ipranges, services, servers_ip, resources_ip or resource_ipranges") ) { + return false; + } + // Remove the Resource from any Resource Groups of which it is a member + so->Sql = "select count(chainname) from resource_groups where resid=" + ResID + ";"; + if ( ! so->sqlExec( so->SQEdit3, "resource_groups") ) { + return false; + } + so->SQEdit3->next(); + if ( so->SQEdit3->value(0).toUInt() ) { // this Resource is a member of at least one Resource Group + QString ActualRanges; + while ( so->SQEdit2->next() ) { + ActualRanges += so->SQEdit2->value(0).toString(); + if ( ! so->SQEdit2->isNull(1) ) { // This is a Resource Override with its own addresses + RRange.setBinaries( so->SQEdit2->value(1).toUInt(), so->SQEdit2->value(1).toUInt() ); + NRange.setBinaries( so->SQEdit2->value(3).toUInt(), so->SQEdit2->value(4).toUInt() ); + IPPair.OldRealRange = RRange; + IPPair.OldNATRange = NRange; + IPPair.OldNATIF = so->SQEdit2->value(5).toString(); + IPPair.OldMust121 = so->SQEdit2->value(6).toBool(); + IPPairs << IPPair; + } + if ( ActualRanges.isEmpty() ) { // We only need to assign these values once + Proto = so->SQEdit2->value(7).toString(); + Port = so->SQEdit2->value(8).toString(); + TTLValue = so->SQEdit2->value(9).toInt(); + BestMatch = so->SQEdit2->value(10).toBool(); + PEPName = so->SQEdit2->value(11).toString(); + } + } + so->Sql = "select chainname, policytype from resource_groups left join security_policies on enabled=" + so->True + " and policytype=0 and (resourcechain=chainname or resource_groups.resourcegroup like " + so->PreConcat + "security_policies.resourcegroup" + so->Concat + "'/%'" + so->PostConcat + ") where resid=" + ResID + ";"; + if ( ! so->sqlExec( so->SQEdit3, "resource_groups") ) { + return false; + } + while (so->SQEdit3->next()) { + if ( ! remResFromRG(ResID, so->SQEdit3->value(0).toString(), ActualRanges, Proto, Port, ! so->SQEdit3->isNull(1) ) ) { + return false; + } + } + } + else { // We do not need the Actual Range and Service information since we do not need to act on any Resource Groups + so->SQEdit2->next(); + TTLValue = so->SQEdit2->value(9).toInt(); + BestMatch = so->SQEdit2->value(10).toBool(); + PEPName = so->SQEdit2->value(11).toString(); + if ( ! so->SQEdit2->isNull(1) ) { + RRange.setBinaries( so->SQEdit2->value(1).toUInt(), so->SQEdit2->value(1).toUInt() ); + NRange.setBinaries( so->SQEdit2->value(3).toUInt(), so->SQEdit2->value(4).toUInt() ); + IPPair.OldRealRange = RRange; + IPPair.OldNATRange = NRange; + IPPair.OldNATIF = so->SQEdit2->value(5).toString(); + IPPair.OldMust121 = so->SQEdit2->value(6).toBool(); + IPPairs << IPPair; + while ( so->SQEdit2->next() ) { + RRange.setBinaries( so->SQEdit2->value(1).toUInt(), so->SQEdit2->value(1).toUInt() ); + NRange.setBinaries( so->SQEdit2->value(3).toUInt(), so->SQEdit2->value(4).toUInt() ); + IPPair.OldRealRange = RRange; + IPPair.OldNATRange = NRange; + IPPair.OldNATIF = so->SQEdit2->value(5).toString(); + IPPair.OldMust121 = so->SQEdit2->value(6).toBool(); + IPPairs << IPPair; + } + } + } + PEPNameDB = PEPName; + PEPNameDB.replace("'", "''"); + return true; + } + //====================================================== + bool SPMMainForm::delRG( QPtrList<QListViewItem> & DelRGs ) { |