avoid struct ucred in audiod.c
[paraslash.git] / audiod.c
index f15ab710d8808da2b945632a9d42d4ad8133f0e0..b0f9f786932be2e44e5c87bb9411345746e16ff1 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1417,14 +1417,14 @@ static int com_cycle(int fd, int argc, char **argv)
        return 1;
 }
 
-static int check_perms(struct ucred *c)
+static int check_perms(uid_t uid)
 {
        int i;
 
        if (!conf.user_allow_given)
                return 1;
        for (i = 0; i < conf.user_allow_given; i++)
-               if (c->uid == conf.user_allow_arg[i])
+               if (uid == conf.user_allow_arg[i])
                        return 1;
        return -E_UCRED_PERM;
 }
@@ -1432,7 +1432,6 @@ static int check_perms(struct ucred *c)
 static int handle_connect(void)
 {
        int i, argc, ret, clifd = -1;
-       struct ucred c;
        char *buf = para_malloc(MAXLINE), **argv = NULL;
        struct sockaddr_un unix_addr;
 
@@ -1440,12 +1439,12 @@ static int handle_connect(void)
        if (ret < 0)
                goto out;
        clifd = ret;
-       ret = recv_cred_buffer(clifd, buf, MAXLINE - 1, &c);
+       ret = recv_cred_buffer(clifd, buf, MAXLINE - 1);
        if (ret < 0)
                goto out;
-       PARA_INFO_LOG("pid: %i, uid: %i, gid: %i, ret: %i, buf: %s\n", c.pid, c.uid, c.gid, ret, buf);
+       PARA_INFO_LOG("connection from user %i\n",  ret);
        buf[ret] = '\0';
-       ret = check_perms(&c);
+       ret = check_perms(ret);
        if (ret < 0)
                goto out;
        argc = split_args(buf, &argv, "\n");