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

812 Commits

Author SHA1 Message Date
Volker Lendecke
cb0201973c lib: Simplify parent_dirname() by using talloc_strndup()
Don't duplicate the talloc_strndup() functionality.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-03-01 20:09:28 +00:00
Volker Lendecke
0853a7a2bb lib: Use talloc_asprintf_addbuf() in utok_string()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-10-08 19:28:31 +00:00
Richard Sharpe
401ae83d5e s3: lib: If we're reporting getaddrinfo fail, print the name we were looking up in the same debug.
Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-12 20:29:32 +00:00
Volker Lendecke
695938b633 lib: Add parent_watch_fd()
Make the parent watcher pipe used in reinit_after_fork() available for
external users that can't call reinit_after_fork().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-11 22:56:37 +00:00
Andreas Schneider
edda7a329e s3:smbd: Remove NIS support
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-04-22 17:57:30 +00:00
Volker Lendecke
bb5bf50819 lib: Remove init_names()
is_myname() looks at lp_* directly, nmbd maintains its own list: We don't
need the baroque loadparm handler anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-16 17:09:32 +00:00
Volker Lendecke
088386bbed lib: Decouple is_myname() from init_names()
In a new binary I forgot "init_names()" in main and it crashed in
auth3. We should not have to call init_names() everywhere I guess.

The my_netbios_names() array is free of duplicates, but as we don't
expect more than a handful of netbios aliases this does not matter for
just checking existence of a name. And moreover, a properly configured
smb.conf doesn't have tons of dups in "netbios aliases" anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-16 17:09:32 +00:00
Ralph Boehme
c2f0fd40da smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to NTCREATEX_FLAG_DENY_FCB
Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-23 17:44:33 +00:00
Ralph Boehme
6da16727e1 smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_DOS to NTCREATEX_FLAG_DENY_DOS
Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-23 17:44:33 +00:00
Matthew DeVore
c2ac923c6a s3: safe_string: do not include string_wrappers.h
Rather than have safe_string.h #include string_wrappers.h, make users of
string_wrappers.h include it explicitly.

includes.h now no longer includes string_wrappers.h transitively. Still
allow includes.h to #include safe_string.h for now so that as many
modules as possible get the safety checks in it.

Signed-off-by: Matthew DeVore <matvore@google.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-08-28 00:56:34 +00:00
Christof Schmitt
ee6b31ad9b lib/util: Remove code inside #ifdef HAVE_BROKEN_READDIR_NAME
This is dead code, the define is never set.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 01:29:45 +00:00
Christof Schmitt
eecd65d475 lib/util: Remove code inside #ifdef NEXT2
This is dead code, the define is never set.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 01:29:45 +00:00
Amitay Isaacs
93408f60cb lib/messaging: Move messages_dgm out of source3
... so CTDB can also use it.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-05-06 00:06:40 +00:00
Andrew Bartlett
f7fe6fa550 lib/util/fault.c: Unify printing of the stack trace with the INTERNAL ERROR string
We can diverged into the s3 and lib/fault panic action stuff once
we have printed the backtrace.

Our tests require we use the word PANIC, and some administrative scripts
might look for similar things, so keep those words.

