mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* smbfs.c (fake_share_stat): Make sure share exists by
smbfs_get_path() and fill buf with realistic data if current_share_info is NULL. Reformat function. (smbfs_get_path): Add const qualifier to path.
This commit is contained in:
parent
07dee4f111
commit
f4a0b6e40b
@ -1,3 +1,10 @@
|
||||
2002-10-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* smbfs.c (fake_share_stat): Make sure share exists by
|
||||
smbfs_get_path() and fill buf with realistic data
|
||||
if current_share_info is NULL. Reformat function.
|
||||
(smbfs_get_path): Add const qualifier to path.
|
||||
|
||||
2002-10-09 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* smbfs.c: Allow username in URL (/#smb:[user@]machine) and
|
||||
@ -1691,13 +1698,14 @@
|
||||
|
||||
2000-04-06 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* ftpfs.c (netrc_next): Turned strange "const char * const keywords"
|
||||
into more alike "const char const * keywords". Still, think, it's
|
||||
too strict.
|
||||
* ftpfs.c (netrc_next): Turned strange "const char * const
|
||||
keywords" into more alike "const char const * keywords". Still,
|
||||
think, it's too strict.
|
||||
|
||||
* smbfs.c: Add #define BOOL_DEFINED before inclusion of samba headers.
|
||||
Libncurses(or slang?) defines BOOL and that can cause problems. (In fact,
|
||||
I can't find references to that const, but sure, I hade reason to do that:)
|
||||
* smbfs.c: Add #define BOOL_DEFINED before inclusion of samba
|
||||
headers. Libncurses(or slang?) defines BOOL and that can cause
|
||||
problems. (In fact, I can't find references to that const, but
|
||||
sure, I hade reason to do that:)
|
||||
|
||||
* util-alone.h: Declare load_anon_passwd() to avoid warnings.
|
||||
|
||||
|
39
vfs/smbfs.c
39
vfs/smbfs.c
@ -809,7 +809,7 @@ smbfs_chmod (vfs *me, char *path, int mode)
|
||||
{
|
||||
DEBUG(3, ("smbfs_chmod(path:%s, mode:%d)\n", path, mode));
|
||||
/* my_errno = EOPNOTSUPP;
|
||||
return -1; */ /* cant chmod on smb filesystem */
|
||||
return -1; */ /* cannot chmod on smb filesystem */
|
||||
return 0; /* make mc happy */
|
||||
}
|
||||
|
||||
@ -1114,7 +1114,7 @@ smbfs_open_link (char *host, char *path, const char *user, int *port,
|
||||
}
|
||||
|
||||
static char *
|
||||
smbfs_get_path (smbfs_connection ** sc, char *path)
|
||||
smbfs_get_path (smbfs_connection ** sc, const char *path)
|
||||
{
|
||||
char *user, *host, *remote_path, *pass;
|
||||
int port = SMB_PORT;
|
||||
@ -1223,28 +1223,46 @@ fake_server_stat(const char *server_url, const char *path, struct stat *buf)
|
||||
}
|
||||
|
||||
static int
|
||||
fake_share_stat(const char *server_url, const char *path, struct stat *buf)
|
||||
fake_share_stat (const char *server_url, const char *path, struct stat *buf)
|
||||
{
|
||||
dir_entry *dentry;
|
||||
if (strlen(path) < strlen(server_url))
|
||||
if (strlen (path) < strlen (server_url))
|
||||
return -1;
|
||||
path += strlen(server_url); /* we only want share name */
|
||||
|
||||
if (!current_share_info) { /* Server was not stat()ed */
|
||||
/* Make sure there is such share at server */
|
||||
smbfs_connection *sc;
|
||||
char *p;
|
||||
p = smbfs_get_path (&sc, path);
|
||||
g_free (p);
|
||||
if (p) {
|
||||
memset (buf, 0, sizeof (*buf));
|
||||
/* show this as dir */
|
||||
buf->st_mode =
|
||||
S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP |
|
||||
S_IXOTH;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
path += strlen (server_url); /* we only want share name */
|
||||
path++;
|
||||
|
||||
if (*path == '/') /* '/' leading server name */
|
||||
path++; /* probably came from server browsing */
|
||||
|
||||
if (!current_share_info->entries) {
|
||||
if (!smbfs_loaddir(current_share_info)); /* browse host */
|
||||
if (!smbfs_loaddir (current_share_info)) /* browse host */
|
||||
return -1;
|
||||
}
|
||||
dentry = current_share_info->entries;
|
||||
DEBUG(3, ("fake_share_stat: %s on %s\n", path, server_url));
|
||||
DEBUG (3, ("fake_share_stat: %s on %s\n", path, server_url));
|
||||
while (dentry) {
|
||||
if (strcmp(dentry->text, path) == 0) {
|
||||
DEBUG(6, ("fake_share_stat: %s:%4o\n",
|
||||
if (strcmp (dentry->text, path) == 0) {
|
||||
DEBUG (6, ("fake_share_stat: %s:%4o\n",
|
||||
dentry->text, dentry->my_stat.st_mode));
|
||||
memcpy(buf, &dentry->my_stat, sizeof(struct stat));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (struct stat));
|
||||
return 0;
|
||||
}
|
||||
dentry = dentry->next;
|
||||
@ -1486,6 +1504,7 @@ smbfs_stat (vfs * me, char *path, struct stat *buf)
|
||||
}
|
||||
return fake_server_stat (server_url, path, buf);
|
||||
}
|
||||
|
||||
if (!strchr (++pp, '/')) {
|
||||
return fake_share_stat (server_url, path, buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user