X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fafp_options.c;h=e79fc4f227928209ed140a4613f3825944551680;hb=2fdd522410f80afcd055d7333f491ee6c0b4b9fa;hp=e8fe6c82234cc299edf5791b76502f26ef93b9c9;hpb=e122b0d9096580ea5bfa3d46ab340af26b9a9830;p=netatalk.git diff --git a/etc/afpd/afp_options.c b/etc/afpd/afp_options.c index e8fe6c82..e79fc4f2 100644 --- a/etc/afpd/afp_options.c +++ b/etc/afpd/afp_options.c @@ -12,50 +12,35 @@ #include #include - -/* STDC check */ -#if STDC_HEADERS #include -#else /* STDC_HEADERS */ -#ifndef HAVE_STRCHR -#define strchr index -#define strrchr index -#endif /* HAVE_STRCHR */ -char *strchr (), *strrchr (); -#ifndef HAVE_MEMCPY -#define memcpy(d,s,n) bcopy ((s), (d), (n)) -#define memmove(d,s,n) bcopy ((s), (d), (n)) -#endif /* ! HAVE_MEMCPY */ -#endif /* STDC_HEADERS */ - #include -#ifdef HAVE_UNISTD_H #include -#endif /* HAVE_UNISTD_H */ #include #include #include #include #include + #ifdef HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ +#ifdef ADMIN_GRP +#include +#include +#endif /* ADMIN_GRP */ + #include #include -#include "globals.h" +#include +#include +#include + #include "status.h" #include "auth.h" #include "dircache.h" -#include - -#ifdef ADMIN_GRP -#include -#include -#endif /* ADMIN_GRP */ - #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif /* MIN */ @@ -155,6 +140,8 @@ void afp_options_free(struct afp_options *opt, free(opt->ntseparator); if (opt->logconfig && (opt->logconfig != save->logconfig)) free(opt->logconfig); + if (opt->mimicmodel && (opt->mimicmodel != save->mimicmodel)) + free(opt->mimicmodel); } /* initialize options */ @@ -175,8 +162,9 @@ void afp_options_init(struct afp_options *options) options->transports = AFPTRANS_TCP; /* TCP only */ options->passwdfile = _PATH_AFPDPWFILE; options->tickleval = 30; - options->timeout = 4; - options->sleep = 10* 120; /* 10 h in 30 seconds tick */ + options->timeout = 4; /* 4 tickles = 2 minutes */ + options->sleep = 10 * 60 * 2; /* 10 h in 30 seconds tick */ + options->disconnected = 10 * 60 * 2; /* 10 h in 30 seconds tick */ options->server_notif = 1; options->authprintdir = NULL; options->signatureopt = "auto"; @@ -200,7 +188,12 @@ void afp_options_init(struct afp_options *options) #endif options->dircachesize = DEFAULT_MAX_DIRCACHE_SIZE; options->flags |= OPTION_ACL2MACCESS; - options->flags |= OPTION_UUID; /* gets disabled if LDAP isn't configured */ + options->flags |= OPTION_UUID; + options->tcp_sndbuf = 0; /* 0 means don't change OS default */ + options->tcp_rcvbuf = 0; /* 0 means don't change OS default */ + options->dsireadbuf = 12; + options->mimicmodel = NULL; + options->fce_fmodwait = 60; /* put fmod events 60 seconds on hold */ } /* parse an afpd.conf line. i'm doing it this way because it's @@ -248,8 +241,10 @@ int afp_options_parseline(char *buf, struct afp_options *options) options->flags |= OPTION_ANNOUNCESSH; if (strstr(buf, " -noacl2maccess")) options->flags &= ~OPTION_ACL2MACCESS; - if (strstr(buf, " -nouuid")) - options->flags &= ~OPTION_UUID + if (strstr(buf, " -keepsessions")) { + default_options.flags |= OPTION_KEEPSESSIONS; + options->flags |= OPTION_KEEPSESSIONS; + } /* passwd bits */ if (strstr(buf, " -nosavepassword")) @@ -332,12 +327,18 @@ int afp_options_parseline(char *buf, struct afp_options *options) } if ((c = getoption(buf, "-sleep"))) { - options->sleep = atoi(c) *120; + options->disconnected = options->sleep = atoi(c) * 120; if (options->sleep <= 4) { - options->sleep = 4; + options->disconnected = options->sleep = 4; } } + if ((c = getoption(buf, "-dsireadbuf"))) { + options->dsireadbuf = atoi(c); + if (options->dsireadbuf < 6) + options->dsireadbuf = 6; + } + if ((c = getoption(buf, "-server_quantum"))) options->server_quantum = strtoul(c, NULL, 0); @@ -358,8 +359,11 @@ int afp_options_parseline(char *buf, struct afp_options *options) while (NULL != (c = strstr(c, "-setuplog"))) { char *optstr; if ((optstr = getoption(c, "-setuplog"))) { + /* hokey2: options->logconfig must be converted to store an array of logstrings */ + if (options->logconfig) + free(options->logconfig); + options->logconfig = strdup(optstr); setuplog(optstr); - options->logconfig = optstr; /* at least store the last (possibly only) one */ c += sizeof("-setuplog"); } } @@ -424,8 +428,6 @@ int afp_options_parseline(char *buf, struct afp_options *options) if ((c = getoption(buf, "-port"))) options->port = strdup(c); - if ((c = getoption(buf, "-ddpaddr"))) - atalk_aton(c, &options->ddpaddr); if ((c = getoption(buf, "-signature")) && (opt = strdup(c))) options->signatureopt = opt; @@ -480,6 +482,31 @@ int afp_options_parseline(char *buf, struct afp_options *options) if ((c = getoption(buf, "-dircachesize"))) options->dircachesize = atoi(c); + if ((c = getoption(buf, "-tcpsndbuf"))) + options->tcp_sndbuf = atoi(c); + + if ((c = getoption(buf, "-tcprcvbuf"))) + options->tcp_rcvbuf = atoi(c); + + if ((c = getoption(buf, "-fcelistener"))) { + LOG(log_note, logtype_afpd, "Adding fce listener \"%s\"", c); + fce_add_udp_socket(c); + } + if ((c = getoption(buf, "-fcecoalesce"))) { + LOG(log_note, logtype_afpd, "Fce coalesce: %s", c); + fce_set_coalesce(c); + } + if ((c = getoption(buf, "-fceevents"))) { + LOG(log_note, logtype_afpd, "Fce events: %s", c); + fce_set_events(c); + } + + if ((c = getoption(buf, "-fceholdfmod"))) + options->fce_fmodwait = atoi(c); + + if ((c = getoption(buf, "-mimicmodel")) && (opt = strdup(c))) + options->mimicmodel = opt; + return 1; } @@ -489,6 +516,8 @@ int afp_options_parseline(char *buf, struct afp_options *options) */ static void show_version( void ) { + int num, i; + printf( "afpd %s - Apple Filing Protocol (AFP) daemon of Netatalk\n\n", VERSION ); puts( "This program is free software; you can redistribute it and/or modify it under" ); @@ -498,22 +527,12 @@ static void show_version( void ) puts( "afpd has been compiled with support for these features:\n" ); - printf( " AFP3.x support:\t" ); -#ifdef AFP3x - puts( "Yes" ); -#else - puts( "No" ); -#endif - - printf( " TCP/IP Support:\t" ); - puts( "Yes" ); - - printf( "DDP(AppleTalk) Support:\t" ); -#ifdef NO_DDP - puts( "No" ); -#else - puts( "Yes" ); -#endif + num = sizeof( afp_versions ) / sizeof( afp_versions[ 0 ] ); + printf( " AFP versions:\t" ); + for ( i = 0; i < num; i++ ) { + printf( "%d.%d ", afp_versions[ i ].av_number/10, afp_versions[ i ].av_number%10); + } + puts( "" ); printf( " CNID backends:\t" ); #ifdef CNID_BACKEND_CDB @@ -601,15 +620,18 @@ static void show_version_extended(void ) puts( "No" ); #endif - printf( " Dropbox kludge:\t" ); -#ifdef DROPKLUDGE + printf( " ACL support:\t" ); +#ifdef HAVE_ACLS puts( "Yes" ); #else puts( "No" ); #endif - printf( " Force volume uid/gid:\t" ); -#ifdef FORCE_UIDGID + printf( " EA support:\t" ); + puts( EA_MODULES ); + + printf( " LDAP support:\t" ); +#ifdef HAVE_LDAP puts( "Yes" ); #else puts( "No" ); @@ -622,11 +644,18 @@ static void show_version_extended(void ) static void show_paths( void ) { printf( " afpd.conf:\t%s\n", _PATH_AFPDCONF ); - printf( " afp_signature.conf:\t%s\n", _PATH_AFPDSIGCONF ); printf( " AppleVolumes.system:\t%s\n", _PATH_AFPDSYSVOL ); printf( " AppleVolumes.default:\t%s\n", _PATH_AFPDDEFVOL ); + printf( " afp_signature.conf:\t%s\n", _PATH_AFPDSIGCONF ); + printf( " afp_voluuid.conf:\t%s\n", _PATH_AFPDUUIDCONF ); +#ifdef HAVE_LDAP + printf( " afp_ldap.conf:\t%s\n", _PATH_ACL_LDAPCONF ); +#else + printf( " afp_ldap.conf:\tnot supported\n"); +#endif printf( " UAM search path:\t%s\n", _PATH_AFPDUAMPATH ); - printf( " Server messages path:\t%s\n", SERVERTEXT); + printf( " Server messages path:\t%s\n", SERVERTEXT); + printf( " lockfile:\t%s\n", _PATH_AFPDLOCK); } /* @@ -657,11 +686,14 @@ int afp_options_parse(int ac, char **av, struct afp_options *options) *p = '\0'; } +#ifdef ultrix if (NULL == ( p = strrchr( av[ 0 ], '/' )) ) { p = av[ 0 ]; } else { p++; } + openlog( p, LOG_PID ); /* ultrix only */ +#endif /* ultrix */ while (EOF != ( c = getopt( ac, av, OPTIONS )) ) { switch ( c ) { @@ -753,11 +785,5 @@ int afp_options_parse(int ac, char **av, struct afp_options *options) exit( 2 ); } -#ifdef ultrix - openlog( p, LOG_PID ); /* ultrix only */ -#else - set_processname(p); -#endif /* ultrix */ - return 1; }