cifs-utils mount credentials file is relative to mountpoint

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

 



cifs-utils Team,

mount.cifs and mount.smb3 both have the following -o option:
        credentials=filename | cred=filename

E.g.:
        mount -t smb3 -o cred=mycredfile service mountpoint

I would expect mount to look for mycredfile in the current directory.
Instead mount looks for mycredfile in the mountpoint directory.

I consider this to be a bug.

This problem is caused by chdir(&mountpoint) being called *before*
the credentials file is opened and read.
Below are excerpts from mount.cifs.c which show some details.

I can think of two fixes:

1) Open and read the credentials file *before* chdir(&mountpoint)

2) Document that the credentials file should have an absolute path

Thank you!
Daniel Lewart
Urbana, Illinois
---
mount.cifs.c

2039 int main(int argc, char **argv)
2040 {
2163     /* chdir into mountpoint as soon as possible */
2164     rc = acquire_mountpoint(&mountpoint);
2187     /* child */
2188     rc = assemble_mountinfo(...);
2353 }

acquire_mountpoint -> chdir
assemble_mountinfo -> parse_options -> open_cred_file -> fopen

###



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

  Powered by Linux