]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/afp_options.c
dircache: support locking of dirs which prevent cache removal.
[netatalk.git] / etc / afpd / afp_options.c
1 /*
2  * $Id: afp_options.c,v 1.51.4.2 2010-02-05 10:27:58 franklahm Exp $
3  *
4  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
5  * Copyright (c) 1990,1993 Regents of The University of Michigan.
6  * All Rights Reserved.  See COPYRIGHT.
7  *
8  * modified from main.c. this handles afp options.
9  */
10
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif /* HAVE_CONFIG_H */
14
15 #include <stdio.h>
16 #include <stdlib.h>
17
18 /* STDC check */
19 #if STDC_HEADERS
20 #include <string.h>
21 #else /* STDC_HEADERS */
22 #ifndef HAVE_STRCHR
23 #define strchr index
24 #define strrchr index
25 #endif /* HAVE_STRCHR */
26 char *strchr (), *strrchr ();
27 #ifndef HAVE_MEMCPY
28 #define memcpy(d,s,n) bcopy ((s), (d), (n))
29 #define memmove(d,s,n) bcopy ((s), (d), (n))
30 #endif /* ! HAVE_MEMCPY */
31 #endif /* STDC_HEADERS */
32
33 #include <ctype.h>
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif /* HAVE_UNISTD_H */
37 #include <sys/param.h>
38 #include <sys/socket.h>
39 #include <atalk/logger.h>
40
41 #include <netinet/in.h>
42 #include <arpa/inet.h>
43 #ifdef HAVE_NETDB_H
44 #include <netdb.h>
45 #endif /* HAVE_NETDB_H */
46
47 #include <atalk/paths.h>
48 #include <atalk/util.h>
49 #include "globals.h"
50 #include "status.h"
51 #include "auth.h"
52 #include "dircache.h"
53
54 #include <atalk/compat.h>
55
56 #ifdef ADMIN_GRP
57 #include <grp.h>
58 #include <sys/types.h>
59 #endif /* ADMIN_GRP */
60
61 #ifndef MIN
62 #define MIN(a, b)  ((a) < (b) ? (a) : (b))
63 #endif /* MIN */
64
65 /* FIXME CNID */
66 const char *Cnid_srv = "localhost";
67 const char *Cnid_port = "4700";
68
69 #define OPTIONS "dn:f:s:uc:g:P:ptDS:TL:F:U:hIvVm:"
70 #define LENGTH 512
71
72 /* return an option. this uses an internal array, so it's necessary
73  * to duplicate it if you want to hold it for long. this is probably
74  * non-optimal. */
75 static char *getoption(char *buf, const char *option)
76 {
77     static char string[LENGTH + 1];
78     char *end;
79     int len;
80
81     if (option && (buf = strstr(buf, option)))
82         buf = strpbrk(buf, " \t");
83
84     while (buf && isspace(*buf))
85         buf++;
86
87     if (!buf)
88         return NULL;
89
90     /* search for any quoted stuff */
91     if (*buf == '"' && (end = strchr(buf + 1, '"'))) {
92         buf++;
93         len = MIN(end - buf, LENGTH);
94     } else if ((end = strpbrk(buf, " \t\n"))) /* option or eoln */
95         len = MIN(end - buf, LENGTH);
96     else
97         len = MIN(strlen(buf), LENGTH);
98
99     strncpy(string, buf, len);
100     string[len] = '\0';
101     return string;
102 }
103
104 /* get rid of any allocated afp_option buffers. */
105 void afp_options_free(struct afp_options *opt,
106                       const struct afp_options *save)
107 {
108     if (opt->defaultvol.name && (opt->defaultvol.name != save->defaultvol.name))
109         free(opt->defaultvol.name);
110     if (opt->defaultvol.full_name && (opt->defaultvol.full_name != save->defaultvol.full_name))
111         free(opt->defaultvol.full_name);
112
113     if (opt->systemvol.name && (opt->systemvol.name != save->systemvol.name))
114         free(opt->systemvol.name);
115     if (opt->systemvol.full_name && (opt->systemvol.full_name != save->systemvol.full_name))
116         free(opt->systemvol.full_name);
117
118     if (opt->uservol.name && (opt->uservol.name != save->uservol.name))
119         free(opt->uservol.name);
120     if (opt->uservol.full_name && (opt->uservol.full_name != save->uservol.full_name))
121         free(opt->uservol.full_name);
122
123     if (opt->loginmesg && (opt->loginmesg != save->loginmesg))
124         free(opt->loginmesg);
125     if (opt->guest && (opt->guest != save->guest))
126         free(opt->guest);
127     if (opt->server && (opt->server != save->server))
128         free(opt->server);
129     if (opt->ipaddr && (opt->ipaddr != save->ipaddr))
130         free(opt->ipaddr);
131     if (opt->port && (opt->port != save->port))
132         free(opt->port);
133     if (opt->fqdn && (opt->fqdn != save->fqdn))
134         free(opt->fqdn);
135     if (opt->uampath && (opt->uampath != save->uampath))
136         free(opt->uampath);
137     if (opt->uamlist && (opt->uamlist != save->uamlist))
138         free(opt->uamlist);
139     if (opt->passwdfile && (opt->passwdfile != save->passwdfile))
140         free(opt->passwdfile);
141     if (opt->signature && (opt->signature != save->signature))
142         free(opt->signature);
143     if (opt->k5service && (opt->k5service != save->k5service))
144         free(opt->k5service);
145     if (opt->k5realm && (opt->k5realm != save->k5realm))
146         free(opt->k5realm);
147     if (opt->k5keytab && (opt->k5keytab != save->k5keytab))
148         free(opt->k5keytab);
149     if (opt->unixcodepage && (opt->unixcodepage != save->unixcodepage))
150         free(opt->unixcodepage);
151     if (opt->maccodepage && (opt->maccodepage != save->maccodepage))
152         free(opt->maccodepage);
153
154     if (opt->ntdomain && (opt->ntdomain != save->ntdomain))
155         free(opt->ntdomain);
156     if (opt->ntseparator && (opt->ntseparator != save->ntseparator))
157         free(opt->ntseparator);
158 }
159
160 /* initialize options */
161 void afp_options_init(struct afp_options *options)
162 {
163     memset(options, 0, sizeof(struct afp_options));
164     options->connections = 20;
165     options->pidfile = _PATH_AFPDLOCK;
166     options->defaultvol.name = _PATH_AFPDDEFVOL;
167     options->systemvol.name = _PATH_AFPDSYSVOL;
168     options->configfile = _PATH_AFPDCONF;
169     options->uampath = _PATH_AFPDUAMPATH;
170     options->uamlist = "uams_dhx.so,uams_dhx2.so";
171     options->guest = "nobody";
172     options->loginmesg = "";
173     options->transports = AFPTRANS_TCP; /*  TCP only */
174     options->passwdfile = _PATH_AFPDPWFILE;
175     options->tickleval = 30;
176     options->timeout = 4;
177     options->sleep = 10* 120; /* 10 h in 30 seconds tick */
178     options->server_notif = 1;
179     options->authprintdir = NULL;
180     options->signature = "host";
181     options->umask = 0;
182 #ifdef ADMIN_GRP
183     options->admingid = 0;
184 #endif /* ADMIN_GRP */
185     options->k5service = NULL;
186     options->k5realm = NULL;
187     options->k5keytab = NULL;
188     options->unixcharset = CH_UNIX;
189     options->unixcodepage = "LOCALE";
190     options->maccharset = CH_MAC;
191     options->maccodepage = "MAC_ROMAN";
192     options->volnamelen = 80; /* spec: 255, 10.1: 73, 10.4/10.5: 80 */
193     options->ntdomain = NULL;
194     options->ntseparator = NULL;
195 #ifdef USE_SRVLOC
196     /* don't advertize slp by default */
197     options->flags |= OPTION_NOSLP;
198 #endif
199     options->dircachesize = DEFAULT_MAX_DIRCACHE_SIZE;
200 }
201
202 /* parse an afpd.conf line. i'm doing it this way because it's
203  * easy. it is, however, massively hokey. sample afpd.conf:
204  * server:AFPServer@zone -loginmesg "blah blah blah" -nodsi 
205  * "private machine"@zone2 -noguest -port 11012
206  * server2 -nocleartxt -nodsi
207  *
208  * NOTE: this ignores unknown options 
209  */
210 int afp_options_parseline(char *buf, struct afp_options *options)
211 {
212     char *c, *opt;
213
214     /* handle server */
215     if (*buf != '-' && (c = getoption(buf, NULL)) && (opt = strdup(c)))
216         options->server = opt;
217
218     /* parse toggles */
219     if (strstr(buf, " -nodebug"))
220         options->flags &= ~OPTION_DEBUG;
221 #ifdef USE_SRVLOC
222     if (strstr(buf, " -slp"))
223         options->flags &= ~OPTION_NOSLP;
224 #endif
225
226     if (strstr(buf, " -nouservolfirst"))
227         options->flags &= ~OPTION_USERVOLFIRST;
228     if (strstr(buf, " -uservolfirst"))
229         options->flags |= OPTION_USERVOLFIRST;
230     if (strstr(buf, " -nouservol"))
231         options->flags |= OPTION_NOUSERVOL;
232     if (strstr(buf, " -uservol"))
233         options->flags &= ~OPTION_NOUSERVOL;
234     if (strstr(buf, " -proxy"))
235         options->flags |= OPTION_PROXY;
236     if (strstr(buf, " -noicon"))
237         options->flags &= ~OPTION_CUSTOMICON;
238     if (strstr(buf, " -icon"))
239         options->flags |= OPTION_CUSTOMICON;
240     if (strstr(buf, " -advertise_ssh"))
241         options->flags |= OPTION_ANNOUNCESSH;
242
243     /* passwd bits */
244     if (strstr(buf, " -nosavepassword"))
245         options->passwdbits |= PASSWD_NOSAVE;
246     if (strstr(buf, " -savepassword"))
247         options->passwdbits &= ~PASSWD_NOSAVE;
248     if (strstr(buf, " -nosetpassword"))
249         options->passwdbits &= ~PASSWD_SET;
250     if (strstr(buf, " -setpassword"))
251         options->passwdbits |= PASSWD_SET;
252
253     /* transports */
254     if (strstr(buf, " -transall"))
255         options->transports = AFPTRANS_ALL;
256     if (strstr(buf, " -notransall"))
257         options->transports = AFPTRANS_NONE;
258     if (strstr(buf, " -tcp"))
259         options->transports |= AFPTRANS_TCP;
260     if (strstr(buf, " -notcp"))
261         options->transports &= ~AFPTRANS_TCP;
262     if (strstr(buf, " -ddp"))
263         options->transports |= AFPTRANS_DDP;
264     if (strstr(buf, " -noddp"))
265         options->transports &= ~AFPTRANS_DDP;
266     if (strstr(buf, "-client_polling"))
267         options->server_notif = 0;
268
269     /* figure out options w/ values. currently, this will ignore the setting
270      * if memory is lacking. */
271
272     if ((c = getoption(buf, "-hostname"))) {
273         int len = strlen (c);
274         if (len <= MAXHOSTNAMELEN) {
275             memcpy(options->hostname, c, len);
276             options->hostname[len] = 0;
277         }
278         else
279             LOG(log_info, logtype_afpd, "WARNING: hostname %s is too long (%d)",c,len);
280     }
281
282     if ((c = getoption(buf, "-defaultvol")) && (opt = strdup(c)))
283         options->defaultvol.name = opt;
284     if ((c = getoption(buf, "-systemvol")) && (opt = strdup(c)))
285         options->systemvol.name = opt;
286     if ((c = getoption(buf, "-loginmesg")) && (opt = strdup(c)))
287         options->loginmesg = opt;
288     if ((c = getoption(buf, "-guestname")) && (opt = strdup(c)))
289         options->guest = opt;
290     if ((c = getoption(buf, "-passwdfile")) && (opt = strdup(c)))
291         options->passwdfile = opt;
292     if ((c = getoption(buf, "-passwdminlen")))
293         options->passwdminlen = MIN(1, atoi(c));
294     if ((c = getoption(buf, "-loginmaxfail")))
295         options->loginmaxfail = atoi(c);
296     if ((c = getoption(buf, "-tickleval"))) {
297         options->tickleval = atoi(c);
298         if (options->tickleval <= 0) {
299             options->tickleval = 30;
300         }
301     }
302     if ((c = getoption(buf, "-timeout"))) {
303         options->timeout = atoi(c);
304         if (options->timeout <= 0) {
305             options->timeout = 4;
306         }
307     }
308
309     if ((c = getoption(buf, "-sleep"))) {
310         options->sleep = atoi(c) *120;
311         if (options->sleep <= 4) {
312             options->sleep = 4;
313         }
314     }
315
316     if ((c = getoption(buf, "-server_quantum")))
317         options->server_quantum = strtoul(c, NULL, 0);
318
319     if ((c = getoption(buf, "-volnamelen"))) {
320         options->volnamelen = atoi(c);
321         if (options->volnamelen < 8) {
322             options->volnamelen = 8; /* max mangled volname "???#FFFF" */
323         }
324         if (options->volnamelen > 255) {
325             options->volnamelen = 255; /* AFP3 spec */
326         }
327     }
328
329     /* -[no]setuplog <logtype> <loglevel> [<filename>]*/
330     c = buf;
331     /* Now THIS is hokey! Multiple occurrences are not supported by our current code, */
332     /* so I have to loop myself. */
333     while (NULL != (c = strstr(c, "-setuplog"))) {
334         char *optstr;
335         if ((optstr = getoption(c, "-setuplog"))) {
336             setuplog(optstr);
337             c += sizeof("-setuplog");
338         }
339     }
340
341     if ((c = getoption(buf, "-unsetuplog")))
342       unsetuplog(c);
343
344 #ifdef ADMIN_GRP
345     if ((c = getoption(buf, "-admingroup"))) {
346         struct group *gr = getgrnam(c);
347         if (gr != NULL) {
348             options->admingid = gr->gr_gid;
349         }
350     }
351 #endif /* ADMIN_GRP */
352
353     if ((c = getoption(buf, "-k5service")) && (opt = strdup(c)))
354         options->k5service = opt;
355     if ((c = getoption(buf, "-k5realm")) && (opt = strdup(c)))
356         options->k5realm = opt;
357     if ((c = getoption(buf, "-k5keytab"))) {
358         if ( NULL == (options->k5keytab = (char *) malloc(sizeof(char)*(strlen(c)+14)) )) {
359                 LOG(log_error, logtype_afpd, "malloc failed");
360                 exit(-1);
361         }
362         snprintf(options->k5keytab, strlen(c)+14, "KRB5_KTNAME=%s", c);
363         putenv(options->k5keytab);
364         /* setenv( "KRB5_KTNAME", c, 1 ); */
365     }
366     if ((c = getoption(buf, "-authprintdir")) && (opt = strdup(c)))
367         options->authprintdir = opt;
368     if ((c = getoption(buf, "-uampath")) && (opt = strdup(c)))
369         options->uampath = opt;
370     if ((c = getoption(buf, "-uamlist")) && (opt = strdup(c)))
371         options->uamlist = opt;
372
373     if ((c = getoption(buf, "-ipaddr"))) {
374 #if 0
375         struct in_addr inaddr;
376         if (inet_aton(c, &inaddr) && (opt = strdup(c))) {
377             if (!gethostbyaddr((const char *) &inaddr, sizeof(inaddr), AF_INET))
378                 LOG(log_info, logtype_afpd, "WARNING: can't find %s", opt);
379             options->ipaddr = opt;
380         }
381         else {
382             LOG(log_error, logtype_afpd, "Error parsing -ipaddr, is %s in numbers-and-dots notation?", c);
383         }
384 #endif
385         options->ipaddr = strdup(c);
386     }
387
388     /* FIXME CNID Cnid_srv is a server attribute */
389     if ((c = getoption(buf, "-cnidserver"))) {
390         char *p = strrchr(c, ':');
391         if (p)
392             *p = 0;
393         Cnid_srv = strdup(c);
394         if (p)
395             Cnid_port = strdup(p + 1);
396         LOG(log_debug, logtype_afpd, "CNID Server: %s:%s", Cnid_srv, Cnid_port);
397     }
398
399     if ((c = getoption(buf, "-port")))
400         options->port = strdup(c);
401     if ((c = getoption(buf, "-ddpaddr")))
402         atalk_aton(c, &options->ddpaddr);
403     if ((c = getoption(buf, "-signature")) && (opt = strdup(c)))
404         options->signature = opt;
405
406     /* do a little checking for the domain name. */
407     if ((c = getoption(buf, "-fqdn"))) {
408         char *p = strchr(c, ':');
409         if (p)
410             *p = '\0';
411         if (gethostbyname(c)) {
412             if (p)
413                 *p = ':';
414             if ((opt = strdup(c)))
415                 options->fqdn = opt;
416         }
417         else {
418             LOG(log_error, logtype_afpd, "error parsing -fqdn, gethostbyname failed for: %s", c);
419         }
420     }
421
422     if ((c = getoption(buf, "-unixcodepage"))) {
423         if ((charset_t)-1  == ( options->unixcharset = add_charset(c)) ) {
424             options->unixcharset = CH_UNIX;
425             LOG(log_warning, logtype_afpd, "setting Unix codepage to '%s' failed", c);
426         }
427         else {
428             if ((opt = strdup(c)))
429                 options->unixcodepage = opt;
430         }
431     }
432         
433     if ((c = getoption(buf, "-maccodepage"))) {
434         if ((charset_t)-1 == ( options->maccharset = add_charset(c)) ) {
435             options->maccharset = CH_MAC;
436             LOG(log_warning, logtype_afpd, "setting Mac codepage to '%s' failed", c);
437         }
438         else {
439             if ((opt = strdup(c)))
440                 options->maccodepage = opt;
441         }
442     }
443     
444     if ((c = strstr(buf, "-closevol"))) {
445         options->closevol= 1;
446     }
447
448     if ((c = getoption(buf, "-ntdomain")) && (opt = strdup(c)))
449        options->ntdomain = opt;
450
451     if ((c = getoption(buf, "-ntseparator")) && (opt = strdup(c)))
452        options->ntseparator = opt;
453
454     if ((c = getoption(buf, "-dircachesize")))
455         options->dircachesize = atoi(c);
456      
457     return 1;
458 }
459
460 /*
461  * Show version information about afpd.
462  * Used by "afp -v".
463  */
464 static void show_version( void )
465 {
466         printf( "afpd %s - Apple Filing Protocol (AFP) daemon of Netatalk\n\n", VERSION );
467
468         puts( "This program is free software; you can redistribute it and/or modify it under" );
469         puts( "the terms of the GNU General Public License as published by the Free Software" );
470         puts( "Foundation; either version 2 of the License, or (at your option) any later" );
471         puts( "version. Please see the file COPYING for further information and details.\n" );
472
473         puts( "afpd has been compiled with support for these features:\n" );
474
475         printf( "        AFP3.x support:\t" );
476 #ifdef AFP3x
477         puts( "Yes" );
478 #else
479         puts( "No" );
480 #endif
481
482         printf( "      Transport layers:\t" );
483 #ifdef NO_DDP
484         puts( "TCP/IP" );
485 #else
486         puts( "TCP/IP DDP" );
487 #endif
488
489         printf( "         CNID backends:\t" );
490 #ifdef CNID_BACKEND_CDB
491         printf( "cdb ");
492 #endif
493 #ifdef CNID_BACKEND_DB3
494         printf( "db3 " );
495 #endif
496 #ifdef CNID_BACKEND_DBD
497 #ifdef CNID_BACKEND_DBD_TXN
498         printf( "dbd-txn " );
499 #else
500         printf( "dbd " );
501 #endif
502 #endif
503 #ifdef CNID_BACKEND_HASH
504         printf( "hash " );
505 #endif
506 #ifdef CNID_BACKEND_LAST
507         printf( "last " );
508 #endif
509 #ifdef CNID_BACKEND_MTAB
510         printf( "mtab " );
511 #endif
512 #ifdef CNID_BACKEND_TDB
513         printf( "tdb " );
514 #endif
515         puts( "" );
516 }
517
518 /*
519  * Show extended version information about afpd and Netatalk.
520  * Used by "afp -V".
521  */
522 static void show_version_extended(void )
523 {
524         show_version( );
525
526         printf( "           SLP support:\t" );
527 #ifdef USE_SRVLOC
528         puts( "Yes" );
529 #else
530         puts( "No" );
531 #endif
532
533         printf( "  TCP wrappers support:\t" );
534 #ifdef TCPWRAP
535         puts( "Yes" );
536 #else
537         puts( "No" );
538 #endif
539
540         printf( "         Quota support:\t" );
541 #ifndef NO_QUOTA_SUPPORT
542         puts( "Yes" );
543 #else
544         puts( "No" );
545 #endif
546
547         printf( "   Admin group support:\t" );
548 #ifdef ADMIN_GRP
549         puts( "Yes" );
550 #else
551         puts( "No" );
552 #endif
553
554         printf( "    Valid shell checks:\t" );
555 #ifndef DISABLE_SHELLCHECK
556         puts( "Yes" );
557 #else
558         puts( "No" );
559 #endif
560
561         printf( "      cracklib support:\t" );
562 #ifdef USE_CRACKLIB
563         puts( "Yes" );
564 #else
565         puts( "No" );
566 #endif
567
568         printf( "        Dropbox kludge:\t" );
569 #ifdef DROPKLUDGE
570         puts( "Yes" );
571 #else
572         puts( "No" );
573 #endif
574
575         printf( "  Force volume uid/gid:\t" );
576 #ifdef FORCE_UIDGID
577         puts( "Yes" );
578 #else
579         puts( "No" );
580 #endif
581 }
582
583 /*
584  * Display compiled-in default paths
585  */
586 static void show_paths( void )
587 {
588         printf( "             afpd.conf:\t%s\n", _PATH_AFPDCONF );
589         printf( "   AppleVolumes.system:\t%s\n", _PATH_AFPDSYSVOL );
590         printf( "  AppleVolumes.default:\t%s\n", _PATH_AFPDDEFVOL );
591         printf( "       UAM search path:\t%s\n", _PATH_AFPDUAMPATH );
592 }
593
594 /*
595  * Display usage information about adpd.
596  */
597 static void show_usage( char *name )
598 {
599         fprintf( stderr, "Usage:\t%s [-dDIptTu] [-c maxconnections] [-f defaultvolumes] [-F config]\n", name );
600         fprintf( stderr, "\t     [-g guest] [-L message] [-m umask][-n nbpname] [-P pidfile]\n" );
601         fprintf( stderr, "\t     [-s systemvolumes] [-S port] [-U uams]\n" );
602         fprintf( stderr, "\t%s -h|-v|-V\n", name );
603 }
604
605 int afp_options_parse(int ac, char **av, struct afp_options *options)
606 {
607     extern char *optarg;
608     extern int optind;
609
610     char *p;
611     char *tmp;  /* Used for error checking the result of strtol */
612     int c, err = 0;
613
614     if (gethostname(options->hostname, sizeof(options->hostname )) < 0 ) {
615         perror( "gethostname" );
616         return 0;
617     }
618     if (NULL != ( p = strchr(options->hostname, '.' )) ) {
619         *p = '\0';
620     }
621
622     if (NULL == ( p = strrchr( av[ 0 ], '/' )) ) {
623         p = av[ 0 ];
624     } else {
625         p++;
626     }
627
628     while (EOF != ( c = getopt( ac, av, OPTIONS )) ) {
629         switch ( c ) {
630         case 'd' :
631             options->flags |= OPTION_DEBUG;
632             break;
633         case 'n' :
634             options->server = optarg;
635             break;
636         case 'f' :
637             options->defaultvol.name = optarg;
638             break;
639         case 's' :
640             options->systemvol.name = optarg;
641             break;
642         case 'u' :
643             options->flags |= OPTION_USERVOLFIRST;
644             break;
645         case 'c' :
646             options->connections = atoi( optarg );
647             break;
648         case 'g' :
649             options->guest = optarg;
650             break;
651
652         case 'P' :
653             options->pidfile = optarg;
654             break;
655
656         case 'p':
657             options->passwdbits |= PASSWD_NOSAVE;
658             break;
659         case 't':
660             options->passwdbits |= PASSWD_SET;
661             break;
662
663         case 'D':
664             options->transports &= ~AFPTRANS_DDP;
665             break;
666         case 'S':
667             options->port = optarg;
668             break;
669         case 'T':
670             options->transports &= ~AFPTRANS_TCP;
671             break;
672         case 'L':
673             options->loginmesg = optarg;
674             break;
675         case 'F':
676             options->configfile = optarg;
677             break;
678         case 'U':
679             options->uamlist = optarg;
680             break;
681         case 'v':       /* version */
682             show_version( ); puts( "" );
683             show_paths( ); puts( "" );
684             exit( 0 );
685             break;
686         case 'V':       /* extended version */
687             show_version_extended( ); puts( "" );
688             show_paths( ); puts( "" );
689             exit( 0 );
690             break;
691         case 'h':       /* usage */
692             show_usage( p );
693             exit( 0 );
694             break;
695         case 'I':
696             options->flags |= OPTION_CUSTOMICON;
697             break;
698         case 'm':
699             options->umask = strtoul(optarg, &tmp, 8);
700             if ((options->umask > 0777)) {
701                 fprintf(stderr, "%s: out of range umask setting provided\n", p);
702                 err++;
703             }
704             if (tmp[0] != '\0') {
705                 fprintf(stderr, "%s: invalid characters in umask setting provided\n", p);
706                 err++;
707             }
708             break;
709         default :
710             err++;
711         }
712     }
713     if ( err || optind != ac ) {
714         show_usage( p );
715         exit( 2 );
716     }
717
718 #ifdef ultrix
719     openlog( p, LOG_PID ); /* ultrix only */
720 #else
721     set_processname(p);
722 #endif /* ultrix */
723
724     return 1;
725 }