replaced the "wins proxy" to treat NetBIOS names as DNS names with new
authorSamba Release Account <samba-bugs@samba.org>
Sun, 6 Jul 1997 12:06:23 +0000 (12:06 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Sun, 6 Jul 1997 12:06:23 +0000 (12:06 +0000)
"dns proxy" option.  the "wins proxy" option should be used for broadcast
only hosts, and isn't properly implemented anyway.

the new "dns proxy" option can be disabled if the (blocking) dns resolution
takes up a significant amount of time.  this _will_ occur if gethostbyname
does external DNS lookups, instead of just (immediately) returning entries
in /etc/hosts.

lkcl
(This used to be commit 350dfc57dd3001ba27519000a2ab9dd541a66ac7)

source3/include/proto.h
source3/nameservreply.c
source3/param/loadparm.c

index ef9382279e3a5d25344ca6732828389a425c32df..8aecf7907ad725977374e73d55299854d3b1d04a 100644 (file)
@@ -147,6 +147,7 @@ char *lp_wins_server(void);
 char *lp_interfaces(void);
 char *lp_socket_address(void);
 char *lp_nis_home_map_name(void);
 char *lp_interfaces(void);
 char *lp_socket_address(void);
 char *lp_nis_home_map_name(void);
+BOOL lp_dns_proxy(void);
 BOOL lp_wins_support(void);
 BOOL lp_wins_proxy(void);
 BOOL lp_local_master(void);
 BOOL lp_wins_support(void);
 BOOL lp_wins_proxy(void);
 BOOL lp_local_master(void);
@@ -273,12 +274,18 @@ BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ec
 BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
 BOOL start_share_mode_mgmt(void);
 BOOL stop_share_mode_mgmt(void);
 BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
 BOOL start_share_mode_mgmt(void);
 BOOL stop_share_mode_mgmt(void);
-BOOL lock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token *);
-BOOL unlock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token);
+BOOL lock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token *ptok);
+BOOL unlock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token token);
 int get_share_modes(int cnum, share_lock_token token, uint32 dev, uint32 inode, 
                     min_share_mode_entry **old_shares);
 void del_share_mode(share_lock_token token, int fnum);
 BOOL set_share_mode(share_lock_token token, int fnum);
 int get_share_modes(int cnum, share_lock_token token, uint32 dev, uint32 inode, 
                     min_share_mode_entry **old_shares);
 void del_share_mode(share_lock_token token, int fnum);
 BOOL set_share_mode(share_lock_token token, int fnum);
+BOOL lock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token *ptok);
+BOOL unlock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token token);
+int get_share_modes(int cnum, share_lock_token token, uint32 dev, uint32 inode, 
+                    min_share_mode_entry **old_shares);
+void del_share_mode(share_lock_token token, int fnum);
+BOOL set_share_mode(share_lock_token token,int fnum);
 
 /*The following definitions come from  mangle.c  */
 
 
 /*The following definitions come from  mangle.c  */
 
@@ -302,7 +309,6 @@ int reply_sendend(char *inbuf,char *outbuf);
 
 /*The following definitions come from  nameannounce.c  */
 
 
 /*The following definitions come from  nameannounce.c  */
 
-void reset_announce_timer();
 void announce_request(struct work_record *work, struct in_addr ip);
 void do_announce_request(char *info, char *to_name, int announce_type, 
                         int from,
 void announce_request(struct work_record *work, struct in_addr ip);
 void do_announce_request(char *info, char *to_name, int announce_type, 
                         int from,
@@ -320,6 +326,7 @@ void announce_my_servers_removed(void);
 void announce_server(struct subnet_record *d, struct work_record *work,
                     char *name, char *comment, time_t ttl, int server_type);
 void announce_host(time_t t);
 void announce_server(struct subnet_record *d, struct work_record *work,
                     char *name, char *comment, time_t ttl, int server_type);
 void announce_host(time_t t);
+void reset_announce_timer();
 void announce_master(time_t t);
 void announce_remote(time_t t);
 
 void announce_master(time_t t);
 void announce_remote(time_t t);
 
@@ -327,8 +334,7 @@ void announce_remote(time_t t);
 
 void expire_browse_cache(time_t t);
 struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
 
 void expire_browse_cache(time_t t);
 struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
-                                             time_t ttl, 
-                                              struct subnet_record *d,
+                                             time_t ttl, struct subnet_record *d,
                                               struct in_addr ip, BOOL local);
 void do_browser_lists(time_t t);
 
                                               struct in_addr ip, BOOL local);
 void do_browser_lists(time_t t);
 
@@ -718,16 +724,12 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize);
 
 /*The following definitions come from  shmem.c  */
 
 
 /*The following definitions come from  shmem.c  */
 
+BOOL smb_shm_create_hash_table( unsigned int size );
 BOOL smb_shm_open( char *file_name, int size);
 BOOL smb_shm_close( void );
 BOOL smb_shm_free(smb_shm_offset_t offset);
 BOOL smb_shm_set_userdef_off(smb_shm_offset_t userdef_off);
 void * smb_shm_offset2addr(smb_shm_offset_t offset);
 BOOL smb_shm_open( char *file_name, int size);
 BOOL smb_shm_close( void );
 BOOL smb_shm_free(smb_shm_offset_t offset);
 BOOL smb_shm_set_userdef_off(smb_shm_offset_t userdef_off);
 void * smb_shm_offset2addr(smb_shm_offset_t offset);
