Changeset 751 for trunk/server/source3/libsmb/clikrb5.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/libsmb/clikrb5.c
r745 r751 489 489 } 490 490 491 #if !defined(HAVE_KRB5_LOCATE_KDC)492 493 /* krb5_locate_kdc is an internal MIT symbol. MIT are not yet willing to commit494 * to a public interface for this functionality, so we have to be able to live495 * without it if the MIT libraries are hiding their internal symbols.496 */497 498 #if defined(KRB5_KRBHST_INIT)499 /* Heimdal */500 krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)501 {502 krb5_krbhst_handle hnd;503 krb5_krbhst_info *hinfo;504 krb5_error_code rc;505 int num_kdcs, i;506 struct sockaddr *sa;507 struct addrinfo *ai;508 509 *addr_pp = NULL;510 *naddrs = 0;511 512 rc = krb5_krbhst_init(ctx, realm->data, KRB5_KRBHST_KDC, &hnd);513 if (rc) {514 DEBUG(0, ("smb_krb5_locate_kdc: krb5_krbhst_init failed (%s)\n", error_message(rc)));515 return rc;516 }517 518 for ( num_kdcs = 0; (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); num_kdcs++)519 ;520 521 krb5_krbhst_reset(ctx, hnd);522 523 if (!num_kdcs) {524 DEBUG(0, ("smb_krb5_locate_kdc: zero kdcs found !\n"));525 krb5_krbhst_free(ctx, hnd);526 return -1;527 }528 529 sa = SMB_MALLOC_ARRAY( struct sockaddr, num_kdcs );530 if (!sa) {531 DEBUG(0, ("smb_krb5_locate_kdc: malloc failed\n"));532 krb5_krbhst_free(ctx, hnd);533 naddrs = 0;534 return -1;535 }536 537 memset(sa, '\0', sizeof(struct sockaddr) * num_kdcs );538 539 for (i = 0; i < num_kdcs && (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); i++) {540 541 #if defined(HAVE_KRB5_KRBHST_GET_ADDRINFO)542 rc = krb5_krbhst_get_addrinfo(ctx, hinfo, &ai);543 if (rc) {544 DEBUG(0,("krb5_krbhst_get_addrinfo failed: %s\n", error_message(rc)));545 continue;546 }547 #endif548 if (hinfo->ai && hinfo->ai->ai_family == AF_INET)549 memcpy(&sa[i], hinfo->ai->ai_addr, sizeof(struct sockaddr));550 }551 552 krb5_krbhst_free(ctx, hnd);553 554 *naddrs = num_kdcs;555 *addr_pp = sa;556 return 0;557 }558 559 #else /* ! defined(KRB5_KRBHST_INIT) */560 561 krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,562 struct sockaddr **addr_pp, int *naddrs, int get_masters)563 {564 DEBUG(0, ("unable to explicitly locate the KDC on this platform\n"));565 return KRB5_KDC_UNREACH;566 }567 568 #endif /* KRB5_KRBHST_INIT */569 570 #else /* ! HAVE_KRB5_LOCATE_KDC */571 572 krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,573 struct sockaddr **addr_pp, int *naddrs, int get_masters)574 {575 return krb5_locate_kdc(ctx, realm, addr_pp, naddrs, get_masters);576 }577 578 #endif /* HAVE_KRB5_LOCATE_KDC */579 580 491 #if !defined(HAVE_KRB5_FREE_UNPARSED_NAME) 581 492 void krb5_free_unparsed_name(krb5_context context, char *val) … … 2108 2019 } 2109 2020 2110 ret = krb5_cc_store_cred(context, ccache, creds);2111 if (ret) {2112 goto done;2113 }2114 2115 2021 if (out_creds) { 2116 2022 *out_creds = creds;
Note:
See TracChangeset
for help on using the changeset viewer.