summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
2026-01-20lib: Remove a function unused since 2016Volker Lendecke1-5/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-20srvsvc: Move valid_share_pathname() to where it's usedVolker Lendecke1-33/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-20lib: Remove the pointless unix_format() macroVolker Lendecke1-2/+1
One of the two callers even had a comment what it does... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-07smbd: Move utok_string() into smbdVolker Lendecke1-20/+0
Only used in chdir_current_service() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-10s3: Remove TALLOC_REALLOC() macroVolker Lendecke1-2/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-10s3: Replace a few calls to TALLOC() with talloc_size()Volker Lendecke1-1/+1
That does the same Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-05-15lib: Modernize a few DEBUGsVolker Lendecke1-10/+10
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-09-10util: Make show_msg call DEBUG just onceVolker Lendecke1-25/+38
format_debug_text() still splits up lines with separate write-calls, but DEBUGADD is something that I would like to get rid of. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2024-09-04smbd: improve reinit_after_fork error handlingDavid Disseldorp1-0/+1
reinit_after_fork() may panic or return an error on failure. When smbd is started in interactive mode, it ignores the reinit_after_fork() return status and unconditionally proceeds to smbd_process(). Similarly, if messaging_reinit() fails within reinit_after_fork() then it will subsequently call ctdb_async_ctx_reinit() if clustering is enabled. There's no reason why these errors shouldn't be handled immediately, so add appropriate error handling. Found by code inspection; not seen in the wild. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Wed Sep 4 09:53:01 UTC 2024 on atb-devel-224
2024-07-26s3/lib: move set_namearray() to util_namearray.cRalph Boehme1-63/+0
Needed to fix circular dependencies between samba-passdb, secrets3 and samba3util (iirc). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-26s3/lib: modernize set_namearray()Ralph Boehme1-80/+30
No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-26s3/lib: remove name_compare_entry typedefRalph Boehme1-3/+5
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-06-24lib: Align an integer typeVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2024-05-22s3:lib: Remove obsolete name_to_fqdn()Andreas Schneider1-59/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-03-12lib: Simplify copy_unix_token()Volker Lendecke1-5/+6
Avoid an else with implicit NULL initialization Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-03-12smbd: Remove get_Protocol()Volker Lendecke1-5/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-21s3/lib: add log_panic_action()Ralph Boehme1-0/+6
Can be used to log a nice stack backtrace with full debug symbols by setting "panic action" to something like panic action = cd /home/slow/git/samba/master && /home/slow/git/samba/master/selftest/gdb_backtrace %d This is similar to log_stack_trace(), but that doesn't come with debug symbols. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-21s3/lib: factor out call_panic_action() from smb_panic_s3()Ralph Boehme1-11/+26
No change in behaviour. Best viewed with git show -w. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-15smbd: Move mask_match_search() to smb1_reply.cVolker Lendecke1-16/+0
Only called there. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-10-27s3:util: Add gfree_memcache() to gfree_all()Andreas Schneider1-0/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-10smbd: Remove a pointless NULL checkVolker Lendecke1-1/+1
boolean short-circuiting already gives us this condition. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-07-13s3:lib: Fix code spellingAndreas Schneider1-3/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2023-06-16lib: Simplify two if-expressionsVolker Lendecke1-12/+6
This version looks easier to read to me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-04-19s3:lib: Do not try to match '.' and '..' directories in is_in_path()Andreas Schneider1-0/+5
This fixes setting veto files to '.*' to not list hidden files and directories starting with a dot. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15360 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): Wed Apr 19 22:30:19 UTC 2023 on atb-devel-224
2023-02-13lib: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-02-13lib: Simplify ms_has_wild() with strpbrk()Volker Lendecke1-13/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Move tab_depth() to reg_parse_prs.cVolker Lendecke1-7/+0
Wow, I did not know we still use prs_struct... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Make map_share_mode_to_deny_mode() static to smbstatusVolker Lendecke1-21/+0
At some point in the future this might disappear, we should really not show DOS share modes in smbstatus. Maybe this can't be changed though. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10smbd: Make get_safe_[[SI]VAL|ptr] static to smb1_lanman.cVolker Lendecke1-41/+0
SMB1-specific, only used there. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-14smbd: remove process shortname arg from reinit_after_fork()Ralph Boehme1-6/+1
All callers pass NULL anyway, so it isn't used anymore. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-10s3:lib: reset all tevent trace callbacks in reinit_after_fork()Pavel Filipenský1-0/+9
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> With "tevent: add event trace api" we have now more callbacks to reset. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-10s3:lib: fix trailing whitespacesPavel Filipenský1-15/+15
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-03-01lib: Simplify parent_dirname() by using talloc_strndup()Volker Lendecke1-2/+2
Don't duplicate the talloc_strndup() functionality. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-10-08lib: Use talloc_asprintf_addbuf() in utok_string()Volker Lendecke1-11/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-12s3: lib: If we're reporting getaddrinfo fail, print the name we were looking ↵Richard Sharpe1-2/+3
up in the same debug. Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-11lib: Add parent_watch_fd()Volker Lendecke1-0/+19
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-04-22s3:smbd: Remove NIS supportAndreas Schneider1-164/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-16lib: Remove init_names()Volker Lendecke1-1/+0
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-16lib: Decouple is_myname() from init_names()Volker Lendecke1-9/+26
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>
2020-10-23smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to NTCREATEX_FLAG_DENY_FCBRalph Boehme1-2/+2
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-23smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_DOS to NTCREATEX_FLAG_DENY_DOSRalph Boehme1-2/+2
Just a shorter name, no change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-08-28s3: safe_string: do not include string_wrappers.hMatthew DeVore1-0/+1
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-07-16lib/util: Remove code inside #ifdef HAVE_BROKEN_READDIR_NAMEChristof Schmitt1-5/+0
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-16lib/util: Remove code inside #ifdef NEXT2Christof Schmitt1-5/+0
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-05-06lib/messaging: Move messages_dgm out of source3Amitay Isaacs1-1/+1
... so CTDB can also use it. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2020-02-27lib/util/fault.c: Unify printing of the stack trace with the INTERNAL ERROR ↵Andrew Bartlett1-4/+0
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-27lib/util: Make prctl_set_comment take a printf format stringAndrew Bartlett1-1/+1
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>
2019-12-02lib: Remove unused smb_xvasprintf()Volker Lendecke1-19/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martins@samba.org>
2019-11-27smbdotconf: mark "panic action" with substitution="1"Ralph Boehme1-1/+3
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-27smbdotconf: mark "homedir map" with substitution="1"Ralph Boehme1-2/+6
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>