From a49b66d98f3de80884b15f68285f4b602db19885 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Fri, 27 Jul 2012 12:01:35 +0200 Subject: [PATCH] Reset signal handlers and alarm timer after successfull PAM authentication Fixes a problem with AFP disconnects caused by pam_smbpass.so messing with our handlers and timer. --- NEWS | 3 +++ etc/afpd/afp_dsi.c | 33 ++++++++++++++++++++------------- etc/afpd/auth.c | 3 +++ include/atalk/globals.h | 2 +- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 0f88863b..fac31688 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,9 @@ Changes in 2.2.4 * FIX: Missing UAM links * FIX: Lockup in AFP logout on Fedora 17 +* FIX: Reset signal handlers and alarm timer after successfull PAM + authentication. Fixes a problem with AFP disconnects caused + by pam_smbpass.so messing with our handlers and timer. Changes in 2.2.3 ================ diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index 7779b230..8529177d 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -383,23 +383,11 @@ static void pending_request(DSI *dsi) } } -/* ------------------------------------------- - afp over dsi. this never returns. -*/ -void afp_over_dsi(AFPObj *obj) +void afp_over_dsi_sighandlers(AFPObj *obj) { DSI *dsi = (DSI *) obj->handle; - int rc_idx; - u_int32_t err, cmd; - u_int8_t function; struct sigaction action; - AFPobj = obj; - obj->exit = afp_dsi_die; - obj->reply = (int (*)()) dsi_cmdreply; - obj->attention = (int (*)(void *, AFPUserBytes)) dsi_attention; - dsi->tickle = 0; - memset(&action, 0, sizeof(action)); sigfillset(&action.sa_mask); action.sa_flags = SA_RESTART; @@ -462,6 +450,25 @@ void afp_over_dsi(AFPObj *obj) afp_dsi_die(EXITERR_SYS); } #endif /* DEBUGGING */ +} + +/* ------------------------------------------- + afp over dsi. this never returns. +*/ +void afp_over_dsi(AFPObj *obj) +{ + DSI *dsi = (DSI *) obj->handle; + int rc_idx; + u_int32_t err, cmd; + u_int8_t function; + + AFPobj = obj; + obj->exit = afp_dsi_die; + obj->reply = (int (*)()) dsi_cmdreply; + obj->attention = (int (*)(void *, AFPUserBytes)) dsi_attention; + dsi->tickle = 0; + + afp_over_dsi_sighandlers(obj); if (dircache_init(obj->options.dircachesize) != 0) afp_dsi_die(EXITERR_SYS); diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index 40d3a5ac..b3d0d9a2 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -415,6 +415,9 @@ static int login(AFPObj *obj, struct passwd *pwd, void (*logout)(void), int expi /* pam_umask or similar might have changed our umask */ (void)umask(obj->options.umask); + /* Some PAM module might have reset our signal handlers and timer, so we need to reestablish them */ + afp_over_dsi_sighandlers(obj); + return( AFP_OK ); } diff --git a/include/atalk/globals.h b/include/atalk/globals.h index 68e68a32..3c458d5d 100644 --- a/include/atalk/globals.h +++ b/include/atalk/globals.h @@ -167,5 +167,5 @@ extern struct dir rootParent; extern void afp_over_asp (AFPObj *); #endif /* NO_DDP */ extern void afp_over_dsi (AFPObj *); - +extern void afp_over_dsi_sighandlers(AFPObj *obj); #endif /* globals.h */ -- 2.39.2