-/*
- * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- */
+/* Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
/** \file user_list.h exported functions from user_list.c */
-#include "list.h"
-#include "crypt.h"
-
/**
- * permission flags that can be set individually for any server command
+ * Flags for server commands and user permissions.
*
- * - DB_READ: command reads from the database
- * - DB_WRITE: command changes the contents of the database
- * - AFS_READ: command reads information about the current audio stream
- * - AFS_WRITE: command changes the current audio stream
+ * For each command, zero or more of these flags are ored to define the command
+ * permissions. A user is allowed to run the command if and only if all command
+ * permission flags are set for the user in the server.users config file which
+ * is read at server startup.
*/
-enum {DB_READ = 1, DB_WRITE = 2, AFS_READ = 4, AFS_WRITE = 8};
+enum server_command_permissions {
+ NO_PERMISSION_REQUIRED = 0, /** None of the below. */
+ AFS_READ = 1, /** Read-only operation on the AFS database. */
+ AFS_WRITE = 2, /** Read-write operation on the AFS database. */
+ VSS_READ = 4, /** Read-only operation on the virtual streaming system. */
+ VSS_WRITE = 8 /** Read-write operation on the virtual streaming system. */
+};
/**
* data needed to authenticate the user
*/
struct user {
- /** the position of this user in the list of users */
+ /** The position of this user in the list of users. */
struct list_head node;
- /** the username */
+ /** The username. */
char *name;
- /** the public RSA key */
- RSA *rsa;
- /** the privileges that this user has */
+ /** The public key. */
+ struct asymmetric_key *pubkey;
+ /** The privileges of this user. */
unsigned int perms;
};
-void init_user_list(char *user_list_file);
-int lookup_user(struct user *user);
+void user_list_init(const char *user_list_file);
+void user_list_deplete(void);
+const struct user *user_list_lookup(const char *name);