summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
2010-09-26s3: Remove talloc_autofree_context() from nametouid()Volker Lendecke1-1/+1
pass is freed a few lines down
2010-09-20s3-build: only include ctdbd_conn.h where needed.Günther Deschner1-0/+1
Guenther
2010-09-16s3/s4: merge msleep and smb_msleepBjörn Jacke1-49/+0
the merged variant is renamed to smb_msleep as some platforms already have a msleep function.
2010-09-14s3/profiling: don't use CLOCK_PROCESS_CPUTIME_IDBjörn Jacke1-17/+0
that clock is a CPU burnometer but we need a chronometer for profiling.
2010-08-31s3: messaging_ctdbd_connection() was only called with procid_self()Volker Lendecke1-1/+1
Eventually we'll get this right...
2010-08-28s3: Fix some DEBUGsVolker Lendecke1-2/+2
2010-08-05s3-popt: Only include popt-common.h when needed.Andreas Schneider1-0/+1
2010-08-05s3-secrets: only include secrets.h when needed.Günther Deschner1-0/+1
Guenther
2010-07-05s3: Pass procid_self() explicitly to messaging_ctdbd_connection()Volker Lendecke1-2/+2
2010-07-04s3: Pass the new server_id through reinit_after_forkVolker Lendecke1-1/+2
2010-07-04s3: Re-initialize the server_id in messaging_reinitVolker Lendecke1-3/+3
2010-06-22Fix bug 7528 - Solaris with NIS autohome.Jeremy Allison1-0/+3
Ensure entries containing "\n" are stripped. Jeremy.
2010-05-28s3:lib split out global workgroup and netbios name functions.Andrew Bartlett1-42/+1
Having these in their own file allows easier selective inclusion. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-03-26s3-event: switch s3 to using tevent_re_initialise()Andrew Tridgell1-2/+2
This correctly initialises the event backend, and checks for errors (thanks to Metze for suggesting this)
2010-03-10s3: Fix a long-standing problem with recycled PIDsVolker Lendecke1-0/+9
When a samba server process dies hard, it has no chance to clean up its entries in locking.tdb, brlock.tdb, connections.tdb and sessionid.tdb. For locking.tdb and brlock.tdb Samba is robust by checking every time we read an entry from the database if the corresponding process still exists. If it does not exist anymore, the entry is deleted. This is not 100% failsafe though: On systems with a limited PID space there is a non-zero chance that between the smbd's death and the fresh access, the PID is recycled by another long-running process. This renders all files that had been locked by the killed smbd potentially unusable until the new process also dies. This patch is supposed to fix the problem the following way: Every process ID in every database is augmented by a random 64-bit number that is stored in a serverid.tdb. Whenever we need to check if a process still exists we know its PID and the 64-bit number. We look up the PID in serverid.tdb and compare the 64-bit number. If it's the same, the process still is a valid smbd holding the lock. If it is different, a new smbd has taken over. I believe this is safe against an smbd that has died hard and the PID has been taken over by a non-samba process. This process would not have registered itself with a fresh 64-bit number in serverid.tdb, so the old one still exists in serverid.tdb. We protect against this case by the parent smbd taking care of deregistering PIDs from serverid.tdb and the fact that serverid.tdb is CLEAR_IF_FIRST. CLEAR_IF_FIRST does not work in a cluster, so the automatic cleanup does not work when all smbds are restarted. For this, "net serverid wipe" has to be run before smbd starts up. As a convenience, "net serverid wipedbs" also cleans up sessionid.tdb and connections.tdb. While there, this also cleans up overloading connections.tdb with all the process entries just for messaging_send_all(). Volker
2010-02-23s3: Consolidate server_id_self into the equivalent procid_self()Volker Lendecke1-5/+0
2010-01-24s3: Add -C (--use-ccache) to popt_common_credentialsVolker Lendecke1-0/+10
2010-01-21s3: Move "yesno" to the only place where it is used: client.cVolker Lendecke1-18/+0
2009-11-29s3: Move directory_exist_stat to testparm.c, it only looks at the modeVolker Lendecke1-21/+0
2009-11-29s3: Pass fake_dir_create_times down to file_exist_stat, none of the callers ↵Volker Lendecke1-2/+3
look at the mtime
2009-11-29s3: "get_file_size" only looks at the sizeVolker Lendecke1-1/+1
2009-11-29s3: "socket_exist" only looks at the modeVolker Lendecke1-1/+1
2009-11-29s3: Pass the "fake dir create times" parameter to sys_*statVolker Lendecke1-4/+4
Step 0 to restore it as a per-share paramter
2009-11-23Revert "s3: Make the implicit reference to Protocol in mask_match() explicit"Volker Lendecke1-8/+4
This reverts commit e23d8a3d1f558a7e98ef2afd71e1d15c5b3a71bc.
2009-11-23Revert "s3: Make the implicit reference to Protocol in mask_match_list() ↵Volker Lendecke1-3/+3
explicit" This reverts commit 1e22899d268ae5a089f941a204413c07ee64fc78.
2009-11-23Revert "s3: Make the implicit reference to Protocol in is_in_path() explicit"Volker Lendecke1-3/+2
This reverts commit f7b4151a64d8c6851e62255a7139fd00a5fc63a3.
2009-11-23Revert "s3: Move the global variable Protocol to struct smbd_server_connection"Volker Lendecke1-0/+12
This reverts commit c85a4c9ba4a7de65a7850f6f9708df66bd24deea.
2009-11-21s3: Move the global variable Protocol to struct smbd_server_connectionVolker Lendecke1-12/+0
2009-11-21s3: Make the implicit reference to Protocol in is_in_path() explicitVolker Lendecke1-2/+3
2009-11-21s3: Make the implicit reference to Protocol in mask_match_list() explicitVolker Lendecke1-3/+3
2009-11-21s3: Make the implicit reference to Protocol in mask_match() explicitVolker Lendecke1-4/+8
2009-11-21s3: Fix some nonempty blank linesVolker Lendecke1-16/+16
2009-11-21s3: Avoid two calls to strcmp()Volker Lendecke1-4/+4
2009-11-14Attempt to fix the s4 build -- we can not use map_nt_error_from_unix in lib/Volker Lendecke1-0/+11
2009-11-04Remove "Protocol" as an extern, and add accessor functions.Jeremy Allison1-1/+11
Jeremy.
2009-09-11s3-util: add get/set_cmdline_auth_info_domain to user_auth_info struct.Günther Deschner1-0/+18
Guenther
2009-08-25Allow for name array strings that don't end in a slashZach Loafman1-12/+17
Fix set_namearray to allow for strings that don't end in a slash. Also remove unnecessary strdup()s. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-08-24make smbcontrol smbd ping work proper checking for arguments handle short ↵Olaf Flebbe1-6/+16
pid_t correctly
2009-07-08s3: Remove is_ntfs_stream_name() and split_ntfs_stream_name()Tim Prouty1-90/+0
Actually I moved split_ntfs_stream_name into torture.c which is the one consumer of it. This could probably be changed at some point.
2009-07-01s3:util: let parent_dirname() correctly return toplevel filenamesStefan Metzmacher1-1/+1
metze
2009-06-12s3: Call va_end() after all va_start()/va_copy() calls.Andrew Kroeger1-1/+1
There are error paths in S3 where va_end() is not properly called after va_start() or va_copy() have been called. These issues were noted while performing an inspection for S4 bug #6129. Thanks to Erik Hovland <erik@hovland.org> for the original bug report.
2009-05-29util: move add_gid_to_array_unique to toplevel and add add_uid_to_array_unique.Günther Deschner1-33/+0
Guenther
2009-05-27s3: Allow child processes to exit gracefully if we are out of fdsMarc VanHeyningen1-6/+6
When we run out of file descriptors for some reason, every new connection forks a child that immediately panics causing smbd to coredump. This seems unnecessarily harsh; with this code change we now catch that error and merely log a message about it and exit without the core dump. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-05-26Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STATVolker Lendecke1-5/+5
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
2009-04-20Remove smb_mkstemp() - libreplace will now provide a secure mkstemp() ifJelmer Vernooij1-18/+0
the system one is broken.
2009-03-18s3: remove POLICY_HND.Günther Deschner1-2/+2
Guenther
2009-03-17Remove the global "struct cm_cred_struct" and associated calls, makeJeremy Allison1-0/+40
callers pass in a struct user_auth_info * instead. This commit causes smbc_set_credentials() to print out a message telling callers to use smbc_set_credentials_with_fallback() instead, as smbc_set_credentials() has a broken API (no SMBCCTX * pointer). No more global variables used in the connection manager API for client dfs calls. Jeremy.
2009-03-16Add some appropriate const.Jeremy Allison1-8/+8
Jeremy.
2009-03-04s3: Remove madvise supportSteven Danneman1-7/+0
This reverts 193be432. The MADVISE_PROTECT is inherited by all child processes and cannot be unset. The intention of the original patch was to protect the parent process, but allow children to be killed in low memory. Since this isn't possible with the current API, reverting the whole feature.
2009-02-24Remove read_pktVolker Lendecke1-99/+0