Fix confusing error message -- bug 5252
authorVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2008 08:51:33 +0000 (09:51 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2008 08:51:33 +0000 (09:51 +0100)
Thanks to Walter Franzini
(This used to be commit 19de47fef1b35c47885acc40760a232e4643079c)

source3/client/mount.cifs.c

index 44614f6e8a365d6a1c4fa3ac203b03eba25a60bf..c68c9ee7f767378c1aca50c4ea1e4fdebb4659f9 100644 (file)
@@ -205,8 +205,10 @@ static int open_cred_file(char * file_name)
                                /* go past equals sign */
                                temp_val++;
                                for(length = 0;length<4087;length++) {
-                                       if(temp_val[length] == '\n')
+                                       if ((temp_val[length] == '\n')
+                                           || (temp_val[length] == '\0')) {
                                                break;
+                                       }
                                }
                                if(length > 4086) {
                                        printf("mount.cifs failed due to malformed username in credentials file");
@@ -229,7 +231,7 @@ static int open_cred_file(char * file_name)
                                /* go past equals sign */
                                temp_val++;
                                for(length = 0;length<65;length++) {
-                                       if(temp_val[length] == '\n')
+                                       if(temp_val[length] == '\n' || temp_val[length] == '\0')
                                                break;
                                }
                                if(length > 64) {
@@ -258,7 +260,7 @@ static int open_cred_file(char * file_name)
                                if(verboseflag)
                                        printf("\nDomain %s\n",temp_val);
                                 for(length = 0;length<65;length++) {
-                                        if(temp_val[length] == '\n')
+                                        if(temp_val[length] == '\n' || temp_val[length] == '\0')
                                                 break;
                                 }
                                 if(length > 64) {