summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2002-05-17 03:37:37 +0000
committerRichard Sharpe <sharpe@samba.org>2002-05-17 03:37:37 +0000
commit6ee4366093b24251aa52c272512b2efacb9582d8 (patch)
treebabf9b0cc7aefbb43019fefc580944a2a366d655 /source3/libsmb
parent4f783edcf3a01572589866031fa312316a703a34 (diff)
downloadsamba-6ee4366093b24251aa52c272512b2efacb9582d8.tar.gz
samba-6ee4366093b24251aa52c272512b2efacb9582d8.tar.bz2
samba-6ee4366093b24251aa52c272512b2efacb9582d8.zip
Changes to allow head to translate NMB flags ...
(This used to be commit c986a19cde0dfa96b512eb24d873203981e68c48)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index c578df6621..85f33aeda4 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -305,7 +305,7 @@ BOOL name_register(int fd, const char *name, int name_type,
****************************************************************************/
struct in_addr *name_query(int fd,const char *name,int name_type,
BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count)
+ struct in_addr to_ip, int *count, int *flags)
{
BOOL found=False;
int i, retries = 3;
@@ -318,6 +318,7 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
memset((char *)&p,'\0',sizeof(p));
(*count) = 0;
+ (*flags) = 0;
nmb->header.name_trn_id = generate_trn_id();
nmb->header.opcode = 0;
@@ -440,6 +441,19 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
found=True;
retries=0;
+ /* We add the flags back ... */
+ if (nmb2->header.response)
+ (*flags) |= NM_FLAGS_RS;
+ if (nmb2->header.nm_flags.authoritative)
+ (*flags) |= NM_FLAGS_AA;
+ if (nmb2->header.nm_flags.trunc)
+ (*flags) |= NM_FLAGS_TC;
+ if (nmb2->header.nm_flags.recursion_desired)
+ (*flags) |= NM_FLAGS_RD;
+ if (nmb2->header.nm_flags.recursion_available)
+ (*flags) |= NM_FLAGS_RA;
+ if (nmb2->header.nm_flags.bcast)
+ (*flags) |= NM_FLAGS_B;
free_packet(p2);
/*
* If we're doing a unicast lookup we only
@@ -670,10 +684,11 @@ BOOL name_resolve_bcast(const char *name, int name_type,
*/
for( i = num_interfaces-1; i >= 0; i--) {
struct in_addr sendto_ip;
+ int flags;
/* Done this way to fix compiler error on IRIX 5.x */
sendto_ip = *iface_n_bcast(i);
*return_ip_list = name_query(sock, name, name_type, True,
- True, sendto_ip, return_count);
+ True, sendto_ip, return_count, &flags);
if(*return_ip_list != NULL) {
close(sock);
return True;
@@ -726,6 +741,7 @@ static BOOL resolve_wins(const char *name, int name_type,
DEBUG(3, ("resolve_wins: WINS server == <%s>\n", inet_ntoa(wins_ip)) );
if((wins_ismyip && !global_in_nmbd) || !wins_ismyip) {
+ int flags;
sock = open_socket_in( SOCK_DGRAM, 0, 3,
interpret_addr(lp_socket_address()),
True );
@@ -733,7 +749,7 @@ static BOOL resolve_wins(const char *name, int name_type,
*return_iplist = name_query( sock, name,
name_type, False,
True, wins_ip,
- return_count);
+ return_count, &flags);
if(*return_iplist != NULL) {
close(sock);
return True;