-BOOL smb_shm_lock(void);
-BOOL smb_shm_unlock(void);
-smb_shm_offset_t smb_shm_alloc(int size);
-smb_shm_offset_t smb_shm_addr2offset(void *addr);
-smb_shm_offset_t smb_shm_get_userdef_off(void);
 BOOL smb_shm_lock_hash_entry( unsigned int entry);
 BOOL smb_shm_unlock_hash_entry( unsigned int entry );
 BOOL smb_shm_get_usage(int *bytes_free,
 BOOL smb_shm_lock_hash_entry( unsigned int entry);
 BOOL smb_shm_unlock_hash_entry( unsigned int entry );
 BOOL smb_shm_get_usage(int *bytes_free,
index 9e46b80303922a8efde1aa9f0a48e96e0b8fc2a2..81ffe9ffae620b0b4adab6997a816125ae34e9a4 100644 (file)
@@ -559,12 +559,13 @@ void reply_name_query(struct packet_struct *p)
     }
    
     /* do we want to do dns lookups? */
     }
    
     /* do we want to do dns lookups? */
-    /* XXXX this DELAYS nmbd while it does a search. not a good idea
-       but there's no pleasant alternative. phil@hands.com suggested
-       making the name a full DNS name, which would succeed / fail
-       much quicker.
+    /* XXXX this DELAYS nmbd while it does a search.  lp_dns_proxy()
+       can be switched off, to ensure that the blocking doesn't occur.
+       a better solution would be to fork, but this will require a
+       mechanism to carry on processing after the query is resolved
+       (similar to the netbios queue).
      */
      */
-    if (success && !n && (lp_wins_proxy() || !bcast))
+    if (success && !n && (lp_dns_proxy() || !bcast))
     {
       n = dns_name_search(question, p->timestamp);
     }
     {
       n = dns_name_search(question, p->timestamp);
     }
index 9d3850b2428c9fd12d1de19d9f7df1053e2dd90c..4c6ce30b193e3643f52237d2758b3c8328aafa9b 100644 (file)
@@ -155,6 +155,7 @@ typedef struct
   int shmem_size;
   int shmem_hash_size;
   int client_code_page;
   int shmem_size;
   int shmem_hash_size;
   int client_code_page;
+  BOOL bDNSproxy;
   BOOL bWINSsupport;
   BOOL bWINSproxy;
   BOOL bLocalMaster;
   BOOL bWINSsupport;
   BOOL bWINSproxy;
   BOOL bLocalMaster;
@@ -444,6 +445,7 @@ struct parm_struct
   {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL},
   {"os level",         P_INTEGER, P_GLOBAL, &Globals.os_level,          NULL},
   {"max ttl",          P_INTEGER, P_GLOBAL, &Globals.max_ttl,           NULL},
   {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL},
   {"os level",         P_INTEGER, P_GLOBAL, &Globals.os_level,          NULL},
   {"max ttl",          P_INTEGER, P_GLOBAL, &Globals.max_ttl,           NULL},
+  {"dns proxy",        P_BOOL,    P_GLOBAL, &Globals.bDNSproxy,         NULL},
   {"wins support",     P_BOOL,    P_GLOBAL, &Globals.bWINSsupport,      NULL},
   {"wins proxy",       P_BOOL,    P_GLOBAL, &Globals.bWINSproxy,        NULL},
   {"wins server",      P_STRING,  P_GLOBAL, &Globals.szWINSserver,      NULL},
   {"wins support",     P_BOOL,    P_GLOBAL, &Globals.bWINSsupport,      NULL},
   {"wins proxy",       P_BOOL,    P_GLOBAL, &Globals.bWINSproxy,        NULL},
   {"wins server",      P_STRING,  P_GLOBAL, &Globals.szWINSserver,      NULL},
@@ -650,6 +652,19 @@ static void init_globals(void)
   Globals.bBrowseList = True;
   Globals.bWINSsupport = False;
   Globals.bWINSproxy = False;
   Globals.bBrowseList = True;
   Globals.bWINSsupport = False;
   Globals.bWINSproxy = False;
+
+/* this parameter is currently set to the default functionality
+   in samba.  given that w95 and NT is starting to use DNS for
+   server resolution, i expect that at some point it would be
+   sensible to default this to False.
+
+   this parameter is added because nmbd is a single process, and
+   gethostbyname is a blocking call, which can take out nmbd for
+   several seconds while a dns lookup is performed.
+
+ */
+
+  Globals.bDNSproxy = True;
 }
 
 /***************************************************************************
 }
 
 /***************************************************************************
@@ -802,6 +817,7 @@ FN_GLOBAL_STRING(lp_interfaces,&Globals.szInterfaces)
 FN_GLOBAL_STRING(lp_socket_address,&Globals.szSocketAddress)
 FN_GLOBAL_STRING(lp_nis_home_map_name,&Globals.szNISHomeMapName)
 
 FN_GLOBAL_STRING(lp_socket_address,&Globals.szSocketAddress)
 FN_GLOBAL_STRING(lp_nis_home_map_name,&Globals.szNISHomeMapName)
 
+FN_GLOBAL_BOOL(lp_dns_proxy,&Globals.bDNSproxy)
 FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport)
 FN_GLOBAL_BOOL(lp_wins_proxy,&Globals.bWINSproxy)
 FN_GLOBAL_BOOL(lp_local_master,&Globals.bLocalMaster)
 FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport)
 FN_GLOBAL_BOOL(lp_wins_proxy,&Globals.bWINSproxy)
 FN_GLOBAL_BOOL(lp_local_master,&Globals.bLocalMaster)