Bug 41193 - samba doesn't work if started with TMPDIR not a world-writable dir
Summary: samba doesn't work if started with TMPDIR not a world-writable dir
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: samba   
(Show other bugs)
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-05-18 03:32 UTC by peterw
Modified: 2007-04-18 16:33 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-05-26 08:32:39 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description peterw 2001-05-18 03:32:51 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.2.19-6.2.1 i686)

Description of problem:
If root has a TMPDIR environment variable set when starting/restarting
Samba, Samba will attempt to use that directory instead of /tmp for various
things. If TMPDIR references anything other than a world-writable directory
(e.g. TMPDIR=/root/tmp) then only users who have write privileges to TMPDIR
can use Samba; others cannot even log in (for instance, if TMPDIR was
/root/tmp when starting Samba, then only root can log in to Samba). If a
TMPDIR variable exists but does not point to a valid directory, noone can
use Samba, not even root.

How reproducible:

Steps to Reproduce:
1. log in as root
2. export TMPDIR=""; service smb restart 
3. smbclient -L localhost   # provide password when prompted

Actual Results:  Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.0.8]
tree connect failed: ERRSRV - ERRinvnetname (Invalid network name in tree

Expected Results:  a listing of Samba information, e.g.

Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.0.8]

	Sharename      Type      Comment
	---------      ----      -------
	IPC$           IPC       IPC Service (Samba Server)

Additional info:

Thanks go to Jonathan Marsden for noticing this.

Samba uses mkstemp() when creating files inside the temp directory, which
defaults to /tmp if TMPDIR was not set when Samba was started. So there is
no danger in using /tmp. Anyone who wanted to use a different temp
directory would want/need to edit /etc/rc.d/init.d/smb to set TMPDIR so
that temp dir would be respected at boot time. I suggest that
/etc/rc.d/init.d/smb ought to include a line that unsets TMPDIR so that
Samba functions as intended, e.g.

--- smb.rhat	Tue May  8 00:25:59 2001
+++ smb	Thu May 17 23:30:07 2001
@@ -24,6 +24,9 @@
+# set TMPDIR to a world-writable directory if you like
+# (default is /tmp, and it is used safely)
+unset TMPDIR
 start() {
 	echo -n "Starting SMB services: "

Comment 1 Andrew Bartlett 2001-05-26 08:31:45 UTC
Watch out about the mk(s)temp issues!  Samba only uses any mkstemp in 2.2.0, and
only finally kills mktemp in 2.2.1.  The samba-team claims that all uses are
checked, and I beleive them, but this should be noted.

Comment 2 Trond Eivind Glomsrxd 2001-06-18 21:05:02 UTC
Fixed in samba-2.2.0-2. Thanks for your report.

Note You need to log in before you can comment on or make changes to this bug.