5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek Jakub Hrozek <jhrozek@redhat.com>
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek Copyright (C) 2014 Red Hat
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek SSSD tests: User utilities
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek This program is free software; you can redistribute it and/or modify
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek it under the terms of the GNU General Public License as published by
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek the Free Software Foundation; either version 3 of the License, or
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek (at your option) any later version.
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek This program is distributed in the hope that it will be useful,
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek but WITHOUT ANY WARRANTY; without even the implied warranty of
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek GNU General Public License for more details.
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek You should have received a copy of the GNU General Public License
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek along with this program. If not, see <http://www.gnu.org/licenses/>.
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek/* Just to satisfy dependencies */
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozekstruct cli_protocol_version *register_cli_protocol_version(void)
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek static struct cli_protocol_version responder_test_cli_protocol_version[] = {
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek ret = csv_string_to_uid_array(tmp_ctx, "1, 2, 3", false, &count, &list);
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek ret = csv_string_to_uid_array(tmp_ctx, "sssd, foobar", true, &count, &list);
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek ret = csv_string_to_uid_array(tmp_ctx, "nosuchuser", true, &count, &list);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_create_pipe_fd_setup(void **state)
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ctx = talloc(global_talloc_context, struct create_pipe_ctx);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozekvoid check_sock_properties(struct create_pipe_ctx *ctx, mode_t mode)
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek /* Check existence of the file and the permissions */
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek /* Check it's a UNIX socket */
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = getsockopt(ctx->fd, SOL_SOCKET, SO_DOMAIN, &optval, &optlen);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = getsockopt(ctx->fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek /* Make sure this is a listening socket */
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = getsockopt(ctx->fd, SOL_SOCKET, SO_ACCEPTCONN, &optval, &optlen);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek /* Check the right protocol */
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = getsockopt(ctx->fd, SOL_SOCKET, SO_PROTOCOL, &optval, &optlen);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ctx = talloc_get_type(*state, struct create_pipe_ctx);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = create_pipe_fd(ctx->sock_name, &ctx->fd, 0111);
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek /* Make sure we can overwrite an existing socket */
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ret = create_pipe_fd(ctx->sock_name, &ctx->fd, 0000);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozekstatic int test_create_pipe_fd_teardown(void **state)
4a5cced91df68a85ef0b30de8efe104c8a0aab7aJakub Hrozek ctx = talloc_get_type(*state, struct create_pipe_ctx);
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_create_pipe_fd,
49dd8ee2834d9477418961dbaffa4a03cfa9fd1eRené Genz /* Set debug level to invalid value so we can decide if -d 0 was used. */
5eda23c28c582b43b2a0a165b1750f3875c0fa84Jakub Hrozek pc = poptGetContext(argv[0], argc, argv, long_options, 0);