Re: Howto mount cifs from c?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Doesn't your UNC name have a / instead of a \ between server and share name?

Isn't this simply that you have a bogus UNC (we have a "unc=" parm
because we can't rely on the mount source device to be a properly
formatted unc name)?

mount.cifs.c sets the unc name to standard "universal naming
convention" form ie \\server\share (ie "\\\\" + server_name + "\\" +
share_name and on optional prefix path may follow).
parse_mount_options in the kernel cifs.ko will correct a misformatted
unc name if the slashes before the server name are // rather than \\
but AFAIK does not have a way of fixing a / to \ between the server
name and share name (since it apparently could be valid to some
servers albeit very strange name).

On Thu, Aug 2, 2012 at 3:37 PM, Stef Bon <stefbon@xxxxxxxxx> wrote:
> Hi,
>
> I use:
>
> /* add rw etc*/
>
> len1=sprintf(vfsdata+len0, ",rw,nodfs,unc=");
> len0+=len1;
> /* add the unc */
>
> *(vfsdata+len0)='\\';
> len0++;
> *(vfsdata+len0)='\\';
> len0++;
>
> memcpy(vfsdata+len0, smb_server->name, strlen(smb_server->name));
> len0+=strlen(smb_server->name);
>
> *(vfsdata+len0)='\\';
> len0++;
>
> memcpy(vfsdata+len0, smb_share->name, strlen(smb_share->name));
> len0+=strlen(smb_share->name);
>
> if (strlen(smb_server->ipv4address)>0) {
>
>          /* add ip */
>
>          len1=sprintf(vfsdata+len0, ",ip=%s", smb_server->ipv4address);
>          len0+=len1;
>
> }
> Here I got logmessages:
>
> kernel: fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 118 with uid: 0
> kernel: fs/cifs/connect.c: UNC:
> \\SCLFS20091030\p//SCLFS20091030/public ip:
> SCLFS20091030\p//SCLFS20091030/public
>
> which is also bogus.
>
> I think I'm not the person to remove the unc from the kernel with a
> patch...but I think it's not required anymore, it adds nothing.
> Right now it's required by the cifs module still as I checked.
>
> I think there is something wrong with parsing the backslashes. They
> should be forbidden. Some hint?
>
> Stef
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux