remove some unused functions
removed some functions that are no longer used and unlikely to be resurrected, and also some that were only used to support Windows and can now be replaced with generic versions.
This commit is contained in:
@@ -3045,11 +3045,6 @@ dig_startup(void) {
|
||||
isc_loopmgr_run(loopmgr);
|
||||
}
|
||||
|
||||
void
|
||||
dig_query_start(void) {
|
||||
start_lookup();
|
||||
}
|
||||
|
||||
void
|
||||
dig_shutdown(void) {
|
||||
destroy_lookup(default_lookup);
|
||||
|
||||
@@ -444,12 +444,6 @@ dig_query_setup(bool, bool, int argc, char **argv);
|
||||
void
|
||||
dig_startup(void);
|
||||
|
||||
/*%
|
||||
* Initiates the next lookup cycle
|
||||
*/
|
||||
void
|
||||
dig_query_start(void);
|
||||
|
||||
/*%
|
||||
* Activate/deactivate IDN filtering of output.
|
||||
*/
|
||||
|
||||
@@ -3913,11 +3913,7 @@ main(int argc, char *argv[]) {
|
||||
result = isc_file_mktemplate(output, tempfile, tempfilelen);
|
||||
check_result(result, "isc_file_mktemplate");
|
||||
|
||||
if (outputformat == dns_masterformat_text) {
|
||||
result = isc_file_openunique(tempfile, &outfp);
|
||||
} else {
|
||||
result = isc_file_bopenunique(tempfile, &outfp);
|
||||
}
|
||||
result = isc_file_openunique(tempfile, &outfp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fatal("failed to open temporary output file: %s",
|
||||
isc_result_totext(result));
|
||||
|
||||
@@ -1791,8 +1791,7 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
|
||||
char **tempp, FILE **fp) {
|
||||
opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
|
||||
FILE *f = NULL;
|
||||
isc_result_t result;
|
||||
char *tempname = NULL;
|
||||
@@ -1806,11 +1805,7 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (format == dns_masterformat_text) {
|
||||
result = isc_file_openunique(tempname, &f);
|
||||
} else {
|
||||
result = isc_file_bopenunique(tempname, &f);
|
||||
}
|
||||
result = isc_file_openunique(tempname, &f);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
|
||||
@@ -1846,7 +1841,7 @@ dns_master_dumpasync(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
||||
|
||||
file = isc_mem_strdup(mctx, filename);
|
||||
|
||||
result = opentmp(mctx, format, filename, &tempname, &f);
|
||||
result = opentmp(mctx, filename, &tempname, &f);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_file;
|
||||
}
|
||||
@@ -1887,7 +1882,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
||||
char *tempname;
|
||||
dns_dumpctx_t *dctx = NULL;
|
||||
|
||||
result = opentmp(mctx, format, filename, &tempname, &f);
|
||||
result = opentmp(mctx, filename, &tempname, &f);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -193,76 +193,3 @@ isc_dir_chroot(const char *dirname) {
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
#endif /* ifdef HAVE_CHROOT */
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_dir_createunique(char *templet) {
|
||||
isc_result_t result;
|
||||
char *x;
|
||||
char *p;
|
||||
int i;
|
||||
int pid;
|
||||
|
||||
REQUIRE(templet != NULL);
|
||||
|
||||
/*!
|
||||
* \brief mkdtemp is not portable, so this emulates it.
|
||||
*/
|
||||
|
||||
pid = getpid();
|
||||
|
||||
/*
|
||||
* Replace trailing Xs with the process-id, zero-filled.
|
||||
*/
|
||||
for (x = templet + strlen(templet) - 1; *x == 'X' && x >= templet;
|
||||
x--, pid /= 10)
|
||||
{
|
||||
*x = pid % 10 + '0';
|
||||
}
|
||||
|
||||
x++; /* Set x to start of ex-Xs. */
|
||||
|
||||
do {
|
||||
i = mkdir(templet, 0700);
|
||||
if (i == 0 || errno != EEXIST) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* The BSD algorithm.
|
||||
*/
|
||||
p = x;
|
||||
while (*p != '\0') {
|
||||
if (isdigit((unsigned char)*p)) {
|
||||
*p = 'a';
|
||||
} else if (*p != 'z') {
|
||||
++*p;
|
||||
} else {
|
||||
/*
|
||||
* Reset character and move to next.
|
||||
*/
|
||||
*p++ = 'a';
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (*p == '\0') {
|
||||
/*
|
||||
* Tried all combinations. errno should already
|
||||
* be EEXIST, but ensure it is anyway for
|
||||
* isc__errno2result().
|
||||
*/
|
||||
errno = EEXIST;
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
if (i == -1) {
|
||||
result = isc__errno2result(errno);
|
||||
} else {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -383,23 +383,6 @@ isc_file_openuniquemode(char *templet, int mode, FILE **fp) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_file_bopenunique(char *templet, FILE **fp) {
|
||||
int mode = S_IWUSR | S_IRUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||
return (isc_file_openuniquemode(templet, mode, fp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_file_bopenuniqueprivate(char *templet, FILE **fp) {
|
||||
int mode = S_IWUSR | S_IRUSR;
|
||||
return (isc_file_openuniquemode(templet, mode, fp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_file_bopenuniquemode(char *templet, int mode, FILE **fp) {
|
||||
return (isc_file_openuniquemode(templet, mode, fp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_file_remove(const char *filename) {
|
||||
int r;
|
||||
|
||||
@@ -68,13 +68,4 @@ isc_dir_chdir(const char *dirname);
|
||||
isc_result_t
|
||||
isc_dir_chroot(const char *dirname);
|
||||
|
||||
isc_result_t
|
||||
isc_dir_createunique(char *templet);
|
||||
/*!<
|
||||
* Use a templet (such as from isc_file_mktemplate()) to create a uniquely
|
||||
* named, empty directory. The templet string is modified in place.
|
||||
* If result == ISC_R_SUCCESS, it is the name of the directory that was
|
||||
* created.
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
@@ -102,16 +102,8 @@ isc_result_t
|
||||
isc_file_openuniqueprivate(char *templet, FILE **fp);
|
||||
isc_result_t
|
||||
isc_file_openuniquemode(char *templet, int mode, FILE **fp);
|
||||
isc_result_t
|
||||
isc_file_bopenunique(char *templet, FILE **fp);
|
||||
isc_result_t
|
||||
isc_file_bopenuniqueprivate(char *templet, FILE **fp);
|
||||
isc_result_t
|
||||
isc_file_bopenuniquemode(char *templet, int mode, FILE **fp);
|
||||
/*!<
|
||||
* \brief Create and open a file with a unique name based on 'templet'.
|
||||
* isc_file_bopen*() open the file in binary mode in Windows.
|
||||
* isc_file_open*() open the file in text mode in Windows.
|
||||
*
|
||||
* Notes:
|
||||
*\li 'template' is a reserved work in C++. If you want to complain
|
||||
@@ -312,8 +304,8 @@ isc_result_t
|
||||
isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
|
||||
char const **basename);
|
||||
/*%<
|
||||
* Split a path into dirname and basename. If 'path' contains no slash
|
||||
* (or, on windows, backslash), then '*dirname' is set to ".".
|
||||
* Split a path into dirname and basename. If 'path' contains no slash,
|
||||
* then '*dirname' is set to ".".
|
||||
*
|
||||
* Allocates memory for '*dirname', which can be freed with isc_mem_free().
|
||||
*
|
||||
|
||||
@@ -127,13 +127,6 @@ ns_interfacemgr_setbacklog(ns_interfacemgr_t *mgr, int backlog);
|
||||
* Set the size of the listen() backlog queue.
|
||||
*/
|
||||
|
||||
bool
|
||||
ns_interfacemgr_islistening(ns_interfacemgr_t *mgr);
|
||||
/*%<
|
||||
* Return if the manager is listening on any interface. It can be called
|
||||
* after a scan or adjust.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose, bool config);
|
||||
/*%<
|
||||
|
||||
@@ -66,15 +66,3 @@ ns_sortlist_addrorder2(const isc_netaddr_t *addr, const void *arg);
|
||||
* ACL forming the second element in a 2-element top-level
|
||||
* sortlist statement.
|
||||
*/
|
||||
|
||||
void
|
||||
ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, dns_aclenv_t *env,
|
||||
isc_netaddr_t *client_addr,
|
||||
dns_addressorderfunc_t *orderp, void **argp);
|
||||
/*%<
|
||||
* Find the sortlist statement in 'acl' that applies to 'clientaddr', if any.
|
||||
* If a sortlist statement applies, return in '*orderp' a pointer to a function
|
||||
* for ranking network addresses based on that sortlist statement, and in
|
||||
* '*argp' an argument to pass to said function. If no sortlist statement
|
||||
* applies, set '*orderp' and '*argp' to NULL.
|
||||
*/
|
||||
|
||||
@@ -1349,13 +1349,6 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose, bool config) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
bool
|
||||
ns_interfacemgr_islistening(ns_interfacemgr_t *mgr) {
|
||||
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
|
||||
|
||||
return (ISC_LIST_EMPTY(mgr->interfaces) ? false : true);
|
||||
}
|
||||
|
||||
void
|
||||
ns_interfacemgr_setlistenon4(ns_interfacemgr_t *mgr, ns_listenlist_t *value) {
|
||||
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
|
||||
|
||||
@@ -153,29 +153,3 @@ ns_sortlist_addrorder1(const isc_netaddr_t *addr, const void *arg) {
|
||||
|
||||
return (INT_MAX);
|
||||
}
|
||||
|
||||
void
|
||||
ns_sortlist_byaddrsetup(dns_acl_t *sortlist_acl, dns_aclenv_t *env,
|
||||
isc_netaddr_t *client_addr,
|
||||
dns_addressorderfunc_t *orderp, void **argp) {
|
||||
ns_sortlisttype_t sortlisttype;
|
||||
|
||||
sortlisttype = ns_sortlist_setup(sortlist_acl, env, client_addr, argp);
|
||||
|
||||
switch (sortlisttype) {
|
||||
case NS_SORTLISTTYPE_1ELEMENT:
|
||||
*orderp = ns_sortlist_addrorder1;
|
||||
break;
|
||||
case NS_SORTLISTTYPE_2ELEMENT:
|
||||
*orderp = ns_sortlist_addrorder2;
|
||||
break;
|
||||
case NS_SORTLISTTYPE_NONE:
|
||||
*orderp = NULL;
|
||||
break;
|
||||
default:
|
||||
UNEXPECTED_ERROR(
|
||||
"unexpected return from ns_sortlist_setup(): %d",
|
||||
sortlisttype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user