mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
remove named_os_gethostname()
this function was just a front-end for gethostname(). it was
needed when we supported windows, which has a different function
for looking up the hostname; it's not needed any longer.
(cherry picked from commit 197334464e)
This commit is contained in:
parent
833a932928
commit
61692942b8
7 changed files with 13 additions and 31 deletions
|
|
@ -380,9 +380,8 @@ do_hostname_lookup(dns_sdblookup_t *lookup) {
|
|||
}
|
||||
} else {
|
||||
char buf[256];
|
||||
isc_result_t result = named_os_gethostname(buf, sizeof(buf));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
if (gethostname(buf, sizeof(buf)) != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
return (put_txt(lookup, buf));
|
||||
}
|
||||
|
|
@ -420,13 +419,10 @@ do_authors_lookup(dns_sdblookup_t *lookup) {
|
|||
|
||||
static isc_result_t
|
||||
do_id_lookup(dns_sdblookup_t *lookup) {
|
||||
if (named_g_server->sctx->gethostname != NULL) {
|
||||
if (named_g_server->sctx->usehostname) {
|
||||
char buf[256];
|
||||
isc_result_t result;
|
||||
|
||||
result = named_g_server->sctx->gethostname(buf, sizeof(buf));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
if (gethostname(buf, sizeof(buf)) != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
return (put_txt(lookup, buf));
|
||||
} else if (named_g_server->sctx->server_id != NULL) {
|
||||
|
|
|
|||
|
|
@ -62,9 +62,6 @@ named_os_issingleton(const char *filename);
|
|||
void
|
||||
named_os_shutdown(void);
|
||||
|
||||
isc_result_t
|
||||
named_os_gethostname(char *buf, size_t len);
|
||||
|
||||
void
|
||||
named_os_shutdownmsg(char *command, isc_buffer_t *text);
|
||||
|
||||
|
|
|
|||
|
|
@ -869,14 +869,6 @@ named_os_shutdown(void) {
|
|||
cleanup_lockfile();
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
named_os_gethostname(char *buf, size_t len) {
|
||||
int n;
|
||||
|
||||
n = gethostname(buf, len);
|
||||
return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
named_os_shutdownmsg(char *command, isc_buffer_t *text) {
|
||||
char *last, *ptr;
|
||||
|
|
|
|||
|
|
@ -3921,8 +3921,7 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) {
|
|||
if (result == ISC_R_SUCCESS && cfg_obj_isboolean(obj)) {
|
||||
/* "hostname" is interpreted as boolean true */
|
||||
char buf[256];
|
||||
result = named_os_gethostname(buf, sizeof(buf));
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (gethostname(buf, sizeof(buf)) == 0) {
|
||||
dns_dt_setidentity(named_g_server->dtenv, buf);
|
||||
}
|
||||
} else if (result == ISC_R_SUCCESS && !cfg_obj_isvoid(obj)) {
|
||||
|
|
@ -9605,10 +9604,10 @@ load_configuration(const char *filename, named_server_t *server,
|
|||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "server-id", &obj);
|
||||
server->sctx->gethostname = NULL;
|
||||
server->sctx->usehostname = false;
|
||||
if (result == ISC_R_SUCCESS && cfg_obj_isboolean(obj)) {
|
||||
/* The parser translates "hostname" to true */
|
||||
server->sctx->gethostname = named_os_gethostname;
|
||||
server->sctx->usehostname = true;
|
||||
result = ns_server_setserverid(server->sctx, NULL);
|
||||
} else if (result == ISC_R_SUCCESS && !cfg_obj_isvoid(obj)) {
|
||||
/* Found a quoted string */
|
||||
|
|
@ -12331,8 +12330,7 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
|
|||
cb);
|
||||
CHECK(putstr(text, line));
|
||||
|
||||
result = named_os_gethostname(hostname, sizeof(hostname));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (gethostname(hostname, sizeof(hostname)) == 0) {
|
||||
strlcpy(hostname, "localhost", sizeof(hostname));
|
||||
}
|
||||
snprintf(line, sizeof(line), "running on %s: %s\n", hostname,
|
||||
|
|
|
|||
|
|
@ -988,8 +988,8 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message,
|
|||
if (WANTNSID(client)) {
|
||||
if (client->sctx->server_id != NULL) {
|
||||
nsidp = client->sctx->server_id;
|
||||
} else if (client->sctx->gethostname != NULL) {
|
||||
result = client->sctx->gethostname(nsid, sizeof(nsid));
|
||||
} else if (client->sctx->usehostname) {
|
||||
result = gethostname(nsid, sizeof(nsid));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto no_nsid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ struct ns_server {
|
|||
dns_tkeyctx_t *tkeyctx;
|
||||
|
||||
/*% Server id for NSID */
|
||||
char *server_id;
|
||||
ns_hostnamecb_t gethostname;
|
||||
char *server_id;
|
||||
bool usehostname;
|
||||
|
||||
/*% Fuzzer callback */
|
||||
isc_fuzztype_t fuzztype;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ ns_server_create(isc_mem_t *mctx, ns_matchview_t matchingview,
|
|||
|
||||
sctx->fuzztype = isc_fuzz_none;
|
||||
sctx->fuzznotify = NULL;
|
||||
sctx->gethostname = NULL;
|
||||
|
||||
sctx->matchingview = matchingview;
|
||||
sctx->answercookie = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue