free(cmd);
/* filters */
filter_init(filters);
- nf = MAX(2, conf.filter_given) + 1;
+ nf = PARA_MAX(2, conf.filter_given) + 1;
PARA_INFO_LOG("allocating space for %d filters\n", nf);
FOR_EACH_AUDIO_FORMAT(i) {
afi[i].filter_conf = para_malloc(nf * sizeof(char *));
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;
}
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;
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);
- buf[ret] = '\0';
- ret = check_perms(&c);
+ PARA_INFO_LOG("connection from user %i\n", ret);
+ ret = check_perms(ret);
if (ret < 0)
goto out;
argc = split_args(buf, &argv, "\n");
a = &afi[s->format];
ret = a->receiver->pre_select(rn, rfds, wfds, tv);
// PARA_NOTICE_LOG("%s preselect: %d\n", a->receiver->name, ret);
- *max_fileno = MAX(*max_fileno, ret);
+ *max_fileno = PARA_MAX(*max_fileno, ret);
}
}
static void audiod_post_select(int select_ret, fd_set *rfds, fd_set *wfds)