[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] license/slicensepln server_license.cpp, 1.20.4.4, 1.20.4.5
From:       yijil () helixcommunity ! org
Date:       2013-12-17 6:11:51
[Download RAW message or body]

Update of /cvsroot/server/license/slicensepln
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv13409

Modified Files:
      Tag: SERVER_15_1_0
	server_license.cpp 
Log Message:
Committed to: HEAD, SERVER_15_1_0_RN

Reviewed by: Richard

Synopsis
========
Update in ServerLicense

Branches: HEAD, SERVER_15_1_0_RN

Reviewer: Anyone

Description
===========
In some platform, hx_gethostbyname will return NULL which will cause license check fail in old code.

MY FIX:
hx_gethostbyname return NULL, not return HXR_FAIL.

Files Affected
==============
server/license/slicensepln/server_license.cpp

Test perform
==============

Integration Tests:
None

Leak Tests: None
Performance Tests: N/A

Platforms Tested: win-x86_64-vc10

QA Hints
========
None.




Index: server_license.cpp
===================================================================
RCS file: /cvsroot/server/license/slicensepln/server_license.cpp,v
retrieving revision 1.20.4.4
retrieving revision 1.20.4.5
diff -u -d -r1.20.4.4 -r1.20.4.5
--- server_license.cpp	16 Dec 2013 06:58:30 -0000	1.20.4.4
+++ server_license.cpp	17 Dec 2013 06:11:48 -0000	1.20.4.5
@@ -149,17 +149,15 @@
     char hostname[1024];
     gethostname(hostname,sizeof(hostname));
     struct hostent *h; 
-    if ((h = hx_gethostbyname(hostname)) == NULL) 
-    {
-        return HXR_FAIL;
-    }
-
-
-    for (INT32 i = 0; h->h_addr_list[i] != NULL; i++)
+    h = hx_gethostbyname(hostname);
+    if (h)
     {
-        char* pAddr = inet_ntoa(*(struct in_addr*)h->h_addr_list[i]);
-        char* pSaveAddr = new_string(pAddr);
-        m_pAddrArray->Add(pSaveAddr);
+        for (INT32 i = 0; h->h_addr_list[i] != NULL; i++)
+        {
+            char* pAddr = inet_ntoa(*(struct in_addr*)h->h_addr_list[i]);
+            char* pSaveAddr = new_string(pAddr);
+            m_pAddrArray->Add(pSaveAddr);
+        }
     }
    
     //KT: We need to do something about implementing SetReadOnly
@@ -1018,6 +1016,14 @@
 ServerLicense::ValidateComputNext(const char* pMainRegKey, HXBOOL bCPN)
 {
     HX_RESULT hResult = HXR_FAIL;
+    if (m_pAddrArray->GetSize() <= 0)
+    {
+        if (bCPN)
+        {
+            LICENSE_ERRMSG("Can`t fetch local address for ComputeNext authentication.\n");
+        }
+        return hResult;
+    }
 #if !defined(_LINUX) || !defined(_WINDOWS)
     CHXString sImageName;
     char pRegKey[256] = {0};


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic