summaryrefslogtreecommitdiff
path: root/source3/lib
AgeCommit message (Collapse)AuthorFilesLines
2019-07-22s3:prefork: Allow to associate private data with listening socketSamuel Cabrero2-18/+39
Prepare for merger RPC server codebase, where it will be necessary to stablish an association between the listening socket and the dcesrv_endpoint that the socket is serving. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22s3-prefork: Add header inclusion guardsSamuel Cabrero1-0/+4
Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-18lib: Fix the 32-bit buildVolker Lendecke1-4/+4
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): Thu Jul 18 12:55:30 UTC 2019 on sn-devel-184
2019-07-17s3/lib/smbconf: clang: 'Value stored during its initialization is never read'Noel Power1-7/+7
Fixes: source3/lib/smbconf/smbconf_reg.c:123:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:178:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:444:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:583:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:712:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:995:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:1103:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ 7 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Autobuild-User(master): Gary Lockyer <gary@samba.org> Autobuild-Date(master): Wed Jul 17 00:07:48 UTC 2019 on sn-devel-184
2019-07-16s3/lib: clang: 'Value stored to 'rta' is never read'Noel Power1-1/+0
Fixes: source3/lib/addrchange.c:217:2: warning: Value stored to 'rta' is never read <--[clang] rta = IFA_RTA(ifa); ^ ~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-16s3/lib: clang: Fix 'passed-by-value struct argument contains uninit-ed data'Noel Power1-1/+1
Fixed: g_lock.c:358:21: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'pid') <--[clang] state->watch_req = dbwrap_watched_watch_send( ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-16s3/lib: clang: Fix 'Value stored to 'b' is never read'Noel Power1-3/+3
Fixes: source3/lib/substitute.c:516:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ source3/lib/substitute.c:709:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ source3/lib/substitute.c:811:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ 3 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-16s3/lib/dwrap: clang: Fix 'Array access results in a null pointer dereference'Noel Power1-1/+1
Fixes: source3/lib/dbwrap/dbwrap_watch.c:55:3: warning: Array access (from variable 'wkey') results in a null pointer dereference <--[clang] SIVAL(wkey, 0, db_id_len); ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-16s3/lib: clang: Fix 'Value stored during its initialization is never read'Noel Power1-1/+1
Fixes: source3/lib/messages.c:483:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_UNSUCCESSFUL; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-12adouble: add ad_unconvert()Ralph Boehme2-0/+770
This collects a file's stream data and packs it into a AppleDouble file. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12s3: move fruit catia string replace mappings to s3/lib/Ralph Boehme2-0/+14
This will be needed by another component soonish. Signed-off-by: Ralph Boehme <slow@samba.org>
2019-07-12s3:{modules => lib}/string_replace.[c|h]Ralph Boehme2-0/+212
This is now also consumed by something outside source3/modules/. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12s3:modules: pass a TALLOC_CTX to string_replace_init_map()Ralph Boehme1-1/+2
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: ensure stat info is marked invalid on new pathRalph Boehme1-0/+2
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: remove xattrs after successfull conversionRalph Boehme1-0/+3
This ensure the subsequent ad_fset() does not attempt to put back the xattrs on disk in the AppleDouble file. It's not yet a problem as we don't have the code that would do that, but that will be added in the next commit... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: add some ASCII artRalph Boehme1-0/+35
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: use runtime size when writing out AppleDouble headerRalph Boehme1-2/+2
We're calling SMB_VFS_NEXT_PWRITE() to write out the AppleDouble header data. Until now this header always had a fixed sizeof AD_DATASZ_DOT_UND bytes, but a subsequent commit will change that. Use the correct size which is the offset of the begining of the resource fork data. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: pass VFS handle and fsp to ad_pack()Ralph Boehme1-3/+5
Unused for now, that comes next. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12adouble: remove redundant calls to ad_pack()Ralph Boehme1-17/+0
ad_fset() calls ad_pack() anyway... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12s3:lib: move Mac streams util functions to s3/libRalph Boehme2-0/+100
While at it, change the functions to work on the stream name directly instead of struct smb_filename. A later commit wants to use the function on the resulting stream names coming from vfs_streaminfo(). Also use the simple string compare version, not the multibyte ones, as the afp* stream names are simple ASCII string, so there's no need to become fancy. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-12vfs_fruit: move AppleDouble functionality to a dedicated subsystemRalph Boehme2-0/+2066
It's still tied to the VFS, therefor it lives in source3/modules/. Reduces code bloat in vfs_fruit and makes it possible to use it from other parts of the codebase in future. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-08s3/lib: Fix Access to field results in dereference of NULL pointerNoel Power1-0/+7
Fixes: ource3/lib/messages_dgm.c:176:29: warning: Access to field 'queue' results in a dereference of a null pointer (loaded from variable 'out') <--[clang] qlen = tevent_queue_length(out->queue); Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-07-04dbwrap: Add publically available dbwrap_watch_wakeup()Volker Lendecke2-0/+24
Without this, to notify watchers you need to actually store data. This might be a waste of resources. locking.tdb waiters might actually wait for leases.tdb or brlock.tdb changes, and locking.tdb records can be large. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-04dbwrap: Rename dbwrap_watched_wakeup()Volker Lendecke1-6/+7
In the next step I want to make dbwrap_watched_wakeup() publically available under that canonical name. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-01s3/lib: add make_file_index_from_itime()Ralph Boehme2-0/+39
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01s3/lib: add update_stat_ex_file_id()Ralph Boehme1-0/+6
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01s3/lib: add update_stat_ex_itime()Ralph Boehme1-0/+7
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01s3: add st_ex_file_id to struct stat_exRalph Boehme1-0/+2
st_ex_file_id is an immutable, never reused numeric identifier for objects in a filesystem. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01s3: add st_ex_itime to struct stat_exRalph Boehme1-0/+3
st_ex_itime is an immutable original birth time aka instantiation time. Set when a file is created, never changes thereafter. May not be set by the client. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01s3: convert struct stat_ex st_ex_calculated_birthtime bool to flagsRalph Boehme1-5/+6
Subsequent commits will add more flags, this paves the way. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-06-30source3: Update all consumers of strtoul_err(), strtoull_err() to new APISwen Schillig6-18/+27
Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
2019-06-20smbd: Remove unused brlock codeVolker Lendecke2-13/+0
No PENDING locks in brlock.tdb anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-05-29s3/lib: don't write to buffer (which might be NULL) if bufsize <=0Noel Power1-6/+7
Some code depends that tdb_pack[va] will return the bytes it would write to 'buf' if the bufsize passed in is <=0, writing to the buffer is protected by with lines like if (bufsize && bufsize >= len) { /* write to 'buf' */ } however in these instances the local pointer to the buffer is still modified buf += len; It's quite probable if bufsize == 0 that buf itself is NULL, in this case we should protect against performing pointer arithmetic. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-05-29s3/lib/netapi: Fix 'Possible null pointer dereference' warningNoel Power1-1/+1
source3/lib/netapi/localgroup.c:1103: warning: nullPointer: Possible null pointer dereference: r <--[cppcheck] Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-05-28dbwrap: Use sizeof, not an integer constantVolker Lendecke1-1/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-05-24s3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.Ralph Boehme2-16/+16
Keep naming consistent across all usage. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3: lib: Remove file_pload_send().Jeremy Allison2-32/+0
No longer used. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3: lib: Add file_ploadv_send().Jeremy Allison2-0/+32
Not yet used. Preparing to remove file_pload_send() with this safer alternative. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3: lib: Remove file_lines_pload().Jeremy Allison2-17/+0
No longer used. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3: smbd: Convert sysquotas.c code to use file_lines_ploadv().Jeremy Allison1-19/+107
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3: lib: util: Add file_lines_ploadv().Jeremy Allison2-0/+18
Not yet used. Duplicate code to file_lines_pload() except uses vectored argument list. file_lines_pload() will be removed once all callers are converted. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-24s3:lib: Move up NULL checkAndreas Schneider1-4/+4
Found by covscan. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri May 24 07:23:42 UTC 2019 on sn-devel-184
2019-05-23libsmbconf:registry: Return correct case for get_shareChristof Schmitt1-4/+22
get_share (called from 'net conf showshare') does a lookup of the share name case-insensitively. As the registry stores the share name in the correct case and 'net conf list' prints the correct case, also lookup the correct case for get_share. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-05-19Fix uClibc build on 64bit platforms by including stdint.hFabrice Fontaine1-0/+1
Fixes an error detected by buildroot autobuilders: http://autobuild.buildroot.net/results/573/573e2268e205e10d1352fa81122d8f225fdb4575/build-end.log /home/rclinux/rc-buildroot-test/scripts/instance-1/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/stdint.h:122:27: error: conflicting types for 'uintptr_t' typedef unsigned long int uintptr_t; ^ In file included from ../lib/ldb/tests/ldb_msg.c:17:0: ../third_party/cmocka/cmocka.h:126:28: note: previous declaration of 'uintptr_t' was here typedef unsigned int uintptr_t; The define __WORDSIZE is missing when cmocka.h decides how to define uintptr_t, this patch includes stdint.h when needed. Patch sent upstream: https://lists.samba.org/archive/samba-technical/2018-January/125306.html [updated for samba-4.8.4, v2 sent upstream https://lists.samba.org/archive/samba-technical/2018-August/129732.html, updated for samba-4.9.1] Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> [Retrieved from: https://git.buildroot.net/buildroot/tree/package/samba4/0003-Fix-uClibc-build-on-64bit-platforms-by-including-std.patch] Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-05-15s3: net: Harden srprs_str() against memcmp overread.Jeremy Allison1-0/+8
Found by Michael Hanselmann using fuzzing tools BUG: https://bugzilla.samba.org/show_bug.cgi?id=13842 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-08g_lock: Fix a typoVolker Lendecke1-1/+1
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): Wed May 8 17:47:39 UTC 2019 on sn-devel-184
2019-05-08g_lock: Apply some constVolker Lendecke1-1/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-29s3:lib: Use correct C99 initializer for 'struct flock' in messages_dgmAndreas Schneider1-1/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-04-24s3/lib: add a tevent_glib_glue subsystem testRalph Boehme1-0/+397
Tests adapted from glib2 glib/tests/mainloop.c. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2019-04-24s3/lib: new tevent_glib_glue subsystemRalph Boehme2-0/+951
tevent_glib_glue_create() takes glib GMainContext and adds its event sources to a tevent context. tevent will poll the sources and run handlers for pending events as detailed in the glib documentation: https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <npower@samba.org>