Set `server->features' directly rather than calling
1998-11-11 Martin Baulig <martin@home-of-linux.org> * gnuserv.c (main): Set `server->features' directly rather than calling glibtop_set_parameter_l () since this function no longer allows to modify the features. * gnuserv.c, main.c: Use LIBGTOP_ENABLE_DEBUG rather than DEBUG.
This commit is contained in:
committed by
Martin Baulig
parent
44b03ba60b
commit
f24a4d9d22
@@ -1,3 +1,11 @@
|
|||||||
|
1998-11-11 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* gnuserv.c (main): Set `server->features' directly rather than
|
||||||
|
calling glibtop_set_parameter_l () since this function no longer
|
||||||
|
allows to modify the features.
|
||||||
|
|
||||||
|
* gnuserv.c, main.c: Use LIBGTOP_ENABLE_DEBUG rather than DEBUG.
|
||||||
|
|
||||||
1998-11-01 Marc Ewing <marc@tasmanian.redhat.com>
|
1998-11-01 Marc Ewing <marc@tasmanian.redhat.com>
|
||||||
|
|
||||||
* Makefile.am: Added $(GLIB_LIBS) to libs. Not sure
|
* Makefile.am: Added $(GLIB_LIBS) to libs. Not sure
|
||||||
|
@@ -135,7 +135,7 @@ permitted (u_long host_addr, int fd)
|
|||||||
if (timed_read (fd, auth_protocol, AUTH_NAMESZ, AUTH_TIMEOUT, 1) <= 0)
|
if (timed_read (fd, auth_protocol, AUTH_NAMESZ, AUTH_TIMEOUT, 1) <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Client sent authenticatin protocol '%s'\n",
|
fprintf (stderr, "Client sent authenticatin protocol '%s'\n",
|
||||||
auth_protocol);
|
auth_protocol);
|
||||||
#endif
|
#endif
|
||||||
@@ -186,13 +186,13 @@ permitted (u_long host_addr, int fd)
|
|||||||
|
|
||||||
/* Now, try the old GNU_SECURE stuff... */
|
/* Now, try the old GNU_SECURE stuff... */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Doing GNU_SECURE auth ...\n");
|
fprintf (stderr, "Doing GNU_SECURE auth ...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now check the chain for that hash key */
|
/* Now check the chain for that hash key */
|
||||||
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
|
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Trying %lx - %lx\n",
|
fprintf (stderr, "Trying %lx - %lx\n",
|
||||||
host_addr, permitted_hosts [i]);
|
host_addr, permitted_hosts [i]);
|
||||||
#endif
|
#endif
|
||||||
@@ -243,7 +243,7 @@ setup_table (void)
|
|||||||
/* Resolv host names from permitted_host_names []. */
|
/* Resolv host names from permitted_host_names []. */
|
||||||
|
|
||||||
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
|
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Resolving %s ...\n",
|
fprintf (stderr, "Resolving %s ...\n",
|
||||||
permitted_host_names [i]);
|
permitted_host_names [i]);
|
||||||
#endif
|
#endif
|
||||||
@@ -254,7 +254,7 @@ setup_table (void)
|
|||||||
permitted_host_names [i]);
|
permitted_host_names [i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
for (i = 0; i < HOST_TABLE_ENTRIES; i++)
|
for (i = 0; i < HOST_TABLE_ENTRIES; i++)
|
||||||
fprintf (stderr, "Host %s - %lx\n",
|
fprintf (stderr, "Host %s - %lx\n",
|
||||||
permitted_host_names [i],
|
permitted_host_names [i],
|
||||||
@@ -326,7 +326,7 @@ handle_internet_request (int ls)
|
|||||||
if ((s = accept (ls, (struct sockaddr *) &peer, (void *) &addrlen)) == -1)
|
if ((s = accept (ls, (struct sockaddr *) &peer, (void *) &addrlen)) == -1)
|
||||||
glibtop_error_io ("accept");
|
glibtop_error_io ("accept");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Connection was made from %s.\n",
|
fprintf (stderr, "Connection was made from %s.\n",
|
||||||
inet_ntoa (peer.sin_addr));
|
inet_ntoa (peer.sin_addr));
|
||||||
#endif
|
#endif
|
||||||
@@ -339,7 +339,7 @@ handle_internet_request (int ls)
|
|||||||
return;
|
return;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Accepted connection from %s (%u) on socket %d.\n",
|
fprintf (stderr, "Accepted connection from %s (%u) on socket %d.\n",
|
||||||
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port), s);
|
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port), s);
|
||||||
#endif
|
#endif
|
||||||
@@ -356,7 +356,7 @@ handle_internet_request (int ls)
|
|||||||
|
|
||||||
close (s);
|
close (s);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Closed connection to %s (%d).\n",
|
fprintf (stderr, "Closed connection to %s (%d).\n",
|
||||||
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
|
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
|
||||||
#endif
|
#endif
|
||||||
@@ -452,7 +452,7 @@ handle_unix_request (int ls)
|
|||||||
if ((s = accept (ls, (struct sockaddr *) &server, (void *) &len)) < 0)
|
if ((s = accept (ls, (struct sockaddr *) &server, (void *) &len)) < 0)
|
||||||
glibtop_error_io ("accept");
|
glibtop_error_io ("accept");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Accepted connection on socket %d.\n", s);
|
fprintf (stderr, "Accepted connection on socket %d.\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ handle_unix_request (int ls)
|
|||||||
|
|
||||||
close (s);
|
close (s);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Closed connection on socket %d.\n", s);
|
fprintf (stderr, "Closed connection on socket %d.\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
/* Temporarily drop our priviledges. */
|
/* Temporarily drop our priviledges. */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
|
||||||
(int) getuid (), (int) geteuid (),
|
(int) getuid (), (int) geteuid (),
|
||||||
(int) getgid (), (int) getegid ());
|
(int) getgid (), (int) getegid ());
|
||||||
@@ -534,7 +534,7 @@ main (int argc, char *argv [])
|
|||||||
if (setregid (getegid (), getgid ()))
|
if (setregid (getegid (), getgid ()))
|
||||||
glibtop_error_io ("setregid (egid <-> gid)");
|
glibtop_error_io ("setregid (egid <-> gid)");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
|
||||||
(int) getuid (), (int) geteuid (),
|
(int) getuid (), (int) geteuid (),
|
||||||
(int) getgid (), (int) getegid ());
|
(int) getgid (), (int) getegid ());
|
||||||
@@ -548,9 +548,7 @@ main (int argc, char *argv [])
|
|||||||
glibtop_set_parameter_l (server, GLIBTOP_PARAM_METHOD,
|
glibtop_set_parameter_l (server, GLIBTOP_PARAM_METHOD,
|
||||||
&method, sizeof (method));
|
&method, sizeof (method));
|
||||||
|
|
||||||
glibtop_set_parameter_l (server, GLIBTOP_PARAM_FEATURES,
|
server->features = glibtop_server_features;
|
||||||
&glibtop_server_features,
|
|
||||||
sizeof (glibtop_server_features));
|
|
||||||
|
|
||||||
glibtop_init_r (&server, 0, 0);
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
@@ -569,7 +567,7 @@ main (int argc, char *argv [])
|
|||||||
* SERVER_GID. Otherwise we completely drop any priviledges.
|
* SERVER_GID. Otherwise we completely drop any priviledges.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
||||||
getuid (), geteuid (), getgid (), getegid ());
|
getuid (), geteuid (), getgid (), getegid ());
|
||||||
#endif
|
#endif
|
||||||
@@ -580,7 +578,7 @@ main (int argc, char *argv [])
|
|||||||
if (setregid (getegid (), getgid ()))
|
if (setregid (getegid (), getgid ()))
|
||||||
glibtop_error_io ("setregid (egid <-> gid)");
|
glibtop_error_io ("setregid (egid <-> gid)");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
||||||
getuid (), geteuid (), getgid (), getegid ());
|
getuid (), geteuid (), getgid (), getegid ());
|
||||||
#endif
|
#endif
|
||||||
@@ -590,7 +588,7 @@ main (int argc, char *argv [])
|
|||||||
glibtop_error_io ("setreuid (root)");
|
glibtop_error_io ("setreuid (root)");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
||||||
getuid (), geteuid (), getgid (), getegid ());
|
getuid (), geteuid (), getgid (), getegid ());
|
||||||
#endif
|
#endif
|
||||||
@@ -605,7 +603,7 @@ main (int argc, char *argv [])
|
|||||||
glibtop_error_io ("setreuid (euid)");
|
glibtop_error_io ("setreuid (euid)");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
fprintf (stderr, "Parent ID: (%d, %d) - (%d, %d)\n",
|
||||||
getuid (), geteuid (), getgid (), getegid ());
|
getuid (), geteuid (), getgid (), getegid ());
|
||||||
#endif
|
#endif
|
||||||
@@ -621,8 +619,7 @@ main (int argc, char *argv [])
|
|||||||
glibtop_set_parameter_l (server, GLIBTOP_PARAM_METHOD,
|
glibtop_set_parameter_l (server, GLIBTOP_PARAM_METHOD,
|
||||||
&method, sizeof (method));
|
&method, sizeof (method));
|
||||||
|
|
||||||
glibtop_set_parameter_l (server, GLIBTOP_PARAM_FEATURES,
|
server->features = features;
|
||||||
&features, sizeof (features));
|
|
||||||
|
|
||||||
glibtop_init_r (&server, 0, 0);
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
@@ -657,7 +654,7 @@ main (int argc, char *argv [])
|
|||||||
if (ils >= 0)
|
if (ils >= 0)
|
||||||
FD_SET (ils, &rmask);
|
FD_SET (ils, &rmask);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
fprintf (stderr, "Server ready and waiting for connections.\n");
|
fprintf (stderr, "Server ready and waiting for connections.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -21,6 +21,15 @@
|
|||||||
|
|
||||||
#include "daemon.h"
|
#include "daemon.h"
|
||||||
|
|
||||||
|
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||||
|
#ifndef PARENT_DEBUG
|
||||||
|
#define PARENT_DEBUG 1
|
||||||
|
#endif
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_parent_connection (int s)
|
handle_parent_connection (int s)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user