struct hostent * dnssec_gethostbyname2(const char *name, int family) { val_status_t val_status; struct hostent * res; if (dnssec_init_context()) return NULL; LOG(L_INFO, " gethostbyname2(%s) called: wrapper\n", name); res = val_gethostbyname2(libval_ctx, name, family, &val_status); if (val_istrusted(val_status) && !val_does_not_exist(val_status)) { return res; } return NULL; }
/* * Function: val_gethostbyname * * Purpose: A validating DNSSEC-aware version of the gethostbyname function. * This function supports only IPv4 addresses. * * Parameters: * ctx -- The validation context. Can be NULL for default value. * name -- The domain name or IPv4 address in dotted-decimal format. * val_status -- A pointer to a val_status_t variable to hold the * returned validation-status value. This parameter * must not be NULL. * If successful, *val_status will contain a success * code. If there is a failure, *val_status will contain * the validator error code. To test whether the returned * error code represents a trustworthy status, the caller * can use the val_istrusted() function. * * Return value: * Returns the entry from the host database or DNS for host on success. * Returns NULL on failure. * * See also: val_gethostbyname_r(), val_gethostbyname2, val_istrusted() */ struct hostent * val_gethostbyname(val_context_t * ctx, const char *name, val_status_t * val_status) { return val_gethostbyname2(ctx, name, AF_INET, val_status); } /* val_gethostbyname() */