Bug 7282 - Credentials file format not backwards compatible to mount.smbfs
Summary: Credentials file format not backwards compatible to mount.smbfs
Status: RESOLVED FIXED
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: user space tools (show other bugs)
Version: 2.6
Hardware: All Linux
: P3 trivial
Target Milestone: ---
Assignee: Jeff Layton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-23 01:38 UTC by Scott Lovenberg
Modified: 2010-05-29 04:31 UTC (History)
1 user (show)

See Also:


Attachments
Parses "user" and "pass" entries of a credentials file in open_cred_file(char* file_name) function. (636 bytes, patch)
2010-03-23 03:03 UTC, Scott Lovenberg
no flags Details
More clean version of last patch. Handles both cases with single if. Also, cosmetic change for consistent style inside of parens. (602 bytes, patch)
2010-03-23 03:40 UTC, Scott Lovenberg
no flags Details
Formal patch for mount.cifs rebased for cifs-utils-4.2.0. (871 bytes, patch)
2010-04-03 21:17 UTC, Scott Lovenberg
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Lovenberg 2010-03-23 01:38:50 UTC
I had completely forgotten about this until I found it in my inbox and I'm submitting a bug report so that it doesn't slip through the digital cracks again.


The credentials option for mount.smbfs used to be the following format: 
 user=name 
 password=pass 
 
I've found that the format supported for mount.cifs is: 
 username=name 
 password=pass 
 
This seems at odds with the manual page for mount.cifs under the user=arg option: 
 [...] 
 Note 
 The cifs vfs accepts the parameter user=, or for users familiar with smbfs it 
 accepts the longer form of the parameter username=. Similarly the longer smbfs 
 style parameter names may be accepted as synonyms for the shorter cifs 
 parameters pass=,dom= and cred=. 
 [...] 
 
 I had, for whatever reason, assumed that the user option rules would apply to the credentials file or that it would be backwards compatible with the older mount.smbfs credentials file format. Are either of these assumptions correct? If not, would it make sense to add or reword the manual page a bit (assuming I'm not the only one that misinterpreted it) for clarity? I wouldn't mind drafting up a proposal if others felt it was worth the effort. 
 
 
 Happy Version Numbers: 
 from The Fine Manual page for mount.cifs(8) 
 VERSION 
 This man page is correct for version 1.52 of the cifs vfs filesystem (roughly Linux kernel 2.6.24). 
 [1005 12:24 sun ~]#smbd -V 
 Version 3.0.33-3.7.el5 
 [1007 12:26 sun ~]#uname -a 
 Linux sanitized.network.tld 2.6.18-92.1.22.el5.centos.plusxen #1 SMP Wed Dec 17 11:22:13 EST 2008 x86_64 x86_64 x86_64 GNU/Linux 
  
 Would you agree that it is more desirable to add the "user=" format to mount.cifs to maintain backwards compatibility? I think this is probably the most 'clean' way to deal with it.
Comment 1 Scott Lovenberg 2010-03-23 01:54:43 UTC
I have a quick (untested) patch.  I just added
'|| strncasecmp("user"),line_buf+i,4' to open_cred_file(char * file_name) in mount.cifs.c.

Should I submit as an official patch and if so, what format of patch file is preferred?
Comment 2 Scott Lovenberg 2010-03-23 03:03:45 UTC
Created attachment 5523 [details]
Parses "user" and "pass" entries of a credentials file in open_cred_file(char* file_name) function.

Untested, but I can't see how it couldn't work :)
Comment 3 Scott Lovenberg 2010-03-23 03:40:46 UTC
Created attachment 5524 [details]
More clean version of last patch.  Handles both cases with single if.  Also, cosmetic change for consistent style inside of parens.

Sorry for spamming, I've got insomnia and I keep looking over mount.cifs.c.  

I'm thinking more and more I'd like to make a number of changes to fix items on the back burner.
Comment 4 Jeff Layton 2010-04-01 21:35:44 UTC
Patch looks reasonable to me. Please base it on current cifs-utils code and send the patch to linux-cifs-client mailing list so that it can be reviewed there.
Comment 5 Scott Lovenberg 2010-04-03 21:17:42 UTC
Created attachment 5591 [details]
Formal patch for mount.cifs rebased for cifs-utils-4.2.0.

This is the formal patch that has been submitted to the mailing list.  Adding here for documentation purposes.
Comment 6 Scott Lovenberg 2010-05-29 04:31:43 UTC
Forgot to close this one out.  
Patch was applied and shipped with cifs-utils-4.3.