sss_tools.c revision 284937e6b5b0c9d7a1d3382d0d2820d1168842fb
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2015 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <talloc.h>
#include <stdlib.h>
#include <string.h>
#include <popt.h>
#include "config.h"
#include "tools/common/sss_tools.h"
struct sss_cmdline {
const char *exec; /* argv[0] */
const char *command; /* command name */
int argc; /* rest of arguments */
const char **argv;
};
{
int debug = SSSDBG_DEFAULT;
int opt;
struct poptOption options[] = {
0, _("The debug level to run with"), NULL },
};
/* do nothing */
}
/* Strip common options from arguments. We will discard_const here,
* since it is not worth the trouble to convert it back and forth. */
}
struct confdb_ctx **_confdb)
{
struct confdb_ctx *confdb;
char *path;
return ENOMEM;
}
"Could not initialize connection to the confdb\n");
return ret;
}
}
return EOK;
}
struct confdb_ctx *confdb,
struct sss_domain_info **_domains)
{
struct sss_domain_info *domains;
struct sss_domain_info *dom;
return ret;
}
"Could not initialize connection to the sysdb\n");
return ret;
}
if (!IS_SUBDOMAIN(dom)) {
/* Update list of subdomains for this domain */
"Failed to update subdomains for domain %s.\n",
}
}
}
return ret;
}
}
return ret;
}
{
struct sss_tool_ctx *tool_ctx;
return NULL;
}
/* Connect to confdb. */
goto done;
}
/* Setup domains. */
goto done;
}
goto done;
}
done:
}
return tool_ctx;
}
int sss_tool_usage(const char *tool_name,
struct sss_route_cmd *commands)
{
int i;
}
return EXIT_FAILURE;
}
struct sss_tool_ctx *tool_ctx,
struct sss_route_cmd *commands,
void *pvt)
{
struct sss_cmdline cmdline;
const char *cmd;
int i;
return EXIT_FAILURE;
}
if (argc < 2) {
}
}
}
}
struct poptOption *options,
enum sss_tool_opt require_option,
void *popt_fn_pvt,
const char *fopt_name,
const char *fopt_help,
const char **_fopt)
{
const char *optstr;
char *help;
int ret;
/* Create help option string. We always need to append command name since
* we use POPT_CONTEXT_KEEP_FIRST. */
} else {
}
return EXIT_FAILURE;
}
/* Create popt context. This function is supposed to be called on
* command argv which does not contain executable (argv[0]), therefore
* we need to use KEEP_FIRST that ensures argv[0] is also processed. */
/* Parse options. Invoke custom function if provided. If no parsing
* function is provided, print error on unknown option. */
ret = EXIT_FAILURE;
goto done;
}
} else {
ret = EXIT_FAILURE;
goto done;
}
}
/* Parse free option which is always required if requested. */
ret = EXIT_FAILURE;
goto done;
}
/* No more arguments expected. If something follows it is an error. */
if (poptGetArg(pc)) {
ret = EXIT_FAILURE;
goto done;
}
}
/* If at least one option is required and not provided, print error. */
ret = EXIT_FAILURE;
goto done;
}
ret = EXIT_SUCCESS;
done:
return ret;
}
struct poptOption *options,
enum sss_tool_opt require_option,
void *popt_fn_pvt)
{
}
struct sss_route_cmd *commands,
void *pvt)
{
struct sss_tool_ctx *tool_ctx;
int ret;
if (uid != 0) {
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
return ret;
}
struct sss_tool_ctx *tool_ctx,
const char *input,
const char **_username,
struct sss_domain_info **_domain)
{
struct sss_domain_info *domain;
int ret;
"be a subdomain that was not yet found.\n");
goto done;
goto done;
}
done:
}
return ret;
}