diff options
author | Christopher R. Hertel <crh@samba.org> | 1997-10-04 01:07:47 +0000 |
---|---|---|
committer | Christopher R. Hertel <crh@samba.org> | 1997-10-04 01:07:47 +0000 |
commit | 09dc951f2acd67da9d895e8e00c01e7abbbe0960 (patch) | |
tree | 89c5bff152fae67e84a12adfbf78a8a9e6f8368d /source/utils/nmblookup.c | |
parent | 23eeab7aa2e9c935e1f48ce3449544c03c1c899f (diff) | |
download | samba-09dc951f2acd67da9d895e8e00c01e7abbbe0960.tar.gz samba-09dc951f2acd67da9d895e8e00c01e7abbbe0960.tar.xz samba-09dc951f2acd67da9d895e8e00c01e7abbbe0960.zip |
nmblookup.c:
I've added a -r option. When specified, nmblookup will attempt to bind
to port 137. In order for this to work, the user must be root and the
port must be available (i.e., nmbd not running). If either condition is
not met, nmblookup will default to normal behavior; it will try to bind
to a free port above 7999. I also removed an artifact. The -p <port>
option was being accepted but falling through to the default, which was
the usage message. I removed "p:" from the getopt() list.
params.c:
Rewritten. The scanning is much more linear, and I found and fixed a
few bugs. I don't like the way that the scratch buffer is handled,
but I believe that it is an improvement over the previous version.
Chris -)-----
Diffstat (limited to 'source/utils/nmblookup.c')
-rw-r--r-- | source/utils/nmblookup.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c index aebbc4292ca..36905aa5ae3 100644 --- a/source/utils/nmblookup.c +++ b/source/utils/nmblookup.c @@ -35,6 +35,8 @@ extern struct in_addr ipzero; int ServerFD= -1; +int RootPort = 0; + /**************************************************************************** open the socket communication **************************************************************************/ @@ -49,7 +51,10 @@ static BOOL open_sockets(void) return False; } - ServerFD = open_socket_in(SOCK_DGRAM, 0,3,interpret_addr(lp_socket_address())); + ServerFD = open_socket_in( SOCK_DGRAM, + (RootPort ? 137 :0), + 3, + interpret_addr(lp_socket_address()) ); if (ServerFD == -1) return(False); @@ -113,7 +118,7 @@ int main(int argc,char *argv[]) charset_initialise(); - while ((opt = getopt(argc, argv, "p:d:B:i:s:SMh")) != EOF) + while ((opt = getopt(argc, argv, "d:B:i:s:SMrh")) != EOF) switch (opt) { case 'B': @@ -137,6 +142,9 @@ int main(int argc,char *argv[]) case 's': pstrcpy(servicesf, optarg); break; + case 'r': + RootPort = -1; + break; case 'h': usage(); exit(0); |