Syncup with HEAD:
authorTim Potter <tpot@samba.org>
Wed, 28 May 2003 01:06:53 +0000 (01:06 +0000)
committerTim Potter <tpot@samba.org>
Wed, 28 May 2003 01:06:53 +0000 (01:06 +0000)
>revision 1.3
>date: 2003/05/20 04:28:29;  author: sfrench;  state: Exp;  lines: +10 -5
>Fix Linux cifs vfs mount helper parsing of slashes
(This used to be commit b2b4a7e4998cc41842e8b564a4ccb77737aeed04)

source3/client/mount.cifs.c

index 7167859d7b2e6fa403c604b0205c367da00dfa2b..6edb06aedfb10611596025a3cff9a798b4cd61fa 100755 (executable)
@@ -223,14 +223,15 @@ char * parse_server(char * unc_name)
                        return 0;
                } else {
                        unc_name[0] = '\\';
-                       unc_name[1] = '\\';
+                       unc_name[0] = '/';
+                       unc_name[1] = '/';
                        unc_name += 2;
                        if ((share = strchr(unc_name, '/')) || 
                                (share = strchr(unc_name,'\\'))) {
                                *share = 0;  /* temporarily terminate the string */
                                share += 1;
                                host_entry = gethostbyname(unc_name);
-                               *(share - 1) = '\\'; /* put the slash back */
+                               *(share - 1) = '/'; /* put the slash back */
 /*                             rc = getipnodebyname(unc_name, AF_INET, AT_ADDRCONFIG ,&rc);*/
                                if(host_entry == NULL) {
                                        printf("mount error: could not find target server. TCP name %s not found ", unc_name);
@@ -300,6 +301,7 @@ int main(int argc, char ** argv)
        char * uuid = NULL;
        char * mountpoint;
        char * options;
+       char * temp;
        int rc,i;
        int rsize = 0;
        int wsize = 0;
@@ -500,9 +502,13 @@ int main(int argc, char ** argv)
                optlen += strlen(mountpassword) + 6;
        options = malloc(optlen + 10);
 
-    options[0] = 0;
+       options[0] = 0;
        strncat(options,"unc=",4);
        strcat(options,share_name);
+       /* scan backwards and reverse direction of slash */
+       temp = strrchr(options, '/');
+       if(temp > options + 6)
+               *temp = '\\';
        if(ipaddr) {
                strncat(options,",ip=",4);
                strcat(options,ipaddr);
@@ -533,7 +539,7 @@ int main(int argc, char ** argv)
                        printf("mount error: cifs filesystem not supported by the system\n");
                        break;
                default:
-                       printf("mount error %d = %s",errno,strerror(errno));
+                       printf("mount error %d = %s\n",errno,strerror(errno));
                }
                printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");
                return -1;