if (q->everybody)
return(SMS_SUCCESS);
- if (client_is_member(cl, acl_id))
+ if (get_client(cl, &client_type, &client_id) != SMS_SUCCESS)
+ return(SMS_PERM);
+ if (find_member("LIST", acl_id, client_type, client_id, 0))
return(SMS_SUCCESS);
else
return(SMS_PERM);
##}
-/* If this client has cached list information, use that. Otherwise,
- * use the general get_client & find_member routines to determine if
- * the user is a member of the list.
- */
-
-int client_is_member(cl, id)
-client *cl;
-int id;
-{
- char *client_type;
- int client_id, status;
-
- if (cl->lists[0]) {
- register int i;
- for (i = 0; cl->lists[i] && i < NLISTS; i++)
- if (cl->lists[i] == id)
- return(1);
- return(0);
- }
-
- /* parse client name */
- if (get_client(cl, &client_type, &client_id) != SMS_SUCCESS)
- return(0);
-
- /* see if client is in the list (or any of its sub-lists) */
- return(find_member("LIST", id, client_type, client_id, 0));
-}
-
-
get_client(cl, client_type, client_id)
client *cl;
char **client_type;
##}
-/* Cache the lists that the client is a member of. These will be used
- * to speed up access checking later.
- */
-
-set_client_lists(cl)
-client *cl;
-##{
-## int lid, mid;
-## char *type;
- int count = 0;
-
- cl->lists[count] = 0;
- if (cl->users_id != 0) {
- type = "USER";
- mid = cl->users_id;
- } else if (cl->client_id != 0) {
- type = "KERBEROS";
- mid = -cl->client_id;
- } else
- return;
-
-## range of m is members
-## repeat retrieve (lid = m.list_id) where m.member_type = @type and
-## m.member_id = @mid {
- cl->lists[count++] = lid;
- if (count >= NLISTS)
-## endretrieve
-## }
- if (count >= NLISTS) {
- cl->lists[0] = 0;
- com_err(whoami, 0, "too many lists to cache");
- } else
- cl->lists[count] = 0;
-##}
-
-
/* For now this just checks the argc's. It should also see that there
* are no duplicate names.
*/
return(SMS_PERM);
}
- if (!strcmp(strtrim(acl_type), "LIST")) {
- if (!client_is_member(cl, acl_id))
- return(SMS_PERM);
- else
- return(SMS_SUCCESS);
- }
-
/* check for client in access control list */
status = find_member(acl_type, acl_id, client_type, client_id, 0);
if (!status) return(SMS_PERM);
return(SMS_SUCCESS);
- if (!strcmp(strtrim(acl_type), "LIST")) {
- if (!client_is_member(cl, acl_id))
- return(SMS_PERM);
- else
- return(SMS_SUCCESS);
- }
-
/* parse client structure */
if ((status = get_client(cl, &client_type, &client_id)) != SMS_SUCCESS)
return(status);
if (!flags)
return(SMS_SUCCESS);
- if (!strcmp(strtrim(acl_type), "LIST")) {
- if (!client_is_member(cl, acl_id))
- return(SMS_PERM);
- else
- return(SMS_SUCCESS);
- }
-
/* parse client structure */
if ((status = get_client(cl, &client_type, &client_id)) != SMS_SUCCESS)
return(status);
if (rowcount > 1)
return(SMS_PERM);
- if (!strcmp(strtrim(acl_type), "LIST")) {
- if (!client_is_member(cl, acl_id))
- return(SMS_PERM);
- else
- return(SMS_SUCCESS);
- }
-
/* parse client structure */
if ((status = get_client(cl, &client_type, &client_id)) != SMS_SUCCESS)
return(status);
return(SMS_PERM);
if (users_id == cl->users_id)
return(SMS_SUCCESS);
- if (!client_is_member(cl, list_id))
- return(SMS_PERM);
- else
+ if ((status = get_client(cl, &client_type, &client_id)) != SMS_SUCCESS)
+ return(status);
+ status = find_member("LIST", list_id, client_type, client_id, 0);
+ if (status)
return(SMS_SUCCESS);
+ else
+ return(SMS_PERM);
##}