diff options
author | Jeremy Allison <jra@samba.org> | 1998-03-16 20:59:47 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-03-16 20:59:47 +0000 |
commit | c54af0f8b20e3f93c59da6a817920e1de6c4a870 (patch) | |
tree | b0da64f4bb04846bdf9562ecb445b22fbd6f1885 /source3/nmbd | |
parent | 14d6ee34de8935cb3ef59820fabf98d588dab11f (diff) | |
download | samba-c54af0f8b20e3f93c59da6a817920e1de6c4a870.tar.gz samba-c54af0f8b20e3f93c59da6a817920e1de6c4a870.tar.bz2 samba-c54af0f8b20e3f93c59da6a817920e1de6c4a870.zip |
Adding the same change as was added to 1.9.18 branch to add the
"name resolve order" parameter.
source/Makefile: Re-ordered link for name resolve order code.
source/clientgen.c:
source/clientutil.c: Added calls to resolve_name().
source/includes.h: Added HPUX zombie fix.
source/loadparm.c: Added new name resolve order parameter.
source/namequery.c: Re-wrote to include parsing of lmhosts file, new resolve_name()
function requested by John.
source/nmbd.c: Tell resolve_name not to do WINS lookups if we are the WINS server.
source/nmbd_lmhosts.c: Call lmhosts parsing functions in namequery.c
source/password.c: Call resolve_name() to lookup security=server name.
source/reply.c:
source/time.c:
source/trans2.c: "fake directory create times" fix from Jim Hague - hague@research.canon.com.au.
source/util.c: Removed isalnum() test in Get_Hostname() that seems to cause
problems on many systems.
Jeremy.
(This used to be commit 7f118970da7c43eaddcf92dc056d3e849f1e7d5c)
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd.c | 3 | ||||
-rw-r--r-- | source3/nmbd/nmbd_lmhosts.c | 81 |
2 files changed, 10 insertions, 74 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index e757aa46c4..837f98e8bb 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -44,6 +44,8 @@ extern pstring myname; extern fstring myworkgroup; extern char **my_netbios_names; +extern BOOL global_in_nmbd; + /* are we running as a daemon ? */ static BOOL is_daemon = False; @@ -552,6 +554,7 @@ int main(int argc,char *argv[]) global_nmb_port = NMB_PORT; *host_file = 0; + global_in_nmbd = True; StartupTime = time(NULL); diff --git a/source3/nmbd/nmbd_lmhosts.c b/source3/nmbd/nmbd_lmhosts.c index 722c3681f5..206c2367b1 100644 --- a/source3/nmbd/nmbd_lmhosts.c +++ b/source3/nmbd/nmbd_lmhosts.c @@ -33,88 +33,21 @@ Load a lmhosts file. ****************************************************************************/ void load_lmhosts_file(char *fname) { - FILE *fp = fopen(fname,"r"); - pstring line; + pstring name; + int name_type; + struct in_addr ipaddr; + FILE *fp = startlmhosts( fname ); + if (!fp) { DEBUG(2,("load_lmhosts_file: Can't open lmhosts file %s. Error was %s\n", fname, strerror(errno))); return; } - while (!feof(fp)) + while (getlmhostsent(fp, name, &name_type, &ipaddr) ) { - pstring ip,name,flags,extra; struct subnet_record *subrec = NULL; - char *ptr; - int count = 0; - struct in_addr ipaddr; enum name_source source = LMHOSTS_NAME; - int name_type = -1; - - if (!fgets_slash(line,sizeof(pstring),fp)) - continue; - - if (*line == '#') - continue; - - strcpy(ip,""); - strcpy(name,""); - strcpy(flags,""); - - ptr = line; - - if (next_token(&ptr,ip ,NULL)) - ++count; - if (next_token(&ptr,name ,NULL)) - ++count; - if (next_token(&ptr,flags,NULL)) - ++count; - if (next_token(&ptr,extra,NULL)) - ++count; - - if (count <= 0) - continue; - - if (count > 0 && count < 2) - { - DEBUG(0,("load_lmhosts_file: Ill formed hosts line [%s]\n",line)); - continue; - } - - if (count >= 4) - { - DEBUG(0,("load_lmhosts_file: too many columns in lmhosts file %s (obsolete syntax)\n", - fname)); - continue; - } - - DEBUG(4, ("load_lmhosts_file: lmhost entry: %s %s %s\n", ip, name, flags)); - - if (strchr(flags,'G') || strchr(flags,'S')) - { - DEBUG(0,("load_lmhosts_file: group flag in %s ignored (obsolete)\n",fname)); - continue; - } - - ipaddr = *interpret_addr2(ip); - - /* Extra feature. If the name ends in '#XX', where XX is a hex number, - then only add that name type. */ - if((ptr = strchr(name, '#')) != NULL) - { - char *endptr; - - ptr++; - name_type = (int)strtol(ptr, &endptr,0); - - if(!*ptr || (endptr == ptr)) - { - DEBUG(0,("load_lmhosts_file: invalid name %s containing '#'.\n", name)); - continue; - } - - *(--ptr) = '\0'; /* Truncate at the '#' */ - } /* We find a relevent subnet to put this entry on, then add it. */ /* Go through all the broadcast subnets and see if the mask matches. */ @@ -141,7 +74,7 @@ void load_lmhosts_file(char *fname) } } - fclose(fp); + endlmhosts(fp); } /**************************************************************************** |