[PATCH] some cleanups
Volker Lendecke
vl at samba.org
Thu Nov 17 06:35:52 UTC 2016
On Thu, Nov 17, 2016 at 07:28:54AM +0100, Volker Lendecke wrote:
> Hi!
>
> Review appreciated!
>
> Thanks, Volker
Now with patch.
Volker
-------------- next part --------------
>From 205aa19ac9a975da56b01a22c08557257da28622 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 15:22:46 +0000
Subject: [PATCH 1/6] ntlm_auth: Avoid some statics
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/utils/ntlm_auth.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index a5c1844..90dc97d 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -2254,12 +2254,12 @@ enum {
{
TALLOC_CTX *frame = talloc_stackframe();
int opt;
- static const char *helper_protocol;
- static int diagnostics;
+ const char *helper_protocol = NULL;
+ int diagnostics = 0;
- static const char *hex_challenge;
- static const char *hex_lm_response;
- static const char *hex_nt_response;
+ const char *hex_challenge = NULL;
+ const char *hex_lm_response = NULL;
+ const char *hex_nt_response = NULL;
struct loadparm_context *lp_ctx;
poptContext pc;
--
2.1.4
>From 9cb406480072c3cd9614fa4e0495d9f007e4398f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 15:39:21 +0000
Subject: [PATCH 2/6] lib: Rename fgets_slash to x_fgets_slash
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/samba_util.h | 2 +-
lib/util/util_file.c | 4 ++--
libcli/nbt/lmhosts.c | 2 +-
source3/auth/user_util.c | 2 +-
source3/nmbd/nmbd_synclists.c | 2 +-
source3/nmbd/nmbd_winsserver.c | 2 +-
source3/printing/print_aix.c | 2 +-
source3/printing/print_standard.c | 3 ++-
8 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 416fde8..74adb25 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -337,7 +337,7 @@ read a line from a file with possible \ continuation chars.
Blanks at the start or end of a line are stripped.
The string will be allocated if s2 is NULL
**/
-_PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f);
+_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f);
/**
* Read one line (data until next newline or eof) and allocate it
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 1ec3582..cad917b 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -36,7 +36,7 @@ read a line from a file with possible \ continuation chars.
Blanks at the start or end of a line are stripped.
The string will be allocated if s2 is NULL
**/
-_PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
+_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f)
{
char *s=s2;
int len = 0;
@@ -97,7 +97,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
maxlen *= 2;
t = realloc_p(s, char, maxlen);
if (!t) {
- DEBUG(0,("fgets_slash: failed to expand buffer!\n"));
+ DBG_ERR("failed to expand buffer!\n");
SAFE_FREE(s);
return(NULL);
} else s = t;
diff --git a/libcli/nbt/lmhosts.c b/libcli/nbt/lmhosts.c
index 3e746f0..e68dc08 100644
--- a/libcli/nbt/lmhosts.c
+++ b/libcli/nbt/lmhosts.c
@@ -66,7 +66,7 @@ bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type,
*name_type = -1;
- if (!fgets_slash(line,sizeof(line),fp)) {
+ if (!x_fgets_slash(line,sizeof(line),fp)) {
continue;
}
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index d5c61b2..79b193e 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
@@ -361,7 +361,7 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
DEBUG(4,("Scanning username map %s\n",mapfile));
- while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) {
+ while((s=x_fgets_slash(buf,sizeof(buf),f))!=NULL) {
char *unixname = s;
char *dosname = strchr_m(unixname,'=');
char **dosuserlist;
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index f3e524d..1c2b04d 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -262,7 +262,7 @@ static void complete_sync(struct sync_record *s)
while (!x_feof(f)) {
TALLOC_CTX *frame = NULL;
- if (!fgets_slash(line,sizeof(line),f))
+ if (!x_fgets_slash(line,sizeof(line),f))
continue;
ptr = line;
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index cdec10e..cd4ff42 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -655,7 +655,7 @@ bool initialise_wins(void)
/* Read a line from the wins.dat file. Strips whitespace
from the beginning and end of the line. */
- if (!fgets_slash(line,sizeof(line),fp)) {
+ if (!x_fgets_slash(line,sizeof(line),fp)) {
continue;
}
diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c
index 927a71b..da47be0 100644
--- a/source3/printing/print_aix.c
+++ b/source3/printing/print_aix.c
@@ -52,7 +52,7 @@ bool aix_cache_reload(struct pcap_cache **_pcache)
iEtat = 0;
/* scan qconfig file for searching <printername>: */
- for (;(line = fgets_slash(NULL, 1024, pfile)); free(line)) {
+ for (;(line = x_fgets_slash(NULL, 1024, pfile)); free(line)) {
bool ok;
if (*line == '*' || *line == 0)
diff --git a/source3/printing/print_standard.c b/source3/printing/print_standard.c
index 140ca70..080ef07 100644
--- a/source3/printing/print_standard.c
+++ b/source3/printing/print_standard.c
@@ -73,7 +73,8 @@ bool std_pcap_cache_reload(const char *pcap_name, struct pcap_cache **_pcache)
return false;
}
- for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; free(pcap_line)) {
+ for (; (pcap_line = x_fgets_slash(NULL, 1024, pcap_file)) != NULL;
+ free(pcap_line)) {
char *name = NULL;
char *comment = NULL;
char *p, *q;
--
2.1.4
>From d0df6da02fc88e332c6a7ba12b69388781b78cc0 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 15:47:08 +0000
Subject: [PATCH 3/6] lib: Reformat x_fgets_slash
This is so old code that I'd like to move somewhere else next, but before
that I'd like to clean it up a bit.
No code change, just indentation changed and some {} added.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/util_file.c | 132 ++++++++++++++++++++++++++-------------------------
1 file changed, 68 insertions(+), 64 deletions(-)
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index cad917b..4777951 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -38,72 +38,76 @@ The string will be allocated if s2 is NULL
**/
_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f)
{
- char *s=s2;
- int len = 0;
- int c;
- bool start_of_line = true;
-
- if (x_feof(f))
- return(NULL);
-
- if (maxlen <2) return(NULL);
-
- if (!s2)
- {
- maxlen = MIN(maxlen,8);
- s = (char *)malloc(maxlen);
- }
-
- if (!s) return(NULL);
-
- *s = 0;
-
- while (len < maxlen-1)
- {
- c = x_getc(f);
- switch (c)
- {
- case '\r':
- break;
- case '\n':
- while (len > 0 && s[len-1] == ' ')
- {
- s[--len] = 0;
- }
- if (len > 0 && s[len-1] == '\\')
- {
- s[--len] = 0;
- start_of_line = true;
- break;
- }
- return(s);
- case EOF:
- if (len <= 0 && !s2)
- SAFE_FREE(s);
- return(len>0?s:NULL);
- case ' ':
- if (start_of_line)
- break;
- /* fall through */
- default:
- start_of_line = false;
- s[len++] = c;
- s[len] = 0;
+ char *s=s2;
+ int len = 0;
+ int c;
+ bool start_of_line = true;
+
+ if (x_feof(f)) {
+ return(NULL);
+ }
+
+ if (maxlen <2) {
+ return(NULL);
+ }
+
+ if (!s2) {
+ maxlen = MIN(maxlen,8);
+ s = (char *)malloc(maxlen);
}
- if (!s2 && len > maxlen-3)
- {
- char *t;
-
- maxlen *= 2;
- t = realloc_p(s, char, maxlen);
- if (!t) {
- DBG_ERR("failed to expand buffer!\n");
- SAFE_FREE(s);
- return(NULL);
- } else s = t;
+
+ if (!s) {
+ return(NULL);
+ }
+
+ *s = 0;
+
+ while (len < maxlen-1) {
+ c = x_getc(f);
+ switch (c)
+ {
+ case '\r':
+ break;
+ case '\n':
+ while (len > 0 && s[len-1] == ' ') {
+ s[--len] = 0;
+ }
+ if (len > 0 && s[len-1] == '\\') {
+ s[--len] = 0;
+ start_of_line = true;
+ break;
+ }
+ return(s);
+ case EOF:
+ if (len <= 0 && !s2) {
+ SAFE_FREE(s);
+ }
+ return(len>0?s:NULL);
+ case ' ':
+ if (start_of_line) {
+ break;
+ }
+ /* fall through */
+ default:
+ start_of_line = false;
+ s[len++] = c;
+ s[len] = 0;
+ }
+ if (!s2 && len > maxlen-3) {
+ char *t;
+
+ maxlen *= 2;
+ t = realloc_p(s, char, maxlen);
+ if (!t) {
+ DBG_ERR("failed to expand buffer!\n");
+ SAFE_FREE(s);
+ return(NULL);
+ } else {
+ s = t;
+ }
+ }
}
- }
- return(s);
+ return(s);
}
/**
--
2.1.4
>From 0313edbd803d266f5e83da76424e0ab2403cd6e4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 15:53:45 +0000
Subject: [PATCH 4/6] lib: Apply an overflow check
Very unlikely here, as the realloc will have failed long before, but
still I would like to check overflow.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/util_file.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 4777951..52749ea 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -94,17 +94,25 @@ _PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f)
s[len] = 0;
}
if (!s2 && len > maxlen-3) {
+ int m;
char *t;
- maxlen *= 2;
+ m = maxlen * 2;
+ if (m < maxlen) {
+ DBG_ERR("length overflow");
+ SAFE_FREE(s);
+ return NULL;
+ }
+ maxlen = m;
+
t = realloc_p(s, char, maxlen);
if (!t) {
DBG_ERR("failed to expand buffer!\n");
SAFE_FREE(s);
return(NULL);
- } else {
- s = t;
}
+
+ s = t;
}
}
return(s);
--
2.1.4
>From f400f4752177a6977212544c66a6b618531c88af Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 16:54:38 +0000
Subject: [PATCH 5/6] lib: Move x_fgets_slash to xfile.c
This makes it easier to remove the global #include xfile.h
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/samba_util.h | 7 ----
lib/util/util_file.c | 92 -------------------------------------------------
lib/util/xfile.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/util/xfile.h | 7 ++++
4 files changed, 101 insertions(+), 99 deletions(-)
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 74adb25..2f8de9e 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -333,13 +333,6 @@ const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx,
/**
-read a line from a file with possible \ continuation chars.
-Blanks at the start or end of a line are stripped.
-The string will be allocated if s2 is NULL
-**/
-_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f);
-
-/**
* Read one line (data until next newline or eof) and allocate it
*/
_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint);
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 52749ea..4948afb 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -27,98 +27,6 @@
#include "lib/util/debug.h"
/**
- * @file
- * @brief File-related utility functions
- */
-
-/**
-read a line from a file with possible \ continuation chars.
-Blanks at the start or end of a line are stripped.
-The string will be allocated if s2 is NULL
-**/
-_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f)
-{
- char *s=s2;
- int len = 0;
- int c;
- bool start_of_line = true;
-
- if (x_feof(f)) {
- return(NULL);
- }
-
- if (maxlen <2) {
- return(NULL);
- }
-
- if (!s2) {
- maxlen = MIN(maxlen,8);
- s = (char *)malloc(maxlen);
- }
-
- if (!s) {
- return(NULL);
- }
-
- *s = 0;
-
- while (len < maxlen-1) {
- c = x_getc(f);
- switch (c)
- {
- case '\r':
- break;
- case '\n':
- while (len > 0 && s[len-1] == ' ') {
- s[--len] = 0;
- }
- if (len > 0 && s[len-1] == '\\') {
- s[--len] = 0;
- start_of_line = true;
- break;
- }
- return(s);
- case EOF:
- if (len <= 0 && !s2) {
- SAFE_FREE(s);
- }
- return(len>0?s:NULL);
- case ' ':
- if (start_of_line) {
- break;
- }
- /* fall through */
- default:
- start_of_line = false;
- s[len++] = c;
- s[len] = 0;
- }
- if (!s2 && len > maxlen-3) {
- int m;
- char *t;
-
- m = maxlen * 2;
- if (m < maxlen) {
- DBG_ERR("length overflow");
- SAFE_FREE(s);
- return NULL;
- }
- maxlen = m;
-
- t = realloc_p(s, char, maxlen);
- if (!t) {
- DBG_ERR("failed to expand buffer!\n");
- SAFE_FREE(s);
- return(NULL);
- }
-
- s = t;
- }
- }
- return(s);
-}
-
-/**
* Read one line (data until next newline or eof) and allocate it
*/
_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint)
diff --git a/lib/util/xfile.c b/lib/util/xfile.c
index 62dd121..b22cb98 100644
--- a/lib/util/xfile.c
+++ b/lib/util/xfile.c
@@ -37,6 +37,8 @@
#include "system/filesys.h"
#include "memory.h"
#include "xfile.h"
+#include "lib/util/debug.h"
+#include "lib/util/samba_util.h"
#define XBUFSIZE BUFSIZ
@@ -428,3 +430,95 @@ XFILE *x_fdup(const XFILE *f)
x_setvbuf(ret, NULL, X_IOFBF, XBUFSIZE);
return ret;
}
+
+/**
+ * @file
+ * @brief File-related utility functions
+ */
+
+/**
+read a line from a file with possible \ continuation chars.
+Blanks at the start or end of a line are stripped.
+The string will be allocated if s2 is NULL
+**/
+char *x_fgets_slash(char *s2,int maxlen,XFILE *f)
+{
+ char *s=s2;
+ int len = 0;
+ int c;
+ bool start_of_line = true;
+
+ if (x_feof(f)) {
+ return(NULL);
+ }
+
+ if (maxlen <2) {
+ return(NULL);
+ }
+
+ if (!s2) {
+ maxlen = MIN(maxlen,8);
+ s = (char *)malloc(maxlen);
+ }
+
+ if (!s) {
+ return(NULL);
+ }
+
+ *s = 0;
+
+ while (len < maxlen-1) {
+ c = x_getc(f);
+ switch (c)
+ {
+ case '\r':
+ break;
+ case '\n':
+ while (len > 0 && s[len-1] == ' ') {
+ s[--len] = 0;
+ }
+ if (len > 0 && s[len-1] == '\\') {
+ s[--len] = 0;
+ start_of_line = true;
+ break;
+ }
+ return(s);
+ case EOF:
+ if (len <= 0 && !s2) {
+ SAFE_FREE(s);
+ }
+ return(len>0?s:NULL);
+ case ' ':
+ if (start_of_line) {
+ break;
+ }
+ /* fall through */
+ default:
+ start_of_line = false;
+ s[len++] = c;
+ s[len] = 0;
+ }
+ if (!s2 && len > maxlen-3) {
+ int m;
+ char *t;
+
+ m = maxlen * 2;
+ if (m < maxlen) {
+ DBG_ERR("length overflow");
+ SAFE_FREE(s);
+ return NULL;
+ }
+ maxlen = m;
+
+ t = realloc_p(s, char, maxlen);
+ if (!t) {
+ DBG_ERR("failed to expand buffer!\n");
+ SAFE_FREE(s);
+ return(NULL);
+ }
+
+ s = t;
+ }
+ }
+ return(s);
+}
diff --git a/lib/util/xfile.h b/lib/util/xfile.h
index f52596d..5fb6341 100644
--- a/lib/util/xfile.h
+++ b/lib/util/xfile.h
@@ -104,4 +104,11 @@ off_t x_tseek(XFILE *f, off_t offset, int whence);
XFILE *x_fdup(const XFILE *f);
+/**
+read a line from a file with possible \ continuation chars.
+Blanks at the start or end of a line are stripped.
+The string will be allocated if s2 is NULL
+**/
+_PUBLIC_ char *x_fgets_slash(char *s2,int maxlen,XFILE *f);
+
#endif /* _XFILE_H_ */
--
2.1.4
>From e8f0cc2f8c2e4947f36e12295f1b7418bfd21e58 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 16 Nov 2016 17:17:25 +0000
Subject: [PATCH 6/6] lib: Remove global xfile.h includes
This makes it more obvious where this legacy code is used
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/samba_util.h | 1 -
libcli/smbreadline/smbreadline.c | 1 +
source3/auth/user_util.c | 1 +
source3/client/client.c | 1 +
source3/include/includes.h | 1 -
source3/lib/popt_common.c | 1 +
source3/modules/vfs_expand_msdfs.c | 1 +
source3/nmbd/nmbd.h | 1 +
source3/printing/print_aix.c | 1 +
source3/printing/print_standard.c | 1 +
source3/rpc_server/svcctl/srv_svcctl_reg.c | 1 +
source3/utils/ntlm_auth.c | 1 +
source3/winbindd/idmap_hash/mapfile.c | 1 +
source4/include/includes.h | 1 -
source4/utils/ntlm_auth.c | 1 +
15 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 2f8de9e..7863555 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -46,7 +46,6 @@ extern const char *panic_action;
#include "lib/util/time.h"
#include "lib/util/data_blob.h"
-#include "lib/util/xfile.h"
#include "lib/util/byteorder.h"
#include "lib/util/talloc_stack.h"
diff --git a/libcli/smbreadline/smbreadline.c b/libcli/smbreadline/smbreadline.c
index c585554..8be6e48 100644
--- a/libcli/smbreadline/smbreadline.c
+++ b/libcli/smbreadline/smbreadline.c
@@ -24,6 +24,7 @@
#include "system/select.h"
#include "system/readline.h"
#include "libcli/smbreadline/smbreadline.h"
+#include "lib/util/xfile.h"
#undef malloc
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index 79b193e..f3cf499 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "auth.h"
+#include "lib/util/xfile.h"
/*******************************************************************
Map a username from a dos name to a unix name by looking in the username
diff --git a/source3/client/client.c b/source3/client/client.c
index ded7971..65696f9 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -39,6 +39,7 @@
#include "libsmb/nmblib.h"
#include "include/ntioctl.h"
#include "../libcli/smb/smbXcli_base.h"
+#include "lib/util/xfile.h"
#ifndef REGISTER
#define REGISTER 0
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 234a564..a436427 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -303,7 +303,6 @@ typedef char fstring[FSTRING_LEN];
/* Lists, trees, caching, database... */
#include "../lib/util/samba_util.h"
#include "../lib/util/util_net.h"
-#include "../lib/util/xfile.h"
#include "../lib/util/memory.h"
#include "../lib/util/attr.h"
#include "../lib/util/tsort.h"
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index 6c1515b..f74543f 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -24,6 +24,7 @@
#include "system/filesys.h"
#include "popt_common.h"
#include "lib/param/param.h"
+#include "lib/util/xfile.h"
/* Handle command line options:
* -d,--debuglevel
diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c
index eaf96e0..40c57c2 100644
--- a/source3/modules/vfs_expand_msdfs.c
+++ b/source3/modules/vfs_expand_msdfs.c
@@ -24,6 +24,7 @@
#include "smbd/globals.h"
#include "auth.h"
#include "../lib/tsocket/tsocket.h"
+#include "lib/util/xfile.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
diff --git a/source3/nmbd/nmbd.h b/source3/nmbd/nmbd.h
index 47940e1..f2086a5 100644
--- a/source3/nmbd/nmbd.h
+++ b/source3/nmbd/nmbd.h
@@ -25,6 +25,7 @@
#define SYNC_DNS 1
#endif
+#include "lib/util/xfile.h"
#include "libsmb/nmblib.h"
#include "nmbd/nmbd_proto.h"
diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c
index da47be0..7b5a1e3 100644
--- a/source3/printing/print_aix.c
+++ b/source3/printing/print_aix.c
@@ -27,6 +27,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "printing/pcap.h"
+#include "lib/util/xfile.h"
#ifdef AIX
bool aix_cache_reload(struct pcap_cache **_pcache)
diff --git a/source3/printing/print_standard.c b/source3/printing/print_standard.c
index 080ef07..4404aeb 100644
--- a/source3/printing/print_standard.c
+++ b/source3/printing/print_standard.c
@@ -57,6 +57,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "printing/pcap.h"
+#include "lib/util/xfile.h"
/* handle standard printcap - moved from pcap_printer_fn() */
bool std_pcap_cache_reload(const char *pcap_name, struct pcap_cache **_pcache)
diff --git a/source3/rpc_server/svcctl/srv_svcctl_reg.c b/source3/rpc_server/svcctl/srv_svcctl_reg.c
index 0952e25..9b1af80 100644
--- a/source3/rpc_server/svcctl/srv_svcctl_reg.c
+++ b/source3/rpc_server/svcctl/srv_svcctl_reg.c
@@ -31,6 +31,7 @@
#include "rpc_server/svcctl/srv_svcctl_reg.h"
#include "auth.h"
#include "registry/reg_backend_db.h"
+#include "lib/util/xfile.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_REGISTRY
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 90dc97d..9888dbc 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -47,6 +47,7 @@
#include "nsswitch/libwbclient/wbclient.h"
#include "lib/param/loadparm.h"
#include "lib/util/base64.h"
+#include "lib/util/xfile.h"
#if HAVE_KRB5
#include "auth/kerberos/pac_utils.h"
diff --git a/source3/winbindd/idmap_hash/mapfile.c b/source3/winbindd/idmap_hash/mapfile.c
index a0e2b48..41554a1 100644
--- a/source3/winbindd/idmap_hash/mapfile.c
+++ b/source3/winbindd/idmap_hash/mapfile.c
@@ -24,6 +24,7 @@
#include "idmap.h"
#include "idmap_hash.h"
#include <stdio.h>
+#include "lib/util/xfile.h"
XFILE *lw_map_file = NULL;
diff --git a/source4/include/includes.h b/source4/include/includes.h
index 5aabb8e..39b0494 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -55,7 +55,6 @@
#ifndef _PRINTF_ATTRIBUTE
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
#endif
-#include "../lib/util/xfile.h"
#include "../lib/util/attr.h"
/* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 75dcebf..a4a1c8b 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -39,6 +39,7 @@
#include "auth/ntlmssp/ntlmssp.h"
#include "param/param.h"
#include "lib/util/base64.h"
+#include "lib/util/xfile.h"
#define INITIAL_BUFFER_SIZE 300
#define MAX_BUFFER_SIZE 63000
--
2.1.4
More information about the samba-technical
mailing list