1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

58 Commits

Author SHA1 Message Date
Samuel Cabrero
52744d35a3 nmbd: Reduce the wait interface loop sleep time
Under some circumstances the network-online.target can be reached
without an IPv4 address, for example when using systemd-networkd and
having systemd-networkd-wait-online.service disabled. This will trigger
a five seconds sleep which seems a bit excessive. It is specially
critical when winbind.service is enabled as it won't be started until
nmbd.service is running, delaying the systemd-logind.service five seconds.

Reduce the sleep time from 5 seconds to 250ms to exit the loop as soon
as possible.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 14 20:52:47 UTC 2021 on sn-devel-184
2021-05-14 20:52:47 +00:00
Volker Lendecke
263e6e06bd nmbd: Fix socket cleanup in make_subnet()
We can have -errno in the in those variables

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-24 20:31:30 +00:00
Volker Lendecke
7d25dfa6c1 nmbd: Fix CID 1474439: Incorrect expression
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-24 20:31:30 +00:00
Volker Lendecke
72540222c2 lib: Properly return errno from open_socket_in()
Before this patch, open_socket_in() relied on quite a bit of code to
not touch errno after for example socket() returned -1. Change this to
explicitly save errno in "ret", such that a later DEBUG() with all its
formatting code can mess it up.

