archive mirror
 help / color / mirror / Atom feed
* cifs-utils mount credentials file is relative to mountpoint
@ 2021-04-27 10:25 Daniel Lewart
  0 siblings, 0 replies; only message in thread
From: Daniel Lewart @ 2021-04-27 10:25 UTC (permalink / raw)
  To: linux-cifs

cifs-utils Team,

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

        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

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-27 10:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 10:25 cifs-utils mount credentials file is relative to mountpoint Daniel Lewart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).