The use of DEBUG(0, ... is deliberate to keep the output
of the PANIC line as consistent as possible with the historical smbd output.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 27 05:09:44 UTC 2020 on sn-devel-184
2020-02-27 05:09:44 +00:00
Andrew Bartlett
efb3aa95c5 lib/util: Make prctl_set_comment take a printf format string
This makes it easier to pass a small amount of variable information
into the buffer, to distinguish processes in the AD DC.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-02-27 03:42:35 +00:00
Volker Lendecke
39f9618316 lib: Remove unused smb_xvasprintf()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martins@samba.org>
2019-12-02 21:23:35 +00:00
Ralph Boehme
ea61dd917e smbdotconf: mark "panic action" with substitution="1"
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-27 10:25:35 +00:00
Ralph Boehme
9f3c05d009 smbdotconf: mark "homedir map" with substitution="1"
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-27 10:25:34 +00:00
Ralph Boehme
330f4ac1ca s3:lib: add missing TALLOC_CTX parameter in call to lp_homedir_map()
This seems to be dead (at least dying) code,
is WITH_NISPLUS_HOME ever defined?

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-27 10:25:34 +00:00
Volker Lendecke
219a189c99 lib: Add "utok_string"
A terse, one-line unix token representation for debugging purposes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-09-11 19:59:34 +00:00
Andreas Schneider
7ff94b18e2 s3:vfs: Correctly check if OFD locks should be enabled or not
Also the smb.conf options should only be checked once and a reload of
the config should not switch to a different locking mode.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb  9 03:43:50 CET 2019 on sn-devel-144
2019-02-09 03:43:50 +01:00
Stefan Metzmacher
1616654275 s3:smbd: prepare the usage of per_thread_cwd_*() functions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-01-11 23:11:11 +01:00
Ralph Boehme
ad04a6ce49 s3:lib: add root_unix_token()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-01-11 23:11:11 +01:00
Volker Lendecke
5b2c3f2f42 lib: Remove gencache.h from proto.h
It's a pain to recompile the world if gencache.h changes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 19 18:52:50 CEST 2018 on sn-devel-144
2018-10-19 18:52:50 +02:00
Volker Lendecke
2557ae53ed lib: Move the "expired" for gencache_parse calculation into gencache.c
Make it more robust

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 16 21:20:19 CEST 2018 on sn-devel-144
2018-10-16 21:20:19 +02:00
Stefan Metzmacher
a4d2eedafe s3:util: remove reinit_after_fork_pipe_handler before sending SIGTERM
We should not keep the tevent_fd active when we sending us a SIGTERM,
this is not a real problem, but due to a different bug I triggered
a 100% cpu loop. I think it's safer to idle in that case instead
of waisting a lot of energy.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-24 19:41:14 +02:00
Andrew Bartlett
bf9551902a lib/util: Move log_stack_trace() to common code
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-11 01:06:39 +02:00
Andrew Bartlett
85dc9ee140 s3-lib: Remove support for libexc for IRIX backtraces
IRIX is long dead, and this code needs become_root() which is not in
the top level code.

Additionally, the check for libexc never made it into waf, so this
has been dead code since Samba 4.1.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-11 01:06:39 +02:00
Andreas Schneider
c29d087e1e include: Create system/nis.h in libreplace
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238

Pair-Programmed-With: Guenther Deschner <gd@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-01-22 12:26:20 +01:00
Ralph Boehme
2813b53e1a dbwrap_ctdb: implement parse_record_send()/recv()
This mainly works like the sync version, but calls ctdbd_parse_send/recv
instead.

We use one global ctdb connection that is used exclusively for async
requests.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-04-18 22:54:16 +02:00
Volker Lendecke
b4ed72a2d3 s3/lib: Use ms_fnmatch_protocol in mask_match
This avoids the talloc/free through push_ucs2_talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-01-22 18:30:12 +01:00
Volker Lendecke
9af73f62ce lib: Add lib/util/server_id.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-01-22 18:30:11 +01:00
Jeremy Allison
828b60f30d lib/util: Move unix_wild_match() from source3/lib/util to lib/util/
Use top-level functions instead of source3 specific ones.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-16 12:41:09 +01:00
Jeremy Allison
caadd8afe6 s3: lib: Move from talloc_strdup then lower to strlower_talloc()
Do things in one go.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-16 12:41:09 +01:00
Jeremy Allison
076963c23e s3: util: Remove unneeded strequal() call. Convert to simple character check.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12419

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-16 12:41:09 +01:00
Jeremy Allison
b7a4210e28 s3: lib - Fix formatting of unix_wild_match() sub-function to README.Coding standards.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12419

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-11-16 12:41:09 +01:00
Andreas Schneider
631e063f6b s3-lib: Do not set an empty string in split_domain_user()
The function should also return if it failed or not.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Sep 25 12:56:17 CEST 2016 on sn-devel-144
2016-09-25 12:56:17 +02:00
Jeremy Allison
5985383167 s3: lib: util: Add map_process_lock_to_ofd_lock() utility function.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
2016-05-21 01:28:28 +02:00
Jeremy Allison
bb93b24b18 s3: lib: Add 'int op' parameter to fcntl_getlock().
Will allow us to move to open file description locks
from process-associated locks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
2016-05-21 01:28:28 +02:00
Ralph Boehme
719e42294d s3/lib: add remote arch caching
This allows caching the remote arch string in gencache. A subsequent
commit will use this in SMB2 negprot.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Ralph Boehme
44c236ac7f s3/lib: add get_remote_arch_from_str()
This will be used when fetching remote arch from gencache.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Ralph Boehme
6b5b004918 s3/lib: rework get_remote_arch_str() to use an array
By using C99 designated array initializers we can simplify the code and
remove the dependency on initializers appearing in a particular order.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:22 +02:00
Volker Lendecke
79f946cdb6 lib: Remove unused talloc_append_blob
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
640870ee20 lib: Separate out xx_path() & callers
We should not have to #include proto.h just for cache_path() or so

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Volker Lendecke
c281573399 lib: Use directory_create_or_exist in xx_path
directory_create_or_exist is a little different: It does the lstat first and
sets the umask properly, but I think this is more correct than the xx_path()
version before.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-14 20:23:13 +01:00
Jeremy Allison
07c4967d6c s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Remove lp_posix_pathnames() out of ms_has_wild().

NB. The usage of ms_has_wild() inside set_namearray()
should *never* have been looking at lp_posix_pathnames()
anyway, as this is a config option that needs to look
at wildcards. This was probably an old (but never
triggered) bug.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:27 +01:00
Volker Lendecke
c66592bcf7 lib: Move some procid functions out of util.c
Including proto.h just for pid_to_procid() is a pain...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-09 07:53:18 +01:00
Volker Lendecke
f0bfd61556 lib: Increase a debuglevel
We do this every time when a process exits. If that process has
properly cleaned up after itself, we spit out this message.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-09 07:53:18 +01:00
Christof Schmitt
b041a589ae Remove function name from callers of DBG_*
It is now added automatically.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-21 23:13:17 +02:00
Volker Lendecke
a788fd3065 lib: Remove unused global my_unique_id
The unique_id is now always attached to a messaging_context.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-10-19 12:09:10 +02:00