sysdb_private.h revision 25a9a1768d2e3587cc68b76a0a5df1e42a2c89ab
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder/*
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder SSSD
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder Private System Database Header
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder This program is free software; you can redistribute it and/or modify
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder it under the terms of the GNU General Public License as published by
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder the Free Software Foundation; either version 3 of the License, or
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder (at your option) any later version.
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder This program is distributed in the hope that it will be useful,
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder but WITHOUT ANY WARRANTY; without even the implied warranty of
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder GNU General Public License for more details.
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder You should have received a copy of the GNU General Public License
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder*/
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#ifndef __INT_SYS_DB_H__
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define __INT_SYS_DB_H__
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_10 "0.10"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_9 "0.9"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_8 "0.8"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_7 "0.7"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_6 "0.6"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_5 "0.5"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_4 "0.4"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_3 "0.3"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_2 "0.2"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION_0_1 "0.1"
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_VERSION SYSDB_VERSION_0_10
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#define SYSDB_BASE_LDIF \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "dn: @ATTRIBUTES\n" \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "userPrincipalName: CASE_INSENSITIVE\n" \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "cn: CASE_INSENSITIVE\n" \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "dc: CASE_INSENSITIVE\n" \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "dn: CASE_INSENSITIVE\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "originalDN: CASE_INSENSITIVE\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "objectclass: CASE_INSENSITIVE\n" \
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder "\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "dn: @INDEXLIST\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: cn\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: objectclass\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: member\n" \
df87ff823273ae2969e9d29e833845b4c0a9ee77notanartist "@IDXATTR: memberof\n" \
f79175f2c52a2d588934ba75c1994892c6fa4918notanartist "@IDXATTR: name\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: uidNumber\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: gidNumber\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: lastUpdate\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "@IDXATTR: dataExpireTimestamp\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "@IDXATTR: originalDN\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "@IDXATTR: nameAlias\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: servicePort\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: serviceProtocol\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXATTR: sudoUser\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@IDXONE: 1\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "\n" \
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist "dn: @MODULES\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "@LIST: asq,memberof\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "dn: cn=sysdb\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "cn: sysdb\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "version: " SYSDB_VERSION "\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "description: base object\n" \
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder "\n"
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder#include "db/sysdb.h"
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maederstruct sysdb_ctx {
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder struct sss_domain_info *domain;
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder bool mpg;
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maeder struct ldb_context *ldb;
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maeder char *ldb_file;
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maeder};
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maeder
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartist/* Internal utility functions */
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maederint sysdb_get_db_file(TALLOC_CTX *mem_ctx,
be110dccc9f7bd9e987b35943b16ccb22922248fChristian Maeder const char *provider, const char *name,
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder const char *base_path, char **_ldb_file);
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maedererrno_t sysdb_ldb_connect(TALLOC_CTX *mem_ctx, const char *filename,
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder struct ldb_context **_ldb);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder struct sss_domain_info *domain,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder const char *db_path,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder bool allow_upgrade,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder struct sysdb_ctx **_ctx);
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder/* Upgrade routines */
9308cb2aebeae23f49713896e6d7028b0ac0f83enotanartistint sysdb_upgrade_01(struct ldb_context *ldb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_check_upgrade_02(struct sss_domain_info *domains,
6f70475dddc12732bdbef3e3dd116373e34cd6b9Christian Maeder const char *db_path);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_03(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_04(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_05(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_06(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_07(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_08(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint sysdb_upgrade_09(struct sysdb_ctx *sysdb, const char **ver);
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder
aeabd99d28fef3b392ca208c5ac84f7892af0ddbnotanartistint add_string(struct ldb_message *msg, int flags,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder const char *attr, const char *value);
2ca39b9545cad63df411619615736d9070ad7932Christian Maederint add_ulong(struct ldb_message *msg, int flags,
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder const char *attr, unsigned long value);
2ca39b9545cad63df411619615736d9070ad7932Christian Maeder#endif /* __INT_SYS_DB_H__ */