#include <roken.h>
-#include <fcntl.h>
-
#ifdef AFS_NT40_ENV
#include <WINNT/afsevent.h>
#endif
return afsconf_SuperUser(BU_conf, call, NULL);
}
+/**
+ * Return true if this name is a member of the local realm.
+ */
+int
+BU_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) {
+ LogError(code, "Failed local realm check; name=%s, inst=%s, cell=%s\n",
+ name, inst, cell);
+ }
+ return islocal;
+}
+
int
convert_cell_to_ubik(struct afsconf_cell *cellinfo, afs_uint32 *myHost,
afs_uint32 *serverList)
/* database directory */
if (as->parms[0].items != 0) {
- globalConfPtr->databaseDirectory =
- (char *)malloc(strlen(as->parms[0].items->data) + 1);
+ globalConfPtr->databaseDirectory = strdup(as->parms[0].items->data);
if (globalConfPtr->databaseDirectory == 0)
BUDB_EXIT(-1);
- strcpy(globalConfPtr->databaseDirectory, as->parms[0].items->data);
}
/* -cellservdb, cell configuration directory */
if (as->parms[1].items != 0) {
- globalConfPtr->cellConfigdir =
- (char *)malloc(strlen(as->parms[1].items->data) + 1);
+ globalConfPtr->cellConfigdir = strdup(as->parms[1].items->data);
if (globalConfPtr->cellConfigdir == 0)
BUDB_EXIT(-1);
- strcpy(globalConfPtr->cellConfigdir, as->parms[1].items->data);
-
globalConfPtr->debugFlags |= DF_RECHECKNOAUTH;
}
afs_int32 code = 0;
int fd;
- path = malloc(strlen(globalConfPtr->databaseDirectory) +
- strlen(globalConfPtr->databaseName) +
- strlen(globalConfPtr->databaseExtension) + 1);
+ asprintf(&path, "%s%s%s",
+ globalConfPtr->databaseDirectory,
+ globalConfPtr->databaseName,
+ globalConfPtr->databaseExtension);
if (path == NULL)
ERROR(-1);
- /* construct the database name */
- strcpy(path, globalConfPtr->databaseDirectory);
- strcat(path, globalConfPtr->databaseName);
- strcat(path, globalConfPtr->databaseExtension);
-
fd = open(path, O_RDWR, 0755);
if (!fd) {
code = errno;
ERROR(code);
}
+ /* initialize audit user check */
+ osi_audit_set_user_check(BU_conf, BU_IsLocalRealmMatch);
+
/* initialize ubik */
ubik_SetClientSecurityProcs(afsconf_ClientAuth, afsconf_UpToDate, BU_conf);
ubik_SetServerSecurityProcs(afsconf_BuildServerSecurityObjects,
LogError(0, "Will allocate %d ubik buffers\n", ubik_nBuffers);
- dbNamePtr =
- (char *)malloc(strlen(globalConfPtr->databaseDirectory) +
- strlen(globalConfPtr->databaseName) + 1);
+ asprintf(&dbNamePtr, "%s%s", globalConfPtr->databaseDirectory,
+ globalConfPtr->databaseName);
if (dbNamePtr == 0)
ERROR(-1);
- /* construct the database name */
- strcpy(dbNamePtr, globalConfPtr->databaseDirectory);
- strcat(dbNamePtr, globalConfPtr->databaseName); /* name prefix */
-
rx_SetRxDeadTime(60); /* 60 seconds inactive before timeout */
if (rxBind) {
}
}
+ /* Disable jumbograms */
+ rx_SetNoJumbo();
+
code = ubik_ServerInitByInfo (globalConfPtr->myHost,
htons(AFSCONF_BUDBPORT),
&cellinfo,
afsconf_BuildServerSecurityObjects(BU_conf, &securityClasses, &numClasses);
- /* Disable jumbograms */
- rx_SetNoJumbo();
-
tservice =
rx_NewServiceHost(host, 0, BUDB_SERVICE, "BackupDatabase",
securityClasses, numClasses, BUDB_ExecuteRequest);