~ubuntu-branches/ubuntu/oneiric/openafs/oneiric-201305130334

« back to all changes in this revision

Viewing changes to src/ptserver/ptserver.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2006-10-21 20:57:09 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20061021205709-y5keam1v20qxjwwo
Tags: 1.4.2-2
Upstream fix to prevent butc segfaulting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
1
2
/*
2
3
 * Copyright 2000, International Business Machines Corporation and others.
3
4
 * All Rights Reserved.
112
113
#include <afs/param.h>
113
114
 
114
115
RCSID
115
 
    ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21.2.4 2006/02/22 04:09:30 jaltman Exp $");
 
116
    ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21.2.7 2006/06/20 20:35:01 jaltman Exp $");
116
117
 
117
118
#include <afs/stds.h>
118
119
#ifdef  AFS_AIX32_ENV
167
168
 
168
169
int restricted = 0;
169
170
int rxMaxMTU = -1;
 
171
int rxBind = 0;
 
172
 
 
173
#define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */
 
174
afs_uint32 SHostAddrs[ADDRSPERSITE];
170
175
 
171
176
static struct afsconf_cell info;
172
177
 
222
227
    int kerberosKeys;           /* set if found some keys */
223
228
    int lwps = 3;
224
229
    char clones[MAXHOSTSPERCELL];
 
230
    afs_uint32 host = htonl(INADDR_ANY);
225
231
 
226
232
    const char *pr_dbaseName;
227
233
    char *whoami = "ptserver";
305
311
        else if (strncmp(arg, "-restricted", alen) == 0) {
306
312
            restricted = 1;
307
313
        }
 
314
        else if (strncmp(arg, "-rxbind", alen) == 0) {
 
315
            rxBind = 1;
 
316
        }
308
317
        else if (strncmp(arg, "-enable_peer_stats", alen) == 0) {
309
318
            rx_enablePeerRPCStats();
310
319
        } else if (strncmp(arg, "-enable_process_stats", alen) == 0) {
374
383
                   "[-syslog[=FACILITY]] "
375
384
                   "[-p <number of processes>] [-rebuild] "
376
385
                   "[-groupdepth <depth>] "
377
 
                   "[-restricted] [-rxmaxmtu <bytes>]"
 
386
                   "[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
378
387
                   "[-enable_peer_stats] [-enable_process_stats] "
379
388
                   "[-default_access default_user_access default_group_access] "
380
389
                   "[-help]\n");
381
390
#else /* AFS_NT40_ENV */
382
391
            printf("Usage: ptserver [-database <db path>] "
383
392
                   "[-auditlog <log path>] "
384
 
                   "[-p <number of processes>] [-rebuild] "
 
393
                   "[-p <number of processes>] [-rebuild] [-rxbind] "
385
394
                   "[-default_access default_user_access default_group_access] "
386
 
                   "[-restricted] [-rxmaxmtu <bytes>]"
 
395
                   "[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
387
396
                   "[-groupdepth <depth>] " "[-help]\n");
388
397
#endif
389
398
#else
394
403
                   "[-p <number of processes>] [-rebuild] "
395
404
                   "[-enable_peer_stats] [-enable_process_stats] "
396
405
                   "[-default_access default_user_access default_group_access] "
397
 
                   "[-restricted] [-rxmaxmtu <bytes>]"
 
406
                   "[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
398
407
                   "[-help]\n");
399
408
#else /* AFS_NT40_ENV */
400
409
            printf("Usage: ptserver [-database <db path>] "
401
410
                   "[-auditlog <log path>] "
402
411
                   "[-default_access default_user_access default_group_access] "
403
 
                   "[-restricted] [-rxmaxmtu <bytes>]"
 
412
                   "[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
404
413
                   "[-p <number of processes>] [-rebuild] " "[-help]\n");
405
414
#endif
406
415
#endif
493
502
     * and the header are in separate Ubik buffers then 120 buffers may be
494
503
     * required. */
495
504
    ubik_nBuffers = 120 + /*fudge */ 40;
 
505
 
 
506
    if (rxBind) {
 
507
        afs_int32 ccode;
 
508
#ifndef AFS_NT40_ENV
 
509
        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
 
510
            AFSDIR_SERVER_NETINFO_FILEPATH) {
 
511
            char reason[1024];
 
512
            ccode = parseNetFiles(SHostAddrs, NULL, NULL,
 
513
                                           ADDRSPERSITE, reason,
 
514
                                           AFSDIR_SERVER_NETINFO_FILEPATH,
 
515
                                           AFSDIR_SERVER_NETRESTRICT_FILEPATH);
 
516
        } else 
 
517
#endif
 
518
        {
 
519
            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
 
520
        }
 
521
        if (ccode == 1) {
 
522
            host = SHostAddrs[0];
 
523
            rx_InitHost(host, htons(AFSCONF_PROTPORT));
 
524
        }
 
525
    }
 
526
 
496
527
    code =
497
528
        ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, &clones,
498
529
                              pr_dbaseName, &dbase);
519
550
    }
520
551
 
521
552
    tservice =
522
 
        rx_NewService(0, PRSRV, "Protection Server", sc, 3,
 
553
        rx_NewServiceHost(host, 0, PRSRV, "Protection Server", sc, 3,
523
554
                      PR_ExecuteRequest);
524
555
    if (tservice == (struct rx_service *)0) {
525
556
        fprintf(stderr, "ptserver: Could not create new rx service.\n");
529
560
    rx_SetMaxProcs(tservice, lwps);
530
561
 
531
562
    tservice =
532
 
        rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
 
563
        rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
533
564
                      RXSTATS_ExecuteRequest);
534
565
    if (tservice == (struct rx_service *)0) {
535
566
        fprintf(stderr, "ptserver: Could not create new rx service.\n");