Bug 41193 - samba doesn't work if started with TMPDIR not a world-writable dir
samba doesn't work if started with TMPDIR not a world-writable dir
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: samba (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-17 23:32 EDT by peterw
Modified: 2007-04-18 12:33 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description peterw 2001-05-17 23:32:51 EDT
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:
Always

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
connect.)

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 @@
 
 RETVAL=0
 
+# 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 04:31:45 EDT
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 17:05:02 EDT
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.