sss_userdel.c revision 4aa841c5724f313435aeea1c0319e81bb0d14321
/*
SSSD
sss_userdel
Copyright (C) Jakub Hrozek <jhrozek@redhat.com> 2009
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 <stdio.h>
#include <stdlib.h>
#include <talloc.h>
#include <popt.h>
#include "tools/tools_util.h"
#include "tools/sss_sync_ops.h"
{
int ret = EXIT_SUCCESS;
const char *pc_username = NULL;
int pc_debug = 0;
int pc_remove = 0;
int pc_force = 0;
struct poptOption long_options[] = {
0, _("The debug level to run with"), NULL },
{ "no-remove", 'R', POPT_ARG_NONE, NULL, 'R', _("Do not remove home directory and mail spool"), NULL },
{ "force", 'f', POPT_ARG_NONE, NULL, 'f', _("Force removal of files not owned by the user"), NULL },
};
debug_prg_name = argv[0];
ret = set_locale();
ERROR("Error setting the locale\n");
ret = EXIT_FAILURE;
goto fini;
}
/* parse parameters */
switch (ret) {
case 'r':
break;
case 'R':
break;
case 'f':
break;
}
}
if (ret != -1) {
ret = EXIT_FAILURE;
goto fini;
}
if (pc_username == NULL) {
ret = EXIT_FAILURE;
goto fini;
}
ERROR("Error initializing the tools - no local domain\n");
} else {
ERROR("Error initializing the tools\n");
}
ret = EXIT_FAILURE;
goto fini;
}
/* if the domain was not given as part of FQDN, default to local domain */
ERROR("Invalid domain specified in FQDN\n");
ret = EXIT_FAILURE;
goto fini;
}
/*
* Fills in defaults for ops_ctx user did not specify.
*/
ERROR("Cannot set default values\n");
ret = EXIT_FAILURE;
goto fini;
}
/* Error message will be printed in the switch */
goto done;
}
ERROR("User %s is outside the defined ID range for domain\n",
ret = EXIT_FAILURE;
goto fini;
}
goto done;
}
/* userdel */
/* cancel transaction */
goto done;
}
goto fini;
}
pc_force);
ERROR("Not removing home dir - not owned by user\n");
ret = EXIT_FAILURE;
goto fini;
}
}
done:
if (ret) {
switch (ret) {
case ENOENT:
ERROR("No such user in local domain. "
"Removing users only allowed in local domain.\n");
break;
default:
ERROR("Internal error. Could not remove user.\n");
break;
}
ret = EXIT_FAILURE;
goto fini;
}
ret = EXIT_SUCCESS;
fini:
}