not set. [Sam Noble]
* FIX: afpd: Catsearch, fix possible SIGSEGV
* FIX: cnid: Fix compile problems on Tru64. [Burkhard Schmidt]
+* FIX: deadlock in signal handlers (Redhat 9)
+* FIX: don't log network probe (OSX 10.3)
Changes in 1.6.3
================
/*
- * $Id: afp_dsi.c,v 1.24.2.2 2003-06-09 15:09:06 srittau Exp $
+ * $Id: afp_dsi.c,v 1.24.2.3 2003-11-05 06:41:01 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
sigemptyset( &action.sa_mask );
sigaddset(&action.sa_mask, SIGALRM);
sigaddset(&action.sa_mask, SIGTERM);
+#ifdef SERVERTEXT
+ sigaddset(&action.sa_mask, SIGUSR2);
+#endif
action.sa_flags = SA_RESTART;
if ( sigaction( SIGHUP, &action, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
sigemptyset( &action.sa_mask );
sigaddset(&action.sa_mask, SIGALRM);
sigaddset(&action.sa_mask, SIGHUP);
+#ifdef SERVERTEXT
+ sigaddset(&action.sa_mask, SIGUSR2);
+#endif
action.sa_flags = SA_RESTART;
if ( sigaction( SIGTERM, &action, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
/* Added for server message support */
action.sa_handler = afp_dsi_getmesg;
sigemptyset( &action.sa_mask );
- sigaddset(&action.sa_mask, SIGUSR2);
+ sigaddset(&action.sa_mask, SIGTERM);
+ sigaddset(&action.sa_mask, SIGALRM);
+ sigaddset(&action.sa_mask, SIGHUP);
action.sa_flags = SA_RESTART;
if ( sigaction( SIGUSR2, &action, 0) < 0 ) {
LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGHUP);
sigaddset(&action.sa_mask, SIGTERM);
+#ifdef SERVERTEXT
+ sigaddset(&action.sa_mask, SIGUSR2);
+#endif
action.sa_flags = SA_RESTART;
if ((sigaction(SIGALRM, &action, NULL) < 0) ||
(setitimer(ITIMER_REAL, &dsi->timer, NULL) < 0)) {
/*
- * $Id: main.c,v 1.20 2002-10-04 15:15:05 srittau Exp $
+ * $Id: main.c,v 1.20.2.1 2003-11-05 06:41:01 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
fd_set rfds;
struct sigaction sv;
sigset_t sigs;
+ int ret;
#ifdef TRU64
argc = ac;
memset(&sv, 0, sizeof(sv));
sv.sa_handler = child_handler;
sigemptyset( &sv.sa_mask );
+ sigaddset(&sv.sa_mask, SIGALRM);
+ sigaddset(&sv.sa_mask, SIGHUP);
+ sigaddset(&sv.sa_mask, SIGTERM);
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGCHLD, &sv, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
sv.sa_handler = afp_goaway;
sigemptyset( &sv.sa_mask );
- sigaddset(&sv.sa_mask, SIGHUP);
+ sigaddset(&sv.sa_mask, SIGALRM);
sigaddset(&sv.sa_mask, SIGTERM);
+ sigaddset(&sv.sa_mask, SIGCHLD);
sv.sa_flags = SA_RESTART;
if ( sigaction( SIGHUP, &sv, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
afp_exit(1);
}
+
+ sigemptyset( &sv.sa_mask );
+ sigaddset(&sv.sa_mask, SIGALRM);
+ sigaddset(&sv.sa_mask, SIGHUP);
+ sigaddset(&sv.sa_mask, SIGCHLD);
+ sv.sa_flags = SA_RESTART;
if ( sigaction( SIGTERM, &sv, 0 ) < 0 ) {
LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
afp_exit(1);
*/
sigemptyset(&sigs);
+ sigaddset(&sigs, SIGALRM);
sigaddset(&sigs, SIGHUP);
+#if 0
+ /* don't block SIGTERM */
sigaddset(&sigs, SIGTERM);
+#endif
+ sigaddset(&sigs, SIGCHLD);
sigprocmask(SIG_BLOCK, &sigs, NULL);
if (!(configs = configinit(&default_options))) {
LOG(log_error, logtype_afpd, "main: no servers configured: %s\n", strerror(errno));
* solution. */
while (1) {
rfds = save_rfds;
- if (select(FD_SETSIZE, &rfds, NULL, NULL, NULL) < 0) {
+ sigprocmask(SIG_UNBLOCK, &sigs, NULL);
+ ret = select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
+ sigprocmask(SIG_BLOCK, &sigs, NULL);
+ if (ret < 0) {
if (errno == EINTR)
continue;
LOG(log_error, logtype_afpd, "main: can't wait for input: %s", strerror(errno));
/*
- * $Id: asp_getsess.c,v 1.7 2002-06-18 23:45:16 didg Exp $
+ * $Id: asp_getsess.c,v 1.7.2.1 2003-11-05 06:41:02 didg Exp $
*
* Copyright (c) 1990,1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
/* install cleanup pointer */
server_child_setup(children, CHILD_ASPFORK, child_cleanup);
- /* install tickle handler */
+ /* install tickle handler
+ * we are the parent process
+ */
memset(&action, 0, sizeof(action));
action.sa_handler = tickle_handler;
sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGHUP);
+ sigaddset(&action.sa_mask, SIGTERM);
+ sigaddset(&action.sa_mask, SIGCHLD);
action.sa_flags = SA_RESTART;
timer.it_interval.tv_sec = timer.it_value.tv_sec = tickleval;
/*
- * $Id: dsi_stream.c,v 1.9 2002-10-11 14:18:39 didg Exp $
+ * $Id: dsi_stream.c,v 1.8.4.1 2003-11-05 06:41:02 didg Exp $
*
* Copyright (c) 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
else if (len > 0)
stored += len;
else { /* eof or error */
- LOG(log_error, logtype_default, "dsi_stream_read(%d): %s", len, (len < 0)?strerror(errno):"unexpected EOF");
+ /* don't log EOF error if it's just after connect (OSX 10.3 probe) */
+ if (len || stored || dsi->read_count) {
+ LOG(log_error, logtype_default, "dsi_stream_read(%d): %s", len, (len < 0)?strerror(errno):"unexpected EOF");
+ }
break;
}
}
sigset_t oldset;
#ifdef USE_WRITEV
struct iovec iov[2];
- size_t towrite;
+ size_t towrite;
ssize_t len;
#endif /* USE_WRITEV */
/* read data. function on success. 0 on failure. data length gets
* stored in length variable. this should really use size_t's, but
* that would require changes elsewhere. */
-int dsi_stream_receive(DSI *dsi, void *buf, const size_t ilength,
- size_t *rlength)
+int dsi_stream_receive(DSI *dsi, void *buf, const int ilength,
+ int *rlength)
{
char block[DSI_BLOCKSIZ];
/*
- * $Id: dsi_tcp.c,v 1.9 2002-01-24 16:27:31 jmarcus Exp $
+ * $Id: dsi_tcp.c,v 1.9.4.1 2003-11-05 06:41:02 didg Exp $
*
* Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
/* read in the first two bytes */
len = dsi_stream_read(dsi, block, 2);
- if (len <= 0 || (block[0] > DSIFL_MAX) || (block[1] > DSIFUNC_MAX)) {
+ if (!len ) {
+ /* connection already closed, don't log it (normal OSX 10.3 behaviour) */
+ exit(1);
+ }
+
+ if (len < 2 || (block[0] > DSIFL_MAX) || (block[1] > DSIFUNC_MAX)) {
LOG(log_error, logtype_default, "dsi_tcp_open: invalid header");
exit(1);
}
char log_details_buffer[MAXLOGSIZE];
log_file_data_pair *logs;
+
+ /* fn is not reentrant but is used in signal handler
+ * with LOGGER it's a little late source name and line number
+ * are already changed.
+ */
+ static int inlog = 0;
+
+ if (inlog)
+ return;
+ inlog = 1;
log_init();
LOG(log_severe, logtype_logger, "can't open Logfile %s",
(*logs)[1].log_filename
);
+ inlog = 0;
return;
}
}
global_log_data.temp_src_filename = NULL;
global_log_data.temp_src_linenumber = 0;
#endif /* DISABLE_LOGGER */
+ inlog = 0;
}
#ifndef DISABLE_LOGGER
/*
- * $Id: server_child.c,v 1.7 2002-10-07 19:14:41 didg Exp $
+ * $Id: server_child.c,v 1.7.2.1 2003-11-05 06:41:03 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
{
server_child_fork *fork;
struct server_child_data *child;
- sigset_t sig;
+ sigset_t sig, oldsig;
/* we need to prevent deletions from occuring before we get a
* chance to add the child in. */
sigemptyset(&sig);
sigaddset(&sig, SIGCHLD);
- sigprocmask(SIG_BLOCK, &sig, NULL);
+ sigprocmask(SIG_BLOCK, &sig, &oldsig);
/* it's possible that the child could have already died before the
* sigprocmask. we need to check for this. */
if (kill(pid, 0) < 0) {
- sigprocmask(SIG_UNBLOCK, &sig, NULL);
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
return 1;
}
/* if we already have an entry. just return. */
if (resolve_child(fork->table, pid)) {
- sigprocmask(SIG_UNBLOCK, &sig, NULL);
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
return 0;
}
if ((child = (struct server_child_data *)
calloc(1, sizeof(struct server_child_data))) == NULL) {
- sigprocmask(SIG_UNBLOCK, &sig, NULL);
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
return -1;
}
child->pid = pid;
hash_child(fork->table, child);
children->count++;
- sigprocmask(SIG_UNBLOCK, &sig, NULL);
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
return 0;
}
break;
}
}
-
if (WIFEXITED(status)) {
if (WEXITSTATUS(status)) {
LOG(log_info, logtype_default, "server_child[%d] %d exited %d", i, pid,