]> git.tue.mpg.de Git - paraslash.git/commitdiff
kill get_user() and struct user
authorAndre <maan@meins.(none)>
Wed, 1 Nov 2006 12:05:54 +0000 (13:05 +0100)
committerAndre <maan@meins.(none)>
Wed, 1 Nov 2006 12:05:54 +0000 (13:05 +0100)
It is unused as it was replaced by the in-memory variants _get_user()
and struct _user.

command.c
server.h

index 4b9782f8e8505b3f7088b0a705a64e67cde411ce..c4229d4f21a8d8f0ec43d66ba1a7d35ed4acda4f 100644 (file)
--- a/command.c
+++ b/command.c
@@ -992,70 +992,6 @@ long int para_rand(long unsigned max)
        return (long int) ((max + 0.0) * (random() / (RAND_MAX + 1.0)));
 }
 
-/* Open user_list file, returns pointer to opened file on success,
- * NULL on errors
- */
-static FILE *open_user_list(char *file)
-{
-       PARA_DEBUG_LOG("opening user list %s\n", file);
-       return fopen(file, "r");
-}
-
-/*
- * lookup user in user_list file. Fills in a user struct containing
- * filename of the user's public key as well as the permissions of that user.
- * Returns 1 on success, 0 if user does not exist and < 0 on errors.
- */
-static int get_user(struct user *user) {
-       FILE *file_ptr;
-       char *char_ptr;
-       char line[MAXLINE];
-       /* keyword, user, key, perms */
-       char w[MAXLINE], n[MAXLINE], k[MAXLINE], p[MAXLINE], tmp[4][MAXLINE];
-       int num, ret;
-
-       file_ptr = open_user_list(user_list);
-       if (!file_ptr)
-               return -E_USERLIST;
-       for (;;) {
-               ret = para_fgets(line, MAXLINE, file_ptr);
-               if (ret < 0)
-                       PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
-               if (ret <= 0)
-                       break;
-               if (sscanf(line,"%200s %200s %200s %200s", w, n, k, p) < 3)
-                       continue;
-               if (strcmp(w, "user") || strcmp(user->name, n))
-                       continue;
-               PARA_DEBUG_LOG("found entry for %s\n", n);
-               strcpy(user->name, n);
-               strcpy(user->pubkey_file, k);
-               user->perms = 0;
-               char_ptr = p;
-               num = sscanf(char_ptr, "%200[A-Z_],%200[A-Z_],%200[A-Z_],%200[A-Z_]",
-                       tmp[0], tmp[1], tmp[2], tmp[3]);
-               PARA_DEBUG_LOG("found %i perm entries\n", num);
-               user->perms = 0;
-               while (num > 0) {
-                       num--;
-                       if (!strcmp(tmp[num], "AFS_READ"))
-                               user->perms = user->perms | AFS_READ;
-                       else if (!strcmp(tmp[num], "AFS_WRITE"))
-                               user->perms = user->perms | AFS_WRITE;
-                       else if (!strcmp(tmp[num], "DB_READ"))
-                               user->perms = user->perms | DB_READ;
-                       else if (!strcmp(tmp[num], "DB_WRITE"))
-                               user->perms = user->perms | DB_WRITE;
-                       else /* unknown permission */
-                               PARA_WARNING_LOG("unknown permission: %s\n",
-                                       tmp[num]);
-               }
-               break;
-       }
-       fclose(file_ptr);
-       return ret;
-}
-
 static void init_rc4_keys(void)
 {
        int i;
index 0077338bf47e1162ff121c51337705eca607c4f7..1652d91efc38a453768829fbb5fbdabfd275f42a 100644 (file)
--- a/server.h
+++ b/server.h
@@ -38,15 +38,6 @@ enum {DB_READ = 1, DB_WRITE = 2, AFS_READ = 4, AFS_WRITE = 8};
 /**
  * data needed to authenticate the user
  */
-struct user{
-       /** the username */
-       char name[MAXLINE];
-       /** full path to the public RSA key */
-       char pubkey_file[_POSIX_PATH_MAX];
-       /** the privileges of this user */
-       unsigned int perms;
-};
-
 struct _user {
        /** the position of this user in the list of users */
        struct list_head node;