#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
+#include <ctype.h>
#include <afs/stds.h>
+#include <rx/rx.h>
+#include <rx/rxstat.h>
#include "afs_ptsAdmin.h"
#include "../adminutil/afs_AdminInternal.h"
#include <afs/afs_AdminErrors.h>
#include <afs/ptserver.h>
/*
- * The list of external functions that aren't prototyped anywhere
- */
-
-extern int PR_NameToID();
-extern int PR_AddToGroup();
-extern int PR_ChangeEntry();
-extern int PR_RemoveFromGroup();
-extern int PR_INewEntry();
-extern int PR_NewEntry();
-extern int PR_Delete();
-extern int PR_IDToName();
-extern int PR_ListEntry();
-extern int PR_SetMax();
-extern int PR_ListElements();
-extern int PR_SetFieldsEntry();
-extern int PR_IsAMemberOf();
-extern int PR_ListMax();
-extern int PR_ListOwned();
-extern int PR_ListEntries();
-
-/*
* IsValidCellHandle - validate the cell handle for making pts
* requests.
*
}
}
- tst = ubik_Call(PR_NameToID, cellHandle->pts, 0, names, ids);
+ tst = ubik_PR_NameToID(cellHandle->pts, 0, names, ids);
if (tst) {
goto fail_TranslatePTSNames;
names.namelist_val = (prname *) & tmp_array[0];
strncpy(names.namelist_val[0], id1, PTS_MAX_NAME_LEN);
+ names.namelist_val[0][PTS_MAX_NAME_LEN - 1] = '\0';
strncpy(names.namelist_val[1], id2, PTS_MAX_NAME_LEN);
+ names.namelist_val[1][PTS_MAX_NAME_LEN - 1] = '\0';
ids->idlist_val = 0;
ids->idlist_len = 0;
names[0].namelist_len = 1;
names[0].namelist_val = (prname *) & tmp_array[0];
- strncpy(names[0].namelist_val, ptsName, PTS_MAX_NAME_LEN);
+ strncpy((char *)names[0].namelist_val, ptsName, PTS_MAX_NAME_LEN);
+ ((char *)names[0].namelist_val)[PTS_MAX_NAME_LEN - 1] = '\0';
ids.idlist_val = 0;
ids.idlist_len = 0;
int rc = 0;
afs_status_t tst = 0;
- tst = ubik_Call(PR_IDToName, cellHandle->pts, 0, ids, names);
+ tst = ubik_PR_IDToName(cellHandle->pts, 0, ids, names);
if (tst) {
goto fail_TranslatePTSIds;
int rc = 0;
afs_status_t tst = 0;
afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
- idlist ids;
+ idlist ids = {0,0};
/*
* Validate arguments
*/
tst =
- ubik_Call(PR_AddToGroup, c_handle->pts, 0, ids.idlist_val[0],
+ ubik_PR_AddToGroup(c_handle->pts, 0, ids.idlist_val[0],
ids.idlist_val[1]);
if (tst != 0) {
*/
tst =
- ubik_Call(PR_ChangeEntry, c_handle->pts, 0, ids.idlist_val[1], "",
+ ubik_PR_ChangeEntry(c_handle->pts, 0, ids.idlist_val[1], "",
ids.idlist_val[0], 0);
if (tst != 0) {
*/
int ADMINAPI
-pts_GroupCreate(const void *cellHandle, const char *newGroup,
- const char *newOwner, int *newGroupId, afs_status_p st)
+pts_GroupCreate(const void *cellHandle, char *newGroup,
+ char *newOwner, int *newGroupId, afs_status_p st)
{
int rc = 0;
afs_status_t tst = 0;
if (*newGroupId != 0) {
tst =
- ubik_Call(PR_INewEntry, c_handle->pts, 0, newGroup, *newGroupId,
+ ubik_PR_INewEntry(c_handle->pts, 0, newGroup, *newGroupId,
newOwnerId);
} else {
tst =
- ubik_Call(PR_NewEntry, c_handle->pts, 0, newGroup, PRGRP,
+ ubik_PR_NewEntry(c_handle->pts, 0, newGroup, PRGRP,
newOwnerId, newGroupId);
}
* Retrieve information about the group
*/
- tst = ubik_Call(PR_ListEntry, c_handle->pts, 0, groupId, &groupEntry);
+ tst = ubik_PR_ListEntry(c_handle->pts, 0, groupId, &groupEntry);
if (tst != 0) {
goto fail_pts_GroupGet;
groupP->nameUid = groupEntry.id;
groupP->ownerUid = groupEntry.owner;
groupP->creatorUid = groupEntry.creator;
- strcpy(groupP->name, groupEntry.name);
+ strncpy(groupP->name, groupEntry.name, PTS_MAX_NAME_LEN);
+ groupP->name[PTS_MAX_NAME_LEN - 1] = '\0';
/*
* Set the access rights based upon the value of the flags member
* of the groupEntry struct.
goto fail_pts_GroupGet;
}
- strcpy(groupP->owner, names.namelist_val[0]);
- strcpy(groupP->creator, names.namelist_val[1]);
+ strncpy(groupP->owner, names.namelist_val[0], PTS_MAX_NAME_LEN);
+ groupP->owner[PTS_MAX_NAME_LEN - 1] = '\0';
+ strncpy(groupP->creator, names.namelist_val[1], PTS_MAX_NAME_LEN);
+ groupP->creator[PTS_MAX_NAME_LEN - 1] = '\0';
free(names.namelist_val);
rc = 1;
* Make the rpc
*/
- tst = ubik_Call(PR_Delete, c_handle->pts, 0, entryId);
+ tst = ubik_PR_Delete(c_handle->pts, 0, entryId);
if (tst != 0) {
goto fail_EntryDelete;
goto fail_pts_GroupMaxGet;
}
- tst = ubik_Call(PR_ListMax, c_handle->pts, 0, &maxUserId, maxGroupId);
+ tst = ubik_PR_ListMax(c_handle->pts, 0, &maxUserId, maxGroupId);
if (tst != 0) {
goto fail_pts_GroupMaxGet;
goto fail_pts_GroupMaxSet;
}
- tst = ubik_Call(PR_SetMax, c_handle->pts, 0, maxGroupId, PRGRP);
+ tst = ubik_PR_SetMax(c_handle->pts, 0, maxGroupId, PRGRP);
if (tst != 0) {
goto fail_pts_GroupMaxSet;
iter->ids.prlist_val = 0;
tst =
- ubik_Call(PR_ListElements, c_handle->pts, 0, groupId, &iter->ids,
+ ubik_PR_ListElements(c_handle->pts, 0, groupId, &iter->ids,
&exceeded);
if (tst != 0) {
afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
idlist ids;
+ ids.idlist_val = NULL;
+
/*
* Validate arguments
*/
*/
tst =
- ubik_Call(PR_RemoveFromGroup, c_handle->pts, 0, ids.idlist_val[0],
+ ubik_PR_RemoveFromGroup(c_handle->pts, 0, ids.idlist_val[0],
ids.idlist_val[1]);
if (tst != 0) {
int ADMINAPI
pts_GroupRename(const void *cellHandle, const char *oldName,
- const char *newName, afs_status_p st)
+ char *newName, afs_status_p st)
{
int rc = 0;
afs_status_t tst = 0;
* Make the rpc
*/
- tst = ubik_Call(PR_ChangeEntry, c_handle->pts, 0, groupId, newName, 0, 0);
+ tst = ubik_PR_ChangeEntry(c_handle->pts, 0, groupId, newName, 0, 0);
if (tst != 0) {
goto fail_pts_GroupRename;
*/
tst =
- ubik_Call(PR_SetFieldsEntry, c_handle->pts, 0, groupId, PR_SF_ALLBITS,
+ ubik_PR_SetFieldsEntry(c_handle->pts, 0, groupId, PR_SF_ALLBITS,
flags, 0, 0, 0, 0);
if (tst != 0) {
*/
int ADMINAPI
-pts_UserCreate(const void *cellHandle, const char *userName, int *newUserId,
+pts_UserCreate(const void *cellHandle, char *userName, int *newUserId,
afs_status_p st)
{
int rc = 0;
afs_status_t tst = 0;
afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
- afs_int32 userId = 0;
/*
* Validate arguments
if (*newUserId != 0) {
tst =
- ubik_Call(PR_INewEntry, c_handle->pts, 0, userName, *newUserId,
+ ubik_PR_INewEntry(c_handle->pts, 0, userName, *newUserId,
0);
} else {
tst =
- ubik_Call(PR_NewEntry, c_handle->pts, 0, userName, 0, 0,
+ ubik_PR_NewEntry(c_handle->pts, 0, userName, 0, 0,
newUserId);
}
goto fail_IsAdministrator;
}
tst =
- ubik_Call(PR_IsAMemberOf, c_handle->pts, 0, userId, adminId,
+ ubik_PR_IsAMemberOf(c_handle->pts, 0, userId, adminId,
&isAdmin);
if (tst != 0) {
goto fail_IsAdministrator;
* Retrieve information about the group
*/
- tst = ubik_Call(PR_ListEntry, c_handle->pts, 0, userId, &userEntry);
+ tst = ubik_PR_ListEntry(c_handle->pts, 0, userId, &userEntry);
if (tst != 0) {
goto fail_pts_UserGet;
userP->nameUid = userEntry.id;
userP->ownerUid = userEntry.owner;
userP->creatorUid = userEntry.creator;
- strcpy(userP->name, userEntry.name);
+ strncpy(userP->name, userEntry.name, PTS_MAX_NAME_LEN);
+ userP->name[PTS_MAX_NAME_LEN - 1] = '\0';
/*
* The permission bits are described in the GroupGet function above.
goto fail_pts_UserGet;
}
- strcpy(userP->owner, names.namelist_val[0]);
- strcpy(userP->creator, names.namelist_val[1]);
+ strncpy(userP->owner, names.namelist_val[0], PTS_MAX_NAME_LEN);
+ userP->owner[PTS_MAX_NAME_LEN - 1] ='\0';
+ strncpy(userP->creator, names.namelist_val[1], PTS_MAX_NAME_LEN);
+ userP->creator[PTS_MAX_NAME_LEN - 1] = '\0';
free(names.namelist_val);
rc = 1;
int ADMINAPI
pts_UserRename(const void *cellHandle, const char *oldName,
- const char *newName, afs_status_p st)
+ char *newName, afs_status_p st)
{
int rc = 0;
afs_status_t tst = 0;
* Make the rpc
*/
- tst = ubik_Call(PR_ChangeEntry, c_handle->pts, 0, userId, newName, 0, 0);
+ tst = ubik_PR_ChangeEntry(c_handle->pts, 0, userId, newName, 0, 0);
if (tst != 0) {
goto fail_pts_UserRename;
*/
tst =
- ubik_Call(PR_SetFieldsEntry, c_handle->pts, 0, userId, mask, flags,
+ ubik_PR_SetFieldsEntry(c_handle->pts, 0, userId, mask, flags,
newQuota, 0, 0, 0);
if (tst != 0) {
goto fail_pts_UserMaxGet;
}
- tst = ubik_Call(PR_ListMax, c_handle->pts, 0, maxUserId, &maxGroupId);
+ tst = ubik_PR_ListMax(c_handle->pts, 0, maxUserId, &maxGroupId);
if (tst != 0) {
goto fail_pts_UserMaxGet;
goto fail_pts_UserMaxSet;
}
- tst = ubik_Call(PR_SetMax, c_handle->pts, 0, maxUserId, 0);
+ tst = ubik_PR_SetMax(c_handle->pts, 0, maxUserId, 0);
if (tst != 0) {
goto fail_pts_UserMaxSet;
if ((!list->finished_retrieving) && (list->owned_names.namelist_len == 0)) {
tst =
- ubik_Call(PR_ListOwned, list->c_handle->pts, 0, list->owner,
+ ubik_PR_ListOwned(list->c_handle->pts, 0, list->owner,
&list->owned_ids, &list->more);
if (tst != 0) {
goto fail_GetOwnedGroupRPC;
bulkentries.prentries_len = 0;
tst =
- ubik_Call(PR_ListEntries, list->c_handle->pts, 0, list->flag,
+ ubik_PR_ListEntries(list->c_handle->pts, 0, list->flag,
start, &bulkentries, &(list->nextstartindex));
if (tst != 0) {