sss_sync_ops.h revision b76531423695f649f1907422d9ecbb8c14143999
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl/*
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl Authors:
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl Jakub Hrozek <jhrozek@redhat.com>
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl Copyright (C) 2009 Red Hat
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl This program is free software; you can redistribute it and/or modify
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl it under the terms of the GNU General Public License as published by
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl the Free Software Foundation; either version 3 of the License, or
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl (at your option) any later version.
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl This program is distributed in the hope that it will be useful,
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco but WITHOUT ANY WARRANTY; without even the implied warranty of
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco GNU General Public License for more details.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco You should have received a copy of the GNU General Public License
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco along with this program. If not, see <http://www.gnu.org/licenses/>.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco*/
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#ifndef __SSS_OPS_H__
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define __SSS_OPS_H__
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#include "tools/tools_util.h"
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#include <stdbool.h>
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define DO_LOCK 1
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define DO_UNLOCK 2
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* 0 = not set, pick default */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define DO_CREATE_HOME 1
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#define DO_NOT_CREATE_HOME 2
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define DO_REMOVE_HOME 1
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define DO_NOT_REMOVE_HOME 2
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define DO_FORCE_REMOVAL 1
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riescostruct ops_ctx {
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco struct sss_domain_info *domain;
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco char *name;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco uid_t uid;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco gid_t gid;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco char *gecos;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco char *home;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco char *shell;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco int lock;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco bool create_homedir;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco bool remove_homedir;
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco mode_t umask;
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco char *skeldir;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco char *maildir;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco char **addgroups;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco char **rmgroups;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco};
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* default values for add operations */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint useradd_defaults(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct confdb_ctx *confdb,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *gecos,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *homedir,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *shell,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int create_home,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *skeldir);
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco/* default values for remove operations */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint userdel_defaults(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct confdb_ctx *confdb,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int remove_home);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* synchronous operations */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint useradd(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint userdel(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct sysdb_ctx *sysdb,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
7474965b2e6323002c96c0b39a59843cde201870Adrián Riescoint usermod(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint groupadd(struct sysdb_ctx *sysdb,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint groupdel(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct sysdb_ctx *sysdb,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint groupmod(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *data);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx,
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco const char *name,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *out);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoint sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *name,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ops_ctx *out);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#endif /* __SSS_OPS_H__ */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco