Changeset 232 for branches/samba-3.2.x/source/libsmb/dsgetdcname.c
- Timestamp:
- May 27, 2009, 9:09:42 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/libsmb/dsgetdcname.c
r228 r232 1384 1384 } 1385 1385 1386 static 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 1386 1407 /******************************************************************** 1387 1408 dsgetdcname. … … 1401 1422 struct netr_DsRGetDCNameInfo *myinfo = NULL; 1402 1423 char *query_site = NULL; 1424 bool first = true; 1425 struct netr_DsRGetDCNameInfo *first_info = NULL; 1403 1426 1404 1427 DEBUG(10,("dsgetdcname: domain_name: %s, " … … 1428 1451 flags, query_site, &myinfo); 1429 1452 if (NT_STATUS_IS_OK(status)) { 1430 *info = myinfo;1431 1453 goto done; 1432 1454 } … … 1441 1463 &myinfo); 1442 1464 1443 if (NT_STATUS_IS_OK(status)) {1444 *info = myinfo;1445 }1446 1447 1465 done: 1448 1466 SAFE_FREE(query_site); 1449 1467 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.