sss_sync_ops.c revision 8a1738f9379a1b8fb5c95c3df649e014ff5a1434
/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2009 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 <tevent.h>
#include <talloc.h>
#include "tools/sss_sync_ops.h"
/* Default settings for user attributes */
#define DFL_SHELL_VAL "/bin/bash"
#define DFL_BASEDIR_VAL "/home"
#define DFL_CREATE_HOMEDIR true
#define DFL_REMOVE_HOMEDIR true
#define DFL_UMASK 077
#define DFL_SKEL_DIR "/etc/skel"
#define DFL_MAIL_DIR "/var/spool/mail"
return val; \
} \
} while(0)
struct sync_op_res {
int error;
bool done;
};
/*
* Generic modify groups member
*/
char **grouplist,
int optype)
{
int ret;
int i;
if (!tmpctx) {
return ENOMEM;
}
/* FIXME: add transaction around loop */
for (i = 0; grouplist[i]; i++) {
grouplist[i]);
if (!parent_dn) {
goto done;
}
if (ret) {
goto done;
}
}
done:
return ret;
}
/*
* Modify a user
*/
struct user_mod_state {
struct sysdb_attrs *attrs;
};
const char *gecos,
const char *home,
const char *shell,
int lock,
struct sysdb_attrs **_attrs)
{
int ret;
struct sysdb_attrs *attrs;
return ENOMEM;
}
if (shell) {
shell);
"Could not add attribute to changeset\n");
}
if (home) {
home);
"Could not add attribute to changeset\n");
}
if (gecos) {
gecos);
"Could not add attribute to changeset\n");
}
if (uid) {
uid);
"Could not add attribute to changeset\n");
}
if (gid) {
gid);
"Could not add attribute to changeset\n");
}
"true");
"Could not add attribute to changeset\n");
}
/* PAM code checks for 'false' value in SYSDB_DISABLED attribute */
"false");
"Could not add attribute to changeset\n");
}
return EOK;
}
/*
* Public interface for modifying users
*/
{
int ret;
if (!member_dn) {
return ENOMEM;
}
}
&attrs);
return ret;
}
if (ret) {
return ret;
}
}
if (ret) {
return ret;
}
}
if (ret) {
return ret;
}
}
return EOK;
}
/*
* Public interface for modifying groups
*/
{
int ret;
if (!member_dn) {
return ENOMEM;
}
}
if (!attrs) {
return ENOMEM;
}
if (ret) {
return ret;
}
if (ret) {
return ret;
}
}
if (ret) {
return ret;
}
}
if (ret) {
return ret;
}
}
return EOK;
}
struct confdb_ctx *confdb,
int remove_home)
{
int ret;
char *conf_path;
bool dfl_remove_home;
if (!conf_path) {
return ENOMEM;
}
/* remove homedir on user creation? */
if (!remove_home) {
goto done;
}
} else {
}
/* a directory to remove mail spools from */
goto done;
}
done:
return ret;
}
/*
* Default values for add operations
*/
struct confdb_ctx *confdb,
const char *gecos,
const char *homedir,
const char *shell,
int create_home,
const char *skeldir)
{
int ret;
if (!conf_path) {
return ENOMEM;
}
/* gecos */
goto done;
}
/* homedir */
if (homedir) {
} else {
goto done;
}
}
goto done;
}
/* default shell */
if (!shell) {
goto done;
}
} else {
goto done;
}
}
/* create homedir on user creation? */
if (!create_home) {
goto done;
}
} else {
}
/* umask to create homedirs */
goto done;
}
/* a directory to create mail spools in */
goto done;
}
/* skeleton dir */
if (!skeldir) {
goto done;
}
} else {
goto done;
}
}
done:
return ret;
}
/*
* Public interface for adding users
*/
{
int ret;
if (ret) {
goto done;
}
if (!member_dn) {
goto done;
}
if (ret) {
goto done;
}
}
done:
return ret;
}
/*
* Public interface for deleting users
*/
{
int ret;
if (!user_dn) {
return ENOMEM;
}
if (ret) {
}
return ret;
}
/*
* Public interface for adding groups
*/
{
int ret;
}
return ret;
}
/*
* Public interface for deleting groups
*/
{
int ret;
return ENOMEM;
}
if (ret) {
}
return ret;
}
/*
* getpwnam, getgrnam and friends
*/
const char *name,
{
struct ldb_result *res;
const char *str;
int ret;
if (ret) {
return ret;
}
case 0:
return ENOENT;
case 1:
/* fill ops_ctx */
return ENOMEM;
}
return ENOMEM;
}
return ENOMEM;
}
return ENOMEM;
}
} else {
} else { /* Invalid value */
return EIO;
}
}
break;
default:
return EIO;
}
return EOK;
}
const char *name,
{
struct ldb_result *res;
const char *str;
int ret;
if (ret) {
return ret;
}
case 0:
return ENOENT;
case 1:
/* fill ops_ctx */
return ENOMEM;
}
break;
default:
return EIO;
}
return EOK;
}