関数 | |
void | load_lmhosts_file (char *fname) |
BOOL | find_name_in_lmhosts (struct nmb_name *nmbname, struct name_record **namerecp) |
void load_lmhosts_file | ( | char * | fname | ) |
nmbd_lmhosts.c の 32 行で定義されています。
参照先 add_name_to_subnet()・subnet_record::bcast_ip・endlmhosts()・errno・fp・getlmhostsent()・LMHOSTS_NAME・subnet_record::mask_ip・name・name_type・remote_broadcast_subnet・same_net()・startlmhosts()・strerror().
参照元 main().
00033 { 00034 pstring name; 00035 int name_type; 00036 struct in_addr ipaddr; 00037 XFILE *fp = startlmhosts( fname ); 00038 00039 if (!fp) { 00040 DEBUG(2,("load_lmhosts_file: Can't open lmhosts file %s. Error was %s\n", 00041 fname, strerror(errno))); 00042 return; 00043 } 00044 00045 while (getlmhostsent(fp, name, &name_type, &ipaddr) ) { 00046 struct subnet_record *subrec = NULL; 00047 enum name_source source = LMHOSTS_NAME; 00048 00049 /* We find a relevent subnet to put this entry on, then add it. */ 00050 /* Go through all the broadcast subnets and see if the mask matches. */ 00051 for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { 00052 if(same_net(ipaddr, subrec->bcast_ip, subrec->mask_ip)) 00053 break; 00054 } 00055 00056 /* If none match add the name to the remote_broadcast_subnet. */ 00057 if(subrec == NULL) 00058 subrec = remote_broadcast_subnet; 00059 00060 if(name_type == -1) { 00061 /* Add the (0) and (0x20) names directly into the namelist for this subnet. */ 00062 (void)add_name_to_subnet(subrec,name,0x00,(uint16)NB_ACTIVE,PERMANENT_TTL,source,1,&ipaddr); 00063 (void)add_name_to_subnet(subrec,name,0x20,(uint16)NB_ACTIVE,PERMANENT_TTL,source,1,&ipaddr); 00064 } else { 00065 /* Add the given name type to the subnet namelist. */ 00066 (void)add_name_to_subnet(subrec,name,name_type,(uint16)NB_ACTIVE,PERMANENT_TTL,source,1,&ipaddr); 00067 } 00068 } 00069 00070 endlmhosts(fp); 00071 }
BOOL find_name_in_lmhosts | ( | struct nmb_name * | nmbname, | |
struct name_record ** | namerecp | |||
) |
nmbd_lmhosts.c の 79 行で定義されています。
参照先 name_record::data・find_name_on_subnet()・LMHOSTS_NAME・remote_broadcast_subnet・nmb_data::source.
00080 { 00081 struct name_record *namerec; 00082 00083 *namerecp = NULL; 00084 00085 if((namerec = find_name_on_subnet(remote_broadcast_subnet, nmbname, FIND_ANY_NAME))==NULL) 00086 return False; 00087 00088 if(!NAME_IS_ACTIVE(namerec) || (namerec->data.source != LMHOSTS_NAME)) 00089 return False; 00090 00091 *namerecp = namerec; 00092 return True; 00093 }