Split function fish_open_archive_int() to fish_open_archive_pipeopen() and fish_open_archive_talk().

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2010-10-14 11:36:30 +04:00
parent 3ba4abac41
commit 3cef64306e

View File

@ -354,12 +354,9 @@ fish_getcwd (struct vfs_class *me, struct vfs_s_super *super)
ERRNOR (EIO, NULL);
}
static int
fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
{
/* hide panels */
pre_exec ();
static void
fish_open_archive_pipeopen (struct vfs_s_super *super)
{
char gbuf[10];
const char *argv[10]; /* All of 10 is used now */
@ -401,11 +398,17 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
fish_pipeopen (super, xsh, argv);
}
static gboolean
fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
{
char answer[2048];
print_vfs_message (_("fish: Waiting for initial line..."));
if (!vfs_s_get_line (me, SUP.sockr, answer, sizeof (answer), ':'))
ERRNOR (E_PROTO, -1);
return FALSE;
print_vfs_message ("%s", answer);
if (strstr (answer, "assword"))
{
@ -414,7 +417,8 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
message (D_ERROR, MSG_ERROR,
_("Sorry, we cannot do password authenticated connections for now."));
ERRNOR (EPERM, -1);
return FALSE;
#if 0
if (!SUP.password)
{
char *p, *op;
@ -422,22 +426,37 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
op = vfs_get_password (p);
g_free (p);
if (op == NULL)
ERRNOR (EPERM, -1);
return FALSE;
SUP.password = op;
}
print_vfs_message (_("fish: Sending password..."));
{
size_t str_len;
str_len = strlen (SUP.password);
if ((write (SUP.sockw, SUP.password, str_len) != (ssize_t) str_len)
|| (write (SUP.sockw, "\n", 1) != 1))
{
ERRNOR (EIO, -1);
return FALSE;
}
}
#endif
}
return TRUE;
}
static int
fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
{
/* hide panels */
pre_exec ();
/* open pipe */
fish_open_archive_pipeopen (super);
/* Start talk with ssh-server (password prompt, etc ) */
if (!fish_open_archive_talk (me, super))
{
ERRNOR (E_PROTO, -1);
}
print_vfs_message (_("fish: Sending initial line..."));