cifs mount fix for handling -V parameter
authorSteve French <smfrench@gmail.com>
Tue, 24 Feb 2009 18:52:08 +0000 (12:52 -0600)
committerMichael Adam <obnox@samba.org>
Tue, 24 Mar 2009 16:46:48 +0000 (17:46 +0100)
also syncs with 3-3 mount.cifs

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@samba.org>
(cherry picked from commit e831cd78ee3cf89abee058a475540955fad423ce)

Signed-off-by: Michael Adam <obnox@samba.org>
source/client/mount.cifs.c

index e7397da2e9763fa46374ed49ba44dd957a5fc345..67e964d635169cc2d633a198be1af4dea90615ea 100644 (file)
@@ -485,7 +485,8 @@ static int parse_options(char ** optionsp, int * filesys_flags)
                        }
                } else if (strncmp(data, "sec", 3) == 0) {
                        if (value) {
-                               if (!strcmp(value, "none"))
+                               if (!strncmp(value, "none", 4) ||
+                                   !strncmp(value, "krb5", 4))
                                        got_password = 1;
                        }
                } else if (strncmp(data, "ip", 2) == 0) {
@@ -533,8 +534,11 @@ static int parse_options(char ** optionsp, int * filesys_flags)
                                SAFE_FREE(out);
                                return 1;
                        }
-               } else if ((strncmp(data, "domain", 3) == 0)
-                          || (strncmp(data, "workgroup", 5) == 0)) {
+               } else if ((strncmp(data, "dom" /* domain */, 3) == 0)
+                          || (strncmp(data, "workg", 5) == 0)) {
+                       /* note this allows for synonyms of "domain"
+                          such as "DOM" and "dom" and "workgroup"
+                          and "WORKGRP" etc. */
                        if (!value || !*value) {
                                printf("CIFS: invalid domain name\n");
                                SAFE_FREE(out);
@@ -1075,6 +1079,14 @@ int main(int argc, char ** argv)
                }
                mountpoint = argv[2];
        } else {
+               if ((strcmp (argv[1], "--version") == 0) ||
+                   ((strcmp (argv[1], "-V") == 0))) {
+                       printf ("mount.cifs version: %s.%s%s\n",
+                       MOUNT_CIFS_VERSION_MAJOR,
+                       MOUNT_CIFS_VERSION_MINOR,
+                       MOUNT_CIFS_VENDOR_SUFFIX);
+                       exit (0);
+               }
                mount_cifs_usage();
                exit(EX_USAGE);
        }
@@ -1286,7 +1298,13 @@ int main(int argc, char ** argv)
        }
 
        if(got_user == 0) {
-               user_name = getusername();
+               /* Note that the password will not be retrieved from the
+                  USER env variable (ie user%password form) as there is
+                  already a PASSWD environment varaible */
+               if (getenv("USER"))
+                       user_name = strdup(getenv("USER"));
+               if (user_name == NULL)
+                       user_name = getusername();
                got_user = 1;
        }