2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 #include <afs/param.h>
16 #include <afs/cm_config.h>
19 #include "afs_config.h"
20 #include "tab_hosts.h"
24 * PROTOTYPES _________________________________________________________________
28 void HostsTab_OnInitDialog (HWND hDlg);
29 BOOL HostsTab_OnApply (HWND hDlg);
30 void HostsTab_OnSelect (HWND hDlg);
31 void HostsTab_OnAdd (HWND hDlg);
32 void HostsTab_OnEdit (HWND hDlg);
33 void HostsTab_OnRemove (HWND hDlg);
35 void HostsTab_FillList (HWND hDlg);
37 BOOL CALLBACK CellEdit_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
38 void CellEdit_OnInitDialog (HWND hDlg);
39 void CellEdit_OnDestroy (HWND hDlg);
40 void CellEdit_OnApply (HWND hDlg);
41 void CellEdit_OnSelect (HWND hDlg);
42 void CellEdit_OnAdd (HWND hDlg);
43 void CellEdit_OnEdit (HWND hDlg);
44 void CellEdit_OnRemove (HWND hDlg);
45 void CellEdit_Enable (HWND hDlg);
46 void CellEdit_AddServerEntry (HWND hDlg, PCELLDBLINE pLine, int iOrder);
47 int CALLBACK CellEdit_SortFunction (HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2);
49 BOOL CALLBACK ServerEdit_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
50 void ServerEdit_OnInitDialog (HWND hDlg);
51 BOOL ServerEdit_OnOK (HWND hDlg);
53 BOOL TextToAddr (SOCKADDR_IN *pAddr, LPTSTR pszServer);
57 * ROUTINES ___________________________________________________________________
61 BOOL CALLBACK HostsTab_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
67 Main_OnInitDialog (GetParent(hDlg));
68 HostsTab_OnInitDialog (hDlg);
75 if (!HostsTab_OnApply (hDlg))
76 SetWindowLongPtr (hDlg, DWLP_MSGRESULT, TRUE);
80 HostsTab_OnAdd (hDlg);
84 HostsTab_OnEdit (hDlg);
88 HostsTab_OnRemove (hDlg);
92 HostsTab_DlgProc (hDlg, WM_HELP, 0, 0);
99 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_GENERAL_CCENTER);
101 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_CELLS);
105 switch (((LPNMHDR)lp)->code)
108 HostsTab_OnSelect (hDlg);
112 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_EDIT)))
113 HostsTab_OnEdit (hDlg);
123 void HostsTab_OnInitDialog (HWND hDlg)
125 if (!g.Configuration.CellServDB.pFirst)
127 CSDB_ReadFile (&g.Configuration.CellServDB, NULL);
129 // Fill in our list with cell names.
131 HostsTab_FillList (hDlg);
132 HostsTab_OnSelect (hDlg);
134 // If this is the Control Center applet, shove the default cell
135 // name onto the tab too.
139 Config_GetCellName (g.Configuration.szCell);
140 SetDlgItemText (hDlg, IDC_CELL, g.Configuration.szCell);
146 BOOL HostsTab_CommitChanges (BOOL fForce)
149 if ((hDlg = PropSheet_FindTabWindow (g.psh, (DLGPROC)HostsTab_DlgProc)) == NULL)
152 SetWindowLongPtr (hDlg, DWLP_MSGRESULT, FALSE); // Make sure we try to apply
153 if (HostsTab_OnApply (hDlg))
155 SetWindowLongPtr (hDlg, DWLP_MSGRESULT, TRUE);
160 BOOL HostsTab_OnApply (HWND hDlg)
162 // Don't try to do anything if we've already failed the apply
163 if (GetWindowLongPtr (hDlg, DWLP_MSGRESULT))
166 if (!CSDB_WriteFile (&g.Configuration.CellServDB))
169 // If this is the Control Center applet, we'll have to validate
170 // the cell name too.
174 TCHAR szNoCell[ cchRESOURCE ];
175 GetString (szNoCell, IDS_CELL_UNKNOWN);
177 TCHAR szCell[ cchRESOURCE ];
178 GetDlgItemText (hDlg, IDC_CELL, szCell, cchRESOURCE);
180 if ((!szCell[0]) || (!lstrcmpi (szNoCell, szCell)))
182 Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_NOCELL_DESC_CC);
186 if (!CSDB_FindCell (&g.Configuration.CellServDB, szCell))
190 char cellname[128], i;
192 /* we pray for all ascii cellnames */
193 for ( i=0 ; szCell[i] && i < (sizeof(cellname)-1) ; i++ )
194 cellname[i] = szCell[i];
197 if (cm_SearchCellByDNS(cellname, NULL, &ttl, NULL, NULL))
200 Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_BADCELL_DESC_CC);
205 if (!Config_SetCellName (szCell))
207 lstrcpy (g.Configuration.szCell, szCell);
214 void HostsTab_OnSelect (HWND hDlg)
216 HWND hList = GetDlgItem (hDlg, IDC_LIST);
217 HLISTITEM hItem = FastList_FindFirstSelected (hList);
218 HLISTITEM hNext = FastList_FindNextSelected (hList, hItem);
220 EnableWindow (GetDlgItem (hDlg, IDC_EDIT), !!hItem && !hNext);
221 EnableWindow (GetDlgItem (hDlg, IDC_REMOVE), !!hItem);
225 void HostsTab_OnAdd (HWND hDlg)
227 TCHAR szTitle[ cchRESOURCE ];
228 GetString (szTitle, IDS_CELLADD_TITLE);
230 LPPROPSHEET psh = PropSheet_Create (szTitle, FALSE, GetParent(hDlg), 0);
231 psh->sh.dwFlags |= PSH_NOAPPLYNOW; // Remove the Apply button
232 psh->sh.dwFlags |= PSH_HASHELP; // Add a Help button instead
233 PropSheet_AddTab (psh, szTitle, IDD_CELL_EDIT, (DLGPROC)CellEdit_DlgProc, 0, TRUE);
234 PropSheet_ShowModal (psh);
236 HostsTab_FillList (hDlg);
237 HostsTab_OnSelect (hDlg);
241 void HostsTab_OnEdit (HWND hDlg)
243 HWND hList = GetDlgItem (hDlg, IDC_LIST);
244 HLISTITEM hItem = FastList_FindFirstSelected (hList);
247 PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
249 CSDB_CrackLine (&Info, pLine->szLine);
251 LPTSTR pszTitle = FormatString (IDS_CELLEDIT_TITLE, TEXT("%s"), ((Info.szComment[0]) ? Info.szComment : Info.szCell));
253 LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE, GetParent(hDlg), (LPARAM)pLine);
254 psh->sh.dwFlags |= PSH_NOAPPLYNOW; // Remove the Apply button
255 psh->sh.dwFlags |= PSH_HASHELP; // Add a Help button instead
256 PropSheet_AddTab (psh, ((Info.szComment[0]) ? Info.szComment : Info.szCell), IDD_CELL_EDIT, (DLGPROC)CellEdit_DlgProc, (LPARAM)pLine, TRUE);
257 PropSheet_ShowModal (psh);
259 FreeString (pszTitle);
262 HostsTab_FillList (hDlg);
263 HostsTab_OnSelect (hDlg);
267 void HostsTab_OnRemove (HWND hDlg)
269 HWND hList = GetDlgItem (hDlg, IDC_LIST);
270 HLISTITEM hItem = FastList_FindFirstSelected (hList);
271 HLISTITEM hNext = FastList_FindNextSelected (hList, hItem);
279 if (Message (MB_ICONEXCLAMATION | MB_OKCANCEL, GetCautionTitle(), IDS_HOSTREM_MANY) != IDOK)
284 PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
286 CSDB_CrackLine (&Info, pLine->szLine);
288 if (Message (MB_ICONEXCLAMATION | MB_OKCANCEL, GetCautionTitle(), IDS_HOSTREM_ONE, TEXT("%s"), Info.szCell) != IDOK)
292 for ( ; hItem; hItem = FastList_FindNextSelected (hList, hItem))
294 PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
295 CSDB_RemoveCell (&g.Configuration.CellServDB, pLine);
298 HostsTab_FillList (hDlg);
299 HostsTab_OnSelect (hDlg);
303 void HostsTab_FillList (HWND hDlg)
305 HWND hList = GetDlgItem (hDlg, IDC_LIST);
306 FastList_Begin (hList);
307 FastList_RemoveAll (hList);
309 for (PCELLDBLINE pLine = g.Configuration.CellServDB.pFirst; pLine; pLine = pLine->pNext)
312 if (!CSDB_CrackLine (&Info, pLine->szLine))
317 TCHAR szText[ MAX_PATH ];
318 lstrcpy (szText, Info.szCell);
320 #if 0 // Add this if you like a more verbose Cell Hosts tab
322 wsprintf (&szText[ lstrlen(szText) ], TEXT(" (%s)"), Info.szComment);
326 memset (&ai, 0x00, sizeof(ai));
327 ai.iFirstImage = IMAGE_NOIMAGE;
328 ai.iSecondImage = IMAGE_NOIMAGE;
330 ai.lParam = (LPARAM)pLine;
331 FastList_AddItem (hList, &ai);
334 FastList_End (hList);
338 BOOL CALLBACK CellEdit_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
343 CellEdit_OnInitDialog (hDlg);
347 CellEdit_OnDestroy (hDlg);
354 CellEdit_OnApply (hDlg);
358 CellEdit_Enable (hDlg);
362 CellEdit_Enable (hDlg);
366 CellEdit_OnAdd (hDlg);
367 CellEdit_Enable (hDlg);
371 CellEdit_OnEdit (hDlg);
372 CellEdit_Enable (hDlg);
376 CellEdit_OnRemove (hDlg);
377 CellEdit_Enable (hDlg);
381 CellEdit_DlgProc (hDlg, WM_HELP, 0, 0);
387 if (PropSheet_FindTabParam (hDlg))
388 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_CELLPROP_EDIT);
390 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_CELLPROP_ADD);
394 switch (((LPNMHDR)lp)->code)
397 CellEdit_OnSelect (hDlg);
401 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_EDIT)))
402 CellEdit_OnEdit (hDlg);
403 CellEdit_Enable (hDlg);
413 void CellEdit_OnInitDialog (HWND hDlg)
415 PCELLDBLINE pLine = (PCELLDBLINE)PropSheet_FindTabParam (hDlg);
419 CSDB_CrackLine (&Info, pLine->szLine);
420 SetDlgItemText (hDlg, IDC_CELL, Info.szCell);
421 SetDlgItemText (hDlg, IDC_COMMENT, Info.szComment);
424 for (pLine = pLine->pNext; pLine; pLine = pLine->pNext)
427 if (!CSDB_CrackLine (&Info, pLine->szLine))
432 CellEdit_AddServerEntry (hDlg, pLine, iOrder++);
436 // Prepare the columns on the server list
438 HWND hList = GetDlgItem (hDlg, IDC_LIST);
440 FASTLISTCOLUMN Column;
441 Column.dwFlags = FLCF_JUSTIFY_LEFT;
442 Column.cxWidth = 200;
443 GetString (Column.szText, IDS_SVRCOL_COMMENT);
444 FastList_SetColumn (hList, 0, &Column);
446 Column.dwFlags = FLCF_JUSTIFY_LEFT;
447 Column.cxWidth = 100;
448 GetString (Column.szText, IDS_SVRCOL_SERVER);
449 FastList_SetColumn (hList, 1, &Column);
451 FastList_SetSortFunction (hList, CellEdit_SortFunction);
453 // Remove the Context Help [?] thing from the title bar
455 DWORD dwStyle = GetWindowLong (GetParent (hDlg), GWL_STYLE);
456 dwStyle &= ~DS_CONTEXTHELP;
457 SetWindowLong (GetParent (hDlg), GWL_STYLE, dwStyle);
459 dwStyle = GetWindowLong (GetParent (hDlg), GWL_EXSTYLE);
460 dwStyle &= ~WS_EX_CONTEXTHELP;
461 SetWindowLong (GetParent (hDlg), GWL_EXSTYLE, dwStyle);
463 // A little cleanup and we're done!
465 CellEdit_Enable (hDlg);
466 CellEdit_OnSelect (hDlg);
470 void CellEdit_OnDestroy (HWND hDlg)
472 HWND hList = GetDlgItem (hDlg, IDC_LIST);
473 for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem))
475 PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
481 void CellEdit_OnApply (HWND hDlg)
483 TCHAR szCell[ cchCELLDBLINE ];
484 GetDlgItemText (hDlg, IDC_CELL, szCell, cchCELLDBLINE);
486 TCHAR szComment[ cchCELLDBLINE ];
487 GetDlgItemText (hDlg, IDC_COMMENT, szComment, cchCELLDBLINE);
489 TCHAR szLinkedCell[ cchCELLDBLINE ] = TEXT("");
491 // Find out if there's already an entry in CellServDB for this cell
493 PCELLDBLINE pCellLine;
494 if ((pCellLine = CSDB_FindCell (&g.Configuration.CellServDB, szCell)) != NULL)
497 if (CSDB_CrackLine (&Info, pCellLine->szLine))
498 lstrcpy (szLinkedCell, Info.szLinkedCell);
501 // Replace our cell's entry in CellServDB, or add one if necessary.
503 if ((pCellLine = CSDB_AddCell (&g.Configuration.CellServDB, szCell, szLinkedCell, szComment)) != NULL)
505 // Remove the old servers from this cell
507 CSDB_RemoveCellServers (&g.Configuration.CellServDB, pCellLine);
509 // Add the servers from our list to the CellServDB
511 PCELLDBLINE pAppendTo = pCellLine;
513 HWND hList = GetDlgItem (hDlg, IDC_LIST);
514 for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem))
516 PCELLDBLINE pFromList = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
518 pAppendTo = CSDB_AddLine (&g.Configuration.CellServDB, pAppendTo, pFromList->szLine);
524 void CellEdit_OnSelect (HWND hDlg)
526 HWND hList = GetDlgItem (hDlg, IDC_LIST);
527 HLISTITEM hItem = FastList_FindFirstSelected (hList);
528 HLISTITEM hNext = FastList_FindNextSelected (hList, hItem);
530 EnableWindow (GetDlgItem (hDlg, IDC_EDIT), !!hItem && !hNext);
531 EnableWindow (GetDlgItem (hDlg, IDC_REMOVE), !!hItem);
535 void CellEdit_OnAdd (HWND hDlg)
538 memset (&Line, 0x00, sizeof(CELLDBLINE));
542 HWND hList = GetDlgItem (hDlg, IDC_LIST);
543 for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem))
545 PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
546 iOrder = max (iOrder, 1+ (int)(pInfo->pNext));
549 if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK)
551 CellEdit_AddServerEntry (hDlg, &Line, iOrder);
556 void CellEdit_OnEdit (HWND hDlg)
558 HWND hList = GetDlgItem (hDlg, IDC_LIST);
559 HLISTITEM hItem = FastList_FindFirstSelected (hList);
560 PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
563 memcpy (&Line, pInfo, sizeof(CELLDBLINE));
565 if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK)
568 CSDB_CrackLine (&Info, Line.szLine);
570 TCHAR szServer[ cchRESOURCE ];
571 lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer));
573 FastList_SetItemText (hList, hItem, 0, Info.szComment);
574 FastList_SetItemText (hList, hItem, 1, szServer);
576 lstrcpy (pInfo->szLine, Line.szLine);
581 void CellEdit_OnRemove (HWND hDlg)
583 HWND hList = GetDlgItem (hDlg, IDC_LIST);
584 FastList_Begin (hList);
587 while ((hItem = FastList_FindFirstSelected (hList)) != NULL)
589 PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
591 FastList_RemoveItem (hList, hItem);
594 FastList_End (hList);
598 void CellEdit_Enable (HWND hDlg)
602 TCHAR szText[ cchRESOURCE ];
603 GetDlgItemText (hDlg, IDC_CELL, szText, cchRESOURCE);
607 if (!FastList_FindFirst (GetDlgItem (hDlg, IDC_LIST)))
610 EnableWindow (GetDlgItem (GetParent (hDlg), IDOK), fEnable);
614 void CellEdit_AddServerEntry (HWND hDlg, PCELLDBLINE pLine, int iOrder)
616 HWND hList = GetDlgItem (hDlg, IDC_LIST);
618 PCELLDBLINE pCopy = New (CELLDBLINE);
619 memcpy (pCopy, pLine, sizeof(CELLDBLINE));
621 pCopy->pNext = (PCELLDBLINE)iOrder;
624 CSDB_CrackLine (&Info, pCopy->szLine);
626 TCHAR szServer[ cchRESOURCE ];
627 lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer));
630 memset (&ai, 0x00, sizeof(ai));
631 ai.iFirstImage = IMAGE_NOIMAGE;
632 ai.iSecondImage = IMAGE_NOIMAGE;
633 ai.pszText = Info.szComment;
634 ai.lParam = (LPARAM)pCopy;
635 HLISTITEM hItem = FastList_AddItem (hList, &ai);
637 FastList_SetItemText (hList, hItem, 1, szServer);
641 int CALLBACK CellEdit_SortFunction (HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2)
643 if (!hItem1 || !hItem2)
646 PCELLDBLINE pLine1 = (PCELLDBLINE)lpItem1;
647 PCELLDBLINE pLine2 = (PCELLDBLINE)lpItem2;
649 int iOrder1 = (int)(pLine1->pNext);
650 int iOrder2 = (int)(pLine2->pNext);
651 return iOrder1 - iOrder2;
655 BOOL CALLBACK ServerEdit_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
660 SetWindowLongPtr (hDlg, DWLP_USER, lp);
661 ServerEdit_OnInitDialog (hDlg);
668 if (ServerEdit_OnOK (hDlg))
669 EndDialog (hDlg, IDOK);
673 EndDialog (hDlg, IDCANCEL);
677 ServerEdit_DlgProc (hDlg, WM_HELP, 0, 0);
680 case IDC_ADDR_SPECIFIC:
681 case IDC_ADDR_LOOKUP:
682 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), IsDlgButtonChecked (hDlg, IDC_ADDR_SPECIFIC));
689 pLine = (PCELLDBLINE)GetWindowLongPtr (hDlg, DWLP_USER);
692 if (!CSDB_CrackLine (&Info, pLine->szLine))
693 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_CELLPROP_SERVER_ADD);
695 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_CELLPROP_SERVER_EDIT);
703 void ServerEdit_OnInitDialog (HWND hDlg)
705 PCELLDBLINE pLine = (PCELLDBLINE)GetWindowLongPtr (hDlg, DWLP_USER);
707 TCHAR szTitle[ cchRESOURCE ];
709 if (!CSDB_CrackLine (&Info, pLine->szLine))
710 GetString (szTitle, IDS_ADDSERVER_TITLE);
712 GetString (szTitle, IDS_EDITSERVER_TITLE);
713 SetWindowText (hDlg, szTitle);
716 memset (&Addr, 0x00, sizeof(SOCKADDR_IN));
717 Addr.sin_family = AF_INET;
718 Addr.sin_addr.s_addr = Info.ipServer;
719 SA_SetAddr (GetDlgItem (hDlg, IDC_SERVER), &Addr);
721 CheckDlgButton (hDlg, IDC_ADDR_SPECIFIC, !!Info.ipServer);
722 CheckDlgButton (hDlg, IDC_ADDR_LOOKUP, !Info.ipServer);
723 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), IsDlgButtonChecked (hDlg, IDC_ADDR_SPECIFIC));
725 SetDlgItemText (hDlg, IDC_COMMENT, Info.szComment);
729 BOOL ServerEdit_OnOK (HWND hDlg)
731 PCELLDBLINE pLine = (PCELLDBLINE)GetWindowLongPtr (hDlg, DWLP_USER);
733 TCHAR szComment[ cchCELLDBLINE ];
734 GetDlgItemText (hDlg, IDC_COMMENT, szComment, cchCELLDBLINE);
737 if (IsDlgButtonChecked (hDlg, IDC_ADDR_SPECIFIC))
739 SA_GetAddr (GetDlgItem (hDlg, IDC_SERVER), &Addr);
740 lstrcpy (szComment, inet_ntoa (*(struct in_addr *)&Addr.sin_addr.s_addr));
742 if (!TextToAddr (&Addr, szComment))
744 Message (MB_ICONHAND, GetErrorTitle(), IDS_BADLOOKUP_DESC, TEXT("%s"), szComment);
748 TCHAR szServer[ cchCELLDBLINE ];
749 lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Addr.sin_addr.s_addr));
751 CSDB_FormatLine (pLine->szLine, szServer, NULL, szComment, FALSE);
756 BOOL TextToAddr (SOCKADDR_IN *pAddr, LPTSTR pszServer)
758 if (!pszServer || !*pszServer)
762 memset (pAddr, 0x00, sizeof(SOCKADDR_IN));
763 pAddr->sin_family = AF_INET;
765 if ((*pszServer >= TEXT('0')) && (*pszServer <= TEXT('9')))
767 if ((pAddr->sin_addr.s_addr = inet_addr (pszServer)) == 0)
771 if ((pEntry = gethostbyaddr ((char*)&pAddr->sin_addr.s_addr, sizeof(int), AF_INET)) == NULL)
774 if (pEntry->h_name[0])
775 lstrcpy (pszServer, pEntry->h_name); // return the server's fqdn
777 else // Need to lookup the server by its name
780 if ((pEntry = gethostbyname (pszServer)) == NULL)
783 memcpy (&pAddr->sin_addr, (struct in_addr *)pEntry->h_addr, sizeof(struct in_addr));
784 if (!pAddr->sin_addr.s_addr)
787 if (pEntry->h_name[0])
788 lstrcpy (pszServer, pEntry->h_name); // return the server's fqdn