+/*
+ * Determine whether the specified message exists in the cached_msglist
+ * (This is a security check)
+ */
+int check_cached_msglist(long msgnum) {
+
+ /* cases in which we skip the check */
+ if (!CC) return om_ok; /* not a session */
+ if (CC->client_socket <= 0) return om_ok; /* not a client session */
+ if (CC->cached_msglist == NULL) return om_access_denied; /* no msglist fetched */
+ if (CC->cached_num_msgs == 0) return om_access_denied; /* nothing to check */
+
+
+ /* FIXME FIXME SLOW SEARCH DO NOT LET THIS GO INTO PRODUCTION */
+ int i;
+ for (i=0; i < CC->cached_num_msgs ; ++i) {
+ if (CC->cached_msglist[i] == msgnum) return om_ok;
+ }
+
+ return om_access_denied;
+}
+
+