* tcputil.c (get_remote_port): Move to mcfs.c.
(send_string): Move to mcserv.c. (rpc_add_get_callback): Remove, it's unused.
Этот коммит содержится в:
родитель
95ffa342bd
Коммит
379ea9b60d
@ -1,5 +1,9 @@
|
||||
2002-10-02 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* tcputil.c (get_remote_port): Move to mcfs.c.
|
||||
(send_string): Move to mcserv.c.
|
||||
(rpc_add_get_callback): Remove, it's unused.
|
||||
|
||||
* container.h: Remove, it's unused.
|
||||
|
||||
* utilvfs.c: Remove tests, since get_host_and_username() is
|
||||
|
37
vfs/mcfs.c
37
vfs/mcfs.c
@ -40,6 +40,14 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PMAP_SET
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#ifdef HAVE_RPC_PMAP_CLNT_H
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "utilvfs.h"
|
||||
|
||||
#include "vfs.h"
|
||||
@ -158,6 +166,35 @@ static int mcfs_login_server (int my_socket, char *user, int port,
|
||||
return my_socket;
|
||||
}
|
||||
|
||||
static int
|
||||
get_remote_port (struct sockaddr_in *sin, int *version)
|
||||
{
|
||||
#ifdef HAVE_PMAP_GETMAPS
|
||||
int port;
|
||||
struct pmaplist *pl;
|
||||
|
||||
*version = 1;
|
||||
port = mcserver_port;
|
||||
for (pl = pmap_getmaps (sin); pl; pl = pl->pml_next)
|
||||
if (pl->pml_map.pm_prog == RPC_PROGNUM
|
||||
&& pl->pml_map.pm_prot == IPPROTO_TCP
|
||||
&& pl->pml_map.pm_vers >= *version) {
|
||||
*version = pl->pml_map.pm_vers;
|
||||
port = pl->pml_map.pm_port;
|
||||
}
|
||||
return port;
|
||||
#else
|
||||
#ifdef HAVE_PMAP_GETPORT
|
||||
int port;
|
||||
for (*version = RPC_PROGVER; *version >= 1; (*version)--)
|
||||
if (port = pmap_getport (sin, RPC_PROGNUM, *version, IPPROTO_TCP))
|
||||
return port;
|
||||
#endif /* HAVE_PMAP_GETPORT */
|
||||
#endif /* HAVE_PMAP_GETMAPS */
|
||||
*version = 1;
|
||||
return mcserver_port;
|
||||
}
|
||||
|
||||
/* This used to be in utilvfs.c, but as it deals with portmapper, it
|
||||
is probably usefull for mcfs */
|
||||
static int
|
||||
|
@ -766,6 +766,11 @@ static int ftp_answer (int sock, char *text)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int send_string (int sock, char *string)
|
||||
{
|
||||
return socket_write_block (sock, string, strlen (string));
|
||||
}
|
||||
|
||||
static int do_ftp_auth (char *username, char *password)
|
||||
{
|
||||
struct sockaddr_in local_address;
|
||||
|
@ -89,11 +89,6 @@ int socket_write_block (int sock, char *buffer, int len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int send_string (int sock, char *string)
|
||||
{
|
||||
return socket_write_block (sock, string, strlen (string));
|
||||
}
|
||||
|
||||
int rpc_send (int sock, ...)
|
||||
{
|
||||
long int tmp, len, cmd;
|
||||
@ -235,17 +230,6 @@ int rpc_get (int sock, ...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rpc_add_get_callback (int sock, void (*cback)(int))
|
||||
{
|
||||
sock_callback_t *new;
|
||||
|
||||
new = g_new (sock_callback_t, 1);
|
||||
new->cback = cback;
|
||||
new->sock = sock;
|
||||
new->link = sock_callbacks;
|
||||
sock_callbacks = new;
|
||||
}
|
||||
#endif /* WITH_MCFS */
|
||||
|
||||
static void sig_pipe (int unused)
|
||||
@ -264,33 +248,3 @@ void tcp_init (void)
|
||||
sigaction (SIGPIPE, &sa, NULL);
|
||||
}
|
||||
|
||||
#ifdef WITH_MCFS
|
||||
int get_remote_port (struct sockaddr_in *sin, int *version)
|
||||
{
|
||||
#ifdef HAVE_PMAP_GETMAPS
|
||||
int port;
|
||||
struct pmaplist *pl;
|
||||
|
||||
*version = 1;
|
||||
port = mcserver_port;
|
||||
for (pl = pmap_getmaps (sin); pl; pl = pl->pml_next)
|
||||
if (pl->pml_map.pm_prog == RPC_PROGNUM &&
|
||||
pl->pml_map.pm_prot == IPPROTO_TCP &&
|
||||
pl->pml_map.pm_vers >= *version) {
|
||||
*version = pl->pml_map.pm_vers;
|
||||
port = pl->pml_map.pm_port;
|
||||
}
|
||||
return port;
|
||||
#else
|
||||
#ifdef HAVE_PMAP_GETPORT
|
||||
int port;
|
||||
for (*version = RPC_PROGVER; *version >= 1; (*version)--)
|
||||
if (port = pmap_getport (sin, RPC_PROGNUM, *version, IPPROTO_TCP))
|
||||
return port;
|
||||
#endif /* HAVE_PMAP_GETPORT */
|
||||
#endif /* HAVE_PMAP_GETMAPS */
|
||||
*version = 1;
|
||||
return mcserver_port;
|
||||
}
|
||||
#endif /* WITH_MCFS */
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
/* Operations of the rpc manager */
|
||||
|
||||
#include <netinet/in.h> /* For sockaddr_in needed by get_remote_port */
|
||||
|
||||
/* Please note that the RPC manager does not use integers, it only uses */
|
||||
/* 4-byte integers for the comunication */
|
||||
enum {
|
||||
@ -14,11 +12,8 @@ enum {
|
||||
|
||||
int rpc_get (int sock, ...);
|
||||
int rpc_send (int sock, ...);
|
||||
void rpc_add_get_callback (int sock, void (*cback)(int));
|
||||
int socket_read_block (int sock, char *dest, int len);
|
||||
int socket_write_block (int sock, char *buffer, int len);
|
||||
int send_string (int sock, char *string);
|
||||
void tcp_init (void);
|
||||
int get_remote_port (struct sockaddr_in *sin, int *version);
|
||||
|
||||
extern int got_sigpipe;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user