diff options
author | Volker Lendecke <vl@samba.org> | 2016-11-23 08:55:16 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2016-12-11 11:17:24 +0100 |
commit | c07a9b5bebf300d87fb682417950ec31f83d04e0 (patch) | |
tree | f2e38be1a62851f6be89e49c06397c97d49e4862 /libcli | |
parent | 3af7ff5c820bef1e90fd8bed477e10245c9335bd (diff) | |
download | samba-c07a9b5bebf300d87fb682417950ec31f83d04e0.tar.gz |
libnbt: lmhosts xfile->stdio
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/nbt/libnbt.h | 9 | ||||
-rw-r--r-- | libcli/nbt/lmhosts.c | 19 |
2 files changed, 13 insertions, 15 deletions
diff --git a/libcli/nbt/libnbt.h b/libcli/nbt/libnbt.h index fd0c7fea66d..d4813b96165 100644 --- a/libcli/nbt/libnbt.h +++ b/libcli/nbt/libnbt.h @@ -24,7 +24,6 @@ #include "librpc/gen_ndr/nbt.h" #include "librpc/ndr/libndr.h" -#include "lib/util/xfile.h" /* possible states for pending requests @@ -361,10 +360,10 @@ NTSTATUS nbt_name_refresh_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct nbt_name_refresh_wins *io); -XFILE *startlmhosts(const char *fname); -bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type, - struct sockaddr_storage *pss); -void endlmhosts(XFILE *fp); +FILE *startlmhosts(const char *fname); +bool getlmhostsent(TALLOC_CTX *ctx, FILE *fp, char **pp_name, int *name_type, + struct sockaddr_storage *pss); +void endlmhosts(FILE *fp); NTSTATUS resolve_lmhosts_file_as_sockaddr(const char *lmhosts_file, const char *name, int name_type, diff --git a/libcli/nbt/lmhosts.c b/libcli/nbt/lmhosts.c index e68dc08d1e5..722f6adc63d 100644 --- a/libcli/nbt/lmhosts.c +++ b/libcli/nbt/lmhosts.c @@ -22,7 +22,6 @@ */ #include "includes.h" -#include "lib/util/xfile.h" #include "lib/util/util_net.h" #include "system/filesys.h" #include "system/network.h" @@ -32,9 +31,9 @@ Start parsing the lmhosts file. *********************************************************/ -XFILE *startlmhosts(const char *fname) +FILE *startlmhosts(const char *fname) { - XFILE *fp = x_fopen(fname,O_RDONLY, 0); + FILE *fp = fopen(fname, "r"); if (!fp) { DEBUG(4,("startlmhosts: Can't open lmhosts file %s. " "Error was %s\n", @@ -48,14 +47,14 @@ XFILE *startlmhosts(const char *fname) Parse the next line in the lmhosts file. *********************************************************/ -bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type, - struct sockaddr_storage *pss) +bool getlmhostsent(TALLOC_CTX *ctx, FILE *fp, char **pp_name, int *name_type, + struct sockaddr_storage *pss) { char line[1024]; *pp_name = NULL; - while(!x_feof(fp) && !x_ferror(fp)) { + while(!feof(fp) && !ferror(fp)) { char *ip = NULL; char *flags = NULL; char *extra = NULL; @@ -66,7 +65,7 @@ bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type, *name_type = -1; - if (!x_fgets_slash(line,sizeof(line),fp)) { + if (!fgets_slash(NULL,line,sizeof(line),fp)) { continue; } @@ -151,9 +150,9 @@ bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type, Finish parsing the lmhosts file. *********************************************************/ -void endlmhosts(XFILE *fp) +void endlmhosts(FILE *fp) { - x_fclose(fp); + fclose(fp); } /******************************************************** @@ -170,7 +169,7 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(const char *lmhosts_file, * "lmhosts" means parse the local lmhosts file. */ - XFILE *fp; + FILE *fp; char *lmhost_name = NULL; int name_type2; struct sockaddr_storage return_ss; |