From 379ea9b60de3dca12c12ee8145de26a833b766b8 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 1 Oct 2002 04:09:31 +0000 Subject: [PATCH] * tcputil.c (get_remote_port): Move to mcfs.c. (send_string): Move to mcserv.c. (rpc_add_get_callback): Remove, it's unused. --- vfs/ChangeLog | 4 ++++ vfs/mcfs.c | 37 +++++++++++++++++++++++++++++++++++++ vfs/mcserv.c | 5 +++++ vfs/tcputil.c | 46 ---------------------------------------------- vfs/tcputil.h | 5 ----- 5 files changed, 46 insertions(+), 51 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 8aa75480b..91456d4e9 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,5 +1,9 @@ 2002-10-02 Pavel Roskin + * 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 diff --git a/vfs/mcfs.c b/vfs/mcfs.c index a167f81cf..1c2bcb482 100644 --- a/vfs/mcfs.c +++ b/vfs/mcfs.c @@ -40,6 +40,14 @@ #include #endif +#ifdef HAVE_PMAP_SET +#include +#include +#ifdef HAVE_RPC_PMAP_CLNT_H +#include +#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 diff --git a/vfs/mcserv.c b/vfs/mcserv.c index 174866c2a..ef41cf57f 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -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; diff --git a/vfs/tcputil.c b/vfs/tcputil.c index 0aa7b6483..1589e867d 100644 --- a/vfs/tcputil.c +++ b/vfs/tcputil.c @@ -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 */ - diff --git a/vfs/tcputil.h b/vfs/tcputil.h index 9b2b1094b..b7b81386e 100644 --- a/vfs/tcputil.h +++ b/vfs/tcputil.h @@ -1,7 +1,5 @@ /* Operations of the rpc manager */ -#include /* 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;