Ignore:
Timestamp:
May 27, 2009, 9:09:42 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/libsmb/dsgetdcname.c

    r228 r232  
    13841384}
    13851385
     1386static bool is_closest_site(struct netr_DsRGetDCNameInfo *info)
     1387{
     1388        if (info->dc_flags & DS_SERVER_CLOSEST) {
     1389                return true;
     1390        }
     1391
     1392        if (!info->client_site_name) {
     1393                return true;
     1394        }
     1395
     1396        if (!info->dc_site_name) {
     1397                return false;
     1398        }
     1399
     1400        if (strcmp(info->client_site_name, info->dc_site_name) == 0) {
     1401                return true;
     1402        }
     1403
     1404        return false;
     1405}
     1406
    13861407/********************************************************************
    13871408 dsgetdcname.
     
    14011422        struct netr_DsRGetDCNameInfo *myinfo = NULL;
    14021423        char *query_site = NULL;
     1424        bool first = true;
     1425        struct netr_DsRGetDCNameInfo *first_info = NULL;
    14031426
    14041427        DEBUG(10,("dsgetdcname: domain_name: %s, "
     
    14281451                                    flags, query_site, &myinfo);
    14291452        if (NT_STATUS_IS_OK(status)) {
    1430                 *info = myinfo;
    14311453                goto done;
    14321454        }
     
    14411463                                        &myinfo);
    14421464
    1443         if (NT_STATUS_IS_OK(status)) {
    1444                 *info = myinfo;
    1445         }
    1446 
    14471465 done:
    14481466        SAFE_FREE(query_site);
    14491467
    1450         return status;
    1451 }
     1468        if (!NT_STATUS_IS_OK(status)) {
     1469                if (!first) {
     1470                        *info = first_info;
     1471                        return NT_STATUS_OK;
     1472                }
     1473                return status;
     1474        }
     1475
     1476        if (!first) {
     1477                TALLOC_FREE(first_info);
     1478        } else if (!is_closest_site(myinfo)) {
     1479                first = false;
     1480                first_info = myinfo;
     1481                /* TODO: may use the next_closest_site here */
     1482                query_site = SMB_STRDUP(myinfo->client_site_name);
     1483                goto rediscover;
     1484        }
     1485
     1486        *info = myinfo;
     1487        return NT_STATUS_OK;
     1488}
Note: See TracChangeset for help on using the changeset viewer.