Lines Matching defs:ad

57 static void delete_ds(adutils_ad_t *ad, const char *host, int port);
500 adutils_ad_t *ad;
504 if ((ad = calloc(1, sizeof (*ad))) == NULL)
506 ad->ref = 1;
507 ad->partition = part;
514 ad->basedn = adutils_dns2dn(domain_name);
517 ad->basedn = strdup("");
519 if (ad->basedn == NULL)
522 if (pthread_mutex_init(&ad->lock, NULL) != 0)
524 *new_ad = ad;
528 free(ad->basedn);
529 free(ad);
534 adutils_ad_free(adutils_ad_t **ad)
539 if (ad == NULL || *ad == NULL)
542 (void) pthread_mutex_lock(&(*ad)->lock);
544 if (atomic_dec_32_nv(&(*ad)->ref) > 0) {
545 (void) pthread_mutex_unlock(&(*ad)->lock);
546 *ad = NULL;
554 if (p->owner != (*ad)) {
559 delete_ds((*ad), p->host, p->port);
568 (void) pthread_mutex_unlock(&(*ad)->lock);
569 (void) pthread_mutex_destroy(&(*ad)->lock);
571 if ((*ad)->known_domains)
572 free((*ad)->known_domains);
573 free((*ad)->basedn);
574 free(*ad);
576 *ad = NULL;
663 get_conn(adutils_ad_t *ad)
687 if (adh->owner == ad)
703 adh = ad->last_adh;
712 if (adh != NULL && adh->owner == ad && adh->ld != NULL &&
717 if (adh->owner == ad)
721 ad->last_adh = adh;
766 adutils_add_ds(adutils_ad_t *ad, const char *host, int port)
775 if (p->owner != ad)
791 new->owner = ad;
834 delete_ds(adutils_ad_t *ad, const char *host, int port)
839 if ((*p)->owner != ad || strcmp(host, (*p)->host) != 0 ||
876 adutils_add_domain(adutils_ad_t *ad, const char *domain, const char *sid)
879 int num = ad->num_known_domains;
881 ad->num_known_domains++;
882 new = realloc(ad->known_domains,
883 sizeof (struct known_domain) * ad->num_known_domains);
885 ad->known_domains = new;
886 (void) strlcpy(ad->known_domains[num].name, domain,
887 sizeof (ad->known_domains[num].name));
888 (void) strlcpy(ad->known_domains[num].sid, sid,
889 sizeof (ad->known_domains[num].sid));
892 if (ad->known_domains != NULL) {
893 free(ad->known_domains);
894 ad->known_domains = NULL;
896 ad->num_known_domains = 0;
914 adutils_ad_t *ad = qs->qadh->owner;
917 for (i = 0; i < ad->num_known_domains; i++) {
918 if (domain_eq(domain, ad->known_domains[i].name))
939 adutils_ad_t *ad = qs->qadh->owner;
943 for (i = 0; i < ad->num_known_domains; i++) {
944 if (strcmp(sid, ad->known_domains[i].sid) == 0)
953 adutils_lookup_batch_start(adutils_ad_t *ad, int nqueries,
961 if (ad == NULL)
965 adh = get_conn(ad);
1677 adutils_lookup(adutils_ad_t *ad, const char *filter, const char **attrs,
1683 rc = adutils_lookup_batch_start(ad, 1, NULL, NULL, &qs);