/*
SSSD
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 <talloc.h>
#include <tevent.h>
#include <popt.h>
#include <errno.h>
#include <fcntl.h>
#include "config.h"
#include "tools/tools_util.h"
#include "tools/sss_sync_ops.h"
{
char *confdb_path;
int ret;
if (confdb_path == NULL) {
return ENOMEM;
}
/* Connect to the conf db */
"Could not initialize connection to the confdb\n");
return ret;
}
"Could not initialize connection to the sysdb\n");
return ret;
}
return EOK;
}
/*
* Print poptUsage as well as our error message
*/
{
if (error) {
nl[0]='\n';
}
}
}
{
char **out;
char *orig, *n, *o;
unsigned int i;
n = orig;
tokens = 1;
n++;
tokens++;
}
if (!out) {
return ENOMEM;
}
n = o = orig;
for (i = 0; i < tokens; i++) {
o = n;
if (!n) {
break;
}
*n = '\0';
n++;
}
return EOK;
}
char **groups)
{
int i;
int ret;
if (!groups) {
return EOK;
}
for (i = 0; groups[i]; ++i) {
"Invalid name in group list, skipping: [%s] (%d)\n",
continue;
}
/* If FQDN is specified, it must be within the same domain as user */
if (domain) {
return EINVAL;
}
/* Use only groupname */
talloc_zfree(groups[i]);
return ENOMEM;
}
}
}
return EOK;
}
const char *fullname)
{
int ret;
return ret;
}
if (domain) {
/* only the local domain, whatever named is allowed in tools */
"Invalid domain %s specified in FQDN\n", domain);
return EINVAL;
}
} else {
"Name '%s' does not seem to be FQDN "
ERROR("Name '%1$s' does not seem to be FQDN "
return EINVAL;
}
}
return EOK;
}
char **grouplist,
char **badgroup)
{
int ret;
int i;
if (!groupinfo) {
return ENOMEM;
}
for (i=0; grouplist[i]; ++i) {
grouplist[i],
if (ret) {
break;
}
}
return ret;
}
struct sss_domain_info *dom)
{
if (id &&
return ERANGE;
}
return EOK;
}
int set_locale(void)
{
char *c;
if (c == NULL) {
/* If setlocale fails, continue with the default
* locale. */
}
errno = 0;
if (c == NULL) {
return errno;
}
errno = 0;
c = textdomain(PACKAGE);
if (c == NULL) {
return errno;
}
return EOK;
}
{
int ret;
"Could not allocate memory for tools context\n");
return ENOMEM;
}
/* Connect to the database */
goto fini;
}
goto fini;
}
"Could not allocate memory for data context\n");
ERROR("Out of memory\n");
goto fini;
}
fini:
return ret;
}
/*
* Check is path is owned by uid
* returns 0 - owns
* -1 - does not own
* >0 - an error occurred, error code
*/
{
int ret;
if (ret != 0) {
return ret;
}
return EOK;
}
return -1;
}
const char *maildir,
const char *username,
bool force)
{
int ret;
char *spool_file;
if (spool_file == NULL) {
goto fail;
}
if (force == false) {
/* Check the owner of the mail spool */
switch (ret) {
case 0:
break;
case -1:
spool_file, uid);
/* FALLTHROUGH */
default:
goto fail;
}
}
if (ret != 0) {
"Cannot remove() the spool file %s: [%d][%s]\n",
goto fail;
}
fail:
return ret;
}
const char *homedir,
const char *maildir,
const char *username,
{
int ret;
/* Should this be fatal? I don't think so. Maybe convert to ERROR? */
}
"Not removing home dir - not owned by user\n");
return EPERM;
}
/* Remove the tree */
return ret;
}
return EOK;
}
/* The reason for not putting this into create_homedir
* is better granularity when it comes to reporting error
* messages and tracebacks in pysss
*/
const char *username,
const char *maildir,
{
int ret;
if (spool_file == NULL) {
goto fail;
}
if (fd < 0) {
goto fail;
}
if (ret != 0) {
goto fail;
}
if (ret != 0) {
goto fail;
}
if (ret != 0) {
}
fail:
if (fd >= 0) {
if (ret != 0) {
"Cannot close() the spool file: [%d][%s]\n",
}
}
return ret;
}
const char *homedir,
{
int ret;
"Cannot populate user's home directory: [%d][%s].\n",
goto done;
}
done:
return ret;
}
{
if (!conf_path) {
goto done;
}
NULL, &userdel_cmd);
goto done;
}
errno = 0;
if (pid == 0) {
/* child */
} else {
/* parent */
if (pid == -1) {
goto done;
}
if (ret != 0) {
"command [%s] returned nonzero status %d.\n",
userdel_cmd, ret);
goto done;
}
} else if (WIFSIGNALED(status)) {
"command [%s] was terminated by signal %d.\n",
goto done;
} else if (WIFSTOPPED(status)) {
"command [%s] was stopped by signal %d.\n",
continue;
} else {
goto done;
}
}
if (child_pid == -1) {
goto done;
}
}
done:
return ret;
}