summaryrefslogtreecommitdiff
path: root/source3/utils/nmblookup.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-12-04 19:14:37 +0000
committerLuke Leighton <lkcl@samba.org>1999-12-04 19:14:37 +0000
commitf521205cb3d188fdcadcbd205dcfda4a7dcb89a0 (patch)
tree19135ba0b36cd2108543a462c3b9ec47d4e1dd18 /source3/utils/nmblookup.c
parent8a8a7da5186596ee86b0b188156bca7d5e664784 (diff)
downloadsamba-f521205cb3d188fdcadcbd205dcfda4a7dcb89a0.tar.gz
jeremy is going to hate me for this.
created an "nmb-agent" utility that, yes: it connects to the 137 socket and accepts unix socket connections which it redirects onto port 137. it uses the name_trn_id field to filter requests to the correct location. name_query() and name_status() are the first victims to use this feature (by specifying a file descriptor of -1). (This used to be commit d923bc8da2cf996408194d98381409191dd81a16)
Diffstat (limited to 'source3/utils/nmblookup.c')
-rw-r--r--source3/utils/nmblookup.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 23415a0ca68..f920106f753 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -33,24 +33,28 @@ extern struct in_addr ipzero;
int ServerFD= -1;
-int RootPort = 0;
+BOOL RootPort = False;
/****************************************************************************
open the socket communication
**************************************************************************/
static BOOL open_sockets(void)
{
- ServerFD = open_socket_in( SOCK_DGRAM,
- (RootPort ? 137 :0),
- 3,
- interpret_addr(lp_socket_address()) );
-
- if (ServerFD == -1)
- return(False);
-
- set_socket_options(ServerFD,"SO_BROADCAST");
+ if (RootPort)
+ {
+ ServerFD = open_socket_in( SOCK_DGRAM,
+ 137,
+ 3,
+ interpret_addr(lp_socket_address()) );
+
+ if (ServerFD == -1)
+ {
+ return(False);
+ }
+ set_socket_options(ServerFD,"SO_BROADCAST");
DEBUG(3, ("Socket opened.\n"));
+ }
return True;
}
@@ -152,7 +156,7 @@ int main(int argc,char *argv[])
pstrcpy(servicesf, optarg);
break;
case 'r':
- RootPort = -1;
+ RootPort = True;
break;
case 'h':
usage();