diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-01-26 11:23:43 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-01-26 11:23:43 +0000 |
commit | 3cce5223d4a9bc76ccc72a8e90d43e50346ac6a3 (patch) | |
tree | 39cde05388fb480d89670e5cc83dcdab73628f19 | |
parent | 559a736436da5edbb27f8d3073953606ac75fb31 (diff) |
Remove now unused unix/file.c and unix/fsaccess.c
OK jca, tedu
-rw-r--r-- | usr.sbin/bind/bin/dig/dighost.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/dst_api.c | 6 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/dst_parse.c | 6 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/masterdump.c | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/Makefile.in | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/fsaccess.c | 102 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/include/isc/Makefile.in | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/include/isc/file.h | 368 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/include/isc/fsaccess.h | 177 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/lex.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/log.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/regex.c | 2 |
12 files changed, 16 insertions, 663 deletions
diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c index 0290bd73e01..6cd485c34e2 100644 --- a/usr.sbin/bind/bin/dig/dighost.c +++ b/usr.sbin/bind/bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.39 2020/01/25 10:59:19 florian Exp $ */ +/* $Id: dighost.c,v 1.40 2020/01/26 11:23:42 florian Exp $ */ /*! \file * \note @@ -55,7 +55,7 @@ #include <isc/app.h> #include <isc/base64.h> -#include <isc/file.h> + #include <isc/hex.h> #include <isc/lang.h> #include <isc/log.h> diff --git a/usr.sbin/bind/lib/dns/dst_api.c b/usr.sbin/bind/lib/dns/dst_api.c index 007e68e3499..a4097ae0b7b 100644 --- a/usr.sbin/bind/lib/dns/dst_api.c +++ b/usr.sbin/bind/lib/dns/dst_api.c @@ -33,7 +33,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.20 2020/01/26 11:22:33 florian Exp $ + * $Id: dst_api.c,v 1.21 2020/01/26 11:23:42 florian Exp $ */ /*! \file */ @@ -46,7 +46,7 @@ #include <isc/buffer.h> #include <isc/dir.h> -#include <isc/fsaccess.h> + #include <isc/hmacsha.h> #include <isc/lex.h> @@ -59,7 +59,7 @@ #include <string.h> #include <isc/time.h> #include <isc/util.h> -#include <isc/file.h> + diff --git a/usr.sbin/bind/lib/dns/dst_parse.c b/usr.sbin/bind/lib/dns/dst_parse.c index 9329614750c..037151b7d61 100644 --- a/usr.sbin/bind/lib/dns/dst_parse.c +++ b/usr.sbin/bind/lib/dns/dst_parse.c @@ -33,15 +33,15 @@ /*% * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.11 2020/01/26 11:22:33 florian Exp $ + * $Id: dst_parse.c,v 1.12 2020/01/26 11:23:42 florian Exp $ */ #include <isc/base64.h> #include <isc/dir.h> -#include <isc/file.h> -#include <isc/fsaccess.h> + + #include <isc/lex.h> diff --git a/usr.sbin/bind/lib/dns/masterdump.c b/usr.sbin/bind/lib/dns/masterdump.c index 44f6acad8a9..c2ec60bbc9c 100644 --- a/usr.sbin/bind/lib/dns/masterdump.c +++ b/usr.sbin/bind/lib/dns/masterdump.c @@ -21,7 +21,7 @@ #include <stdlib.h> #include <isc/event.h> -#include <isc/file.h> + #include <isc/magic.h> diff --git a/usr.sbin/bind/lib/isc/Makefile.in b/usr.sbin/bind/lib/isc/Makefile.in index 4bf98db88e6..4f7262e4ee7 100644 --- a/usr.sbin/bind/lib/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/Makefile.in @@ -30,7 +30,7 @@ CWARNINGS = # Alphabetically UNIXOBJS = \ unix/app.@O@ unix/dir.@O@ unix/errno.@O@ \ - unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \ + unix/errno2result.@O@ \ unix/net.@O@ \ unix/socket.@O@ unix/stdio.@O@ \ unix/stdtime.@O@ unix/strerror.@O@ unix/time.@O@ diff --git a/usr.sbin/bind/lib/isc/fsaccess.c b/usr.sbin/bind/lib/isc/fsaccess.c deleted file mode 100644 index 5be67607475..00000000000 --- a/usr.sbin/bind/lib/isc/fsaccess.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: fsaccess.c,v 1.4 2020/01/09 13:47:13 florian Exp $ */ - -/*! \file - * \brief - * This file contains the OS-independent functionality of the API. - */ -#include <isc/fsaccess.h> - -#include <isc/result.h> -#include <isc/util.h> - -/*! - * Shorthand. Maybe ISC__FSACCESS_PERMISSIONBITS should not even be in - * <isc/fsaccess.h>. Could check consistency with sizeof(isc_fsaccess_t) - * and the number of bits in each function. - */ -#define STEP (ISC__FSACCESS_PERMISSIONBITS) -#define GROUP (STEP) -#define OTHER (STEP * 2) - -void -isc_fsaccess_add(int trustee, int permission, isc_fsaccess_t *access) { - REQUIRE(trustee <= 0x7); - REQUIRE(permission <= 0xFF); - - if ((trustee & ISC_FSACCESS_OWNER) != 0) - *access |= permission; - - if ((trustee & ISC_FSACCESS_GROUP) != 0) - *access |= (permission << GROUP); - - if ((trustee & ISC_FSACCESS_OTHER) != 0) - *access |= (permission << OTHER); -} - -void -isc_fsaccess_remove(int trustee, int permission, isc_fsaccess_t *access) { - REQUIRE(trustee <= 0x7); - REQUIRE(permission <= 0xFF); - - - if ((trustee & ISC_FSACCESS_OWNER) != 0) - *access &= ~permission; - - if ((trustee & ISC_FSACCESS_GROUP) != 0) - *access &= ~(permission << GROUP); - - if ((trustee & ISC_FSACCESS_OTHER) != 0) - *access &= ~(permission << OTHER); -} - -static isc_result_t -check_bad_bits(isc_fsaccess_t access, isc_boolean_t is_dir) { - isc_fsaccess_t bits; - - /* - * Check for disallowed user bits. - */ - if (is_dir) - bits = ISC_FSACCESS_READ | - ISC_FSACCESS_WRITE | - ISC_FSACCESS_EXECUTE; - else - bits = ISC_FSACCESS_CREATECHILD | - ISC_FSACCESS_ACCESSCHILD | - ISC_FSACCESS_DELETECHILD | - ISC_FSACCESS_LISTDIRECTORY; - - /* - * Set group bad bits. - */ - bits |= bits << STEP; - /* - * Set other bad bits. - */ - bits |= bits << STEP; - - if ((access & bits) != 0) { - if (is_dir) - return (ISC_R_NOTFILE); - else - return (ISC_R_NOTDIRECTORY); - } - - return (ISC_R_SUCCESS); -} diff --git a/usr.sbin/bind/lib/isc/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/include/isc/Makefile.in index 60e7de220e4..72640e58c81 100644 --- a/usr.sbin/bind/lib/isc/include/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/include/isc/Makefile.in @@ -26,7 +26,7 @@ VERSION=@BIND9_VERSION@ HEADERS = aes.h app.h assertions.h base32.h base64.h \ bind9.h boolean.h buffer.h bufferlist.h \ commandline.h errno.h error.h \ - event.h eventclass.h file.h formatcheck.h fsaccess.h \ + event.h eventclass.h formatcheck.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ @ISC_IPV6_H@ iterated_hash.h \ lang.h lex.h lib.h likely.h list.h log.h \ diff --git a/usr.sbin/bind/lib/isc/include/isc/file.h b/usr.sbin/bind/lib/isc/include/isc/file.h deleted file mode 100644 index d523564f5d6..00000000000 --- a/usr.sbin/bind/lib/isc/include/isc/file.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: file.h,v 1.5 2020/01/25 10:58:21 deraadt Exp $ */ - -#ifndef ISC_FILE_H -#define ISC_FILE_H 1 - -/*! \file isc/file.h */ - -#include <stdio.h> - -#include <isc/lang.h> -#include <isc/stat.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_file_settime(const char *file, isc_time_t *time); - -isc_result_t -isc_file_mode(const char *file, mode_t *modep); - -isc_result_t -isc_file_getmodtime(const char *file, isc_time_t *time); -/*!< - * \brief Get the time of last modification of a file. - * - * Notes: - *\li The time that is set is relative to the (OS-specific) epoch, as are - * all isc_time_t structures. - * - * Requires: - *\li file != NULL. - *\li time != NULL. - * - * Ensures: - *\li If the file could not be accessed, 'time' is unchanged. - * - * Returns: - *\li #ISC_R_SUCCESS - * Success. - *\li #ISC_R_NOTFOUND - * No such file exists. - *\li #ISC_R_INVALIDFILE - * The path specified was not usable by the operating system. - *\li #ISC_R_NOPERM - * The file's metainformation could not be retrieved because - * permission was denied to some part of the file's path. - *\li #ISC_R_IOERROR - * Hardware error interacting with the filesystem. - *\li #ISC_R_UNEXPECTED - * Something totally unexpected happened. - * - */ - -isc_result_t -isc_file_mktemplate(const char *path, char *buf, size_t buflen); -/*!< - * \brief Generate a template string suitable for use with isc_file_openunique(). - * - * Notes: - *\li This function is intended to make creating temporary files - * portable between different operating systems. - * - *\li The path is prepended to an implementation-defined string and - * placed into buf. The string has no path characters in it, - * and its maximum length is 14 characters plus a NUL. Thus - * buflen should be at least strlen(path) + 15 characters or - * an error will be returned. - * - * Requires: - *\li buf != NULL. - * - * Ensures: - *\li If result == #ISC_R_SUCCESS: - * buf contains a string suitable for use as the template argument - * to isc_file_openunique(). - * - *\li If result != #ISC_R_SUCCESS: - * buf is unchanged. - * - * Returns: - *\li #ISC_R_SUCCESS Success. - *\li #ISC_R_NOSPACE buflen indicates buf is too small for the catenation - * of the path with the internal template string. - */ - -isc_result_t -isc_file_openunique(char *templet, FILE **fp); -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 - * about the spelling of 'templet', first look it up in the - * Merriam-Webster English dictionary. (http://www.m-w.com/) - * - *\li This function works by using the template to generate file names. - * The template must be a writable string, as it is modified in place. - * Trailing X characters in the file name (full file name on Unix, - * basename on Win32 -- eg, tmp-XXXXXX vs XXXXXX.tmp, respectively) - * are replaced with ASCII characters until a non-existent filename - * is found. If the template does not include pathname information, - * the files in the working directory of the program are searched. - * - *\li isc_file_mktemplate is a good, portable way to get a template. - * - * Requires: - *\li 'fp' is non-NULL and '*fp' is NULL. - * - *\li 'template' is non-NULL, and of a form suitable for use by - * the system as described above. - * - * Ensures: - *\li If result is #ISC_R_SUCCESS: - * *fp points to an stream opening in stdio's "w+" mode. - * - *\li If result is not #ISC_R_SUCCESS: - * *fp is NULL. - * - * No file is open. Even if one was created (but unable - * to be reopened as a stdio FILE pointer) then it has been - * removed. - * - *\li This function does *not* ensure that the template string has not been - * modified, even if the operation was unsuccessful. - * - * Returns: - *\li #ISC_R_SUCCESS - * Success. - *\li #ISC_R_EXISTS - * No file with a unique name could be created based on the - * template. - *\li #ISC_R_INVALIDFILE - * The path specified was not usable by the operating system. - *\li #ISC_R_NOPERM - * The file could not be created because permission was denied - * to some part of the file's path. - *\li #ISC_R_IOERROR - * Hardware error interacting with the filesystem. - *\li #ISC_R_UNEXPECTED - * Something totally unexpected happened. - */ - -isc_result_t -isc_file_remove(const char *filename); -/*!< - * \brief Remove the file named by 'filename'. - */ - -isc_result_t -isc_file_rename(const char *oldname, const char *newname); -/*!< - * \brief Rename the file 'oldname' to 'newname'. - */ - -isc_boolean_t -isc_file_exists(const char *pathname); -/*!< - * \brief Return #ISC_TRUE if the calling process can tell that the given file exists. - * Will not return true if the calling process has insufficient privileges - * to search the entire path. - */ - -isc_boolean_t -isc_file_isabsolute(const char *filename); -/*!< - * \brief Return #ISC_TRUE if the given file name is absolute. - */ - -isc_result_t -isc_file_isplainfile(const char *name); - -isc_result_t -isc_file_isplainfilefd(int fd); -/*!< - * \brief Check that the file is a plain file - * - * Returns: - *\li #ISC_R_SUCCESS - * Success. The file is a plain file. - *\li #ISC_R_INVALIDFILE - * The path specified was not usable by the operating system. - *\li #ISC_R_FILENOTFOUND - * The file does not exist. This return code comes from - * errno=ENOENT when stat returns -1. This code is mentioned - * here, because in logconf.c, it is the one rcode that is - * permitted in addition to ISC_R_SUCCESS. This is done since - * the next call in logconf.c is to isc_stdio_open(), which - * will create the file if it can. - *\li other ISC_R_* errors translated from errno - * These occur when stat returns -1 and an errno. - */ - -isc_result_t -isc_file_isdirectory(const char *name); -/*!< - * \brief Check that 'name' exists and is a directory. - * - * Returns: - *\li #ISC_R_SUCCESS - * Success, file is a directory. - *\li #ISC_R_INVALIDFILE - * File is not a directory. - *\li #ISC_R_FILENOTFOUND - * File does not exist. - *\li other ISC_R_* errors translated from errno - * These occur when stat returns -1 and an errno. - */ - -isc_boolean_t -isc_file_iscurrentdir(const char *filename); -/*!< - * \brief Return #ISC_TRUE if the given file name is the current directory ("."). - */ - -isc_boolean_t -isc_file_ischdiridempotent(const char *filename); -/*%< - * Return #ISC_TRUE if calling chdir(filename) multiple times will give - * the same result as calling it once. - */ - -const char * -isc_file_basename(const char *filename); -/*%< - * Return the final component of the path in the file name. - */ - -isc_result_t -isc_file_progname(const char *filename, char *buf, size_t buflen); -/*!< - * \brief Given an operating system specific file name "filename" - * referring to a program, return the canonical program name. - * - * Any directory prefix or executable file name extension (if - * used on the OS in case) is stripped. On systems where program - * names are case insensitive, the name is canonicalized to all - * lower case. The name is written to 'buf', an array of 'buflen' - * chars, and null terminated. - * - * Returns: - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOSPACE The name did not fit in 'buf'. - */ - -isc_result_t -isc_file_template(const char *path, const char *templet, char *buf, - size_t buflen); -/*%< - * Create an OS specific template using 'path' to define the directory - * 'templet' to describe the filename and store the result in 'buf' - * such that path can be renamed to buf atomically. - */ - -isc_result_t -isc_file_renameunique(const char *file, char *templet); -/*%< - * Rename 'file' using 'templet' as a template for the new file name. - */ - -isc_result_t -isc_file_absolutepath(const char *filename, char *path, size_t pathlen); -/*%< - * Given a file name, return the fully qualified path to the file. - */ - -/* - * XXX We should also have a isc_file_writeeopen() function - * for safely open a file in a publicly writable directory - * (see write_open() in BIND 8's ns_config.c). - */ - -isc_result_t -isc_file_truncate(const char *filename, isc_offset_t size); -/*%< - * Truncate/extend the file specified to 'size' bytes. - */ - -isc_result_t -isc_file_safecreate(const char *filename, FILE **fp); -/*%< - * Open 'filename' for writing, truncating if necessary. Ensure that - * if it existed it was a normal file. If creating the file, ensure - * that only the owner can read/write it. - */ - -isc_result_t -isc_file_splitpath(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 ".". - * - * Allocates memory for '*dirname'. - * - * Returns: - * - ISC_R_SUCCESS on success - * - ISC_R_INVALIDFILE if 'path' is empty or ends with '/' - * - ISC_R_NOMEMORY if unable to allocate memory - */ - -isc_result_t -isc_file_getsize(const char *file, off_t *size); -/*%< - * Return the size of the file (stored in the parameter pointed - * to by 'size') in bytes. - * - * Returns: - * - ISC_R_SUCCESS on success - */ - -isc_result_t -isc_file_getsizefd(int fd, off_t *size); -/*%< - * Return the size of the file (stored in the parameter pointed - * to by 'size') in bytes. - * - * Returns: - * - ISC_R_SUCCESS on success - */ - -void * -isc_file_mmap(void *addr, size_t len, int prot, - int flags, int fd, off_t offset); -/*%< - * Portable front-end to mmap(). If mmap() is not defined on this - * platform, then we simulate it by calling malloc() and read(). - * (In this event, the addr, prot, and flags parameters are ignored). - */ - -int -isc_file_munmap(void *addr, size_t len); -/*%< - * Portable front-end to munmap(). If munmap() is not defined on - * this platform, then we simply free the memory. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_FILE_H */ diff --git a/usr.sbin/bind/lib/isc/include/isc/fsaccess.h b/usr.sbin/bind/lib/isc/include/isc/fsaccess.h deleted file mode 100644 index 5187f4ef11b..00000000000 --- a/usr.sbin/bind/lib/isc/include/isc/fsaccess.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: fsaccess.h,v 1.4 2020/01/09 18:17:19 florian Exp $ */ - -#ifndef ISC_FSACCESS_H -#define ISC_FSACCESS_H 1 - -/*! \file isc/fsaccess.h - * \brief The ISC filesystem access module encapsulates the setting of file - * and directory access permissions into one API that is meant to be - * portable to multiple operating systems. - * - * The two primary operating system flavors that are initially accommodated - * are POSIX and Windows NT 4.0 and later. The Windows NT access model is - * considerable more flexible than POSIX's model (as much as I am loathe to - * admit it), and so the ISC API has a higher degree of complexity than would - * be needed to simply address POSIX's needs. - * - * The full breadth of NT's flexibility is not available either, for the - * present time. Much of it is to provide compatibility with what Unix - * programmers are expecting. This is also due to not yet really needing all - * of the functionality of an NT system (or, for that matter, a POSIX system) - * in BIND9, and so resolving how to handle the various incompatibilities has - * been a purely theoretical exercise with no operational experience to - * indicate how flawed the thinking may be. - * - * Some of the more notable dumbing down of NT for this API includes: - * - *\li Each of FILE_READ_DATA and FILE_READ_EA are set with #ISC_FSACCESS_READ. - * - * \li All of FILE_WRITE_DATA, FILE_WRITE_EA and FILE_APPEND_DATA are - * set with #ISC_FSACCESS_WRITE. FILE_WRITE_ATTRIBUTES is not set - * so as to be consistent with Unix, where only the owner of the file - * or the superuser can change the attributes/mode of a file. - * - * \li Both of FILE_ADD_FILE and FILE_ADD_SUBDIRECTORY are set with - * #ISC_FSACCESS_CREATECHILD. This is similar to setting the WRITE - * permission on a Unix directory. - * - * \li SYNCHRONIZE is always set for files and directories, unless someone - * can give me a reason why this is a bad idea. - * - * \li READ_CONTROL and FILE_READ_ATTRIBUTES are always set; this is - * consistent with Unix, where any file or directory can be stat()'d - * unless the directory path disallows complete access somewhere along - * the way. - * - * \li WRITE_DAC is only set for the owner. This too is consistent with - * Unix, and is tighter security than allowing anyone else to be - * able to set permissions. - * - * \li DELETE is only set for the owner. On Unix the ability to delete - * a file is controlled by the directory permissions, but it isn't - * currently clear to me what happens on NT if the directory has - * FILE_DELETE_CHILD set but a file within it does not have DELETE - * set. Always setting DELETE on the file/directory for the owner - * gives maximum flexibility to the owner without exposing the - * file to deletion by others. - * - * \li WRITE_OWNER is never set. This too is consistent with Unix, - * and is also tighter security than allowing anyone to change the - * ownership of the file apart from the superu..ahem, Administrator. - * - * \li Inheritance is set to NO_INHERITANCE. - * - * Unix's dumbing down includes: - * - * \li The sticky bit cannot be set. - * - * \li setuid and setgid cannot be set. - * - * \li Only regular files and directories can be set. - * - * The rest of this comment discusses a few of the incompatibilities - * between the two systems that need more thought if this API is to - * be extended to accommodate them. - * - * The Windows standard access right "DELETE" doesn't have a direct - * equivalent in the Unix world, so it isn't clear what should be done - * with it. - * - * The Unix sticky bit is not supported. While NT does have a concept - * of allowing users to create files in a directory but not delete or - * rename them, it does not have a concept of allowing them to be deleted - * if they are owned by the user trying to delete/rename. While it is - * probable that something could be cobbled together in NT 5 with inheritance, - * it can't really be done in NT 4 as a single property that you could - * set on a directory. You'd need to coordinate something with file creation - * so that every file created had DELETE set for the owner but noone else. - * - * On Unix systems, setting #ISC_FSACCESS_LISTDIRECTORY sets READ. - * ... setting either #ISC_FSACCESS_CREATECHILD or #ISC_FSACCESS_DELETECHILD - * sets WRITE. - * ... setting #ISC_FSACCESS_ACCESSCHILD sets EXECUTE. - * - * On NT systems, setting #ISC_FSACCESS_LISTDIRECTORY sets FILE_LIST_DIRECTORY. - * ... setting #ISC_FSACCESS_CREATECHILD sets FILE_CREATE_CHILD independently. - * ... setting #ISC_FSACCESS_DELETECHILD sets FILE_DELETE_CHILD independently. - * ... setting #ISC_FSACCESS_ACCESSCHILD sets FILE_TRAVERSE. - * - * Unresolved: XXXDCL - * \li What NT access right controls the ability to rename a file? - * \li How does DELETE work? If a directory has FILE_DELETE_CHILD but a - * file or directory within it does not have DELETE, is that file - * or directory deletable? - * \li To implement isc_fsaccess_get(), mapping an existing Unix permission - * mode_t back to an isc_fsaccess_t is pretty trivial; however, mapping - * an NT DACL could be impossible to do in a responsible way. - * \li Similarly, trying to implement the functionality of being able to - * say "add group writability to whatever permissions already exist" - * could be tricky on NT because of the order-of-entry issue combined - * with possibly having one or more matching ACEs already explicitly - * granting or denying access. Because this functionality is - * not yet needed by the ISC, no code has been written to try to - * solve this problem. - */ - -#include <isc/lang.h> -#include <isc/types.h> - -/* - * Trustees. - */ -#define ISC_FSACCESS_OWNER 0x1 /*%< User account. */ -#define ISC_FSACCESS_GROUP 0x2 /*%< Primary group owner. */ -#define ISC_FSACCESS_OTHER 0x4 /*%< Not the owner or the group owner. */ -#define ISC_FSACCESS_WORLD 0x7 /*%< User, Group, Other. */ - -/* - * Types of permission. - */ -#define ISC_FSACCESS_READ 0x00000001 /*%< File only. */ -#define ISC_FSACCESS_WRITE 0x00000002 /*%< File only. */ -#define ISC_FSACCESS_EXECUTE 0x00000004 /*%< File only. */ -#define ISC_FSACCESS_CREATECHILD 0x00000008 /*%< Dir only. */ -#define ISC_FSACCESS_DELETECHILD 0x00000010 /*%< Dir only. */ -#define ISC_FSACCESS_LISTDIRECTORY 0x00000020 /*%< Dir only. */ -#define ISC_FSACCESS_ACCESSCHILD 0x00000040 /*%< Dir only. */ - -/*% - * Adding any permission bits beyond 0x200 would mean typedef'ing - * isc_fsaccess_t as uint64_t, and redefining this value to - * reflect the new range of permission types, Probably to 21 for - * maximum flexibility. The number of bits has to accommodate all of - * the permission types, and three full sets of them have to fit - * within an isc_fsaccess_t. - */ -#define ISC__FSACCESS_PERMISSIONBITS 10 - -ISC_LANG_BEGINDECLS - -void -isc_fsaccess_add(int trustee, int permission, isc_fsaccess_t *access); - -void -isc_fsaccess_remove(int trustee, int permission, isc_fsaccess_t *access); - -isc_result_t -isc_fsaccess_set(const char *path, isc_fsaccess_t access); - -ISC_LANG_ENDDECLS - -#endif /* ISC_FSACCESS_H */ diff --git a/usr.sbin/bind/lib/isc/lex.c b/usr.sbin/bind/lib/isc/lex.c index 4e478b2890f..a3965e3d5cd 100644 --- a/usr.sbin/bind/lib/isc/lex.c +++ b/usr.sbin/bind/lib/isc/lex.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.15 2020/01/22 13:02:10 florian Exp $ */ +/* $Id: lex.c,v 1.16 2020/01/26 11:23:42 florian Exp $ */ /*! \file */ @@ -25,7 +25,7 @@ #include <stdlib.h> #include <isc/buffer.h> -#include <isc/file.h> + #include <isc/lex.h> #include <isc/msgs.h> diff --git a/usr.sbin/bind/lib/isc/log.c b/usr.sbin/bind/lib/isc/log.c index 9485104809e..65ef138f73f 100644 --- a/usr.sbin/bind/lib/isc/log.c +++ b/usr.sbin/bind/lib/isc/log.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.21 2020/01/26 11:21:58 florian Exp $ */ +/* $Id: log.c,v 1.22 2020/01/26 11:23:42 florian Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -29,7 +29,7 @@ #include <sys/types.h> /* dev_t FreeBSD 2.1 */ #include <isc/dir.h> -#include <isc/file.h> + #include <isc/log.h> #include <isc/magic.h> #include <isc/msgs.h> diff --git a/usr.sbin/bind/lib/isc/regex.c b/usr.sbin/bind/lib/isc/regex.c index df73e2fdffd..4344a8b0339 100644 --- a/usr.sbin/bind/lib/isc/regex.c +++ b/usr.sbin/bind/lib/isc/regex.c @@ -16,7 +16,7 @@ -#include <isc/file.h> + #include <isc/regex.h> #include <string.h> |