Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/rpcbind/rpcbind.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
#include <pwd.h> | #include <pwd.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include "rpcbind.h" | #include "rpcbind.h" | ||||
/* Global variables */ | /* Global variables */ | ||||
int debugging = 0; /* Tell me what's going on */ | int debugging = 0; /* Tell me what's going on */ | ||||
int doabort = 0; /* When debugging, do an abort on errors */ | int doabort = 0; /* When debugging, do an abort on errors */ | ||||
volatile sig_atomic_t doterminate = 0; /* Terminal signal received */ | |||||
rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */ | rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */ | ||||
int rpcbindlockfd; | |||||
/* who to suid to if -s is given */ | /* who to suid to if -s is given */ | ||||
#define RUN_AS "daemon" | #define RUN_AS "daemon" | ||||
#define RPCBINDDLOCK "/var/run/rpcbind.lock" | #define RPCBINDDLOCK "/var/run/rpcbind.lock" | ||||
static int runasdaemon = 0; | static int runasdaemon = 0; | ||||
int insecure = 0; | int insecure = 0; | ||||
int oldstyle_local = 0; | int oldstyle_local = 0; | ||||
#ifdef LIBWRAP | #ifdef LIBWRAP | ||||
int libwrap = 0; | int libwrap = 0; | ||||
#endif | #endif | ||||
int verboselog = 0; | int verboselog = 0; | ||||
static char **hosts = NULL; | static char **hosts = NULL; | ||||
static struct sockaddr **bound_sa; | static struct sockaddr **bound_sa; | ||||
static int ipv6_only = 0; | static int ipv6_only = 0; | ||||
static int nhosts = 0; | static int nhosts = 0; | ||||
static int on = 1; | static int on = 1; | ||||
static int rpcbindlockfd; | |||||
#ifdef WARMSTART | #ifdef WARMSTART | ||||
/* Local Variable */ | /* Local Variable */ | ||||
static int warmstart = 0; /* Grab an old copy of registrations. */ | static int warmstart = 0; /* Grab an old copy of registrations. */ | ||||
#endif | #endif | ||||
#ifdef PORTMAP | #ifdef PORTMAP | ||||
struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ | struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ | ||||
▲ Show 20 Lines • Show All 642 Lines • ▼ Show 20 Lines | rbllist_add(rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf, | ||||
rbl->rpcb_next = list_rbl; /* Attach to global list */ | rbl->rpcb_next = list_rbl; /* Attach to global list */ | ||||
list_rbl = rbl; | list_rbl = rbl; | ||||
} | } | ||||
/* | /* | ||||
* Catch the signal and die | * Catch the signal and die | ||||
*/ | */ | ||||
static void | static void | ||||
terminate(int signum __unused) | terminate(int signum) | ||||
{ | { | ||||
close(rpcbindlockfd); | |||||
#ifdef WARMSTART | doterminate = signum; | ||||
syslog(LOG_ERR, | |||||
"rpcbind terminating on signal %d. Restart with \"rpcbind -w\"", | |||||
signum); | |||||
write_warmstart(); /* Dump yourself */ | |||||
#endif | |||||
exit(2); | |||||
} | } | ||||
void | void | ||||
rpcbind_abort(void) | rpcbind_abort(void) | ||||
{ | { | ||||
#ifdef WARMSTART | #ifdef WARMSTART | ||||
write_warmstart(); /* Dump yourself */ | write_warmstart(); /* Dump yourself */ | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |