/*
- * Copyright (C) 1997-2007 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2008 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
extern struct misc_meta_data *mmd;
extern struct sender senders[];
-static void dummy(__a_unused int s)
-{}
+static void dummy(int s)
+{
+ /*
+ * At least on Solaris, SIGUSR1 is one-shot, i.e. the signal action is
+ * restored to the default state once the signal handler has been
+ * called.
+ */
+ if (s == SIGUSR1)
+ signal(SIGUSR1, dummy);
+}
static void mmd_dup(struct misc_meta_data *new_mmd)
{
flags = vss_get_status_flags(nmmd->vss_status_flags);
if (nmmd->size) { /* parent currently has an audio file open */
localtime_r(&nmmd->mtime, &mtime_tm);
- strftime(mtime, 29, "%a %b %d %Y", &mtime_tm);
+ strftime(mtime, 29, "%b %d %Y", &mtime_tm);
}
gettimeofday(&now, NULL);
ret = make_message(
"supported senders: %s\n"
"%s",
ut, mmd->num_played,
- getppid(),
+ (int)getppid(),
mmd->active_connections,
mmd->num_commands,
mmd->num_connects,
return -E_COMMAND_SYNTAX;
return send_buffer(fd, VERSION_TEXT("server")
"built: " BUILD_DATE "\n"
- SYSTEM ", " CC_VERSION "\n"
+ UNAME_RS ", " CC_VERSION "\n"
);
}
/**
* perform user authentication and execute a command
*
- * \param fd the file descriptor to send output to
- * \param addr socket address info of peer
+ * \param fd The file descriptor to send output to
+ * \param peername Identifies the connecting peer.
*
* \return EXIT_SUCCESS or EXIT_FAILURE
*
*
* \sa alarm(2), rc4(3), crypt.c, crypt.h
*/
-int handle_connect(int fd, struct sockaddr_in *addr)
+int handle_connect(int fd, const char *peername)
{
int ret, argc, use_rc4 = 0;
char buf[4096];
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_DFL);
- signal(SIGUSR1, SIG_IGN);
/* we need a blocking fd here as recv() might return EAGAIN otherwise. */
ret = mark_fd_blocking(fd);
mmd->num_commands++;
mmd_unlock();
PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name,
- inet_ntoa(addr->sin_addr));
+ peername);
ret = cmd->handler(fd, argc, argv);
if (ret >= 0) {
ret = EXIT_SUCCESS;
goto out;
}
err_out:
- send_va_buffer(fd, "%s\n", PARA_STRERROR(-ret));
+ send_va_buffer(fd, "%s\n", para_strerror(-ret));
net_err:
- PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-ret));
+ PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
ret = EXIT_FAILURE;
out:
free(command);