#include <afs/dir.h>
#ifndef AFS_NT40_ENV
# include <afs/netutils.h>
+# include <afs/softsig.h>
#endif
#include "viced_prototypes.h"
#include "viced.h"
#include "host.h"
-#include <afs/softsig.h>
#if defined(AFS_SGI_ENV)
# include "sys/schedctl.h"
# include "sys/lock.h"
return afsconf_SuperUser(confDir, call, NULL);
}
+/**
+ * Return true if this name is a member of the local realm.
+ */
+int
+fs_IsLocalRealmMatch(void *rock, char *name, char *inst, char *cell)
+{
+ struct afsconf_dir *dir = (struct afsconf_dir *)rock;
+ afs_int32 islocal = 0; /* default to no */
+ int code;
+
+ code = afsconf_IsLocalRealmMatch(dir, &islocal, name, inst, cell);
+ if (code) {
+ ViceLog(0,
+ ("Failed local realm check; code=%d, name=%s, inst=%s, cell=%s\n",
+ code, name, inst, cell));
+ }
+ return islocal;
+}
+
static void
ResetCheckSignal(void)
{
{
int code;
int optval;
- char *optstring;
+ char *optstring = NULL;
struct cmd_item *optlist;
struct cmd_syndesc *opts;
/* rxkad options */
cmd_OptionAsFlag(opts, OPT_dotted, &rxkadDisableDotCheck);
if (cmd_OptionAsList(opts, OPT_realm, &optlist) == 0) {
- extern char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
- extern int num_lrealms;
for (; optlist != NULL; optlist=optlist->next) {
if (strlen(optlist->data) >= AFS_REALM_SZ) {
"characters.\n", AFS_REALM_SZ);
return -1;
}
-
- if (num_lrealms == -1)
- num_lrealms = 0;
- if (num_lrealms >= AFS_NUM_LREALMS) {
- printf("a maximum of %d -realm arguments can be "
- "specified.\n", AFS_NUM_LREALMS);
- return -1;
- }
-
- strncpy(local_realms[num_lrealms++], optlist->data, AFS_REALM_SZ);
- optlist = optlist->next;
+ afsconf_SetLocalRealm(optlist->data); /* overrides krb.conf file, if one */
}
}
}
} /*InitPR */
-struct rx_connection *serverconns[MAXSERVERS];
-struct ubik_client *cstruct;
+static struct ubik_client *cstruct;
-afs_int32
-vl_Initialize(const char *confDir)
+static afs_int32
+vl_Initialize(struct afsconf_dir *dir)
{
afs_int32 code, i;
afs_int32 scIndex = RX_SECIDX_NULL;
- struct afsconf_dir *tdir;
- struct rx_securityClass *sc;
struct afsconf_cell info;
+ struct rx_securityClass *sc;
+ struct rx_connection *serverconns[MAXSERVERS];
- tdir = afsconf_Open(confDir);
- if (!tdir) {
- ViceLog(0,
- ("Could not open configuration directory (%s).\n", confDir));
- exit(1);
- }
- code = afsconf_ClientAuth(tdir, &sc, &scIndex);
+ code = afsconf_ClientAuth(dir, &sc, &scIndex);
if (code) {
ViceLog(0, ("Could not get security object for localAuth\n"));
exit(1);
}
- code = afsconf_GetCellInfo(tdir, NULL, AFSCONF_VLDBSERVICE, &info);
+ code = afsconf_GetCellInfo(dir, NULL, AFSCONF_VLDBSERVICE, &info);
if (info.numServers > MAXSERVERS) {
ViceLog(0,
("vl_Initialize: info.numServers=%d (> MAXSERVERS=%d)\n",
info.hostAddr[i].sin_port, USER_SERVICE_ID, sc,
scIndex);
code = ubik_ClientInit(serverconns, &cstruct);
- afsconf_Close(tdir);
if (code) {
ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
return code;
}
afs_int32
-InitVL(void)
+InitVL(struct afsconf_dir *dir)
{
afs_int32 code;
* If this fails, it's because something major is wrong, and is not
* likely to be time dependent.
*/
- code = vl_Initialize(AFSDIR_SERVER_ETC_DIRPATH);
+ code = vl_Initialize(dir);
if (code != 0) {
ViceLog(0,
("Couldn't initialize volume location library; code=%d.\n", code));
exit(-1);
}
+ /* initialize audit user check */
+ osi_audit_set_user_check(confDir, fs_IsLocalRealmMatch);
+
/* Open FileLog on stdout, stderr, fd 1 and fd2 (for perror), sigh. */
#ifndef AFS_NT40_ENV
serverLogSyslogTag = "fileserver";
InitCallBack(numberofcbs);
ClearXStatValues();
- code = InitVL();
+ code = InitVL(confDir);
if (code && code != VL_MULTIPADDR) {
ViceLog(0, ("Fatal error in library initialization, exiting!!\n"));
exit(1);