Bug 3290

Summary: /sbin/mount.smb uses USER variable which is set even when user option not used
Product: [Retired] Red Hat Linux Reporter: jasons
Component: distributionAssignee: Bill Nottingham <notting>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-06-14 17:26:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jasons 1999-06-05 20:25:09 UTC
/sbin/mount.smb uses USER variable which is set even when
user option not used (since it is the shell variable for the
current user).  This causes mounting smbfs filesystems
without a user to fail since "root" is put on the command
line to smbmount, instead of no user.  Also, since USER
should be in the form of "-U user", smbmount is being told
to make root the password.

The patch below changes USER to SMBUSER.

--- old/mount.smb	Sat Jun  5 15:17:28 1999
+++ new/mount.smb	Sat Jun  5 15:17:07 1999
@@ -28,7 +28,7 @@
 	      COMMAND="$COMMAND -u$MUID"
 	      ;;
 	  user=*)
-	      USER="-U `echo $arg | cut -d '=' -f 2-`"
+	      SMBUSER="-U `echo $arg | cut -d '=' -f 2-`"
 	      ;;
           passwd=*)
               PASSWD=`echo $arg | cut -d '=' -f 2-`
@@ -39,7 +39,7 @@
 done

 if [ -n "$PASSWD" ]; then
-      exec smbmount "$1" $USER $PASSWD -c "$COMMAND"
+      exec smbmount "$1" $SMBUSER $PASSWD -c "$COMMAND"
 else
-      exec smbmount "$1" -N $USER -c "$COMMAND"
+      exec smbmount "$1" -N $SMBUSER -c "$COMMAND"
 fi

Comment 1 Bill Nottingham 1999-06-14 17:26:59 UTC
fixed in the next samba release (2.0.4b-4, or greater.)