REORG: listener: move unix perms from the listener to the bind_conf
Unix permissions are per-bind configuration line and not per listener,
so let's concretize this in the way the config is stored. This avoids
some unneeded loops to set permissions on all listeners.
The access level is not part of the unix perms so it has been moved
away. Once we can use str2listener() to set all listener addresses,
we'll have a bind keyword parser for this one.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 07cc837..e2b7ba3 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -285,8 +285,6 @@
tcpv6_add_listener(l);
}
else {
- l->perm.ux.gid = l->perm.ux.uid = -1;
- l->perm.ux.mode = 0;
uxst_add_listener(l);
}
@@ -1696,6 +1694,7 @@
}
bind_conf = bind_conf_alloc(&curproxy->conf.bind, file, linenum, args[1]);
+ memcpy(&bind_conf->ux, &global.unix_bind.ux, sizeof(global.unix_bind.ux));
/* NOTE: the following line might create several listeners if there
* are comma-separated IPs or port ranges. So all further processing
@@ -1708,8 +1707,6 @@
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
/* Set default global rights and owner for unix bind */
- if (l->addr.ss_family == AF_UNIX)
- memcpy(&(l->perm.ux), &(global.unix_bind.ux), sizeof(global.unix_bind.ux));
global.maxsock++;
}