c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher Copyright (C) Jakub Hrozek <jhrozek@redhat.com> 2009
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher This program is free software; you can redistribute it and/or modify
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher it under the terms of the GNU General Public License as published by
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher the Free Software Foundation; either version 3 of the License, or
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher (at your option) any later version.
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher This program is distributed in the hope that it will be useful,
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher but WITHOUT ANY WARRANTY; without even the implied warranty of
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher GNU General Public License for more details.
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher You should have received a copy of the GNU General Public License
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher along with this program. If not, see <http://www.gnu.org/licenses/>.
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov { "debug",'\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug,
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce "set_locale failed (%d): %s\n", ret, strerror(ret));
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce /* parse params */
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce pc = poptGetContext(NULL, argc, argv, long_options, 0);
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce /* groupname is an argument, not option */
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce BAD_POPT_PARAMS(pc, _("Specify group to add\n"), ret, fini);
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce "init_sss_tools failed (%d): %s\n", ret, strerror(ret));
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce ERROR("Error initializing the tools - no local domain\n");
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce /* if the domain was not given as part of FQDN, default to local domain */
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce /* arguments processed, go on to actual work */
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce if (id_in_range(tctx->octx->gid, tctx->octx->domain) != EOK) {
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce ERROR("The selected GID is outside the allowed range\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher tctx->error = sysdb_transaction_start(tctx->sysdb);
868ae511c9b0d610f83acf8f01975e1f5e3c1aa3Simo Sorce DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher /* groupadd */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov tctx->error = sysdb_transaction_commit(tctx->sysdb);
cff916f5352fe7c3a679571130090efdb935618aStephen Gallagher DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher ERROR("Could not allocate ID for the group - domain full?\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher ERROR("A group with the same name or GID already exists\n");
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher "sysdb operation failed (%d)[%s]\n", ret, strerror(ret));
c2352a73f52f600d95966ebe0b0819649ba923faStephen Gallagher ERROR("Transaction error. Could not add group.\n");