While there, remove the debuglevel parameter. I don't think this
actually useful.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-19 07:09:37 +00:00
Richard Sharpe
b79aed8592 Convert all uses of uint8/16/32 to _t in nmbd and the include file.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-01 19:15:10 +02:00
Andreas Schneider
2df601bff0 nmbd: Send waiting status to systemd.
This tells the Administrator what's going on and we should log that IPv6
is not supported.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10816

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 17 13:16:43 CEST 2014 on sn-devel-104
2014-09-17 13:16:43 +02:00
Stefan Metzmacher
75e9f21108 s3:nmbd_subnetdb: close all sockets attached to a subnet in close_subnet() (bug #8276)
metze
2011-06-30 13:20:05 +02:00
Jeremy Allison
02af307585 More simple const fixes. 2011-05-05 23:56:07 +02:00
Günther Deschner
c217790918 s3-nmbd: move nmbd proto out of main proto.h
Guenther
2010-08-26 00:20:28 +02:00
Andreas Schneider
38b0e6b4d7 s3-nmbd: Remove obsolete signal type cast. 2010-02-23 12:23:42 +01:00
Stefan Metzmacher
0140bc389d s3:nmbd: change "nmbd:bind explicit broadcast" into "nmbd bind explicit broadcast"
metze
2010-02-08 18:35:11 +01:00
Stefan Metzmacher
30a1bc3650 s3:nmbd: also listen explicit on the subnet broadcast addresses
And send replies always via the unicast address of the subnet.

This behavior is off by default (as before)
and can be enabled with "nmbd:bind explicit broadcast = yes".

metze
2010-02-08 18:35:10 +01:00
Aravind Srinivasan
83cf98f113 Have nmbd check all available interfaces for WINS before failing
When nmbd is acting as WINS, it picks the first interface's IP as WINS
server's IP. If the first interface's IP is zero, we will just quit
(even though we might have other interfaces with valid IPs).

This patch makes nmbd look at all interfaces and pick the first interface
with a valid IP as the WINS server's IP.
2009-02-04 20:26:50 -08:00
Jelmer Vernooij
d6a5476ee7 Use sockaddr_storage only where we rely on the size, use sockaddr
otherwise (to clarify we can also pass in structs smaller than
sockaddr_storage, such as sockaddr_in).
2008-10-23 19:53:15 +02:00
Jeremy Allison
f23a6b7c93 Fix bug 5697 nmbd spins in reload_interfaces when only loopback has an IPv4 address
reported by Ted Percival <ted@midg3t.net>.
Jeremy.
(This used to be commit ab06efccf3)
2008-08-19 17:30:30 -07:00
Jeremy Allison
948ebaf033 Fix the last reported debian problem with nmbd not waiting
until interfaces come up.
Jeremy.
(This used to be commit 59a2f0873c)
2008-04-10 08:56:34 -07:00
Jeremy Allison
f88b7a076b This is a large patch (sorry). Migrate from struct in_addr
to struct sockaddr_storage in most places that matter (ie.
not the nmbd and NetBIOS lookups). This passes make test
on an IPv4 box, but I'll have to do more work/testing on
IPv6 enabled boxes. This should now give us a framework
for testing and finishing the IPv6 migration. It's at
the state where someone with a working IPv6 setup should
(theorecically) be able to type :
smbclient //ipv6-address/share
and have it work.
Jeremy.
(This used to be commit 98e154c312)
2007-10-24 14:16:54 -07:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Jeremy Allison
8e54530b52 Add start of IPv6 implementation. Currently most of this is avoiding
IPv6 in winbindd, but moves most of the socket functions that were
wrongly in lib/util.c into lib/util_sock.c and provides generic
IPv4/6 independent versions of most things. Still lots of work
to do, but now I can see how I'll fix the access check code.
Nasty part that remains is the name resolution code which is
used to returning arrays of in_addr structs.
Jeremy.
(This used to be commit 3f6bd0e1ec)
2007-10-10 18:25:16 -07:00
Jeremy Allison
923f14ff37 r25021: Fix coverity #435. Use of -1.
Jeremy.
(This used to be commit f789186086)
2007-10-10 12:30:35 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Jeremy Allison
0ff54fb41d r23349: Fix from Steve Langasek <vorlon@debian.org> to
allow SIGTERM to cause nmbd to exit on awaiting
an interface to come up. Debian bug #168079
Jeremy.
(This used to be commit 9ee310f3d6)
2007-10-10 12:23:08 -05:00
Jeremy Allison
d1ec690972 r22157: Fix bug #3634 - stop nmbd segfaulting with bad interface line.
Jeremy.
(This used to be commit c3e2207cb4)
2007-10-10 12:19:17 -05:00
Jeremy Allison
5a1a08d428 r16581: Fix Klocwork #2017. Possible null deref.
Jeremy.
(This used to be commit 6967fd4cef)
2007-10-10 11:19:01 -05:00
Jeremy Allison
4433376361 r16313: Not a problem - but ensure Klocwork is quiet (#872).
Jeremy.
(This used to be commit 22a345deed)
2007-10-10 11:17:33 -05:00
Jeremy Allison
a5da0a72e1 r16213: Fix Klocwork #852. iface_n_ip can potentially
return NULL. Ensure we don't deref.
Jeremy.
(This used to be commit c2f0ea2ff2)
2007-10-10 11:17:26 -05:00
Jeremy Allison
0648638fef r15700: Make nmbd udp sockets non-blocking to prevent problem
with select returning true but no data being available.
Fix for bug #3779.
Jeremy.
(This used to be commit e5787cf75b)
2007-10-10 11:17:08 -05:00
Jeremy Allison
83b987befd r12107: Move to a tdb-based wins database. At the moment we still
use it as though it were an in-memory db and dump out to
a flat file every 2 mins, but that can now change.
Jeremy.
(This used to be commit a342681792)
2007-10-10 11:05:45 -05:00
Herb Lewis
978ca84860 r6225: get rid of warnings from my compiler about nested externs
(This used to be commit efea76ac71)
2007-10-10 10:56:30 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
9fdc1363be Fix the character set handling properly in nmbd. Also fix bug where
iconv wasn't re-initialised on reading of "charset" parameters. This
caused workgroup name to be set incorrectly if it contained an
extended character.
Jeremy.
(This used to be commit 84ae44678a)
2003-08-27 01:25:01 +00:00
Andrew Bartlett
634c54310c Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings.  (Adds a lot of const).

Andrew Bartlett
(This used to be commit 3a7458f947)
2003-01-03 08:28:12 +00:00
Tim Potter
9327793ff5 Merge of #include <smb.h> removals.
(This used to be commit bdb6e76ab5)
2002-12-12 02:56:15 +00:00
Jeremy Allison
2f194322d4 Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break.
It does compile though :-).
Jeremy.
(This used to be commit f755711df8)
2002-11-12 23:20:50 +00:00
Andrew Tridgell
e90b652848 updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb)
2002-07-15 10:35:28 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Tim Potter
585d0efbc6 Got medieval on another pointless extern. Removed extern struct ipzero
and replaced with two functions:

	void zero_ip(struct in_adder *ip);
	BOOL is_zero_ip(struct in_addr ip);
