cm_HaveToken answers the question of whether a cm_user_t has a
token for a specified cell.
Change-Id: I4dff312a7e9000ccee6952c21fca174700364c4c
Reviewed-on: http://gerrit.openafs.org/9076
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
return expirationTime;
}
+int
+cm_HaveToken(cm_user_t *userp, afs_uint32 cellID)
+{
+ cm_cell_t *cellp = NULL;
+ cm_ucell_t * ucp = NULL;
+ int havetoken = 0;
+ time_t now;
+
+ lock_ObtainMutex(&userp->mx);
+ cellp = cm_FindCellByID(cellID, CM_FLAG_NOPROBE);
+ ucp = cm_GetUCell(userp, cellp);
+ if (ucp->ticketp) {
+ now = time(NULL);
+ if (ucp->expirationTime > now)
+ havetoken = 1;
+ }
+ lock_ReleaseMutex(&userp->mx);
+
+ return havetoken;
+}
+
/*
* Add rights to an acl cache entry. Do the right thing if not present,
extern void cm_CheckTokenCache(time_t now);
+extern int cm_HaveToken(cm_user_t *userp, afs_uint32 cellID);
+
extern cm_user_t *cm_rootUserp;
#endif /* OPENAFS_WINNT_AFSD_CM_USER_H */