From: Jeffrey Altman Date: Tue, 27 Jul 2004 00:01:31 +0000 (+0000) Subject: afsconfig-dns-cells-20040726 X-Git-Tag: openafs-devel-1_3_66~4 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=06634de3494db97c182b3452e1f7a9b70e608606;p=packages%2Fo%2Fopenafs.git afsconfig-dns-cells-20040726 Another annoying bug. afs_config.exe now validates cell names against DNS in addition to the CellServDB file. --- diff --git a/src/WINNT/client_config/tab_general.cpp b/src/WINNT/client_config/tab_general.cpp index 8ec755eb2..450ad7d70 100644 --- a/src/WINNT/client_config/tab_general.cpp +++ b/src/WINNT/client_config/tab_general.cpp @@ -11,6 +11,7 @@ extern "C" { #include #include #include +#include } #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; } diff --git a/src/WINNT/client_config/tab_hosts.cpp b/src/WINNT/client_config/tab_hosts.cpp index 3b2600e18..4f270535d 100644 --- a/src/WINNT/client_config/tab_hosts.cpp +++ b/src/WINNT/client_config/tab_hosts.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include +#include } #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))