bug-cfengine
[Top][All Lists]
Advanced

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

Better handling of search lines in resolv.conf


From: Frank Bagehorn
Subject: Better handling of search lines in resolv.conf
Date: 17 Jun 2002 04:48:45 -0700

I'm a new user of cfengine, I'm using version 2.0.2.
In our environment we have a nameserver configuration that contains
a line like
   search zurich.ibm.com ibm.com
Using the resolve action, this line is left untouched, but another
search line is added, so the search statements read like:
   search zurich.ibm.com
   search zurich.ibm.com ibm.com
I suggest a small change in do.c to improve this handling:

--- do.c.orig   Fri Apr  5 17:45:25 2002
+++ do.c        Mon Jun 17 13:34:40 2002
@@ -2231,11 +2231,14 @@


 snprintf(VBUFF,bufsize,"search %s",ToLowerStr(VDOMAIN));
-if (IsItemIn(filebase,VBUFF))
-   {
-   DeleteItemStarting(&filebase,VBUFF);
-   }
-PrependItem(&filebase,VBUFF,NULL);
+if ( LocateNextItemStarting(filebase,VBUFF) != NULL )
+{
+  printf("File %s has already a line starting
%s\n",VRESOLVCONF[VSYSTEMHARDCLASS],VBUFF);
+}
+else
+{
+  PrependItem(&filebase,VBUFF,NULL);
+}

 DeleteItemStarting(&filebase,"domain");
 snprintf(VBUFF,bufsize,"domain %s",ToLowerStr(VDOMAIN));


With this patch, the resolve action will look for search statements
starting with "search mydomain" and will leave those lines untouched,
otherwise it will add an appropriate line.

Regards
Frank



reply via email to

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