summaryrefslogtreecommitdiff
path: root/source3/utils/sharesec.c
AgeCommit message (Collapse)AuthorFilesLines
2025-11-10s3: talloc_destroy() -> TALLOC_FREE()Volker Lendecke1-1/+1
Sweeping change, I know. Should not change compiled code in most cases, the compiler should be smart enough to elide the assignment right before a return. In the cases where this is not right before the return, TALLOC_FREE() is safer as it makes use-after-free crash. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-01-10sharesec: Check if share exists in configurationVinit Agnihotri1-6/+5
Load config from registry without share info and check if sharename exists from configuration. This results into lesser delay for the same. In case of view we load config with all shares to ensure we get all shares for diplay purpose. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15780 Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: John Mulligan <jmulligan@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Fri Jan 10 10:45:30 UTC 2025 on atb-devel-224
2025-01-10sharesec: Add function to check existence of share from configVinit Agnihotri1-0/+76
Add function to detect if a share name exists in the registry or config file. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15780 Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: John Mulligan <jmulligan@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-01-10sharesec: Fix warning frame not freed in orderVinit Agnihotri1-0/+1
This change should fix following warning: Freed frame ../../source3/utils/sharesec.c:515, expected ../../source3/utils/sharesec.c:637 Frame was not getting freed in case of servicename is NULL. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15780 Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: John Mulligan <jmulligan@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2024-04-10s3:util:sharesec ace_compare() uses NUMERIC_CMP()Douglas Bagnall1-4/+4
ace->access_mask is uint32_t, so can overflow a signed int. This would be easy to trigger, as it is a flags field rather than an allocation count. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-25s3:utils: Call gfree_all() before exit in sharesecAndreas Schneider1-0/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-23s3:utils: Use lpcfg_set_cmdline() in sharesecPavel Kalugin1-1/+4
Signed-off-by: Pavel Kalugin <pkalugin@inno.tech> Reviewed-by: Andreas Schneider <asn@samba.org>
2021-09-10sharesec: don't ignore unknown optionsRalph Boehme1-0/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14828 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-05-25s3:utils: Migrate sharesec to new cmdline option parserAndreas Schneider1-5/+22
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-05-25s3:utils: Remove '-V' for '--viewsddl' from sharesecAndreas Schneider1-3/+3
The '-V' is already used for '-V|--version' in the common options. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-01-22sharesec: Simplify add_ace()Volker Lendecke1-12/+12
Use ADD_TO_ARRAY Signed-off-by: Volker Lendecke <vl@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-03-26sharesec: Use ARRAY_DEL_ELEMENT() in sort_acl()Volker Lendecke1-4/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-11-27s3:param: make "servicename" a substituted optionRalph Boehme1-1/+3
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-26sharesec: Return NTSTATUS from delete_share_securityChristof Schmitt1-1/+2
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-11-26sharesec: Return NTSTATUS from set_share_securityChristof Schmitt1-4/+6
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-24s3: remove now unneeded call to cmdline_messaging_context()Ralph Boehme1-1/+0
This was only needed as dbwrap_open() had a bug where it asked for the ctdb connection before initializing messaging. The previous commit fixed that so we can now safely remove the calls to cmdline_messaging_context() from all tools that don't use messaging. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Oct 24 09:33:47 UTC 2019 on sn-devel-184
2019-08-22s3: free popt context in utilsSwen Schillig1-5/+11
If done with popt context it should be free'd. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
2019-01-28s3:utils: Use C99 initializer for poptOption in sharesecAndreas Schneider1-15/+94
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-12-11sharesec: Use dom_sid_str_bufVolker Lendecke1-2/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-09-07s3:sharesec: Use cmdline_messaging_contextChristof Schmitt1-0/+2
Call cmdline_messasging_context to initialize messaging context before accessing clustered Samba config. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-06-17sharesec: Use non-numerical output for sharesecChristof Schmitt1-2/+2
This is an easy change to get the sharesec output back to the format used before. It is also easier to understand than the output of the flags. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11324 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2015-05-07s3: utils: Convert all uses of uint32/16/8 to _t.Richard Sharpe1-3/+3
Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 7 04:53:39 CEST 2015 on sn-devel-104
2015-04-25sharesec: Use common parse_ace functionChristof Schmitt1-174/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11237 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-04-25sharesec: Print ACEs in similar format as expected in inputChristof Schmitt1-12/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11237 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-04-22s3:param: remove arg save_defaults from lp_load_with_registry_shares()Michael Adam1-1/+1
This is only used in command line contexts, especially for testparm which relies on safe defaults. The only changed use is in sharesec, but it does not harm to also safe the defaults there. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2015-04-22s3:param: remove arg initialize_globals from lp_load_with_registry_shares()Michael Adam1-1/+1
This is only ever called in client context, and only called once. So there is no point at all in requesting reinit_globals. Set it to false. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2015-04-22s3:param: remove "add_ipc" parameter from lp_load_with_registry_shares().Michael Adam1-1/+1
This is not called from the server (which loads registry shares lazily), so add_ipc is always false... Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2015-04-22s3:param: remove "global_only" parameter from lp_load_with_registry_shares().Michael Adam1-2/+1
There is no point in choosing global_only when forcing to load all shares from registry at the same time... Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2015-03-24lib: load_case_tables() -> smb_init_locale()Volker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-29s3/sharesec: use security_ace_equal instead of sec_ace_equalDavid Disseldorp1-3/+5
Both offer the same functionality, sec_ace_equal() will be removed. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-05-28sharesec: remove unused security descriptor print fnsDavid Disseldorp1-85/+0
IDL generated NDR routines are now used, so the old hand rolled functions can be removed. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2014-05-28sharesec: use NDR security descriptor print fnsDavid Disseldorp1-4/+12
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2013-11-15s3-utils: Fix scanf format in sharesec.Andreas Schneider1-3/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-26sharesec: Implement --view-allVolker Lendecke1-1/+34
Listing individual shares can be quite slow when you have a lot of shares. This implements a --view-all option that prints something like [share1] REVISION:1 OWNER:(NULL SID) GROUP:(NULL SID) ACL:S-1-1-0:ALLOWED/0/FULL [share2] REVISION:1 OWNER:(NULL SID) GROUP:(NULL SID) ACL:S-1-1-0:ALLOWED/0/FULL Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2011-09-16s3: Make sharesec optionally use sddlVolker Lendecke1-1/+76
2011-06-09s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc.
2011-03-30s3-passdb: use passdb headers where needed.Günther Deschner1-0/+1
Guenther
2011-02-09s3:utils enable sharesec for registry sharesChristian Ambach1-1/+2
Signed-off-by: Michael Adam <obnox@samba.org> Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Wed Feb 9 16:41:31 CET 2011 on sn-devel-104
2010-11-02s3-debug Move 'load_case_tables()' before lp_set_cmdline() and popt callsAndrew Bartlett1-2/+3
The problem here is that we cannot run lp_set_cmdline() (directly or indirectly via the popt helpers) until load_case_tables() has been run. However, load_case_tables does not have auto-initialisation, so we must init it once, and once only. Andrew Bartlett
2010-11-02s3-debug Remove 'AllowDebugChange' and use lp_set_cmdline() insteadAndrew Bartlett1-1/+1
By removing this global variable, the API between the two different debug systems is made more similar. Both s3 and s4 now have lp_set_cmdline() which ensures that the smb.conf cannot overwrite these the user-specified log level. Andrew Bartlett
2010-11-02s3-debug Impove setup_logging() to specify logging to stderrAndrew Bartlett1-3/+1
This change improves the setup_logging() API so that callers which wish to set up logging to stderr can simply ask for it, rather than directly modify the dbf global variable. Andrew Bartlett
2010-10-12libcli/security Provide a common, top level libcli/security/security.hAndrew Bartlett1-1/+1
This will reduce the noise from merges of the rest of the libcli/security code, without this commit changing what code is actually used. This includes (along with other security headers) dom_sid.h and security_token.h Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-09-20s3-util_sid: use shared dom_sid_compare_auth and dom_sid_equal_X functions.Günther Deschner1-3/+4
Guenther
2010-08-05s3-popt: Only include popt-common.h when needed.Andreas Schneider1-0/+1
2010-05-21s3:dom_sid Global replace of DOM_SID with struct dom_sidAndrew Bartlett1-2/+2
This matches the structure that new code is being written to, and removes one more of the old-style named structures, and the need to know that is is just an alias for struct dom_sid. Andrew Bartlett Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18s3-secdesc: use SD_REVISION from security.idl.Günther Deschner1-1/+1
Guenther
2010-05-18s3-secdesc: remove "typedef struct security_descriptor SEC_DESC".Günther Deschner1-5/+5
Guenther
2010-05-18s3-secdesc: remove "typedef struct security_acl SEC_ACL".Günther Deschner1-5/+5
Guenther
2010-05-18s3-secdesc: remove "typedef struct security_ace SEC_ACE".Günther Deschner1-12/+13
Guenther