Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when creating a file in a folder that has whitespaces in the name #60

Open
Sparkz0629 opened this issue Mar 3, 2022 · 2 comments

Comments

@Sparkz0629
Copy link

Sparkz0629 commented Mar 3, 2022

When attempting to create a file in a folder that has spaces in the name, we get the following error:

open FOLDER WITH SPACES\sambaTest.test: file does not exist

Our code looks as follows:

       conn, err := net.Dial("tcp", "testServer.com:445")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to connecto to [%s]: %v\n", addr, err)
		return err
	}
	defer conn.Close()

	d := &smb2.Dialer{
		Initiator: &smb2.NTLMInitiator{
			User:     user,
			Password: pass,
			Domain:   <Domain Name>,
		},
	}

	s, err := d.Dial(conn)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable connect to server: %v\n", err)
		return err
	}
	defer s.Logoff()

	fs, err := s.Mount("SHARE")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to mount share: %v\n", err)
		return err
	}
	defer fs.Umount()

	destFile := "FOLDER WITH SPACES/sambaTest.test"

        // The code fails on the below lin
        f, err := fs.Create(destFile)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to create file: %v\n", err)
		return err
	}
	defer f.Close()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to write to file: %v\n", err)
		return err
	}
	fmt.Fprintf(os.Stdout, "%d bytes copied\n", bytes)

Has anyone seen similar issues?

@Sparkz0629
Copy link
Author

This appears to be a permissions error.

Using smbClient (version 4.6.5) on solaris i can see contents in the SHARE drive that gets mounts.
However, using go-smb2 or my macbook, the SHARE folder is completely empty.

Same user and password, successfully validates, just no contents... any ideas?

@hirochachacha
Copy link
Owner

wireshark might be the last resort :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants