help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: resolv.conf edit problem


From: Alan Sparks
Subject: PATCH: resolv.conf edit problem
Date: Thu, 07 Jun 2001 15:33:39 -0600

Went to do some resolver config editing.  Put in a rulebase like:

resolve:
  208_169_17::
      208.169.17.163
      209.119.36.3

Was surprised to see the old "nameserver" entries still in place after
the run.

Problem seems that cfengine does not delete old entries from the list it
creates as the new image, a copy of the existing config.  So nonexisting
entries get added, but old entries are never dropped.

I patched cfengine-1.6.3/src/do.c as follows, to recreate the
nameservers in the filebase list before adding the new ones:

*** do.c.orig   Thu Jun  7 15:29:23 2001
--- do.c        Thu Jun  7 15:29:09 2001
***************
*** 2010,2015 ****
--- 2010,2017 ----
     }
 
  DeleteItemStarting(&filebase,"domain");
+ while (DeleteItemStarting(&filebase,"nameserver "))
+   ;
  EditItemsInResolvConf(VRESOLVE,&filebase);
  sprintf(VBUFF,"domain %s",ToLowerStr(VDOMAIN));
  PrependItem(&filebase,VBUFF,NULL);


With this change, cfengine recreates the resolv.conf properly, with only
the specified nameservers.
-Alan

-- 
Alan Sparks, Sr. UNIX Administrator     asparks@quris.com
Quris, Inc.                             (720) 836-2058



reply via email to

[Prev in Thread] Current Thread [Next in Thread]