2 * Copyright (c) 2018 Todd C. Miller <Todd.Miller@sudo.ws>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * This is an open source non-commercial project. Dear PVS-Studio, please check it.
19 * PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
23 * Stub versions of functions needed by the parser.
24 * Required to link cvtsudoers and visudo.
29 #include <sys/types.h>
34 #endif /* HAVE_STRING_H */
37 #endif /* HAVE_STRINGS_H */
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
43 #include "interfaces.h"
75 group_plugin_query(const char *user, const char *group, const struct passwd *pw)
81 struct interface_list *
84 static struct interface_list dummy = SLIST_HEAD_INITIALIZER(interfaces);
89 * Look up the hostname and set user_host and user_shost.
95 debug_decl(get_hostname, SUDOERS_DEBUG_UTIL)
97 if ((user_host = sudo_gethostname()) != NULL) {
98 if ((cp = strchr(user_host, '.'))) {
100 if ((user_shost = strdup(user_host)) == NULL)
101 sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
104 user_shost = user_host;
107 user_host = user_shost = strdup("localhost");
108 if (user_host == NULL)
109 sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
111 user_runhost = user_host;
112 user_srunhost = user_shost;