f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina Pavel Březina <pbrezina@redhat.com>
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina Copyright (C) 2011 Red Hat
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina This program is free software; you can redistribute it and/or modify
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina it under the terms of the GNU General Public License as published by
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina the Free Software Foundation; either version 3 of the License, or
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina (at your option) any later version.
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina This program is distributed in the hope that it will be useful,
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina GNU General Public License for more details.
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina You should have received a copy of the GNU General Public License
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
968e2bc3bb28458b25c3b19868ea50f0325d8b0aPavel Březinavoid print_sss_result(struct sss_sudo_result *result);
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina fprintf(stderr, "Usage: sss_sudo_cli username [uid]\n");
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina /* get sss_result - it will send new query to responder */
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina /* get default options */
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina ret = sss_sudo_send_recv_defaults(uid, username, &error,
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina fprintf(stderr, "sss_sudo_send_recv_defaults() failed: %s\n",
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina printf("User [%s:%llu] found in domain: %s\n\n",
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina printf("=== Printing response data [default options] ===\n");
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina /* get rules */
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina ret = sss_sudo_send_recv(uid, username, domainname, &error, &result);
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina fprintf(stderr, "sss_sudo_send_recv() failed: %s\n", strerror(ret));
46d3d2c731e8c7e138462e5b60a39a279dc77d81Pavel Březina printf("\n=== Printing response data [rules] ===\n");
968e2bc3bb28458b25c3b19868ea50f0325d8b0aPavel Březinavoid print_sss_result(struct sss_sudo_result *result)
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina printf("Number of rules: %d\n", result->num_rules);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina printf("=== Rule %d has %d attributes\n", i, rule->num_attrs);
f8c829e72968b574e1c9bda96f4d5f206622358fPavel Březina printf(" === Attribute named %s has %d values:\n", attr->name,