(This used to be commit 778f5f77a6)
2001-11-26 03:11:44 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00
Simo Sorce
1f312492ec move to SAFE_FREE()
(This used to be commit 1446a1562b)
2001-09-17 04:35:51 +00:00
Christopher R. Hertel
7c09aa553d Same as nmbd.c. These now test wins_srv_count() instead of lp_wins_server
to determine whether the 'wins server' parameter is set.
(This used to be commit 5b975d3a9c)
2001-08-26 06:43:39 +00:00
Christopher R. Hertel
3c9e410c34 Instead of handing back a string (which might be a DNS name or an IP
string), the wins_srv module now hands back a struct in_addr when it's
called.  It caches the IP address once it has been looked up.  The IP
is cleared (and must be looked up again) if the 'wins server' parameter
is reread, or if the node is marked 'dead'.  A dead node will not be
re-tried for 10 minutes (per a #define in wins_srv.c).

As it was, the code was reading the WINS server name or IP directly from
lp_wins_server.  That's okay, except that if the value was expressed as
a name, then a DNS lookup would be done every time the client wanted to
talk to the server.

I still need to work out the implications of failover regarding the
'unicast subnet' list.

Chris -)-----
(This used to be commit 73aa188320)
2000-07-19 05:32:43 +00:00
Christopher R. Hertel
b35f21fb3a First cut toward adding WINS server failover.
*Note: failover doesn't actually work yet!*  It's just that the code I'm
adding provides all of the pieces necessary.

I do have one big question.  Something that I'll have to ask Jeremy, I'm
thinkin'.  In nmbd/nmbd_subnetdb.c the IP of the WINS server is used to
set up the Unicast subnet.

...so what happens if the WINS server changes?

My guess is either:
  a) nothing.
  b) I'd have to change the unicast subnet entry whenever the WINS server
     changes.

Urq.

BTW, the lp_wins_server() function no longer returns the WINS server name
or IP.  It returns the list of WINS servers entered in smb.conf.  To get
the currently 'live' WINS server, use the wins_srv() function.

Fun, eh?

Chris -)-----
(This used to be commit cc08bdc74f)
2000-07-19 01:21:30 +00:00
Jeremy Allison
a49d86ccc1 Additional fix for nmbd and 127.0.0.1 interface.
Jeremy.
(This used to be commit 715fa7ea8c)
2000-04-03 17:12:25 +00:00
Andrew Tridgell
3db52feb1f first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
(This used to be commit 453a822a76)
1999-12-13 13:27:58 +00:00
Jeremy Allison
24ca89bfb0 Removed acconfig.h configure configure.in include/config.h.in: Made smbwrapper not made
by default.
nmbd*: Changed all calls to namestr() to nmbd_namestr() to fix broken FreeBSD include
	   file problem...sigh.
Jeremy.
(This used to be commit 9ee8f39aed)
1998-11-14 01:04:13 +00:00
Andrew Tridgell
1778debff1 added some defensive programming to nmbd. This mostly means zeroing
areas of memory before freeing them.

While doing this I also found a couple of real bugs. In two places we
were freeing some memory that came from the stack, which leads to
a certain core dump on many sytems.
(This used to be commit c5e5c25c85)
1998-08-30 04:27:26 +00:00
Christopher R. Hertel
85474e0780 Cleaned up some testing code and made it more "permanent" looking. The
NetBIOS name lists attached to the subnet records are now managed by
the splay tree code.  I am still working on the WINS database as a
separate issue.  Code is written, it's just a matter of incorporating it.
CRH
(This used to be commit 5ba96ddde4)
1998-07-25 15:45:42 +00:00
Jeremy Allison
3daefed54e chgpasswd.c: Fix from Peter Debus <pdebus@turing.une.edu.au> for Digital UNIX
password change core dump bug.
nmbd_subnetdb.c: Make namelist_entry_compare() static.
nttrans.c: More NT SMB stuff.
Jeremy.
(This used to be commit 1925a29c6b)
1998-07-02 18:49:08 +00:00
Jeremy Allison
06e42fa865 nmbd_elections.c: Removed force elections code to bring into line with 1.9.18.
nmbd_namelistdb.c: Added comment for Chris.
nmbd_subnetdb.c: Went back to Chris's comparison code as with the make_nmb_name
                 change it all works now.
lib/rpc/server/srv_netlog.c: Ensure we return 'account disabled' for disabled
                             accounts, rather than crashing.
Jeremy.
(This used to be commit 4ab3d16827)
1998-06-29 22:50:49 +00:00