Reverted my last brain-dead commit.
Logical error: we need to check whether the server runs on the system it was compiled on and not whether the client uses a server that was compiled on the clients system.
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
1999-02-19 Martin Baulig <martin@home-of-linux.org>
|
1999-02-19 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* lib/open.c, src/daemon/version.c: For suid/sgid servers the
|
|
||||||
operating system version must match the one the server was
|
|
||||||
compiled on.
|
|
||||||
|
|
||||||
* include/glibtop/error.h: Don't include <glib.h>.
|
* include/glibtop/error.h: Don't include <glib.h>.
|
||||||
* sysdeps/common/error.c: Use `int' not `gint'.
|
* sysdeps/common/error.c: Use `int' not `gint'.
|
||||||
|
|
||||||
|
29
lib/open.c
29
lib/open.c
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
#include <glibtop/gnuserv.h>
|
#include <glibtop/gnuserv.h>
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
|
|
||||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -128,23 +126,18 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
/* If the server has been started, ask it for its features. */
|
/* If the server has been started, ask it for its features. */
|
||||||
|
|
||||||
if (server->flags & _GLIBTOP_INIT_STATE_SERVER) {
|
if (server->flags & _GLIBTOP_INIT_STATE_SERVER) {
|
||||||
char version [BUFSIZ+10], buffer [BUFSIZ+10];
|
char version [BUFSIZ], buffer [BUFSIZ];
|
||||||
glibtop_sysdeps sysdeps;
|
glibtop_sysdeps sysdeps;
|
||||||
size_t size, nbytes;
|
size_t size, nbytes;
|
||||||
struct utsname uts;
|
|
||||||
|
|
||||||
/* First check whether the server version is correct. */
|
/* First check whether the server version is correct. */
|
||||||
|
|
||||||
if (uname (&uts))
|
sprintf (version, LIBGTOP_VERSION_STRING,
|
||||||
glibtop_error_io_r (server, "uname");
|
LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
|
||||||
|
sizeof (glibtop_command),
|
||||||
snprintf (version, BUFSIZ, LIBGTOP_VERSION_STRING,
|
sizeof (glibtop_response),
|
||||||
LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
|
sizeof (glibtop_union),
|
||||||
sizeof (glibtop_command),
|
sizeof (glibtop_sysdeps));
|
||||||
sizeof (glibtop_response),
|
|
||||||
sizeof (glibtop_union),
|
|
||||||
sizeof (glibtop_sysdeps),
|
|
||||||
uts.sysname, uts.release, uts.machine);
|
|
||||||
|
|
||||||
size = strlen (version) + 1;
|
size = strlen (version) + 1;
|
||||||
|
|
||||||
@@ -158,12 +151,8 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
glibtop_read_l (server, nbytes, buffer);
|
glibtop_read_l (server, nbytes, buffer);
|
||||||
|
|
||||||
if (memcmp (version, buffer, size))
|
if (memcmp (version, buffer, size))
|
||||||
glibtop_error_r
|
glibtop_error_r (server, "server version is not %s",
|
||||||
(server,
|
LIBGTOP_VERSION);
|
||||||
"server version is not %s / %d "
|
|
||||||
"compiled for %s %s %s",
|
|
||||||
LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
|
|
||||||
uts.sysname, uts.release, uts.machine);
|
|
||||||
|
|
||||||
/* Now ask it for its features. */
|
/* Now ask it for its features. */
|
||||||
|
|
||||||
|
@@ -23,25 +23,18 @@
|
|||||||
#include <glibtop/error.h>
|
#include <glibtop/error.h>
|
||||||
#include <glibtop/version.h>
|
#include <glibtop/version.h>
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_send_version (glibtop *server, int fd)
|
glibtop_send_version (glibtop *server, int fd)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ+10];
|
char buffer [BUFSIZ];
|
||||||
struct utsname uts;
|
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (uname (&uts))
|
sprintf (buffer, LIBGTOP_VERSION_STRING,
|
||||||
glibtop_error_io_r (server, "uname");
|
LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
|
||||||
|
sizeof (glibtop_command),
|
||||||
snprintf (buffer, BUFSIZ, LIBGTOP_VERSION_STRING,
|
sizeof (glibtop_response),
|
||||||
LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
|
sizeof (glibtop_union),
|
||||||
sizeof (glibtop_command),
|
sizeof (glibtop_sysdeps));
|
||||||
sizeof (glibtop_response),
|
|
||||||
sizeof (glibtop_union),
|
|
||||||
sizeof (glibtop_sysdeps),
|
|
||||||
uts.sysname, uts.release, uts.machine);
|
|
||||||
|
|
||||||
size = strlen (buffer) + 1;
|
size = strlen (buffer) + 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user