X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fmain.c;h=91ad85e9909afa52a0d31b2f8b7114fb1a1151a0;hb=9a838f8cba643dc08a958174298d593fd1929caa;hp=158da6c730dd25534f91b370179bc0dde739dbbd;hpb=06af2fac094c3bc000db0e42743b269383d1b99d;p=netatalk.git diff --git a/etc/afpd/main.c b/etc/afpd/main.c index 158da6c7..91ad85e9 100644 --- a/etc/afpd/main.c +++ b/etc/afpd/main.c @@ -1,5 +1,5 @@ /* - * $Id: main.c,v 1.17 2002-02-16 11:05:16 srittau Exp $ + * $Id: main.c,v 1.20 2002-10-04 15:15:05 srittau Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -57,17 +57,8 @@ static int argc = 0; static char **argv = NULL; #endif /* TRU64 */ -#ifdef DID_MTAB -#include "parse_mtab.h" -#endif /* DID_MTAB */ - unsigned char nologin = 0; -#ifdef DID_MTAB -/* global mount table; afpd_st_cnid uses this to lookup the right entry. */ -static struct afpd_mount_table *afpd_mount_table = NULL; -#endif /* DID_MTAB */ - struct afp_options default_options; static AFPConfig *configs; static server_child *server_children; @@ -95,7 +86,7 @@ static void afp_goaway(int sig) dsi_kill(sig); switch( sig ) { case SIGTERM : - LOG(log_info, logtype_default, "shutting down on signal %d", sig ); + LOG(log_info, logtype_afpd, "shutting down on signal %d", sig ); break; case SIGHUP : /* w/ a configuration file, we can force a re-read if we want */ @@ -103,14 +94,14 @@ static void afp_goaway(int sig) if ((nologin + 1) & 1) { AFPConfig *config; - LOG(log_info, logtype_default, "re-reading configuration file"); + LOG(log_info, logtype_afpd, "re-reading configuration file"); for (config = configs; config; config = config->next) if (config->server_cleanup) config->server_cleanup(config); configfree(configs, NULL); if (!(configs = configinit(&default_options))) { - LOG(log_error, logtype_default, "config re-read: no servers configured"); + LOG(log_error, logtype_afpd, "config re-read: no servers configured"); afp_exit(1); } FD_ZERO(&save_rfds); @@ -120,12 +111,12 @@ static void afp_goaway(int sig) FD_SET(config->fd, &save_rfds); } } else { - LOG(log_info, logtype_default, "disallowing logins"); + LOG(log_info, logtype_afpd, "disallowing logins"); auth_unload(); } break; default : - LOG(log_error, logtype_default, "afp_goaway: bad signal" ); + LOG(log_error, logtype_afpd, "afp_goaway: bad signal" ); } if ( sig == SIGTERM ) { AFPConfig *config; @@ -163,7 +154,9 @@ char **av; if (!afp_options_parse(ac, av, &default_options)) exit(1); - umask( default_options.umask ); + /* Save the user's current umask for use with CNID (and maybe some + * other things, too). */ + default_options.save_mask = umask( default_options.umask ); switch(server_lock("afpd", default_options.pidfile, default_options.flags & OPTION_DEBUG)) { @@ -175,17 +168,12 @@ char **av; exit(0); } -#ifdef DID_MTAB - /* if we are going to use afpd.mtab, load the file */ - afpd_mount_table = afpd_mtab_parse ( AFPD_MTAB_FILE ); -#endif /* DID_MTAB */ - /* install child handler for asp and dsi. we do this before afp_goaway * as afp_goaway references stuff from here. * XXX: this should really be setup after the initial connections. */ if (!(server_children = server_child_alloc(default_options.connections, CHILD_NFORKS))) { - LOG(log_error, logtype_default, "main: server_child alloc: %s", strerror(errno) ); + LOG(log_error, logtype_afpd, "main: server_child alloc: %s", strerror(errno) ); afp_exit(1); } @@ -194,7 +182,7 @@ char **av; sigemptyset( &sv.sa_mask ); sv.sa_flags = SA_RESTART; if ( sigaction( SIGCHLD, &sv, 0 ) < 0 ) { - LOG(log_error, logtype_default, "main: sigaction: %s", strerror(errno) ); + LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) ); afp_exit(1); } @@ -204,11 +192,11 @@ char **av; sigaddset(&sv.sa_mask, SIGTERM); sv.sa_flags = SA_RESTART; if ( sigaction( SIGHUP, &sv, 0 ) < 0 ) { - LOG(log_error, logtype_default, "main: sigaction: %s", strerror(errno) ); + LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) ); afp_exit(1); } if ( sigaction( SIGTERM, &sv, 0 ) < 0 ) { - LOG(log_error, logtype_default, "main: sigaction: %s", strerror(errno) ); + LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) ); afp_exit(1); } @@ -225,7 +213,7 @@ char **av; sigaddset(&sigs, SIGTERM); sigprocmask(SIG_BLOCK, &sigs, NULL); if (!(configs = configinit(&default_options))) { - LOG(log_error, logtype_default, "main: no servers configured: %s\n", strerror(errno)); + LOG(log_error, logtype_afpd, "main: no servers configured: %s\n", strerror(errno)); afp_exit(1); } sigprocmask(SIG_UNBLOCK, &sigs, NULL); @@ -249,7 +237,7 @@ char **av; if (select(FD_SETSIZE, &rfds, NULL, NULL, NULL) < 0) { if (errno == EINTR) continue; - LOG(log_error, logtype_default, "main: can't wait for input: %s", strerror(errno)); + LOG(log_error, logtype_afpd, "main: can't wait for input: %s", strerror(errno)); break; }