sysdb.h revision 0228e28a3f07b5dc909cdc154dc89c4952f09280
842ae4bd224140319ae7feec1872b93dfd491143fielding/*
842ae4bd224140319ae7feec1872b93dfd491143fielding SSSD
842ae4bd224140319ae7feec1872b93dfd491143fielding
842ae4bd224140319ae7feec1872b93dfd491143fielding System Database Header
842ae4bd224140319ae7feec1872b93dfd491143fielding
842ae4bd224140319ae7feec1872b93dfd491143fielding Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd This program is free software; you can redistribute it and/or modify
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse it under the terms of the GNU General Public License as published by
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd the Free Software Foundation; either version 3 of the License, or
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd (at your option) any later version.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd This program is distributed in the hope that it will be useful,
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd but WITHOUT ANY WARRANTY; without even the implied warranty of
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd GNU General Public License for more details.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd You should have received a copy of the GNU General Public License
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd along with this program. If not, see <http://www.gnu.org/licenses/>.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd*/
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd#ifndef __SYS_DB_H__
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd#define __SYS_DB_H__
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#include "util/util.h"
6ace32dacb8313226eb9019275d0e4fa45a15148rse#include "confdb/confdb.h"
70535d6421eb979ac79d8f49d31cd94d75dd8b2fjorton#include <tevent.h>
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
a943533fd4d91d114af622731a405407990c4fb1rse#define SYSDB_CONF_SECTION "config/sysdb"
a943533fd4d91d114af622731a405407990c4fb1rse#define CACHE_SYSDB_FILE "cache_%s.ldb"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define LOCAL_SYSDB_FILE "sssd.ldb"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_BASE "cn=sysdb"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_DOM_BASE "cn=%s,cn=sysdb"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_USERS_CONTAINER "cn=users"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GROUPS_CONTAINER "cn=groups"
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_CUSTOM_CONTAINER "cn=custom"
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_TMPL_USER_BASE SYSDB_USERS_CONTAINER",cn=%s,"SYSDB_BASE
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_TMPL_GROUP_BASE SYSDB_GROUPS_CONTAINER",cn=%s,"SYSDB_BASE
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_TMPL_CUSTOM_BASE SYSDB_CUSTOM_CONTAINER",cn=%s,"SYSDB_BASE
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_USER_CLASS "user"
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_GROUP_CLASS "group"
7933d4a963def02417113b6798d87a36395053b0rse
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_NAME "name"
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_NEXTID "nextID"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_UIDNUM "uidNumber"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GIDNUM "gidNumber"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_CREATE_TIME "createTimestamp"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_PWD "userPassword"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_FULLNAME "fullName"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_HOMEDIR "homeDirectory"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_SHELL "loginShell"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_MEMBEROF "memberOf"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_DISABLED "disabled"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_MEMBER "member"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_MEMBERUID "memberUid"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_DEFAULTGROUP "defaultGroup"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_GECOS "gecos"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_LOCALE "locale"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_KEYBOARD "keyboard"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_SESSION "session"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_LAST_LOGIN "lastLogin"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_LAST_ONLINE_AUTH "lastOnlineAuth"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_USERPIC "userPicture"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_LAST_FAILED_LOGIN "lastFailedLogin"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_FAILED_LOGIN_ATTEMPTS "failedLoginAttempts"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_LAST_UPDATE "lastUpdate"
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_CACHE_EXPIRE "dataExpireTimestamp"
d1bb6e2664788e0437acc18e877562c9a796d7cerse#define SYSDB_INITGR_EXPIRE "initgrExpireTimestamp"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_CACHEDPWD "cachedPassword"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
0c44ed1cffad38b900b39e8c65996b9b9cff061djim#define SYSDB_UUID "uniqueID"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_UPN "userPrincipalName"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_CCACHE_FILE "ccacheFile"
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
71c00f988beb28388702e14cb7fe06f08bd792bbdougm#define SYSDB_ORIG_DN "originalDN"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_ORIG_MODSTAMP "originalModifyTimestamp"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_ORIG_MEMBEROF "originalMemberOf"
42167da203d969a1402cf7ce09c14586c04af1dfjim
53c239bee62c6d55b5ddfba5d99376d4c8de924ejwoolley#define SYSDB_USN "entryUSN"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_HIGH_USN "highestUSN"
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_NEXTID_FILTER "("SYSDB_NEXTID"=*)"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_UC "objectclass="SYSDB_USER_CLASS
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GC "objectclass="SYSDB_GROUP_CLASS
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_MPGC "|("SYSDB_UC")("SYSDB_GC")"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_PWNAM_FILTER "(&("SYSDB_UC")("SYSDB_NAME"=%s))"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_PWUID_FILTER "(&("SYSDB_UC")("SYSDB_UIDNUM"=%lu))"
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse#define SYSDB_PWENT_FILTER "("SYSDB_UC")"
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRNAM_FILTER "(&("SYSDB_GC")("SYSDB_NAME"=%s))"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRNA2_FILTER "(&("SYSDB_UC")("SYSDB_MEMBEROF"=%s))"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRGID_FILTER "(&("SYSDB_GC")("SYSDB_GIDNUM"=%lu))"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRENT_FILTER "("SYSDB_GC")"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRNAM_MPG_FILTER "(&("SYSDB_MPGC")("SYSDB_NAME"=%s))"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRGID_MPG_FILTER "(&("SYSDB_MPGC")("SYSDB_GIDNUM"=%lu))"
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRENT_MPG_FILTER "("SYSDB_MPGC")"
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_INITGR_FILTER "(&("SYSDB_GC")("SYSDB_GIDNUM"=*))"
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GETCACHED_FILTER "(&"SYSDB_UC")("SYSDB_LAST_LOGIN">=%lu))"
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_DEFAULT_ATTRS SYSDB_LAST_UPDATE, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_CACHE_EXPIRE, \
176c2742db03fcb7b7d13e6408dd967d87e542e9ben SYSDB_INITGR_EXPIRE, \
176c2742db03fcb7b7d13e6408dd967d87e542e9ben "objectClass"
176c2742db03fcb7b7d13e6408dd967d87e542e9ben
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_PW_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_GIDNUM, SYSDB_GECOS, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_HOMEDIR, SYSDB_SHELL, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_DEFAULT_ATTRS, \
7933d4a963def02417113b6798d87a36395053b0rse NULL}
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRSRC_ATTRS {SYSDB_NAME, SYSDB_GIDNUM, \
e335319a08e12eb7daff9afa80e985dc53f652b8jorton SYSDB_MEMBERUID, \
e335319a08e12eb7daff9afa80e985dc53f652b8jorton SYSDB_DEFAULT_ATTRS, \
e335319a08e12eb7daff9afa80e985dc53f652b8jorton NULL}
e335319a08e12eb7daff9afa80e985dc53f652b8jorton#define SYSDB_GRPW_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, \
e335319a08e12eb7daff9afa80e985dc53f652b8jorton SYSDB_DEFAULT_ATTRS, \
e335319a08e12eb7daff9afa80e985dc53f652b8jorton NULL}
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_GRENT_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, SYSDB_MEMBEROF, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_DEFAULT_ATTRS, \
7933d4a963def02417113b6798d87a36395053b0rse NULL}
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_INITGR_ATTR SYSDB_MEMBEROF
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_INITGR_ATTRS {SYSDB_GIDNUM, \
7933d4a963def02417113b6798d87a36395053b0rse SYSDB_DEFAULT_ATTRS, \
7933d4a963def02417113b6798d87a36395053b0rse NULL}
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_TMPL_USER SYSDB_NAME"=%s,"SYSDB_TMPL_USER_BASE
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_TMPL_GROUP SYSDB_NAME"=%s,"SYSDB_TMPL_GROUP_BASE
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_TMPL_CUSTOM_SUBTREE "cn=%s,"SYSDB_TMPL_CUSTOM_BASE
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_TMPL_CUSTOM SYSDB_NAME"=%s,cn=%s,"SYSDB_TMPL_CUSTOM_BASE
7933d4a963def02417113b6798d87a36395053b0rse
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_MOD_ADD LDB_FLAG_MOD_ADD
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_MOD_DEL LDB_FLAG_MOD_DELETE
7933d4a963def02417113b6798d87a36395053b0rse#define SYSDB_MOD_REP LDB_FLAG_MOD_REPLACE
7933d4a963def02417113b6798d87a36395053b0rse
7efe7de73c89c26518714a504359244d03cfbbc5jortonstruct confdb_ctx;
7efe7de73c89c26518714a504359244d03cfbbc5jortonstruct sysdb_ctx_list;
f84d3d83a741c21154d42e0ebdec9b9b37efeedcjortonstruct sysdb_ctx;
43c3e6a4b559b76b750c245ee95e2782c15b4296jim
3c36b0324c8486306904c84eb0264affc45ed56cwrowestruct sysdb_attrs {
3c36b0324c8486306904c84eb0264affc45ed56cwrowe int num;
3c36b0324c8486306904c84eb0264affc45ed56cwrowe struct ldb_message_element *a;
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse};
e8f95a682820a599fe41b22977010636be5c2717jim
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse/* sysdb_attrs helper functions */
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrsestruct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *memctx);
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm/* values are copied in the structure, allocated on "attrs" */
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougmint sysdb_attrs_add_val(struct sysdb_attrs *attrs,
7933d4a963def02417113b6798d87a36395053b0rse const char *name, const struct ldb_val *val);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_add_string(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *name, const char *str);
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_attrs_add_bool(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *name, bool value);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_add_long(struct sysdb_attrs *attrs,
8fdc55d1624c714391fe1f93ebafe98ace427f4adougm const char *name, long value);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_add_uint32(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *name, uint32_t value);
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_attrs_add_time_t(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *name, time_t value);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_get_el(struct sysdb_attrs *attrs, const char *name,
7933d4a963def02417113b6798d87a36395053b0rse struct ldb_message_element **el);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_steal_string(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *name, char *str);
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_attrs_get_string(struct sysdb_attrs *attrs, const char *name,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char **string);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_attrs_get_string_array(struct sysdb_attrs *attrs, const char *name,
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougm TALLOC_CTX *mem_ctx, const char ***string);
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougm
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougmint sysdb_attrs_replace_name(struct sysdb_attrs *attrs, const char *oldname,
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougm const char *newname);
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougm
a72de14bfdbf0be9d935be9bdc2df631ca5e032bdougmint sysdb_attrs_users_from_str_list(struct sysdb_attrs *attrs,
7933d4a963def02417113b6798d87a36395053b0rse const char *attr_name,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *domain,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char **list);
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_attrs_users_from_ldb_vals(struct sysdb_attrs *attrs,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *attr_name,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *domain,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse struct ldb_val *values,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse int num_values);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse/* convert an ldb error into an errno error */
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_error_to_errno(int ldberr);
0839d91ee551a0e19ea9577bb00976b97308dfddmartin
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse/* DNs related helper functions */
7933d4a963def02417113b6798d87a36395053b0rsestruct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *domain, const char *name);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrsestruct ldb_dn *sysdb_group_dn(struct sysdb_ctx *ctx, void *memctx,
7933d4a963def02417113b6798d87a36395053b0rse const char *domain, const char *name);
0839d91ee551a0e19ea9577bb00976b97308dfddmartinerrno_t sysdb_group_dn_name(struct sysdb_ctx *ctx, void *memctx,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *dn_str, char **name);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrsestruct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *ctx, void *memctx,
e6e65585927961caf45d4e9e932bb1f4e9e89ca1jerenkrantz const char *domain);
e8f95a682820a599fe41b22977010636be5c2717jimstruct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
e6e65585927961caf45d4e9e932bb1f4e9e89ca1jerenkrantz const char *domain, const char *object_name,
e8f95a682820a599fe41b22977010636be5c2717jim const char *subtree_name);
e6e65585927961caf45d4e9e932bb1f4e9e89ca1jerenkrantzstruct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
e8f95a682820a599fe41b22977010636be5c2717jim const char *domain,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse const char *subtree_name);
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrsechar *sysdb_user_strdn(TALLOC_CTX *memctx,
7933d4a963def02417113b6798d87a36395053b0rse const char *domain, const char *name);
7933d4a963def02417113b6798d87a36395053b0rsechar *sysdb_group_strdn(TALLOC_CTX *memctx,
7933d4a963def02417113b6798d87a36395053b0rse const char *domain, const char *name);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowestruct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint compare_ldb_dn_comp_num(const void *m1, const void *m2);
239dd0cf663713025d4451ddd465685021007d82wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe/* functions to start and finish transactions */
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_transaction_start(struct sysdb_ctx *ctx);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_transaction_commit(struct sysdb_ctx *ctx);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_transaction_cancel(struct sysdb_ctx *ctx);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe/* Sysdb initialization.
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe * call this function *only* once to initialize the database and get
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe * the sysdb ctx */
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_init(TALLOC_CTX *mem_ctx,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct confdb_ctx *cdb,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe const char *alt_db_path,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe bool allow_upgrade,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct sysdb_ctx_list **_ctx_list);
239dd0cf663713025d4451ddd465685021007d82wrowe/* used to initialize only one domain database.
239dd0cf663713025d4451ddd465685021007d82wrowe * Do NOT use if sysdb_init has already been called */
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_domain_init(TALLOC_CTX *mem_ctx,
239dd0cf663713025d4451ddd465685021007d82wrowe struct sss_domain_info *domain,
239dd0cf663713025d4451ddd465685021007d82wrowe const char *db_path,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct sysdb_ctx **_ctx);
56bd16e394f49423a22aa82643eb27f26db2c748jorton
56bd16e394f49423a22aa82643eb27f26db2c748jortonint sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list,
56bd16e394f49423a22aa82643eb27f26db2c748jorton struct sss_domain_info *domain,
56bd16e394f49423a22aa82643eb27f26db2c748jorton struct sysdb_ctx **_ctx);
56bd16e394f49423a22aa82643eb27f26db2c748jorton
e8f95a682820a599fe41b22977010636be5c2717jim/* functions to retrieve information from sysdb
e8f95a682820a599fe41b22977010636be5c2717jim * These functions automatically starts an operation
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe * therefore they cannot be called within a transaction */
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_getpwnam(TALLOC_CTX *mem_ctx,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct sysdb_ctx *ctx,
239dd0cf663713025d4451ddd465685021007d82wrowe struct sss_domain_info *domain,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe const char *name,
d1bb6e2664788e0437acc18e877562c9a796d7cerse struct ldb_result **res);
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
71c00f988beb28388702e14cb7fe06f08bd792bbdougmint sysdb_getpwuid(TALLOC_CTX *mem_ctx,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm struct sysdb_ctx *ctx,
7933d4a963def02417113b6798d87a36395053b0rse struct sss_domain_info *domain,
e8f95a682820a599fe41b22977010636be5c2717jim uid_t uid,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe struct ldb_result **res);
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe
8aced0b621ea45e8621c7073b0bfbe5ea91c2329wroweint sysdb_enumpwent(TALLOC_CTX *mem_ctx,
239dd0cf663713025d4451ddd465685021007d82wrowe struct sysdb_ctx *ctx,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe struct sss_domain_info *domain,
239dd0cf663713025d4451ddd465685021007d82wrowe struct ldb_result **res);
93350a0dfa22a2c523cdcbad3357327013ecc145martin
2c038bf2465bf2150c396f4e67f68ebc5bb9e6e9wroweint sysdb_getgrnam(TALLOC_CTX *mem_ctx,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe struct sysdb_ctx *ctx,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe struct sss_domain_info *domain,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe const char *name,
239dd0cf663713025d4451ddd465685021007d82wrowe struct ldb_result **res);
8a5120efd60acf0323371cb30cba489723b03819jorton
e13735ceb2025ea8ed0c530093e13fe57b62f1efwroweint sysdb_getgrgid(TALLOC_CTX *mem_ctx,
b5451913a64155af2eab4f12ecbaf16e15acafc3wrowe struct sysdb_ctx *ctx,
e13735ceb2025ea8ed0c530093e13fe57b62f1efwrowe struct sss_domain_info *domain,
e13735ceb2025ea8ed0c530093e13fe57b62f1efwrowe gid_t gid,
8aced0b621ea45e8621c7073b0bfbe5ea91c2329wrowe struct ldb_result **res);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wroweint sysdb_enumgrent(TALLOC_CTX *mem_ctx,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct sysdb_ctx *ctx,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct sss_domain_info *domain,
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe struct ldb_result **res);
2b7078b0c4fd5b6054f6f2d4f626177844f5c6f7wrowe
af5dd1c93d2185f7e37f8783c593b64fd35ea8a6wroweint sysdb_initgroups(TALLOC_CTX *mem_ctx,
af5dd1c93d2185f7e37f8783c593b64fd35ea8a6wrowe struct sysdb_ctx *ctx,
8dc154408549195c828b823e9dc7396f107f2512jorton struct sss_domain_info *domain,
8dc154408549195c828b823e9dc7396f107f2512jorton const char *name,
b79b480213d7452db127eec054e52eb2b4fa6153wrowe struct ldb_result **res);
417f504d4d11631c0d062be85347f82a26c88677aaron
417f504d4d11631c0d062be85347f82a26c88677aaronint sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
7933d4a963def02417113b6798d87a36395053b0rse struct sysdb_ctx *ctx,
7933d4a963def02417113b6798d87a36395053b0rse struct sss_domain_info *domain,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm const char *name,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm const char **attributes,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct ldb_result **res);
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm/* functions that modify the databse
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm * they have to be called within a transaction
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm * See sysdb_transaction_send()/_recv() */
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm/* Delete Entry */
9cb81d96f6b556cec1aa456191f43f7932aabaaedougmint sysdb_delete_entry(struct sysdb_ctx *ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct ldb_dn *dn,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm bool ignore_not_found);
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougmint sysdb_delete_recursive(TALLOC_CTX *mem_ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sysdb_ctx *ctx,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm struct ldb_dn *dn,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm bool ignore_not_found);
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm/* Search Entry */
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougmint sysdb_search_entry(TALLOC_CTX *mem_ctx,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton struct sysdb_ctx *ctx,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton struct ldb_dn *base_dn,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton int scope,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm const char *filter,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm const char **attrs,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm size_t *msgs_count,
cde1010d880fb6230f80c9d697842ea0b1cb79c7dougm struct ldb_message ***msgs);
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm/* Search User (by uid or name) */
621bd763d2e4d32f19013ac8b76b375b5a01851fdougmint sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct sysdb_ctx *ctx,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct sss_domain_info *domain,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm const char *name,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm const char **attrs,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct ldb_message **msg);
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm
621bd763d2e4d32f19013ac8b76b375b5a01851fdougmint sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct sysdb_ctx *ctx,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct sss_domain_info *domain,
ccbf65bf19ac58a396133923aee4597e0870ec47bnicholes uid_t uid,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm const char **attrs,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct ldb_message **msg);
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm/* Search Group (gy gid or name) */
621bd763d2e4d32f19013ac8b76b375b5a01851fdougmint sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm struct sysdb_ctx *ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sss_domain_info *domain,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm const char *name,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm const char **attrs,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct ldb_message **msg);
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sss_domain_info *domain,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm gid_t gid,
469549ac22c6f7b9ecdd9df2565925563e4df84djwoolley const char **attrs,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct ldb_message **msg);
a943533fd4d91d114af622731a405407990c4fb1rse
a943533fd4d91d114af622731a405407990c4fb1rse/* Replace entry attrs */
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_set_entry_attr(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct ldb_dn *entry_dn,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_attrs *attrs,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm int mod_op);
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm/* Replace user attrs */
9cb81d96f6b556cec1aa456191f43f7932aabaaedougmint sysdb_set_user_attr(TALLOC_CTX *mem_ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sysdb_ctx *ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sss_domain_info *domain,
a943533fd4d91d114af622731a405407990c4fb1rse const char *name,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_attrs *attrs,
a943533fd4d91d114af622731a405407990c4fb1rse int mod_op);
a943533fd4d91d114af622731a405407990c4fb1rse
a943533fd4d91d114af622731a405407990c4fb1rse/* Replace group attrs */
9cb81d96f6b556cec1aa456191f43f7932aabaaedougmint sysdb_set_group_attr(TALLOC_CTX *mem_ctx,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton struct sysdb_ctx *ctx,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton struct sss_domain_info *domain,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton const char *name,
e16695d440d82ec6f9a4b9af18ae38dbeaa19366jerenkrantz struct sysdb_attrs *attrs,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm int mod_op);
a943533fd4d91d114af622731a405407990c4fb1rse
71c00f988beb28388702e14cb7fe06f08bd792bbdougm/* Allocate a new id */
a943533fd4d91d114af622731a405407990c4fb1rseint sysdb_get_new_id(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
6d7efb8c76b56eaebd6032096771c9e44b247f3fdougm struct sss_domain_info *domain,
f4c472b8dce3c2e559232dbb5b27ed2466922ea4jerenkrantz uint32_t *id);
f4c472b8dce3c2e559232dbb5b27ed2466922ea4jerenkrantz
469549ac22c6f7b9ecdd9df2565925563e4df84djwoolley/* Add user (only basic attrs and w/o checks) */
469549ac22c6f7b9ecdd9df2565925563e4df84djwoolleyint sysdb_add_basic_user(TALLOC_CTX *mem_ctx,
d0ba3b97557d47323bd055fb4002ed7692f703b9jerenkrantz struct sysdb_ctx *ctx,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm struct sss_domain_info *domain,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton const char *name,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton uid_t uid, gid_t gid,
e16695d440d82ec6f9a4b9af18ae38dbeaa19366jerenkrantz const char *gecos,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm const char *homedir,
a943533fd4d91d114af622731a405407990c4fb1rse const char *shell);
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
a943533fd4d91d114af622731a405407990c4fb1rse/* Add user (all checks) */
a943533fd4d91d114af622731a405407990c4fb1rseint sysdb_add_user(TALLOC_CTX *mem_ctx,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm struct sysdb_ctx *ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sss_domain_info *domain,
d28d7091912b3d911bdbe18df2d37d315681054bdougm const char *name,
a943533fd4d91d114af622731a405407990c4fb1rse uid_t uid, gid_t gid,
931b4fd1cc9dd3da096c45f4bf7ddcc14e0985c1dougm const char *gecos,
a943533fd4d91d114af622731a405407990c4fb1rse const char *homedir,
a943533fd4d91d114af622731a405407990c4fb1rse const char *shell,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_attrs *attrs,
a943533fd4d91d114af622731a405407990c4fb1rse int cache_timeout);
a943533fd4d91d114af622731a405407990c4fb1rse
a943533fd4d91d114af622731a405407990c4fb1rse/* Add group (only basic attrs and w/o checks) */
c947acd3d1a604a0acad6a53ef685312d4410fc5dougmint sysdb_add_basic_group(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sss_domain_info *domain,
a943533fd4d91d114af622731a405407990c4fb1rse const char *name, gid_t gid);
a943533fd4d91d114af622731a405407990c4fb1rse
a943533fd4d91d114af622731a405407990c4fb1rse/* Add group (all checks) */
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_add_group(TALLOC_CTX *mem_ctx,
7933d4a963def02417113b6798d87a36395053b0rse struct sysdb_ctx *ctx,
7b6ba9c468f26bdb3492d5e8cb79628a3b04e8c8wrowe struct sss_domain_info *domain,
7933d4a963def02417113b6798d87a36395053b0rse const char *name, gid_t gid,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_attrs *attrs,
a943533fd4d91d114af622731a405407990c4fb1rse int cache_timeout);
2f32a3d146dc55d81b31660386e17c3b83ad61b8bnicholes
a943533fd4d91d114af622731a405407990c4fb1rse/* mod_op must be either LDB_FLAG_MOD_ADD or LDB_FLAG_MOD_DELETE */
71c00f988beb28388702e14cb7fe06f08bd792bbdougmint sysdb_mod_group_member(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct ldb_dn *member_dn,
7933d4a963def02417113b6798d87a36395053b0rse struct ldb_dn *group_dn,
7933d4a963def02417113b6798d87a36395053b0rse int mod_op);
71c00f988beb28388702e14cb7fe06f08bd792bbdougm
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_store_user(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sss_domain_info *domain,
2f32a3d146dc55d81b31660386e17c3b83ad61b8bnicholes const char *name,
a943533fd4d91d114af622731a405407990c4fb1rse const char *pwd,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm uid_t uid, gid_t gid,
71c00f988beb28388702e14cb7fe06f08bd792bbdougm const char *gecos,
a943533fd4d91d114af622731a405407990c4fb1rse const char *homedir,
7933d4a963def02417113b6798d87a36395053b0rse const char *shell,
7933d4a963def02417113b6798d87a36395053b0rse struct sysdb_attrs *attrs,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe uint64_t cache_timeout);
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_store_group(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_ctx *ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sss_domain_info *domain,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *name,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe gid_t gid,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_attrs *attrs,
ccbf65bf19ac58a396133923aee4597e0870ec47bnicholes uint64_t cache_timeout);
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_add_group_member(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_ctx *ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sss_domain_info *domain,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *group,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *user);
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_remove_group_member(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_ctx *ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sss_domain_info *domain,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *group,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *user);
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe/* Password caching function.
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe * If you are in a transaction ignore sysdb and pass in the handle.
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe * If you are not in a transaction pass NULL in handle and provide sysdb,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe * in this case a transaction will be automatically started and the
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe * function will be completely wrapped in it's own sysdb transaction */
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_cache_password(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_ctx *sysdb,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sss_domain_info *domain,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton const char *username,
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton const char *password);
2261f694ce2fc09f9df6c65bd8e1f4230313696bjorton
e726f34f8da08c01ee8bc90904b26196b69c8587wroweerrno_t check_failed_login_attempts(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct confdb_ctx *cdb,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct ldb_message *ldb_msg,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe uint32_t *failed_login_attempts,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe time_t *delayed_until);
e726f34f8da08c01ee8bc90904b26196b69c8587wroweint sysdb_cache_auth(TALLOC_CTX *mem_ctx,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sysdb_ctx *sysdb,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct sss_domain_info *domain,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe const char *name,
ccbf65bf19ac58a396133923aee4597e0870ec47bnicholes const uint8_t *authtok,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe size_t authtok_size,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct confdb_ctx *cdb,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe bool just_check,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe time_t *_expire_date,
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrse time_t *_delayed_until);
7933d4a963def02417113b6798d87a36395053b0rse
cc003103e52ff9d5fe9bed567ef9438613ab4fbfrseint sysdb_store_custom(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *ctx,
7933d4a963def02417113b6798d87a36395053b0rse struct sss_domain_info *domain,
7933d4a963def02417113b6798d87a36395053b0rse const char *object_name,
825479074daa2c65852666c4b26d771dff957507jorton const char *subtree_name,
e8f95a682820a599fe41b22977010636be5c2717jim struct sysdb_attrs *attrs);
825479074daa2c65852666c4b26d771dff957507jorton
825479074daa2c65852666c4b26d771dff957507jortonint sysdb_search_custom(TALLOC_CTX *mem_ctx,
a943533fd4d91d114af622731a405407990c4fb1rse struct sysdb_ctx *sysdb,
dfaea9dfb7e6fd2c97b9d35a75d7bcab94af8ff8dougm struct sss_domain_info *domain,
a943533fd4d91d114af622731a405407990c4fb1rse const char *filter,
d2ffb32434f79782ff7a364ffa31064698c5c645jorton const char *subtree_name,
a943533fd4d91d114af622731a405407990c4fb1rse const char **attrs,
7b6ba9c468f26bdb3492d5e8cb79628a3b04e8c8wrowe size_t *msgs_count,
a943533fd4d91d114af622731a405407990c4fb1rse struct ldb_message ***msgs);
fa599e0e097d4d933c4dc378ffbfc3c045dd589ewrowe
a943533fd4d91d114af622731a405407990c4fb1rseint sysdb_search_custom_by_name(TALLOC_CTX *mem_ctx,
0fce4eaa9fdf964f33fab19d0adac422a5305261dougm struct sysdb_ctx *sysdb,
a943533fd4d91d114af622731a405407990c4fb1rse struct sss_domain_info *domain,
a943533fd4d91d114af622731a405407990c4fb1rse const char *object_name,
0fce4eaa9fdf964f33fab19d0adac422a5305261dougm const char *subtree_name,
825479074daa2c65852666c4b26d771dff957507jorton const char **attrs,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe size_t *_count,
e726f34f8da08c01ee8bc90904b26196b69c8587wrowe struct ldb_message ***_msgs);
dfaea9dfb7e6fd2c97b9d35a75d7bcab94af8ff8dougm
7933d4a963def02417113b6798d87a36395053b0rseint sysdb_delete_custom(TALLOC_CTX *mem_ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sysdb_ctx *ctx,
9cb81d96f6b556cec1aa456191f43f7932aabaaedougm struct sss_domain_info *domain,
621bd763d2e4d32f19013ac8b76b375b5a01851fdougm const char *object_name,
7933d4a963def02417113b6798d87a36395053b0rse const char *subtree_name);
7933d4a963def02417113b6798d87a36395053b0rse
6ace32dacb8313226eb9019275d0e4fa45a15148rseint sysdb_asq_search(TALLOC_CTX *mem_ctx,
6ace32dacb8313226eb9019275d0e4fa45a15148rse struct sysdb_ctx *sysdb,
7933d4a963def02417113b6798d87a36395053b0rse struct sss_domain_info *domain,
7933d4a963def02417113b6798d87a36395053b0rse struct ldb_dn *base_dn,
7933d4a963def02417113b6798d87a36395053b0rse const char *expression,
7933d4a963def02417113b6798d87a36395053b0rse const char *asq_attribute,
7933d4a963def02417113b6798d87a36395053b0rse const char **attrs,
7933d4a963def02417113b6798d87a36395053b0rse size_t *msgs_count,
6ace32dacb8313226eb9019275d0e4fa45a15148rse struct ldb_message ***msgs);
int sysdb_search_users(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sub_filter,
const char **attrs,
size_t *msgs_count,
struct ldb_message ***msgs);
int sysdb_delete_user(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, uid_t uid);
int sysdb_search_groups(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *sub_filter,
const char **attrs,
size_t *msgs_count,
struct ldb_message ***msgs);
int sysdb_delete_group(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char *name, gid_t gid);
errno_t sysdb_attrs_to_list(TALLOC_CTX *memctx,
struct sysdb_attrs **attrs,
int attr_count,
const char *attr_name,
char ***_list);
#endif /* __SYS_DB_H__ */