/*
- * $Id: afp_asp.c,v 1.17 2002-08-30 19:32:40 didg Exp $
+ * $Id: afp_asp.c,v 1.18 2002-12-04 10:59:36 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
afp_asp_die(1);
}
+
+ /* ignore SIGHUP */
+ sv.sa_handler = SIG_IGN;
+ sigemptyset( &sv.sa_mask );
+ sv.sa_flags = SA_RESTART;
+ if ( sigaction( SIGHUP, &sv, 0 ) < 0 ) {
+ LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGHUP: %s", strerror(errno) );
+ afp_asp_die(1);
+ }
}
void afp_over_asp(AFPObj *obj)
/*
- * $Id: afp_dsi.c,v 1.25 2002-10-11 14:18:23 didg Exp $
+ * $Id: afp_dsi.c,v 1.26 2002-12-04 10:59:36 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
afp_dsi_die(1);
}
+
+ /* ignore SIGHUP */
+ sv.sa_handler = SIG_IGN;
+ sigemptyset( &sv.sa_mask );
+ sv.sa_flags = SA_RESTART;
+ if ( sigaction( SIGHUP, &sv, 0 ) < 0 ) {
+ LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGHUP: %s", strerror(errno) );
+ afp_dsi_die(1);
+ }
+
}
#ifdef SERVERTEXT
static void alarm_handler()
{
+int err;
/* if we're in the midst of processing something,
don't die. */
if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
- if (!pollvoltime(child.obj))
- dsi_tickle(child.obj->handle);
+ if (!(err = pollvoltime(child.obj)))
+ err = dsi_tickle(child.obj->handle);
+ if (err <= 0)
+ afp_dsi_die(1);
+
} else { /* didn't receive a tickle. close connection */
LOG(log_error, logtype_afpd, "afp_alarm: child timed out");
afp_dsi_die(1);
/*
- * $Id: volume.c,v 1.43 2002-11-15 10:59:11 srittau Exp $
+ * $Id: volume.c,v 1.44 2002-12-04 10:59:36 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
/* FIXME
*/
- if (afp_version >= 30)
+ if (afp_version >= 30) {
volume->max_filename = 255;
- else
+ }
+ else {
volume->max_filename = MACFILELEN;
-
+ }
if (( volume->v_flags & AFPVOL_OPEN ) == 0 ) {
/* FIXME unix name != mac name */
if ((dir = dirnew(volume->v_name, volume->v_name) ) == NULL) {
curdir = ovol->v_dir;
}
}
-
dirfree( vol->v_root );
vol->v_dir = NULL;
#ifdef CNID_DB
if ( (vol->v_flags & AFPVOL_OPEN) && vol->v_time + 30 < tv.tv_sec) {
if ( !stat( vol->v_path, &st ) && vol->v_time != st.st_mtime ) {
vol->v_time = st.st_mtime;
- obj->attention(obj->handle, AFPATTN_NOTIFY | AFPATTN_VOLCHANGED);
+ if (!obj->attention(obj->handle, AFPATTN_NOTIFY | AFPATTN_VOLCHANGED))
+ return -1;
return 1;
}
}
extern int asp_wrtcont __P((ASP, char *, int *));
#define asp_wrtreply(a,b) asp_cmdreply((a), (b))
extern void asp_kill __P((int));
-extern void asp_tickle __P((ASP, const u_int8_t, struct sockaddr_at *));
+extern int asp_tickle __P((ASP, const u_int8_t, struct sockaddr_at *));
#endif
extern void dsi_opensession __P((DSI *));
extern int dsi_attention __P((DSI *, AFPUserBytes));
extern int dsi_cmdreply __P((DSI *, const int));
-extern void dsi_tickle __P((DSI *));
+extern int dsi_tickle __P((DSI *));
extern void dsi_getstatus __P((DSI *));
extern void dsi_close __P((DSI *));
/*
- * $Id: asp_attn.c,v 1.6 2002-01-04 04:45:48 sibaz Exp $
+ * $Id: asp_attn.c,v 1.7 2002-12-04 10:59:37 didg Exp $
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
*/
if ( atp_sreq( asp->asp_atp, &atpb, 1, 0 ) < 0 ) {
LOG(log_error, logtype_default, "atp_sreq: %s", strerror(errno) );
- return -1;
+ return 0;
}
iov[ 0 ].iov_base = data;
atpb.atp_rresiovcnt = sizeof( iov )/sizeof( iov[ 0 ] );
if ( atp_rresp( asp->asp_atp, &atpb ) < 0 ) {
LOG(log_error, logtype_default, "atp_rresp: %s", strerror(errno) );
- return -1;
+ return 0;
}
- return 0;
+ return 1;
}
/*
- * $Id: asp_tickle.c,v 1.6 2002-01-04 04:45:48 sibaz Exp $
+ * $Id: asp_tickle.c,v 1.7 2002-12-04 10:59:37 didg Exp $
*/
#ifdef HAVE_CONFIG_H
#include <atalk/asp.h>
/* send off a tickle */
-void asp_tickle(ASP asp, const u_int8_t sid, struct sockaddr_at *sat)
+int asp_tickle(ASP asp, const u_int8_t sid, struct sockaddr_at *sat)
{
struct atp_block atpb;
char buf[ASP_HDRSIZ];
atpb.atp_sreqtries = 1;
if ( atp_sreq( asp->asp_atp, &atpb, 0, 0 ) < 0 ) {
LOG(log_error, logtype_default, "atp_sreq: %s", strerror(errno) );
+ return 0;
}
+ return 1;
}
/*
- * $Id: dsi_attn.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: dsi_attn.c,v 1.4 2002-12-04 10:59:37 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
#endif /* MIN */
/* send an attention. this may get called at any time, so we can't use
- * DSI buffers to send one. */
+ * DSI buffers to send one.
+ return 0 on error
+
+ */
int dsi_attention(DSI *dsi, AFPUserBytes flags)
{
/* header + AFPUserBytes */
/*
- * $Id: dsi_tickle.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: dsi_tickle.c,v 1.4 2002-12-04 10:59:37 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
/* server generated tickles. as this is only called by the tickle handler,
* we don't need to block signals. well, actually, we might get it during
* a SIGHUP. */
-void dsi_tickle(DSI *dsi)
+int dsi_tickle(DSI *dsi)
{
char block[DSI_BLOCKSIZ];
sigset_t oldset;
u_int16_t id;
-
+ int ret;
+
id = htons(dsi_serverID(dsi));
memset(block, 0, sizeof(block));
/* code = len = reserved = 0 */
sigprocmask(SIG_BLOCK, &dsi->sigblockset, &oldset);
- dsi_stream_write(dsi, block, DSI_BLOCKSIZ);
+ ret = dsi_stream_write(dsi, block, DSI_BLOCKSIZ) == DSI_BLOCKSIZ;
sigprocmask(SIG_SETMASK, &oldset, NULL);
+ return ret;
}