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