/**
* Created by cmiles on 8/9/2017.
*/
var express = require('express');
var router = express.Router();
var authorize = require('../lib/authorize.js');
router.post('/', authorize.auth, function(req, res, next) {
var request = req.body;
fs.writeFileSync("./syntax_verify_config", request.dhcp_config_data, 'utf8');
var exec = require('child_process').exec;
exec('dhcpd -t -cf ./syntax_verify_config > verify_output 2> verify_output', function(err, stdout, stderr)
{
var output = fs.readFileSync('./verify_output', "utf8");
if (err) {
output = output.replace("\n", "
");
output = output.replace(". ", "
");
output = output.replace("line", "
line");
output = output.replace("Configuration file errors encountered", "
Configuration file errors encountered");
res.send('