]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/afp_options.c
New MySQL CNID backend
[netatalk.git] / etc / afpd / afp_options.c
1 /*
2  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3  * Copyright (c) 1990,1993 Regents of The University of Michigan.
4  * All Rights Reserved.  See COPYRIGHT.
5  *
6  * modified from main.c. this handles afp options.
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include "config.h"
11 #endif /* HAVE_CONFIG_H */
12
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <ctype.h>
17 #include <unistd.h>
18 #include <sys/param.h>
19 #include <sys/socket.h>
20 #include <atalk/logger.h>
21
22 #include <netinet/in.h>
23 #include <arpa/inet.h>
24
25 #ifdef HAVE_NETDB_H
26 #include <netdb.h>
27 #endif /* HAVE_NETDB_H */
28
29 #ifdef ADMIN_GRP
30 #include <grp.h>
31 #include <sys/types.h>
32 #endif /* ADMIN_GRP */
33
34 #include <atalk/paths.h>
35 #include <atalk/util.h>
36 #include <atalk/compat.h>
37 #include <atalk/globals.h>
38 #include <atalk/fce_api.h>
39 #include <atalk/errchk.h>
40
41 #include "status.h"
42 #include "auth.h"
43 #include "dircache.h"
44
45 #define LENGTH 512
46
47 /*
48  * Show version information about afpd.
49  * Used by "afp -v".
50  */
51 static void show_version( void )
52 {
53         int num, i;
54
55         printf( "afpd %s - Apple Filing Protocol (AFP) daemon of Netatalk\n\n", VERSION );
56
57         puts( "This program is free software; you can redistribute it and/or modify it under" );
58         puts( "the terms of the GNU General Public License as published by the Free Software" );
59         puts( "Foundation; either version 2 of the License, or (at your option) any later" );
60         puts( "version. Please see the file COPYING for further information and details.\n" );
61
62         puts( "afpd has been compiled with support for these features:\n" );
63
64         num = sizeof( afp_versions ) / sizeof( afp_versions[ 0 ] );
65         printf( "          AFP versions:\t" );
66         for ( i = 0; i < num; i++ ) {
67                 printf( "%d.%d ", afp_versions[ i ].av_number/10, afp_versions[ i ].av_number%10);
68         }
69         puts( "" );
70
71         printf( "         CNID backends:\t" );
72 #ifdef CNID_BACKEND_CDB
73         printf( "cdb ");
74 #endif
75 #ifdef CNID_BACKEND_DB3
76         printf( "db3 " );
77 #endif
78 #ifdef CNID_BACKEND_DBD
79 #ifdef CNID_BACKEND_DBD_TXN
80         printf( "dbd-txn " );
81 #else
82         printf( "dbd " );
83 #endif
84 #endif
85 #ifdef CNID_BACKEND_HASH
86         printf( "hash " );
87 #endif
88 #ifdef CNID_BACKEND_LAST
89         printf( "last " );
90 #endif
91 #ifdef CNID_BACKEND_MTAB
92         printf( "mtab " );
93 #endif
94 #ifdef CNID_BACKEND_TDB
95         printf( "tdb " );
96 #endif
97 #ifdef CNID_BACKEND_MYSQL
98         printf( "mysql " );
99 #endif
100         puts( "" );
101 }
102
103 /*
104  * Show extended version information about afpd and Netatalk.
105  * Used by "afp -V".
106  */
107 static void show_version_extended(void )
108 {
109         show_version( );
110
111         printf( "      Zeroconf support:\t" );
112 #if defined (HAVE_MDNS)
113         puts( "mDNSResponder" );
114 #elif defined (HAVE_AVAHI)
115         puts( "Avahi" );
116 #else
117         puts( "No" );
118 #endif
119
120         printf( "  TCP wrappers support:\t" );
121 #ifdef TCPWRAP
122         puts( "Yes" );
123 #else
124         puts( "No" );
125 #endif
126
127         printf( "         Quota support:\t" );
128 #ifndef NO_QUOTA_SUPPORT
129         puts( "Yes" );
130 #else
131         puts( "No" );
132 #endif
133
134         printf( "   Admin group support:\t" );
135 #ifdef ADMIN_GRP
136         puts( "Yes" );
137 #else
138         puts( "No" );
139 #endif
140
141         printf( "    Valid shell checks:\t" );
142 #ifndef DISABLE_SHELLCHECK
143         puts( "Yes" );
144 #else
145         puts( "No" );
146 #endif
147
148         printf( "      cracklib support:\t" );
149 #ifdef USE_CRACKLIB
150         puts( "Yes" );
151 #else
152         puts( "No" );
153 #endif
154
155         printf( "            EA support:\t" );
156         puts( EA_MODULES );
157
158         printf( "           ACL support:\t" );
159 #ifdef HAVE_ACLS
160         puts( "Yes" );
161 #else
162         puts( "No" );
163 #endif
164
165         printf( "          LDAP support:\t" );
166 #ifdef HAVE_LDAP
167         puts( "Yes" );
168 #else
169         puts( "No" );
170 #endif
171
172         printf( "         D-Bus support:\t" );
173 #ifdef HAVE_DBUS_GLIB
174         puts( "Yes" );
175 #else
176         puts( "No" );
177 #endif
178
179         printf( "         DTrace probes:\t" );
180 #ifdef WITH_DTRACE
181         puts( "Yes" );
182 #else
183         puts( "No" );
184 #endif
185 }
186
187 /*
188  * Display compiled-in default paths
189  */
190 static void show_paths( void )
191 {
192         printf( "              afp.conf:\t%s\n", _PATH_CONFDIR "afp.conf");
193         printf( "           extmap.conf:\t%s\n", _PATH_CONFDIR "extmap.conf");
194         printf( "       state directory:\t%s\n", _PATH_STATEDIR);
195         printf( "    afp_signature.conf:\t%s\n", _PATH_STATEDIR "afp_signature.conf");
196         printf( "      afp_voluuid.conf:\t%s\n", _PATH_STATEDIR "afp_voluuid.conf");
197         printf( "       UAM search path:\t%s\n", _PATH_AFPDUAMPATH );
198         printf( "  Server messages path:\t%s\n", SERVERTEXT);
199 }
200
201 /*
202  * Display usage information about afpd.
203  */
204 static void show_usage(void)
205 {
206         fprintf( stderr, "Usage:\tafpd [-d] [-F configfile]\n");
207         fprintf( stderr, "\tafpd -h|-v|-V\n");
208 }
209
210 void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av)
211 {
212     int c, err = 0;
213
214     while (EOF != ( c = getopt( ac, av, "dF:vVh" )) ) {
215         switch ( c ) {
216         case 'd':
217             obj->cmdlineflags |= OPTION_DEBUG;
218             break;
219         case 'F':
220             obj->cmdlineconfigfile = strdup(optarg);
221             break;
222         case 'v':       /* version */
223             show_version( ); puts( "" );
224             show_paths( ); puts( "" );
225             exit( 0 );
226             break;
227         case 'V':       /* extended version */
228             show_version_extended( ); puts( "" );
229             show_paths( ); puts( "" );
230             exit( 0 );
231             break;
232         case 'h':       /* usage */
233             show_usage();
234             exit( 0 );
235             break;
236         default :
237             err++;
238         }
239     }
240     if ( err || optind != ac ) {
241         show_usage();
242         exit( 2 );
243     }
244
245     return;
246 }