diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-19 01:01:07 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-19 01:01:07 +0000 |
commit | 161c11e4bcd408064493c063b228aab589fd2a19 (patch) | |
tree | 611a376ca4d791851bec291fee1586506e48306d | |
parent | 1c6c4e7e39bde99f8d312516ba530b905bc01da7 (diff) | |
download | samba-161c11e4bcd408064493c063b228aab589fd2a19.tar.gz samba-161c11e4bcd408064493c063b228aab589fd2a19.tar.bz2 samba-161c11e4bcd408064493c063b228aab589fd2a19.zip |
- bug in nmbd registering DOMAIN_NAME<1c> to WINS server; recursion
desired flag MUST be set in any NBT UDP packets sent to a WINS
server, else they will go to the WINS client side of the NT NetBIOS
kernel instead, and will get trashed.
- added \PIPE\browser server-side code.
(This used to be commit 8e406c1fa296c3f97b1cd7ddde7b5aeb9232b26e)
-rw-r--r-- | source3/Makefile.in | 1 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_namelistdb.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 25 | ||||
-rw-r--r-- | source3/rpc_server/srv_brs.c | 98 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 1 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 1 |
7 files changed, 124 insertions, 8 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 37cf1317d7..8e04fa8ff7 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -136,6 +136,7 @@ RPC_SERVER_OBJ = \ rpc_server/srv_pipe.o \ rpc_server/srv_lookup.o \ rpc_server/srv_wkssvc.o \ + rpc_server/srv_brs.o \ rpc_server/srv_spoolss.o RPC_PARSE_OBJ1 = rpc_parse/parse_lsa.o \ diff --git a/source3/include/proto.h b/source3/include/proto.h index bd38d58136..35ac728921 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3315,6 +3315,10 @@ BOOL make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, int status) ; BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth); +/*The following definitions come from rpc_server/srv_brs.c */ + +BOOL api_brs_rpc(pipes_struct *p, prs_struct *data); + /*The following definitions come from rpc_server/srv_lookup.c */ int make_dom_gids(DOMAIN_GRP *mem, int num_members, DOM_GID **ppgids); diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c index 8d6d139867..0bc5fd875a 100644 --- a/source3/nmbd/nmbd_namelistdb.c +++ b/source3/nmbd/nmbd_namelistdb.c @@ -42,6 +42,8 @@ void set_samba_nb_type(void) samba_nb_type = NB_MFLAG; /* samba is a 'hybrid' node type. */ else samba_nb_type = NB_BFLAG; /* samba is broadcast-only node type. */ + + DEBUG(10,("set_samba_nb_type: %x\n", samba_nb_type)); } /* set_samba_nb_type */ /* ************************************************************************** ** diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index f10d9a2bc5..c39699f822 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -143,6 +143,7 @@ static BOOL send_netbios_packet(struct packet_struct *p) static struct packet_struct *create_and_init_netbios_packet(struct nmb_name *nmbname, BOOL bcast, + BOOL rec_des, struct in_addr to_ip) { struct packet_struct *packet = NULL; @@ -161,7 +162,7 @@ static struct packet_struct *create_and_init_netbios_packet(struct nmb_name *nmb nmb->header.name_trn_id = generate_name_trn_id(); nmb->header.response = False; - nmb->header.nm_flags.recursion_desired = False; + nmb->header.nm_flags.recursion_desired = rec_des; nmb->header.nm_flags.recursion_available = False; nmb->header.nm_flags.trunc = False; nmb->header.nm_flags.authoritative = False; @@ -430,11 +431,12 @@ struct response_record *queue_register_name( struct subnet_record *subrec, struct packet_struct *p; struct response_record *rrec; BOOL bcast = (subrec == unicast_subnet) ? False : True; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(nmbname, bcast, + if(( p = create_and_init_netbios_packet(nmbname, bcast, rec_des, subrec->bcast_ip)) == NULL) return NULL; @@ -479,6 +481,7 @@ struct response_record *queue_register_multihomed_name( struct subnet_record *su struct packet_struct *p; struct response_record *rrec; BOOL bcast = False; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; BOOL ret; /* Sanity check. */ @@ -492,7 +495,7 @@ unicast subnet. subnet is %s\n.", subrec->subnet_name )); if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(nmbname, bcast, + if(( p = create_and_init_netbios_packet(nmbname, bcast, rec_des, subrec->bcast_ip)) == NULL) return NULL; @@ -539,13 +542,14 @@ struct response_record *queue_release_name( struct subnet_record *subrec, struct in_addr release_ip) { BOOL bcast = (subrec == unicast_subnet) ? False : True; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; struct packet_struct *p; struct response_record *rrec; if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(nmbname, bcast, + if(( p = create_and_init_netbios_packet(nmbname, bcast, rec_des, subrec->bcast_ip)) == NULL) return NULL; @@ -597,13 +601,14 @@ struct response_record *queue_refresh_name( struct subnet_record *subrec, struct in_addr refresh_ip) { BOOL bcast = (subrec == unicast_subnet) ? False : True; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; struct packet_struct *p; struct response_record *rrec; if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(&namerec->name, bcast, + if(( p = create_and_init_netbios_packet(&namerec->name, bcast,rec_des, subrec->bcast_ip)) == NULL) return NULL; @@ -645,6 +650,7 @@ struct response_record *queue_query_name( struct subnet_record *subrec, struct packet_struct *p; struct response_record *rrec; BOOL bcast = True; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; if ((subrec == unicast_subnet) || (subrec == wins_server_subnet)) bcast = False; @@ -652,7 +658,7 @@ struct response_record *queue_query_name( struct subnet_record *subrec, if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(nmbname, bcast, + if(( p = create_and_init_netbios_packet(nmbname, bcast,rec_des, subrec->bcast_ip)) == NULL) return NULL; @@ -694,8 +700,10 @@ struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip, struct packet_struct *p; struct response_record *rrec; BOOL bcast = False; + BOOL rec_des = True; - if(( p = create_and_init_netbios_packet(nmbname, bcast, to_ip)) == NULL) + if(( p = create_and_init_netbios_packet(nmbname, bcast, rec_des, + to_ip)) == NULL) return NULL; if(initiate_name_query_packet_from_wins_server( p ) == False) @@ -737,6 +745,7 @@ struct response_record *queue_node_status( struct subnet_record *subrec, struct packet_struct *p; struct response_record *rrec; BOOL bcast = False; + BOOL rec_des = (subrec == wins_server_subnet) ? True : False; /* Sanity check. */ if(subrec != unicast_subnet) @@ -749,7 +758,7 @@ unicast subnet. subnet is %s\n.", subrec->subnet_name )); if(assert_check_subnet(subrec)) return NULL; - if(( p = create_and_init_netbios_packet(nmbname, bcast, + if(( p = create_and_init_netbios_packet(nmbname, bcast,rec_des, send_ip)) == NULL) return NULL; diff --git a/source3/rpc_server/srv_brs.c b/source3/rpc_server/srv_brs.c new file mode 100644 index 0000000000..c2abd28cf8 --- /dev/null +++ b/source3/rpc_server/srv_brs.c @@ -0,0 +1,98 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; +extern pstring global_myname; + + +/******************************************************************* + create_brs_info_100 + ********************************************************************/ +static void create_brs_info_100(BRS_INFO_100 *inf) +{ + DEBUG(5,("create_brs_info_100: %d\n", __LINE__)); + + make_brs_info_100(inf); +} + +/******************************************************************* + brs_reply_query_info + + only supports info level 100 at the moment. + + ********************************************************************/ +static void brs_reply_query_info(BRS_Q_QUERY_INFO *q_u, + prs_struct *rdata, + int status) +{ + BRS_R_QUERY_INFO r_u; + BRS_INFO_100 brs100; + + DEBUG(5,("brs_query_info: %d\n", __LINE__)); + + create_brs_info_100(&brs100); + make_brs_r_query_info(&r_u, q_u->switch_value1, &brs100, status); + + /* store the response in the SMB stream */ + brs_io_r_query_info("", &r_u, rdata, 0); + + DEBUG(5,("brs_query_info: %d\n", __LINE__)); +} + +/******************************************************************* + api_brs_query_info + ********************************************************************/ +static void api_brs_query_info( pipes_struct *p, prs_struct *data, + prs_struct *rdata ) +{ + BRS_Q_QUERY_INFO q_u; + + /* grab the net share enum */ + brs_io_q_query_info("", &q_u, data, 0); + + /* construct reply. always indicate success */ + brs_reply_query_info(&q_u, rdata, 0x0); +} + + +/******************************************************************* + \PIPE\brssvc commands + ********************************************************************/ +struct api_struct api_brs_cmds[] = +{ + { "BRS_Q_QUERY_INFO", BRS_QUERY_INFO, api_brs_query_info }, + { NULL , 0 , NULL } +}; + +/******************************************************************* + receives a browser pipe and responds. + ********************************************************************/ +BOOL api_brs_rpc(pipes_struct *p, prs_struct *data) +{ + return api_rpcTNP(p, "api_brssvc_rpc", api_brs_cmds, data); +} + diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index c6d9cf070e..075c9b0d37 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -402,6 +402,7 @@ static struct api_cmd api_fd_commands[] = { "samr", "lsass", api_samr_rpc }, { "srvsvc", "ntsvcs", api_srvsvc_rpc }, { "wkssvc", "ntsvcs", api_wkssvc_rpc }, + { "browser", "ntsvcs", api_brs_rpc }, { "svcctl", "ntsvcs", api_svcctl_rpc }, { "NETLOGON", "lsass", api_netlog_rpc }, { "winreg", "winreg", api_reg_rpc }, diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index ac688a5baa..70023e2407 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -40,6 +40,7 @@ static char *known_nt_pipes[] = { "\\svcctl", "\\samr", "\\wkssvc", + "\\browser", "\\NETLOGON", "\\ntlsa", "\\ntsvcs", |