#include <roken.h>
-#include <sys/types.h>
-#include <string.h>
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
#ifdef AFS_NT40_ENV
-#include <time.h>
-#include <fcntl.h>
#include <windows.h>
#include <WINNT/afsevent.h>
-#else
-#include <sys/time.h>
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <unistd.h>
#endif
+
#include <rx/xdr.h>
#include <afs/afsint.h>
-#include <stdio.h>
-#include <signal.h>
-#include <afs/afs_assert.h>
#include <afs/prs_fs.h>
#include <afs/nfs.h>
#include <lwp.h>
#include <afs/keys.h>
#include <afs/dir.h>
#include <ubik.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <errno.h>
#include <afs/audit.h>
#include <afs/afsutil.h>
#include <lwp.h>
+
#include "volser.h"
#include "volint.h"
#include "volser_internal.h"
-/*@printflike@*/ extern void Log(const char *format, ...);
-/*@printflike@*/ extern void Abort(const char *format, ...);
-
#define VolserVersion "2.0"
#define N_SECURITY_OBJECTS 3
exit(code); \
}
-#if defined(AFS_PTHREAD_ENV)
-int
-threadNum(void)
-{
- return (intptr_t)pthread_getspecific(rx_thread_id_key);
-}
-#endif
-
static void
MyBeforeProc(struct rx_call *acall)
{
struct timeval tv;
int loop = 0;
+ afs_pthread_setname_self("vol bkg");
while (1) {
tv.tv_sec = GCWAKEUP;
tv.tv_usec = 0;
return afsconf_SuperUser(tdir, call, NULL);
}
+/**
+ * Return true if this name is a member of the local realm.
+ */
+static int
+vol_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;
+}
+
#include "AFS_component_version_number.c"
int
main(int argc, char **argv)
exit(1);
}
rxMaxMTU = atoi(argv[++code]);
- if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
- (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
- printf("rxMaxMTU %d invalid; must be between %d-%" AFS_SIZET_FMT "\n",
- rxMaxMTU, RX_MIN_PACKET_SIZE,
- RX_MAX_PACKET_DATA_SIZE);
- exit(1);
- }
} else if (strcmp(argv[code], "-sleep") == 0) {
sscanf(argv[++code], "%d/%d", &TTsleep, &TTrun);
if ((TTsleep < 0) || (TTrun <= 0)) {
InitErrTabs();
#ifdef AFS_PTHREAD_ENV
- SetLogThreadNumProgram( threadNum );
+ SetLogThreadNumProgram( rx_GetThreadNum );
#endif
#ifdef AFS_NT40_ENV
rx_SetNoJumbo();
}
if (rxMaxMTU != -1) {
- rx_SetMaxMTU(rxMaxMTU);
+ if (rx_SetMaxMTU(rxMaxMTU) != 0) {
+ fprintf(stderr, "rxMaxMTU %d is invalid\n", rxMaxMTU);
+ VS_EXIT(1);
+ }
}
rx_GetIFInfo();
rx_SetRxDeadTime(420);
AFSDIR_SERVER_ETC_DIRPATH);
VS_EXIT(1);
}
+
+ /* initialize audit user check */
+ osi_audit_set_user_check(tdir, vol_IsLocalRealmMatch);
+
afsconf_GetKey(tdir, 999, &tkey);
- afsconf_BuildServerSecurityObjects(tdir, 0, &securityClasses, &numClasses);
+ afsconf_BuildServerSecurityObjects(tdir, &securityClasses, &numClasses);
if (securityClasses[0] == NULL)
Abort("rxnull_NewServerSecurityObject");
service =