mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:winbindd: Add a check for the path length of 'winbindd socket directory'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14779 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
e2962b4262
commit
aab5cc95e2
@ -1658,6 +1658,7 @@ int main(int argc, const char **argv)
|
||||
bool ok;
|
||||
const struct dcesrv_endpoint_server *ep_server = NULL;
|
||||
struct dcesrv_context *dce_ctx = NULL;
|
||||
size_t winbindd_socket_dir_len = 0;
|
||||
|
||||
setproctitle_init(argc, discard_const(argv), environ);
|
||||
|
||||
@ -1810,6 +1811,30 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
winbindd_socket_dir_len = strlen(lp_winbindd_socket_directory());
|
||||
if (winbindd_socket_dir_len > 0) {
|
||||
size_t winbindd_socket_len =
|
||||
winbindd_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_socket_len >= sun_path_len) {
|
||||
DBG_ERR("The winbind socket path [%s/%s] is too long "
|
||||
"(%zu >= %zu)\n",
|
||||
lp_winbindd_socket_directory(),
|
||||
WINBINDD_SOCKET_NAME,
|
||||
winbindd_socket_dir_len,
|
||||
sun_path_len);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
DBG_ERR("'winbindd_socket_directory' parameter is empty\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!cluster_probe_ok()) {
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user