Connecting to SMB Shares Fails
- From: "Gaurav Jain" <gaurav anywhere gmail com>
- To: gnome-vfs-list gnome org
- Subject: Connecting to SMB Shares Fails
- Date: Thu, 11 Jan 2007 16:06:08 +0530
Hi,
I'm trying to connect to a protected SMB share using gnome-vfs-2 but
it fails with an "Access denied" error.
The file i'm trying to access over SMB is located at
"smb://gauravj-xp/networkfolder/file.txt" and the user/password to
access it are 'gaurav' and 'password' respectively.
I'm attaching the code that I have written. The error that is thrown
at the terminal is:
Error Access denied occurred opening location
smb://gaurav:password gauravj-xp/networkfolder/file.txt
Any help would be really appreciated!
Thanks,
Gaurav
#include <stdio.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-utils.h>
int print_error(GnomeVFSResult result, const char *uri_string)
{
const char *error_string;
error_string = gnome_vfs_result_to_string(result);
printf("Error %s occurred opening location %s\n",
error_string, uri_string);
return 1;
}
// smb://[[domain;]username[:password] ]server[/share[/path]]
int main()
{
char *file = "smb://gaurav:password gauravj-xp/networkfolder/file.txt";
GnomeVFSHandle *read_handle;
GnomeVFSResult result;
if (!gnome_vfs_init())
{
printf("Count not initialize GnomeVFS!\n");
}
GList *list;
result = gnome_vfs_open(&read_handle, file, GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK)
{
print_error(result, file);
}
else
{
printf("gnome_vfs_open returned GNOME_VFS_OK\n");
}
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]