Changeset 1211
- Timestamp:
- 03/05/10 10:05:16 (2 years ago)
- Files:
-
- 1 modified
-
trunk/unxsBind/bind.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/unxsBind/bind.c
r1210 r1211 3 3 $Id$ 4 4 AUTHOR 5 (C) 2001-20 09 Gary Wallis and Hugo Urquiza for Unixservice.5 (C) 2001-2010 Gary Wallis and Hugo Urquiza for Unixservice, LLC. 6 6 PURPOSE 7 7 GUI independent code: … … 50 50 unsigned uGetZoneOwner(unsigned uZone);//local 51 51 52 //#define EXPERIMENTAL52 #define EXPERIMENTAL 53 53 #ifdef EXPERIMENTAL 54 54 unsigned uNamedCheckConf(char *cNSSet); … … 1718 1718 } 1719 1719 mysql_free_result(res2); 1720 if(zfp && !uDebug) fclose(zfp); 1720 1721 #ifdef EXPERIMENTAL 1721 1722 //Here's when this EXPERIMENTAL code starts to make sense. … … 1730 1731 //tLog.uOwner will match the tClient.uClient value of the company that owns the zone 1731 1732 1733 int iRetVal; 1734 char cQuery[512]; 1735 1732 1736 uZoneOwner=uGetZoneOwner(uZone); 1733 sprintf(gcQuery,"%s/named-checkzone %s %s > /dev/null 2>&1",gcBinDir,field[0],cZoneFile); 1734 printf("Running:%s\n",gcQuery); 1735 if(system(gcQuery)) 1737 sprintf(cQuery,"%s/named-checkzone -q %s %s",gcBinDir,field[0],cZoneFile); 1738 if((iRetVal=system(cQuery))>0) 1736 1739 { 1737 1740 //Command failed, create tLog entry 1738 sprintf(gcQuery,"INSERT INTO tLog SET uLogType= 1,uPermLevel=12,uLoginClient=1,"1741 sprintf(gcQuery,"INSERT INTO tLog SET uLogType=4,uPermLevel=12,uLoginClient=1," 1739 1742 "cLogin='JobQueue',cHost ='127.0.0.1',uTablePK='%u',cTableName='tZone'," 1740 "cMessage='Zone with errors',cServer='%s',uOwner=%u,uCreatedBy=1,"1741 "uCreatedDate=UNIX_TIMESTAMP(NOW()),cLabel='named-checkzone %.32s'",1742 uZone, cMasterNS,uZoneOwner,field[0]);1743 "cMessage='Zone %.99s with errors',cServer='%s',uOwner=%u,uCreatedBy=1," 1744 "uCreatedDate=UNIX_TIMESTAMP(NOW()),cLabel='named-checkzone'", 1745 uZone,field[0],cMasterNS,uZoneOwner); 1743 1746 mysql_query(&gMysql,gcQuery); 1744 1747 if(mysql_errno(&gMysql)) 1745 1748 htmlPlainTextError(mysql_error(&gMysql)); 1749 printf("%s returned %d\n",cQuery,iRetVal); 1746 1750 } 1747 1751 #endif 1748 if(zfp && !uDebug) fclose(zfp);1749 1752 } 1750 1753 mysql_free_result(res); … … 2331 2334 // mysql_free_result(res); 2332 2335 2336 if(uReload) 2337 { 2333 2338 #ifdef EXPERIMENTAL 2334 if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig2339 if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 2335 2340 #endif 2336 if(uReload)2337 {2338 2341 if(cuControlPort[0]) 2339 2342 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload",gcBinDir,cuControlPort); … … 2346 2349 else if(uReconfig) 2347 2350 { 2351 #ifdef EXPERIMENTAL 2352 if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 2353 #endif 2348 2354 if(cuControlPort[0]) 2349 2355 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reconfig",gcBinDir,cuControlPort); … … 3689 3695 unsigned uNamedCheckConf(char *cNameServer) 3690 3696 { 3691 //This function runs a named-check zonefor the iDNS controlled named daemon3697 //This function runs a named-checkconf for the iDNS controlled named daemon 3692 3698 //Returns 0 if OK, 1 if failure. Also it will create a tLog entry in case of error for informing 3693 3699 //the admin users via the iDNS backennd dashboard. … … 3699 3705 //We will check named configuration file to see if there are any issues there 3700 3706 sprintf(gcQuery,"%s/named-checkconf /usr/local/idns/named.conf",gcBinDir); 3701 3702 if(system(gcQuery) )3707 printf("%s\n",gcQuery); 3708 if(system(gcQuery)>0) 3703 3709 { 3704 3710 //Insert tLog record and skip server reload or reconfig 3705 sprintf(gcQuery,"INSERT INTO tLog SET uLogType= 1,uPermLevel=12,uLoginClient=1,"3711 sprintf(gcQuery,"INSERT INTO tLog SET uLogType=4,uPermLevel=12,uLoginClient=1," 3706 3712 "cLogin='MasterJobQueue()',cHost ='127.0.0.1',uTablePK=0,cTableName='(None)'," 3707 3713 "cMessage='Server named.conf with errors',cServer='%s',uOwner=1,uCreatedBy=1,"
