mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
s3:winbind: Do not start if the priviliged socket path is too long
https://bugzilla.samba.org/show_bug.cgi?id=14792 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
8858cf72af
commit
45f6bf1824
@ -1659,6 +1659,8 @@ int main(int argc, const char **argv)
|
||||
const struct dcesrv_endpoint_server *ep_server = NULL;
|
||||
struct dcesrv_context *dce_ctx = NULL;
|
||||
size_t winbindd_socket_dir_len = 0;
|
||||
char *winbindd_priv_socket_dir = NULL;
|
||||
size_t winbindd_priv_socket_dir_len = 0;
|
||||
|
||||
setproctitle_init(argc, discard_const(argv), environ);
|
||||
|
||||
@ -1835,6 +1837,32 @@ int main(int argc, const char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
winbindd_priv_socket_dir = get_winbind_priv_pipe_dir();
|
||||
winbindd_priv_socket_dir_len = strlen(winbindd_priv_socket_dir);
|
||||
if (winbindd_priv_socket_dir_len > 0) {
|
||||
size_t winbindd_priv_socket_len =
|
||||
winbindd_priv_socket_dir_len + 1 +
|
||||
strlen(WINBINDD_SOCKET_NAME);
|
||||
struct sockaddr_un un = {
|
||||
.sun_family = AF_UNIX,
|
||||
};
|
||||
size_t sun_path_len = sizeof(un.sun_path);
|
||||
|
||||
if (winbindd_priv_socket_len >= sun_path_len) {
|
||||
DBG_ERR("The winbind priviliged socket path [%s/%s] is too long "
|
||||
"(%zu >= %zu)\n",
|
||||
winbindd_priv_socket_dir,
|
||||
WINBINDD_SOCKET_NAME,
|
||||
winbindd_priv_socket_len,
|
||||
sun_path_len);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
DBG_ERR("'winbindd_priv_socket_directory' parameter is empty\n");
|
||||
exit(1);
|
||||
}
|
||||
TALLOC_FREE(winbindd_priv_socket_dir);
|
||||
|
||||
if (!cluster_probe_ok()) {
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user