--------------------- PatchSet 10833 Date: 2009/08/09 15:55:06 Author: serassio Branch: nt Tag: (none) Log: Better error handling Members: helpers/external_acl/mswin_ad_group/mswin_check_ad_group.c:1.1.2.7->1.1.2.8 Index: squid/helpers/external_acl/mswin_ad_group/mswin_check_ad_group.c =================================================================== RCS file: /cvsroot/squid-sf//squid/helpers/external_acl/mswin_ad_group/mswin_check_ad_group.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid/helpers/external_acl/mswin_ad_group/mswin_check_ad_group.c 22 Jul 2009 09:22:13 -0000 1.1.2.7 +++ squid/helpers/external_acl/mswin_ad_group/mswin_check_ad_group.c 9 Aug 2009 15:55:06 -0000 1.1.2.8 @@ -231,7 +231,8 @@ hr = CoInitialize(NULL); if (FAILED(hr)) { debug("My_NameTranslate: cannot initialize COM interface, ERROR: %s\n", Get_WIN32_ErrorMessage(hr)); - return NULL; + /* This is a fatal error */ + exit(1); } WIN32_COM_initialized = 1; } @@ -242,13 +243,15 @@ (void **) &pNto); if (FAILED(hr)) { debug("My_NameTranslate: cannot create COM instance, ERROR: %s\n", Get_WIN32_ErrorMessage(hr)); - return NULL; + /* This is a fatal error */ + exit(1); } hr = pNto->lpVtbl->Init(pNto, ADS_NAME_INITTYPE_GC, L""); if (FAILED(hr)) { debug("My_NameTranslate: cannot initialise NameTranslate API, ERROR: %s\n", Get_WIN32_ErrorMessage(hr)); pNto->lpVtbl->Release(pNto); - return NULL; + /* This is a fatal error */ + exit(1); } hr = pNto->lpVtbl->Set(pNto, in_format, name); if (FAILED(hr)) { @@ -308,8 +311,6 @@ /* allocate buffer for str + null termination */ safe_free(DomainName); DomainName = (char *) xmalloc(len + 1); - if (DomainName == NULL) - return NULL; /* copy unicode buffer */ WideCharToMultiByte(CP_ACP, 0, pDSRoleInfo->DomainNameFlat, -1, DomainName, len, NULL, NULL); @@ -417,7 +418,8 @@ if (SUCCEEDED(hr)) { hr = Recursive_Memberof(pGrp); pGrp->lpVtbl->Release(pGrp); - } + } else + debug("Recursive_Memberof: ERROR ADsGetObject for %S failed: %s\n", Group_Path, Get_WIN32_ErrorMessage(hr)); safe_free(Group_Path); } } else { @@ -436,7 +438,8 @@ if (SUCCEEDED(hr)) { hr = Recursive_Memberof(pGrp); pGrp->lpVtbl->Release(pGrp); - } + } else + debug("Recursive_Memberof: ERROR ADsGetObject for %S failed: %s\n", Group_Path, Get_WIN32_ErrorMessage(hr)); safe_free(Group_Path); } VariantClear(&elem); @@ -641,7 +644,9 @@ if (SUCCEEDED(hr)) { hr = Recursive_Memberof(pGrp); pGrp->lpVtbl->Release(pGrp); - } + } else + debug("Valid_Global_Groups: ADsGetObject for %S failed, ERROR: %s\n", User_PrimaryGroup_Path, Get_WIN32_ErrorMessage(hr)); + safe_free(User_PrimaryGroup_Path); } hr = Recursive_Memberof(pUser);