afsconfig-dns-cells-20040726
authorJeffrey Altman <jaltman@mit.edu>
Tue, 27 Jul 2004 00:01:31 +0000 (00:01 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 27 Jul 2004 00:01:31 +0000 (00:01 +0000)
Another annoying bug.  afs_config.exe now validates cell names against
DNS in addition to the CellServDB file.

src/WINNT/client_config/tab_general.cpp
src/WINNT/client_config/tab_hosts.cpp

index 8ec755e..450ad7d 100644 (file)
@@ -11,6 +11,7 @@ extern "C" {
 #include <afs/param.h>
 #include <afs/stds.h>
 #include <rx/rxkad.h>
+#include <afs/cm_config.h>
 }
 
 #include "afs_config.h"
@@ -657,15 +658,27 @@ BOOL GeneralTab_AskIfStopped (HWND hDlg)
 BOOL fIsCellInCellServDB (LPCTSTR pszCell)
 {
    BOOL fFound = FALSE;
-
    CELLSERVDB CellServDB;
-   if (CSDB_ReadFile (&CellServDB, NULL))
-      {
-      if (CSDB_FindCell (&CellServDB, pszCell))
-         fFound = TRUE;
-      CSDB_FreeFile (&CellServDB);
-      }
 
+   if (CSDB_ReadFile (&CellServDB, NULL))
+   {
+       if (CSDB_FindCell (&CellServDB, pszCell))
+           fFound = TRUE;
+       CSDB_FreeFile (&CellServDB);
+   }
+#ifdef AFS_AFSDB_ENV
+    if ( fFound == FALSE ) {
+        int ttl;
+        char cellname[128], i;
+
+        /* we pray for all ascii cellnames */
+        for ( i=0 ; pszCell[i] && i < (sizeof(cellname)-1) ; i++ )
+            cellname[i] = pszCell[i];
+        cellname[i] = '\0';
+
+        fFound = !cm_SearchCellByDNS(cellname, NULL, &ttl, NULL, NULL);
+    }
+#endif
    return fFound;
 }
 
index 3b2600e..4f27053 100644 (file)
@@ -10,6 +10,7 @@
 extern "C" {
 #include <afs/param.h>
 #include <afs/stds.h>
+#include <afs/cm_config.h>
 }
 
 #include "afs_config.h"
@@ -181,8 +182,21 @@ BOOL HostsTab_OnApply (HWND hDlg)
 
       if (!CSDB_FindCell (&g.Configuration.CellServDB, szCell))
          {
-         Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_BADCELL_DESC_CC);
-         return FALSE;
+#ifdef AFS_AFSDB_ENV
+             int ttl;
+             char cellname[128], i;
+
+             /* we pray for all ascii cellnames */
+             for ( i=0 ; szCell[i] && i < (sizeof(cellname)-1) ; i++ )
+                 cellname[i] = szCell[i];
+             cellname[i] = '\0';
+
+             if (cm_SearchCellByDNS(cellname, NULL, &ttl, NULL, NULL))
+#endif
+             {
+                 Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_BADCELL_DESC_CC);
+                 return FALSE;
+             }
          }
 
       if (!Config_SetCellName (szCell))