1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

libnbt: lmhosts xfile->stdio

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2016-11-23 08:55:16 +01:00
parent 3af7ff5c82
commit c07a9b5beb
3 changed files with 14 additions and 16 deletions

View File

@ -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,

View File

@ -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;

View File

@ -36,7 +36,7 @@ void load_lmhosts_file(const char *fname)
int name_type;
struct sockaddr_storage ss;
TALLOC_CTX *ctx = talloc_init("load_lmhosts_file");
XFILE *fp = startlmhosts( fname );
FILE *fp = startlmhosts( fname );
if (!fp) {
DEBUG(2,("load_lmhosts_file: Can't open lmhosts file %s. Error was %s\n",