Patchwork Make credentials file parameters consistent with command line parameters

login
register
mail settings
Submitter Scott Lovenberg
Date April 4, 2010, 2:09 a.m.
Message ID <o2gb1fc6a561004031909j34b0e6c5gad6d591951e9e83@mail.gmail.com>
Download mbox | patch
Permalink /patch/49346/
State New
Headers show

Comments

Scott Lovenberg - April 4, 2010, 2:09 a.m.
This patch makes the mount.cifs credentials file parameters consistent with
the command line parameters to remove ambiguity between the command line
parameter format and the credentials file format. That is, it parses for
both short and long form of the 'username', 'password', and 'domain'
parameters.  This patch is against the current cifs-utils-4.2.

I'm also thinking of adding a second patch that allows for parsing a
"domain/user", "domain%user" and "domain/user%password" formats as allowed
from the command line.

Comments are appreciated.
Jeff Layton - April 4, 2010, 1:24 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 3 Apr 2010 22:09:45 -0400
Scott Lovenberg <scott.lovenberg@gmail.com> wrote:

> This patch makes the mount.cifs credentials file parameters consistent with
> the command line parameters to remove ambiguity between the command line
> parameter format and the credentials file format. That is, it parses for
> both short and long form of the 'username', 'password', and 'domain'
> parameters.  This patch is against the current cifs-utils-4.2.
> 
> I'm also thinking of adding a second patch that allows for parsing a
> "domain/user", "domain%user" and "domain/user%password" formats as allowed
> from the command line.
> 
> Comments are appreciated.

Thanks for the patch. It looks like a reasonable change but the patch
is malformed and doesn't apply. You've also sent it as a MIME encoded
attachment. The ideal way to do this is to commit your patch to a git
tree, use git-format-patch to generate the patch and git-send-email to
send it.

- -- 
Jeff Layton <jlayton@samba.org>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAku4kwYACgkQyP0gxQMdzIAZxgCcDAmOOTq6FVexs8FFAKaP9VBO
VOcAmQEXykt8xbk29hR3IDp1czq9hYkN
=MgcR
-----END PGP SIGNATURE-----
Jeff Layton - April 6, 2010, 6:53 p.m.
On Sun, 4 Apr 2010 09:24:19 -0400
Jeff Layton <jlayton@samba.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Sat, 3 Apr 2010 22:09:45 -0400
> Scott Lovenberg <scott.lovenberg@gmail.com> wrote:
> 
> > This patch makes the mount.cifs credentials file parameters consistent with
> > the command line parameters to remove ambiguity between the command line
> > parameter format and the credentials file format. That is, it parses for
> > both short and long form of the 'username', 'password', and 'domain'
> > parameters.  This patch is against the current cifs-utils-4.2.
> > 
> > I'm also thinking of adding a second patch that allows for parsing a
> > "domain/user", "domain%user" and "domain/user%password" formats as allowed
> > from the command line.
> > 
> > Comments are appreciated.
> 
> Thanks for the patch. It looks like a reasonable change but the patch
> is malformed and doesn't apply. You've also sent it as a MIME encoded
> attachment. The ideal way to do this is to commit your patch to a git
> tree, use git-format-patch to generate the patch and git-send-email to
> send it.
> 

Nevermind...I was able to hand-merge the patch and will go ahead and
commit it to the repo. It'll save some time and effort in the future
though if you submit patches that can be pulled into the repo directly.

Thanks,
Scott Lovenberg - April 6, 2010, 8:03 p.m.
>
>
> Nevermind...I was able to hand-merge the patch and will go ahead and
> commit it to the repo. It'll save some time and effort in the future
> though if you submit patches that can be pulled into the repo directly.
>
>
Thank you.  I have to become familiar with git... I'm more of a subversion
guy, myself (Linus says that makes me stupid and ugly... I can't disagree).
:)

On an unrelated note...
Do you have any thoughts on expanding the parsing to recognize the other
command line formats?  I'd like to see full compatibility between the
credentials file and the command line, so long as it doesn't become the
breeding ground for subtle bugs.

Patch

@@ -358,7 +358,7 @@ 
 		if (newline)
 			*newline = '\0';
 
-		if (strncasecmp("username", line_buf + i, 8) == 0) {
+		if (strncasecmp("user", line_buf + i, 4) == 0) {
 			temp_val = strchr(line_buf + i, '=');
 			if (temp_val) {
 				/* go past equals sign */
@@ -380,7 +380,7 @@ 
 				strlcpy(parsed_info->username, temp_val,
 					sizeof(parsed_info->username));
 			}
-		} else if (strncasecmp("password", line_buf + i, 8) == 0) {
+		} else if (strncasecmp("pass", line_buf + i, 4) == 0) {
 			temp_val = strchr(line_buf + i, '=');
 			if (!temp_val)
 				continue;
@@ -388,7 +388,7 @@ 
 			i = set_password(parsed_info, temp_val);
 			if (i)
 				return i;
-		} else if (strncasecmp("domain", line_buf + i, 6) == 0) {
+		} else if (strncasecmp("dom", line_buf + i, 3) == 0) {
 			temp_val = strchr(line_buf + i, '=');
 			if (temp_val) {
 				/* go past equals sign */