sysdb.h revision 684d1b48b5582a1bf7812b8c3c663592dc6dfed9
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder/*
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly SSSD
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens Elkner
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly System Database Header
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly This program is free software; you can redistribute it and/or modify
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly it under the terms of the GNU General Public License as published by
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly the Free Software Foundation; either version 3 of the License, or
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly (at your option) any later version.
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly This program is distributed in the hope that it will be useful,
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly but WITHOUT ANY WARRANTY; without even the implied warranty of
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly GNU General Public License for more details.
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder You should have received a copy of the GNU General Public License
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
e90dc723887d541f809007ae81c9bb73ced9592eChristian Maeder*/
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#ifndef __SYS_DB_H__
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly#define __SYS_DB_H__
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder#include "util/util.h"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#include "confdb/confdb.h"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#include <tevent.h>
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_CONF_SECTION "config/sysdb"
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define CACHE_SYSDB_FILE "cache_%s.ldb"
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define LOCAL_SYSDB_FILE "sssd.ldb"
f21c7417bdd1c0282025cba0f5cb0ff5bc5c98eeLiam O'Reilly
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_BASE "cn=sysdb"
50c62c8c45643f09bcb2f4a99b07bf1d072ecf40Christian Maeder#define SYSDB_DOM_BASE "cn=%s,cn=sysdb"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_USERS_CONTAINER "cn=users"
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder#define SYSDB_GROUPS_CONTAINER "cn=groups"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_CUSTOM_CONTAINER "cn=custom"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_NETGROUP_CONTAINER "cn=Netgroups"
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define SYSDB_TMPL_USER_BASE SYSDB_USERS_CONTAINER",cn=%s,"SYSDB_BASE
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_TMPL_GROUP_BASE SYSDB_GROUPS_CONTAINER",cn=%s,"SYSDB_BASE
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define SYSDB_TMPL_CUSTOM_BASE SYSDB_CUSTOM_CONTAINER",cn=%s,"SYSDB_BASE
036ecbd8f721096321f47cf6a354a9d1bf3d032fChristian Maeder#define SYSDB_TMPL_NETGROUP_BASE SYSDB_NETGROUP_CONTAINER",cn=%s,"SYSDB_BASE
aa4d26536fffe0153cd81d28925985892ac2f300Christian Maeder
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder#define SYSDB_USER_CLASS "user"
f21c7417bdd1c0282025cba0f5cb0ff5bc5c98eeLiam O'Reilly#define SYSDB_GROUP_CLASS "group"
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define SYSDB_NETGROUP_CLASS "netgroup"
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder#define SYSDB_NAME "name"
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder#define SYSDB_NAME_ALIAS "nameAlias"
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define SYSDB_OBJECTCLASS "objectClass"
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define SYSDB_NEXTID "nextID"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_UIDNUM "uidNumber"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_GIDNUM "gidNumber"
9e5f4073e948104307d43c3962d624b8416f191fLiam O'Reilly#define SYSDB_CREATE_TIME "createTimestamp"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_PWD "userPassword"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_FULLNAME "fullName"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_HOMEDIR "homeDirectory"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_SHELL "loginShell"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_MEMBEROF "memberOf"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_DISABLED "disabled"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_MEMBER "member"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_MEMBERUID "memberUid"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_POSIX "isPosix"
ebd23ec61635b0bebf7969d14f65b9d1e39f2b26Liam O'Reilly
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define SYSDB_DEFAULTGROUP "defaultGroup"
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define SYSDB_GECOS "gecos"
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define SYSDB_LOCALE "locale"
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define SYSDB_KEYBOARD "keyboard"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_SESSION "session"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_LAST_LOGIN "lastLogin"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_LAST_ONLINE_AUTH "lastOnlineAuth"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_USERPIC "userPicture"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_LAST_FAILED_LOGIN "lastFailedLogin"
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define SYSDB_FAILED_LOGIN_ATTEMPTS "failedLoginAttempts"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder#define SYSDB_LAST_UPDATE "lastUpdate"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_CACHE_EXPIRE "dataExpireTimestamp"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_INITGR_EXPIRE "initgrExpireTimestamp"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define SYSDB_AUTHORIZED_SERVICE "authorizedService"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_AUTHORIZED_HOST "authorizedHost"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_NETGROUP_TRIPLE "netgroupTriple"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_ORIG_NETGROUP_MEMBER "originalMemberNisNetgroup"
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define SYSDB_NETGROUP_MEMBER "memberNisNetgroup"
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define SYSDB_DESCRIPTION "description"
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define SYSDB_CACHEDPWD "cachedPassword"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_UUID "uniqueID"
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define SYSDB_UPN "userPrincipalName"
e8d99f05c231b379be702a1aa8c7dd0b3c666928Liam O'Reilly#define SYSDB_CCACHE_FILE "ccacheFile"
e8d99f05c231b379be702a1aa8c7dd0b3c666928Liam O'Reilly
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_ORIG_DN "originalDN"
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_ORIG_MODSTAMP "originalModifyTimestamp"
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define SYSDB_ORIG_MEMBEROF "originalMemberOf"
e8d99f05c231b379be702a1aa8c7dd0b3c666928Liam O'Reilly
e7cd36335f0f7be9ed5005e71d94c2856b588d62Christian Maeder#define SYSDB_USN "entryUSN"
e7cd36335f0f7be9ed5005e71d94c2856b588d62Christian Maeder#define SYSDB_HIGH_USN "highestUSN"
e7cd36335f0f7be9ed5005e71d94c2856b588d62Christian Maeder
e7cd36335f0f7be9ed5005e71d94c2856b588d62Christian Maeder#define SYSDB_NEXTID_FILTER "("SYSDB_NEXTID"=*)"
e8d99f05c231b379be702a1aa8c7dd0b3c666928Liam O'Reilly
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_UC "objectclass="SYSDB_USER_CLASS
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_GC "objectclass="SYSDB_GROUP_CLASS
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_NC "objectclass="SYSDB_NETGROUP_CLASS
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_MPGC "|("SYSDB_UC")("SYSDB_GC")"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_PWNAM_FILTER "(&("SYSDB_UC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_PWUID_FILTER "(&("SYSDB_UC")("SYSDB_UIDNUM"=%lu))"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_PWENT_FILTER "("SYSDB_UC")"
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define SYSDB_GRNAM_FILTER "(&("SYSDB_GC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder#define SYSDB_GRNA2_FILTER "(&("SYSDB_UC")("SYSDB_MEMBEROF"=%s))"
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder#define SYSDB_GRGID_FILTER "(&("SYSDB_GC")("SYSDB_GIDNUM"=%lu))"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_GRENT_FILTER "("SYSDB_GC")"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_GRNAM_MPG_FILTER "(&("SYSDB_MPGC")(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_GRGID_MPG_FILTER "(&("SYSDB_MPGC")("SYSDB_GIDNUM"=%lu))"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_GRENT_MPG_FILTER "("SYSDB_MPGC")"
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder#define SYSDB_INITGR_FILTER "(&("SYSDB_GC")("SYSDB_GIDNUM"=*))"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define SYSDB_GETCACHED_FILTER "(&"SYSDB_UC")("SYSDB_LAST_LOGIN">=%lu))"
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define SYSDB_NETGR_FILTER "(&("SYSDB_NC")("SYSDB_NAME"=%s))"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_NETGR_TRIPLES_FILTER "(|("SYSDB_NAME"=%s)("SYSDB_MEMBEROF"=%s))"
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder#define SYSDB_HAS_ENUMERATED "has_enumerated"
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_DEFAULT_ATTRS SYSDB_LAST_UPDATE, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_CACHE_EXPIRE, \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder SYSDB_INITGR_EXPIRE, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_OBJECTCLASS
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
4314e26a12954cb1c9be4dea10aa8103edac5bbbChristian Maeder#define SYSDB_PW_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_GIDNUM, SYSDB_GECOS, \
ebd23ec61635b0bebf7969d14f65b9d1e39f2b26Liam O'Reilly SYSDB_HOMEDIR, SYSDB_SHELL, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_DEFAULT_ATTRS, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder NULL}
ebd23ec61635b0bebf7969d14f65b9d1e39f2b26Liam O'Reilly#define SYSDB_GRSRC_ATTRS {SYSDB_NAME, SYSDB_GIDNUM, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_MEMBERUID, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_DEFAULT_ATTRS, \
4314e26a12954cb1c9be4dea10aa8103edac5bbbChristian Maeder NULL}
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_GRPW_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_DEFAULT_ATTRS, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder NULL}
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SYSDB_GRENT_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, SYSDB_MEMBEROF, \
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder SYSDB_DEFAULT_ATTRS, \
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder NULL}
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_NETGR_ATTRS {SYSDB_NAME, SYSDB_NETGROUP_TRIPLE, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder SYSDB_NETGROUP_MEMBER, \
e0f1794e365dd347e97b37d7d22b2fce27296fa1Christian Maeder SYSDB_DEFAULT_ATTRS, \
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder NULL}
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder#define SYSDB_INITGR_ATTR SYSDB_MEMBEROF
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_INITGR_ATTRS {SYSDB_GIDNUM, SYSDB_POSIX, \
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder SYSDB_DEFAULT_ATTRS, \
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder NULL}
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder#define SYSDB_TMPL_USER SYSDB_NAME"=%s,"SYSDB_TMPL_USER_BASE
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_TMPL_GROUP SYSDB_NAME"=%s,"SYSDB_TMPL_GROUP_BASE
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_TMPL_NETGROUP SYSDB_NAME"=%s,"SYSDB_TMPL_NETGROUP_BASE
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define SYSDB_TMPL_CUSTOM_SUBTREE "cn=%s,"SYSDB_TMPL_CUSTOM_BASE
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define SYSDB_TMPL_CUSTOM SYSDB_NAME"=%s,cn=%s,"SYSDB_TMPL_CUSTOM_BASE
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
aa4d26536fffe0153cd81d28925985892ac2f300Christian Maeder#define SYSDB_MOD_ADD LDB_FLAG_MOD_ADD
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_MOD_DEL LDB_FLAG_MOD_DELETE
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SYSDB_MOD_REP LDB_FLAG_MOD_REPLACE
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maederstruct confdb_ctx;
648fe1220044aac847acbdfbc4155af5556063ebChristian Maederstruct sysdb_ctx;
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maederstruct sysdb_ctx_list {
bcd914850de931848b86d7728192a149f9c0108bChristian Maeder struct sysdb_ctx **dbs;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly size_t num_dbs;
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly char *db_path;
580f1724640a78be687e79d0ec95dd2665e77e91Liam O'Reilly};
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maederstruct sysdb_attrs {
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder int num;
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder struct ldb_message_element *a;
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder};
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly
f21c7417bdd1c0282025cba0f5cb0ff5bc5c98eeLiam O'Reilly/* sysdb_attrs helper functions */
f21c7417bdd1c0282025cba0f5cb0ff5bc5c98eeLiam O'Reillystruct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *mem_ctx);
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder/* values are copied in the structure, allocated on "attrs" */
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederint sysdb_attrs_add_val(struct sysdb_attrs *attrs,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder const char *name, const struct ldb_val *val);
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederint sysdb_attrs_add_string(struct sysdb_attrs *attrs,
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder const char *name, const char *str);
ee48a7a67da604356b665e51aa7545536a09b737Christian Maederint sysdb_attrs_add_bool(struct sysdb_attrs *attrs,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder const char *name, bool value);
d381ab99d6e2e56e09030577d65d9a118f246d35Christian Maederint sysdb_attrs_add_long(struct sysdb_attrs *attrs,
d381ab99d6e2e56e09030577d65d9a118f246d35Christian Maeder const char *name, long value);
ee48a7a67da604356b665e51aa7545536a09b737Christian Maederint sysdb_attrs_add_uint32(struct sysdb_attrs *attrs,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder const char *name, uint32_t value);
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maederint sysdb_attrs_add_time_t(struct sysdb_attrs *attrs,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder const char *name, time_t value);
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maederint sysdb_attrs_get_el(struct sysdb_attrs *attrs, const char *name,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly struct ldb_message_element **el);
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reillyint sysdb_attrs_steal_string(struct sysdb_attrs *attrs,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char *name, char *str);
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reillyint sysdb_attrs_get_string(struct sysdb_attrs *attrs, const char *name,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char **string);
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reillyint sysdb_attrs_get_string_array(struct sysdb_attrs *attrs, const char *name,
580f1724640a78be687e79d0ec95dd2665e77e91Liam O'Reilly TALLOC_CTX *mem_ctx, const char ***string);
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maedererrno_t sysdb_attrs_get_bool(struct sysdb_attrs *attrs, const char *name,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder bool *value);
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maederint sysdb_attrs_get_uint32_t(struct sysdb_attrs *attrs, const char *name,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder uint32_t *value);
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder
7d96b1ef2b8597330aedee6713615ec15508edcfLiam O'Reillyint sysdb_attrs_replace_name(struct sysdb_attrs *attrs, const char *oldname,
7d96b1ef2b8597330aedee6713615ec15508edcfLiam O'Reilly const char *newname);
7d96b1ef2b8597330aedee6713615ec15508edcfLiam O'Reilly
7d96b1ef2b8597330aedee6713615ec15508edcfLiam O'Reillyint sysdb_attrs_users_from_str_list(struct sysdb_attrs *attrs,
7d96b1ef2b8597330aedee6713615ec15508edcfLiam O'Reilly const char *attr_name,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char *domain,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char *const *list);
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reillyint sysdb_attrs_users_from_ldb_vals(struct sysdb_attrs *attrs,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char *attr_name,
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly const char *domain,
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly struct ldb_val *values,
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly int num_values);
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reillyerrno_t sysdb_attrs_primary_name(struct sysdb_ctx *sysdb,
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly struct sysdb_attrs *attrs,
bc350328e6ac2d9074317e222b4207a6aa49afeaLiam O'Reilly const char *ldap_attr,
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reilly const char **_primary);
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reillyerrno_t sysdb_attrs_get_aliases(TALLOC_CTX *mem_ctx,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder struct sysdb_attrs *attrs,
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder const char *primary,
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder const char ***_aliases);
ee48a7a67da604356b665e51aa7545536a09b737Christian Maedererrno_t sysdb_attrs_primary_name_list(struct sysdb_ctx *sysdb,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder TALLOC_CTX *mem_ctx,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder struct sysdb_attrs **attr_list,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder size_t attr_count,
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder const char *ldap_attr,
dc403ff45531bc75a7544b8b5fc52a5217a1a54aChristian Maeder char ***name_list);
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder
45e2bc90dd11147156ddd7f9651ce8b2ec00f2a1Christian Maeder/* convert an ldb error into an errno error */
45e2bc90dd11147156ddd7f9651ce8b2ec00f2a1Christian Maederint sysdb_error_to_errno(int ldberr);
ee48a7a67da604356b665e51aa7545536a09b737Christian Maeder
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder/* DNs related helper functions */
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maedererrno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, void *mem_ctx,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder const char *_dn, char **_name, char **_val);
f19dc06364e8d6ea36f7c170e1f7a0677de63184Liam O'Reillystruct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder const char *domain, const char *name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *domain, const char *name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *domain, const char *name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *domain);
fa373bc327620e08861294716b4454be8d25669fChristian Maedererrno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *dn_str, char **name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_domain_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder const char *domain);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *domain, const char *object_name,
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder const char *subtree_name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederstruct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *sysdb, void *mem_ctx,
fa373bc327620e08861294716b4454be8d25669fChristian Maeder const char *domain,
b1f12c962a6fb28a298b36cf6a1dcf2ad788fb58Christian Maeder const char *subtree_name);
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maederchar *sysdb_user_strdn(TALLOC_CTX *mem_ctx,
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder const char *domain, const char *name);
fa373bc327620e08861294716b4454be8d25669fChristian Maederchar *sysdb_group_strdn(TALLOC_CTX *mem_ctx,
Error!

 

There was an error!

null

java.lang.NullPointerException