From 0baae61e4233bc812c65c3646b1acf15ef7bc22f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 10 Apr 2024 13:02:39 +0200 Subject: [PATCH] lib: Give lib/util/util_file.c its own header file Signed-off-by: Volker Lendecke Reviewed-by: Martin Schwenke --- auth/credentials/credentials.c | 1 + ctdb/common/ctdb_util.c | 1 + ctdb/server/ctdb_takeover.c | 1 + ctdb/tests/src/fake_ctdbd.c | 1 + ctdb/tools/ctdb.c | 1 + lib/fuzzing/afl-fuzz-main.c | 2 +- lib/util/samba_util.h | 55 -------------- lib/util/tests/file.c | 1 + lib/util/util_file.c | 1 + lib/util/util_file.h | 80 +++++++++++++++++++++ libcli/nbt/lmhosts.c | 1 + libcli/netlogon/netlogon.c | 1 + libgpo/gpo_ini.c | 1 + librpc/rpc/dcerpc_pkt_auth.c | 1 + librpc/rpc/dcerpc_util.c | 1 + librpc/tools/ndrdump.c | 1 + librpc/wsp/wsp_util.c | 1 + source3/auth/user_util.c | 1 + source3/client/clitar.c | 1 + source3/lib/dumpcore.c | 1 + source3/lib/util_file.c | 3 +- source3/libgpo/gpext/registry.c | 1 + source3/modules/vfs_fruit.c | 1 + source3/modules/vfs_glusterfs.c | 1 + source3/modules/vfs_shell_snap.c | 1 + source3/nmbd/nmbd_synclists.c | 1 + source3/nmbd/nmbd_winsserver.c | 1 + source3/param/loadparm.c | 1 + source3/passdb/machine_sid.c | 1 + source3/printing/nt_printing_os2.c | 1 + source3/printing/print_generic.c | 1 + source3/printing/print_standard.c | 1 + source3/rpc_server/rpc_host.c | 1 + source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 + source3/smbd/smb1_lanman.c | 1 + source3/torture/torture.c | 1 + source3/utils/net_ads.c | 1 + source3/utils/net_eventlog.c | 1 + source3/utils/net_offlinejoin.c | 1 + source3/utils/net_usershare.c | 1 + source3/utils/smbcacls.c | 1 + source4/lib/registry/patchfile_dotreg.c | 1 + source4/lib/registry/regf.c | 4 +- source4/lib/tls/tls_tstream.c | 1 + source4/lib/tls/tlscert.c | 1 + source4/libcli/dgram/browse.c | 1 + source4/libcli/dgram/netlogon.c | 1 + source4/librpc/rpc/dcerpc.c | 1 + source4/torture/auth/pac.c | 1 + source4/torture/basic/misc.c | 1 + source4/torture/drs/rpc/dssync.c | 1 + source4/torture/gentest.c | 1 + source4/torture/locktest.c | 1 + source4/torture/smbtorture.c | 1 + source4/torture/util_smb.c | 1 + 55 files changed, 136 insertions(+), 58 deletions(-) create mode 100644 lib/util/util_file.h diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 20ab858e67b..6a590483e99 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */ #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_internal.h" diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 3ca1f772eba..ebf0203871f 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -21,6 +21,7 @@ #include "system/network.h" #include "system/filesys.h" #include "system/wait.h" +#include "lib/util/util_file.h" #include diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 79445ec4899..0f7ac756497 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -30,6 +30,7 @@ #include "lib/util/dlinklist.h" #include "lib/util/debug.h" #include "lib/util/samba_util.h" +#include "lib/util/util_file.h" #include "lib/util/sys_rw.h" #include "lib/util/util_process.h" diff --git a/ctdb/tests/src/fake_ctdbd.c b/ctdb/tests/src/fake_ctdbd.c index a569b0686c3..1b44f1de688 100644 --- a/ctdb/tests/src/fake_ctdbd.c +++ b/ctdb/tests/src/fake_ctdbd.c @@ -31,6 +31,7 @@ #include "lib/util/tevent_unix.h" #include "lib/util/debug.h" #include "lib/util/samba_util.h" +#include "lib/util/util_file.h" #include "lib/async_req/async_sock.h" #include "protocol/protocol.h" diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 3c4bb7ef45d..1e438d9c1c0 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -33,6 +33,7 @@ #include "version.h" #include "lib/util/debug.h" #include "lib/util/samba_util.h" +#include "lib/util/util_file.h" #include "lib/util/sys_rw.h" #include "lib/util/smb_strtox.h" diff --git a/lib/fuzzing/afl-fuzz-main.c b/lib/fuzzing/afl-fuzz-main.c index e0a1d264fc4..7de30b7b660 100644 --- a/lib/fuzzing/afl-fuzz-main.c +++ b/lib/fuzzing/afl-fuzz-main.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "lib/util/samba_util.h" +#include "lib/util/util_file.h" #include "fuzzing.h" int main(int argc, char *argv[]) { diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index e672b4b00b2..81e6b6f9c39 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -366,61 +366,6 @@ const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx, const char *string, const char *sep); -/* The following definitions come from lib/util/util_file.c */ - - -/** - * Read one line (data until next newline or eof) and allocate it - */ -_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint); - -char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, size_t maxlen, FILE *f); - -/** -load a file into memory from a fd. -**/ -_PUBLIC_ char *fd_load(int fd, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx); - - -char **file_lines_parse(const char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx); - -/** -load a file into memory -**/ -_PUBLIC_ char *file_load(const char *fname, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx); - -/** -load a file into memory and return an array of pointers to lines in the file -must be freed with talloc_free(). -**/ -_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx); - -/** -load a fd into memory and return an array of pointers to lines in the file -must be freed with talloc_free(). If convert is true calls unix_to_dos on -the list. -**/ -_PUBLIC_ char **fd_lines_load(int fd, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx); - -_PUBLIC_ bool file_save_mode(const char *fname, const void *packet, - size_t length, mode_t mode); -/** - save a lump of data into a file. Mostly used for debugging -*/ -_PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length); -_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); -_PUBLIC_ int fdprintf(int fd, const char *format, ...) PRINTF_ATTRIBUTE(2,3); - -/* - compare two files, return true if the two files have the same content - */ -bool file_compare(const char *path1, const char *path2); - -/* - load from a pipe into memory. - */ -char *file_ploadv(char * const argl[], size_t *size); - /* The following definitions come from lib/util/util.c */ diff --git a/lib/util/tests/file.c b/lib/util/tests/file.c index 3501c7e135f..a6d1929fb51 100644 --- a/lib/util/tests/file.c +++ b/lib/util/tests/file.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "torture/torture.h" #include "torture/local/proto.h" diff --git a/lib/util/util_file.c b/lib/util/util_file.c index 0e54dffcbf2..221d5a49fdb 100644 --- a/lib/util/util_file.c +++ b/lib/util/util_file.c @@ -24,6 +24,7 @@ #include "system/filesys.h" #include #include "lib/util/samba_util.h" +#include "lib/util/util_file.h" #include "lib/util/sys_popen.h" #include "lib/util/sys_rw.h" #include "lib/util/debug.h" diff --git a/lib/util/util_file.h b/lib/util/util_file.h new file mode 100644 index 00000000000..fa8c599d1af --- /dev/null +++ b/lib/util/util_file.h @@ -0,0 +1,80 @@ +/* + * Unix SMB/CIFS implementation. + * SMB parameters and setup + * Copyright (C) Andrew Tridgell 1992-1998 Modified by Jeremy Allison 1995. + * + * Added afdgets() Jelmer Vernooij 2005 + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see . + */ + +#ifndef __LIB_UTIL_UTIL_FILE_H__ +#define __LIB_UTIL_UTIL_FILE_H__ + +#include "replace.h" +#include + +/** + * Read one line (data until next newline or eof) and allocate it + */ +_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint); + +char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, size_t maxlen, FILE *f); + +/** +load a file into memory from a fd. +**/ +_PUBLIC_ char *fd_load(int fd, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx); + +/** +load a file into memory +**/ +_PUBLIC_ char *file_load(const char *fname, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx); + +/** +load a file into memory and return an array of pointers to lines in the file +must be freed with talloc_free(). +**/ +_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx); + +/** +load a fd into memory and return an array of pointers to lines in the file +must be freed with talloc_free(). If convert is true calls unix_to_dos on +the list. +**/ +_PUBLIC_ char **fd_lines_load(int fd, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx); + +char **file_lines_parse(const char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx); + +_PUBLIC_ bool file_save_mode(const char *fname, const void *packet, + size_t length, mode_t mode); + +/** + save a lump of data into a file. Mostly used for debugging +*/ +_PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length); +_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); +_PUBLIC_ int fdprintf(int fd, const char *format, ...) PRINTF_ATTRIBUTE(2,3); + +/* + compare two files, return true if the two files have the same content + */ +bool file_compare(const char *path1, const char *path2); + +/* + load from a pipe into memory. + */ +char *file_ploadv(char * const argl[], size_t *size); + +#endif diff --git a/libcli/nbt/lmhosts.c b/libcli/nbt/lmhosts.c index dd06e70c071..ef7229b99bf 100644 --- a/libcli/nbt/lmhosts.c +++ b/libcli/nbt/lmhosts.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/util/util_net.h" #include "system/filesys.h" #include "system/network.h" diff --git a/libcli/netlogon/netlogon.c b/libcli/netlogon/netlogon.c index 15e808743d1..417991ada79 100644 --- a/libcli/netlogon/netlogon.c +++ b/libcli/netlogon/netlogon.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "../libcli/netlogon/netlogon.h" NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, diff --git a/libgpo/gpo_ini.c b/libgpo/gpo_ini.c index 66f743e52a0..6926d3de74a 100644 --- a/libgpo/gpo_ini.c +++ b/libgpo/gpo_ini.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "gpo.h" #include "gpo_ini.h" #include "system/filesys.h" diff --git a/librpc/rpc/dcerpc_pkt_auth.c b/librpc/rpc/dcerpc_pkt_auth.c index 5eb9c445ab2..d7f7510c807 100644 --- a/librpc/rpc/dcerpc_pkt_auth.c +++ b/librpc/rpc/dcerpc_pkt_auth.c @@ -22,6 +22,7 @@ #include "replace.h" #include "system/network.h" #include +#include "lib/util/util_file.h" #include "lib/util/talloc_stack.h" #include "lib/util/debug.h" #include "lib/util/byteorder.h" diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c index e6f7fa634a9..66b38a4acf2 100644 --- a/librpc/rpc/dcerpc_util.c +++ b/librpc/rpc/dcerpc_util.c @@ -23,6 +23,7 @@ #include "system/network.h" #include #include "lib/tsocket/tsocket.h" +#include "lib/util/util_file.h" #include "lib/util/tevent_ntstatus.h" #include "librpc/rpc/dcerpc.h" #include "librpc/rpc/dcerpc_util.h" diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c index f706510f4de..5a45f0a5d1d 100644 --- a/librpc/tools/ndrdump.c +++ b/librpc/tools/ndrdump.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "system/locale.h" #include "librpc/ndr/libndr.h" diff --git a/librpc/wsp/wsp_util.c b/librpc/wsp/wsp_util.c index fae6e0b2fe3..d07338b1b5a 100644 --- a/librpc/wsp/wsp_util.c +++ b/librpc/wsp/wsp_util.c @@ -19,6 +19,7 @@ * along with this program; if not, see . */ #include "includes.h" +#include "lib/util/util_file.h" #include "librpc/wsp/wsp_util.h" #include "librpc/gen_ndr/wsp.h" #include "librpc/gen_ndr/ndr_wsp.h" diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c index cd97d62af4b..133993aac69 100644 --- a/source3/auth/user_util.c +++ b/source3/auth/user_util.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "auth.h" #include "lib/gencache.h" diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 14b98111b75..7e54b7bc2e8 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -71,6 +71,7 @@ #include "client/client_proto.h" #include "client/clitar_proto.h" #include "libsmb/libsmb.h" +#include "lib/util/util_file.h" #ifdef HAVE_LIBARCHIVE diff --git a/source3/lib/dumpcore.c b/source3/lib/dumpcore.c index 0c9120689df..3ed6b8965ce 100644 --- a/source3/lib/dumpcore.c +++ b/source3/lib/dumpcore.c @@ -26,6 +26,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #ifdef HAVE_SYS_SYSCTL_H diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index ba96eeee365..5d6afc3c0b1 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -18,7 +18,8 @@ */ #include "replace.h" -#include "lib/util_file.h" +#include "lib/util/util_file.h" +#include "source3/lib/util_file.h" #include "lib/util/debug.h" #include "lib/util/samba_util.h" #include "lib/util/sys_rw.h" diff --git a/source3/libgpo/gpext/registry.c b/source3/libgpo/gpext/registry.c index ffa1d020fb6..d04262c4c84 100644 --- a/source3/libgpo/gpext/registry.c +++ b/source3/libgpo/gpext/registry.c @@ -24,6 +24,7 @@ #include "registry.h" #include "../librpc/gen_ndr/ndr_preg.h" #include "libgpo/gpext/gpext.h" +#include "lib/util/util_file.h" #define GP_EXT_NAME "registry" diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 4ab0f46a4e6..b63fff7f95d 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -30,6 +30,7 @@ #include "../libcli/smb/smb2_create_ctx.h" #include "lib/util/tevent_ntstatus.h" #include "lib/util/tevent_unix.h" +#include "lib/util/util_file.h" #include "offload_token.h" #include "string_replace.h" #include "hash_inode.h" diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 235329f090d..00b4cdd4698 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -41,6 +41,7 @@ #include #include "lib/util/dlinklist.h" #include "lib/util/tevent_unix.h" +#include "lib/util/util_file.h" #include "smbd/globals.h" #include "lib/util/sys_rw.h" #include "smbprofile.h" diff --git a/source3/modules/vfs_shell_snap.c b/source3/modules/vfs_shell_snap.c index d1b7b8c1fd1..df2ea2aa541 100644 --- a/source3/modules/vfs_shell_snap.c +++ b/source3/modules/vfs_shell_snap.c @@ -21,6 +21,7 @@ #include "include/ntioctl.h" #include "system/filesys.h" #include "smbd/smbd.h" +#include "lib/util/util_file.h" /* * Check whether a path can be shadow copied. Return the base volume, allowing diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 0f5c42f6a79..f94e41c9af4 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -33,6 +33,7 @@ #include "libsmb/clirap.h" #include "../libcli/smb/smbXcli_base.h" #include "lib/util/string_wrappers.h" +#include "lib/util/util_file.h" #include "source3/lib/substitute.h" struct sync_record { diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index ecae4476195..4d4f19fef8b 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -24,6 +24,7 @@ #include "system/filesys.h" #include "nmbd/nmbd.h" #include "util_tdb.h" +#include "lib/util/util_file.h" #define WINS_LIST "wins.dat" #define WINS_VERSION 1 diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a67fc8cf51e..414d19d7439 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -55,6 +55,7 @@ #define LOADPARM_SUBSTITUTION_INTERNALS 1 #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "util_tdb.h" #include "lib/param/loadparm.h" diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index fa420d8edfe..16ef6ce266c 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "passdb/machine_sid.h" #include "secrets.h" #include "dbwrap/dbwrap.h" diff --git a/source3/printing/nt_printing_os2.c b/source3/printing/nt_printing_os2.c index 82b82482031..0e1d3e47fd0 100644 --- a/source3/printing/nt_printing_os2.c +++ b/source3/printing/nt_printing_os2.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "printing/nt_printing_os2.h" /**************************************************************************** diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index 8798a4cf34a..a8bf9aff972 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "printing.h" #include "smbd/proto.h" #include "source3/lib/substitute.h" diff --git a/source3/printing/print_standard.c b/source3/printing/print_standard.c index 7cbdac7b257..4a37a4e7ec6 100644 --- a/source3/printing/print_standard.c +++ b/source3/printing/print_standard.c @@ -55,6 +55,7 @@ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "printing/pcap.h" diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c index 1e891b4faaa..7c5785f3a3b 100644 --- a/source3/rpc_server/rpc_host.c +++ b/source3/rpc_server/rpc_host.c @@ -54,6 +54,7 @@ #include "lib/util/debug.h" #include "lib/util/server_id.h" #include "lib/util/util_tdb.h" +#include "lib/util/util_file.h" #include "lib/tdb_wrap/tdb_wrap.h" #include "lib/async_req/async_sock.h" #include "librpc/rpc/dcerpc_util.h" diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 16b8b41f87c..5b75df823b6 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -28,6 +28,7 @@ up, all the errors returned are DOS errors, not NT status codes. */ #include "includes.h" +#include "lib/util/util_file.h" #include "libsmb/namequery.h" #include "ntdomain.h" #include "nt_printing.h" diff --git a/source3/smbd/smb1_lanman.c b/source3/smbd/smb1_lanman.c index 846d6f3b900..8bcddcbb8c2 100644 --- a/source3/smbd/smb1_lanman.c +++ b/source3/smbd/smb1_lanman.c @@ -26,6 +26,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "smbd/smbd.h" #include "smbd/globals.h" #include "source3/smbd/smbXsrv_session.h" diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 86a6e928e14..f036e0311e2 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -48,6 +48,7 @@ #include "lib/gencache.h" #include "lib/util/sys_rw.h" #include "lib/util/asn1.h" +#include "lib/util/util_file.h" #include "lib/param/param.h" #include "auth/gensec/gensec.h" #include "lib/util/string_wrappers.h" diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 43fa0261ad9..d1a0b93469f 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -42,6 +42,7 @@ #include "utils/net_dns.h" #include "auth/kerberos/pac_utils.h" #include "lib/util/string_wrappers.h" +#include "lib/util/util_file.h" #ifdef HAVE_JANSSON #include diff --git a/source3/utils/net_eventlog.c b/source3/utils/net_eventlog.c index 24dbab97cab..932b341f84b 100644 --- a/source3/utils/net_eventlog.c +++ b/source3/utils/net_eventlog.c @@ -22,6 +22,7 @@ #include "includes.h" #include "utils/net.h" #include "lib/eventlog/eventlog.h" +#include "lib/util/util_file.h" /** * Dump an *evt win32 eventlog file diff --git a/source3/utils/net_offlinejoin.c b/source3/utils/net_offlinejoin.c index 3ec5c97adca..a12817c3fc1 100644 --- a/source3/utils/net_offlinejoin.c +++ b/source3/utils/net_offlinejoin.c @@ -24,6 +24,7 @@ #include "libcli/registry/util_reg.h" #include "libcli/security/dom_sid.h" #include "lib/cmdline/cmdline.h" +#include "lib/util/util_file.h" int net_offlinejoin_usage(struct net_context *c, int argc, const char **argv) { diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index e5826eeecf1..74588822434 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -24,6 +24,7 @@ #include "utils/net.h" #include "../libcli/security/security.h" #include "lib/util/string_wrappers.h" +#include "lib/util/util_file.h" struct { const char *us_errstr; diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 0c1d2b38c93..708e03a120a 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -34,6 +34,7 @@ #include "../librpc/gen_ndr/ndr_lsa_c.h" #include "util_sd.h" #include "lib/param/param.h" +#include "lib/util/util_file.h" static char DIRSEP_CHAR = '\\'; diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 5fb342b65b5..632622354f4 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -26,6 +26,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/registry/registry.h" #include "system/filesys.h" diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index d0fc2a98d30..18734ae6f60 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "system/time.h" #include "lib/registry/tdr_regf.h" @@ -2218,7 +2219,8 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, pull = tdr_pull_init(regf); - pull->data.data = (uint8_t*)fd_load(regf->fd, &pull->data.length, 0, regf); + pull->data.data = (uint8_t*) + fd_load(regf->fd, &pull->data.length, 0, regf); if (pull->data.data == NULL) { DEBUG(0, ("Error reading data from file: %s\n", location)); diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c index 5e0c56b0102..41fd6cce5e3 100644 --- a/source4/lib/tls/tls_tstream.c +++ b/source4/lib/tls/tls_tstream.c @@ -21,6 +21,7 @@ #include "system/network.h" #include "system/filesys.h" #include "system/time.h" +#include "lib/util/util_file.h" #include "../util/tevent_unix.h" #include "../lib/tsocket/tsocket.h" #include "../lib/tsocket/tsocket_internal.h" diff --git a/source4/lib/tls/tlscert.c b/source4/lib/tls/tlscert.c index 36482e3aaaf..69a4189dedf 100644 --- a/source4/lib/tls/tlscert.c +++ b/source4/lib/tls/tlscert.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/tls/tls.h" #include diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c index 437b6e13e86..39892bb05c9 100644 --- a/source4/libcli/dgram/browse.c +++ b/source4/libcli/dgram/browse.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" #include "libcli/resolve/resolve.h" diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 1124a3318ba..bda03985684 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" #include "libcli/resolve/resolve.h" diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 802759c72b2..58f00b7f9d2 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/filesys.h" #include "../lib/util/dlinklist.h" #include "lib/events/events.h" diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c index 8ba8ed43c37..0c96e82559c 100644 --- a/source4/torture/auth/pac.c +++ b/source4/torture/auth/pac.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "system/kerberos.h" #include "auth/auth.h" #include "auth/kerberos/kerberos.h" diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 60af5612d1e..4f2d74c41a8 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "libcli/raw/libcliraw.h" #include "libcli/raw/raw_proto.h" #include "system/time.h" diff --git a/source4/torture/drs/rpc/dssync.c b/source4/torture/drs/rpc/dssync.c index 64d04980bc7..689ebd4faa4 100644 --- a/source4/torture/drs/rpc/dssync.c +++ b/source4/torture/drs/rpc/dssync.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/cmdline/cmdline.h" #include "librpc/gen_ndr/ndr_drsuapi_c.h" #include "librpc/gen_ndr/ndr_drsblobs.h" diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index a832c597379..22b94ccc944 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/cmdline/cmdline.h" #include "lib/events/events.h" #include "system/time.h" diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 11701a975bb..b720261e565 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/cmdline/cmdline.h" #include "lib/events/events.h" #include "system/filesys.h" diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index d9e90eab40d..ad1280be7d8 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/cmdline/cmdline.h" #include "system/time.h" #include "system/wait.h" diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 6924164e2a4..3bad0b0ed40 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/util/util_file.h" #include "lib/cmdline/cmdline.h" #include "libcli/raw/libcliraw.h" #include "libcli/raw/raw_proto.h"