whitespace clean up.
* *.{c,h} : whitespace clean up.
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
/* -*-C-*-
|
||||
* Server code for handling requests from clients and forwarding them
|
||||
* on to the GNU Emacs process.
|
||||
*
|
||||
*
|
||||
* This file is part of GNU Emacs.
|
||||
*
|
||||
*
|
||||
* Copying is permitted under those conditions described by the GNU
|
||||
* General Public License.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on 'etc/server.c'
|
||||
* from the 18.52 GNU Emacs distribution.
|
||||
*
|
||||
*
|
||||
* Please mail bugs and suggestions to the author at the above address.
|
||||
*/
|
||||
|
||||
/* HISTORY
|
||||
* 11-Nov-1990 bristor@simba
|
||||
/* HISTORY
|
||||
* 11-Nov-1990 bristor@simba
|
||||
* Added EOT stuff.
|
||||
*/
|
||||
|
||||
@@ -192,17 +192,17 @@ permitted (u_long host_addr, int fd)
|
||||
auth_protocol);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp (auth_protocol, MCOOKIE_NAME)) {
|
||||
/*
|
||||
/*
|
||||
* doing magic cookie auth
|
||||
*/
|
||||
|
||||
|
||||
if (timed_read (fd, buf, 10, AUTH_TIMEOUT, 1) <= 0)
|
||||
return FALSE;
|
||||
|
||||
auth_data_len = atoi (buf);
|
||||
|
||||
|
||||
if (auth_data_len < 1 || (size_t)auth_data_len > sizeof(buf)) {
|
||||
syslog_message(LOG_WARNING, "Invalid data length supplied by client");
|
||||
return FALSE;
|
||||
@@ -222,7 +222,7 @@ permitted (u_long host_addr, int fd)
|
||||
"not compiled with Xauth");
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* auth failed, but allow this to fall through to the
|
||||
* GNU_SECURE protocol....
|
||||
*/
|
||||
@@ -238,12 +238,12 @@ permitted (u_long host_addr, int fd)
|
||||
"trying GNU_SECURE auth...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Other auth protocols go here, and should execute only if
|
||||
* the * auth_protocol name matches. */
|
||||
|
||||
/* Now, try the old GNU_SECURE stuff... */
|
||||
|
||||
|
||||
if (enable_debug)
|
||||
syslog_message (LOG_DEBUG, "Doing GNU_SECURE auth ...");
|
||||
|
||||
@@ -257,7 +257,7 @@ permitted (u_long host_addr, int fd)
|
||||
if (host_addr == permitted_hosts [i])
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ internet_init (void)
|
||||
syslog_io_message (LOG_ERR, "unable to create socket");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
/* Bind the listen address to the socket. */
|
||||
if (bind (ls, (struct sockaddr *) &server,
|
||||
sizeof (struct sockaddr_in)) == -1) {
|
||||
@@ -433,7 +433,7 @@ handle_internet_request (int ls)
|
||||
|
||||
close (s);
|
||||
|
||||
if (verbose_output)
|
||||
if (verbose_output)
|
||||
syslog_message (LOG_INFO, "Closed connection to %s port %u.",
|
||||
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
|
||||
|
||||
@@ -477,7 +477,7 @@ main (int argc, const char **argv)
|
||||
/* On non-glibc systems, this is not set up for us. */
|
||||
if (!program_invocation_name) {
|
||||
char *arg;
|
||||
|
||||
|
||||
program_invocation_name = (char *) argv[0];
|
||||
arg = strrchr (argv[0], '/');
|
||||
program_invocation_short_name =
|
||||
@@ -533,7 +533,7 @@ main (int argc, const char **argv)
|
||||
* SERVER_GID. Otherwise we completely drop any priviledges.
|
||||
*/
|
||||
|
||||
if (enable_debug)
|
||||
if (enable_debug)
|
||||
syslog_message (LOG_DEBUG, "Parent ID: (%d, %d) - (%d, %d)",
|
||||
getuid (), geteuid (), getgid (), getegid ());
|
||||
|
||||
@@ -618,7 +618,7 @@ main (int argc, const char **argv)
|
||||
if (verbose_output)
|
||||
syslog_message (LOG_INFO, "Child %d exited.", ret);
|
||||
}
|
||||
|
||||
|
||||
FD_ZERO (&rmask);
|
||||
|
||||
/* Only the child accepts connections from standard
|
||||
|
@@ -64,18 +64,18 @@ handle_parent_connection (int s)
|
||||
syslog_message (LOG_DEBUG,
|
||||
"Parent (%d) received command %d from client.",
|
||||
getpid (), (int) cmnd->command);
|
||||
|
||||
|
||||
if (cmnd->data_size >= BUFSIZ) {
|
||||
syslog_message (LOG_WARNING,
|
||||
"Client sent %d bytes, but buffer is %d",
|
||||
cmnd->data_size, BUFSIZ);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
memset (resp, 0, sizeof (glibtop_response));
|
||||
|
||||
memset (parameter, 0, sizeof (parameter));
|
||||
|
||||
|
||||
if (cmnd->data_size) {
|
||||
if (enable_debug)
|
||||
syslog_message (LOG_DEBUG, "Client has %d bytes of data.",
|
||||
@@ -92,7 +92,7 @@ handle_parent_connection (int s)
|
||||
do_output (s, resp, 0, 0, NULL);
|
||||
return;
|
||||
case GLIBTOP_CMND_SYSDEPS:
|
||||
memcpy (&resp->u.sysdeps, &server->sysdeps,
|
||||
memcpy (&resp->u.sysdeps, &server->sysdeps,
|
||||
sizeof (glibtop_sysdeps));
|
||||
resp->u.sysdeps.features = GLIBTOP_SYSDEPS_ALL;
|
||||
do_output (s, resp, _offset_union (sysdeps), 0, NULL);
|
||||
|
@@ -95,7 +95,7 @@ main(int argc, char *argv[])
|
||||
_exit (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
glibtop_init_p (glibtop_global_server, 0, 0);
|
||||
|
||||
if (setreuid (euid, uid)) _exit (1);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#define HOST_TABLE_ENTRIES 1
|
||||
|
||||
const char *permitted_host_names [HOST_TABLE_ENTRIES] =
|
||||
const char *permitted_host_names [HOST_TABLE_ENTRIES] =
|
||||
{ NULL };
|
||||
|
||||
unsigned long permitted_hosts [HOST_TABLE_ENTRIES];
|
||||
|
@@ -44,7 +44,7 @@ handle_slave_connection (int input, int output)
|
||||
fprintf (stderr, "Slave %d received command "
|
||||
"%d from client.\n", getpid (), cmnd->command);
|
||||
#endif
|
||||
|
||||
|
||||
if (cmnd->data_size >= BUFSIZ)
|
||||
glibtop_error ("Client sent %d bytes, "
|
||||
"but buffer is %d",
|
||||
@@ -53,19 +53,19 @@ handle_slave_connection (int input, int output)
|
||||
memset (resp, 0, sizeof (glibtop_response));
|
||||
|
||||
memset (parameter, 0, sizeof (parameter));
|
||||
|
||||
|
||||
if (cmnd->data_size) {
|
||||
#ifdef SLAVE_DEBUG
|
||||
fprintf (stderr, "Client has %d bytes of data.\n",
|
||||
cmnd->data_size);
|
||||
#endif
|
||||
|
||||
|
||||
do_read (input, parameter, cmnd->data_size);
|
||||
|
||||
|
||||
} else if (cmnd->size) {
|
||||
memcpy (parameter, cmnd->parameter, cmnd->size);
|
||||
}
|
||||
|
||||
|
||||
switch (cmnd->command) {
|
||||
case GLIBTOP_CMND_QUIT:
|
||||
do_output (output, resp, 0, 0, NULL);
|
||||
@@ -124,7 +124,7 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
|
||||
|
||||
switch (cmnd->command) {
|
||||
case GLIBTOP_CMND_SYSDEPS:
|
||||
memcpy (&resp->u.sysdeps, &server->sysdeps,
|
||||
memcpy (&resp->u.sysdeps, &server->sysdeps,
|
||||
sizeof (glibtop_sysdeps));
|
||||
resp->u.sysdeps.features = glibtop_server_features;
|
||||
resp->u.sysdeps.flags = glibtop_server_features |
|
||||
|
@@ -37,7 +37,7 @@ glibtop_send_version (glibtop *server, int fd)
|
||||
sizeof (glibtop_response),
|
||||
sizeof (glibtop_union),
|
||||
sizeof (glibtop_sysdeps));
|
||||
|
||||
|
||||
size = strlen (buffer) + 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@@ -61,23 +61,23 @@ main (int argc, char *argv [])
|
||||
|
||||
if (dirname [len-1] == '\n')
|
||||
dirname [len-1] = 0;
|
||||
|
||||
|
||||
if (stat (dirname, &statb))
|
||||
continue;
|
||||
|
||||
if (S_ISREG (statb.st_mode)) {
|
||||
glibtop_inodedb_key key;
|
||||
datum d_key, d_content;
|
||||
|
||||
|
||||
d_key.dptr = (void *) &key;
|
||||
d_key.dsize = sizeof (key);
|
||||
|
||||
d_content.dptr = dirname;
|
||||
d_content.dsize = strlen (dirname) + 1;
|
||||
|
||||
|
||||
key.device = (guint64) statb.st_dev;
|
||||
key.inode = (guint64) statb.st_ino;
|
||||
|
||||
|
||||
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
|
||||
glibtop_error_io ("gdbm_store (%s)", dirname);
|
||||
|
||||
@@ -98,9 +98,9 @@ main (int argc, char *argv [])
|
||||
glibtop_inodedb_key key;
|
||||
char filename [BUFSIZ];
|
||||
datum d_key, d_content;
|
||||
|
||||
|
||||
sprintf (filename, "%s/%s", dirname, entry->d_name);
|
||||
|
||||
|
||||
if (stat (filename, &statb))
|
||||
continue;
|
||||
|
||||
@@ -112,10 +112,10 @@ main (int argc, char *argv [])
|
||||
|
||||
d_content.dptr = filename;
|
||||
d_content.dsize = strlen (filename) + 1;
|
||||
|
||||
|
||||
key.device = (guint64) statb.st_dev;
|
||||
key.inode = (guint64) statb.st_ino;
|
||||
|
||||
|
||||
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
|
||||
glibtop_error_io ("gdbm_store (%s)", filename);
|
||||
|
||||
@@ -123,7 +123,7 @@ main (int argc, char *argv [])
|
||||
filename, (unsigned long) statb.st_dev,
|
||||
(unsigned long) statb.st_ino);
|
||||
}
|
||||
|
||||
|
||||
closedir (directory);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user