summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8b49713)
Fix a possible race condition between SIGCHLD handler and new connection attempts.
Changes in 2.2.1
================
Changes in 2.2.1
================
+* NEW: afpd: disable continous service feature by default, new option
+ -keepsessions to enable it
* FIX: afpd: increase BerkeleyDB locks and lockobjs
* FIX: afpd: create special folder as root
* FIX: afpd: fix compilation error if --enable-ddp is used
* FIX: afpd: More robust IPC reconnect error handling
* FIX: afpd: ACL access checking
* FIX: afpd: increase BerkeleyDB locks and lockobjs
* FIX: afpd: create special folder as root
* FIX: afpd: fix compilation error if --enable-ddp is used
* FIX: afpd: More robust IPC reconnect error handling
* FIX: afpd: ACL access checking
+* FIX: afpd: fix a possible race condition between SIGCHLD handler and
+ new connection attempts
* FIX: cnid_dbd: increase BerkeleyDB locks and lockobjs
* FIX: cnid_dbd: implement -d option, deletes CNID db
* FIX: suse: initscript return better status
* FIX: cnid_dbd: increase BerkeleyDB locks and lockobjs
* FIX: cnid_dbd: implement -d option, deletes CNID db
* FIX: suse: initscript return better status
options->flags |= OPTION_ANNOUNCESSH;
if (strstr(buf, " -noacl2maccess"))
options->flags &= ~OPTION_ACL2MACCESS;
options->flags |= OPTION_ANNOUNCESSH;
if (strstr(buf, " -noacl2maccess"))
options->flags &= ~OPTION_ACL2MACCESS;
+ if (strstr(buf, " -keepsessions")) {
+ default_options.flags |= OPTION_KEEPSESSIONS;
+ options->flags |= OPTION_KEEPSESSIONS;
+ }
/* passwd bits */
if (strstr(buf, " -nosavepassword"))
/* passwd bits */
if (strstr(buf, " -nosavepassword"))
#endif /* TRU64 */
unsigned char nologin = 0;
#endif /* TRU64 */
unsigned char nologin = 0;
struct afp_options default_options;
static AFPConfig *configs;
static server_child *server_children;
static sig_atomic_t reloadconfig = 0;
struct afp_options default_options;
static AFPConfig *configs;
static server_child *server_children;
static sig_atomic_t reloadconfig = 0;
+static sig_atomic_t gotsigchld = 0;
/* Two pointers to dynamic allocated arrays which store pollfds and associated data */
static struct pollfd *fdset;
/* Two pointers to dynamic allocated arrays which store pollfds and associated data */
static struct pollfd *fdset;
continue;
fdset_add_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd, LISTEN_FD, config);
}
continue;
fdset_add_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd, LISTEN_FD, config);
}
- fdset_add_fd(&fdset, &polldata, &fdset_used, &fdset_size, disasociated_ipc_fd, DISASOCIATED_IPC_FD, NULL);
+
+ if (default_options.flags & OPTION_KEEPSESSIONS) {
+ LOG(log_note, logtype_afpd, "Activating continous service");
+ fdset_add_fd(&fdset, &polldata, &fdset_used, &fdset_size, disasociated_ipc_fd, DISASOCIATED_IPC_FD, NULL);
+ }
}
static void fd_reset_listening_sockets(void)
}
static void fd_reset_listening_sockets(void)
continue;
fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd);
}
continue;
fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd);
}
- fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, disasociated_ipc_fd);
+
+ if (default_options.flags & OPTION_KEEPSESSIONS)
+ fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, disasociated_ipc_fd);
}
/* ------------------ */
}
/* ------------------ */
LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGTERM");
break;
case SIGQUIT:
LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGTERM");
break;
case SIGQUIT:
- LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGQUIT, NOT disconnecting clients");
+ if (default_options.flags & OPTION_KEEPSESSIONS) {
+ LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGQUIT, NOT disconnecting clients");
+ } else {
+ LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGQUIT");
+ sig = SIGTERM;
+ }
break;
}
if (server_children)
break;
}
if (server_children)
+ case SIGCHLD:
+ /* w/ a configuration file, we can force a re-read if we want */
+ gotsigchld = 1;
+ break;
+
default :
LOG(log_error, logtype_afpd, "afp_goaway: bad signal" );
}
return;
}
default :
LOG(log_error, logtype_afpd, "afp_goaway: bad signal" );
}
return;
}
-static void child_handler(int sig _U_)
+static void child_handler(void)
- sv.sa_handler = child_handler;
+ sv.sa_handler = afp_goaway; /* handler for all sigs */
+
sigemptyset( &sv.sa_mask );
sigaddset(&sv.sa_mask, SIGALRM);
sigaddset(&sv.sa_mask, SIGHUP);
sigemptyset( &sv.sa_mask );
sigaddset(&sv.sa_mask, SIGALRM);
sigaddset(&sv.sa_mask, SIGHUP);
- sv.sa_handler = afp_goaway;
sigemptyset( &sv.sa_mask );
sigaddset(&sv.sa_mask, SIGALRM);
sigaddset(&sv.sa_mask, SIGTERM);
sigemptyset( &sv.sa_mask );
sigaddset(&sv.sa_mask, SIGALRM);
sigaddset(&sv.sa_mask, SIGTERM);
afp_child_t *child;
int fd[2]; /* we only use one, but server_child_add expects [2] */
pid_t pid;
afp_child_t *child;
int fd[2]; /* we only use one, but server_child_add expects [2] */
pid_t pid;
/* wait for an appleshare connection. parent remains in the loop
* while the children get handled by afp_over_{asp,dsi}. this is
/* wait for an appleshare connection. parent remains in the loop
* while the children get handled by afp_over_{asp,dsi}. this is
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
ret = poll(fdset, fdset_used, -1);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
ret = poll(fdset, fdset_used, -1);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
+ saveerrno = errno;
+
+ if (gotsigchld) {
+ gotsigchld = 0;
+ child_handler();
+ continue;
+ }
if (reloadconfig) {
nologin++;
if (reloadconfig) {
nologin++;
fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, child->ipc_fds[0]);
close(child->ipc_fds[0]);
child->ipc_fds[0] = -1;
fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, child->ipc_fds[0]);
close(child->ipc_fds[0]);
child->ipc_fds[0] = -1;
- if (child->disasociated) {
+ if ((default_options.flags & OPTION_KEEPSESSIONS) && child->disasociated) {
LOG(log_note, logtype_afpd, "main: removing reattached child[%u]", child->pid);
server_child_remove(server_children, CHILD_DSIFORK, child->pid);
}
LOG(log_note, logtype_afpd, "main: removing reattached child[%u]", child->pid);
server_child_remove(server_children, CHILD_DSIFORK, child->pid);
}
#define OPTION_UUID (1 << 7)
#define OPTION_ACL2MACCESS (1 << 8)
#define OPTION_NOZEROCONF (1 << 9)
#define OPTION_UUID (1 << 7)
#define OPTION_ACL2MACCESS (1 << 8)
#define OPTION_NOZEROCONF (1 << 9)
+#define OPTION_KEEPSESSIONS (1 << 10) /* preserve sessions across master afpd restart with SIGQUIT */
#ifdef FORCE_UIDGID
/* set up a structure for this */
#ifdef FORCE_UIDGID
/* set up a structure for this */
/* typedef for AFP functions handlers */
typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen);
/* typedef for AFP functions handlers */
typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen);
-/* afp_dsi.c */
-extern AFPObj *AFPobj;
-
-extern int afp_version;
-extern int afp_errno;
-extern unsigned char nologin;
-extern struct dir *curdir;
-extern char getwdbuf[];
-
-/* FIXME CNID */
-extern const char *Cnid_srv;
-extern const char *Cnid_port;
+/* Global variables */
+extern AFPObj *AFPobj;
+extern int afp_version;
+extern int afp_errno;
+extern unsigned char nologin;
+extern struct dir *curdir;
+extern char getwdbuf[];
+extern struct afp_options default_options;
+extern const char *Cnid_srv;
+extern const char *Cnid_port;
extern int get_afp_errno (const int param);
extern void afp_options_init (struct afp_options *);
extern int get_afp_errno (const int param);
extern void afp_options_init (struct afp_options *);