From f80f43c772e8c5504111dd4274eb928e61fa56ed Mon Sep 17 00:00:00 2001 From: Atul Kulkarni Date: Wed, 28 Aug 2013 13:19:27 +0530 Subject: idmap_autorid: extract common code to separate file This is in preparation of adding "net idmap autorid" functionality. Pair-Programmed-With: Michael Adam Signed-off-by: Atul Kulkarni Signed-off-by: Michael Adam Reviewed-by: Volker Lendecke --- source3/include/idmap_autorid_tdb.h | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 source3/include/idmap_autorid_tdb.h (limited to 'source3/include') diff --git a/source3/include/idmap_autorid_tdb.h b/source3/include/idmap_autorid_tdb.h new file mode 100644 index 0000000000..12151289cb --- /dev/null +++ b/source3/include/idmap_autorid_tdb.h @@ -0,0 +1,72 @@ +/* + * idmap_autorid: static map between Active Directory/NT RIDs + * and RFC 2307 accounts. This file contains common functions + * and structures used by idmap_autorid and net idmap autorid utilities + * + * Copyright (C) Christian Ambach, 2010-2012 + * Copyright (C) Atul Kulkarni, 2013 + * Copyright (C) Michael Adam, 2012-2013 + * + * This program is free software; you can redistribute it and/or modify + * 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 . + * + */ + +#ifndef _IDMAP_AUTORID_H_ +#define _IDMAP_AUTORID_H_ + +#include "includes.h" +#include "system/filesys.h" +#include "dbwrap/dbwrap.h" +#include "dbwrap/dbwrap_open.h" +#include "../lib/util/util_tdb.h" +#include "winbindd/idmap_tdb_common.h" + +#define HWM "NEXT RANGE" +#define ALLOC_HWM_UID "NEXT ALLOC UID" +#define ALLOC_HWM_GID "NEXT ALLOC GID" +#define ALLOC_RANGE "ALLOC" +#define CONFIGKEY "CONFIG" + +struct autorid_global_config { + uint32_t minvalue; + uint32_t rangesize; + uint32_t maxranges; +}; + +struct autorid_range_config { + fstring domsid; + fstring keystr; + uint32_t rangenum; + uint32_t domain_range_index; + uint32_t low_id; + struct autorid_global_config *globalcfg; +}; + +NTSTATUS idmap_autorid_get_domainrange(struct db_context *db, + struct autorid_range_config *range, + bool read_only); + +NTSTATUS idmap_autorid_init_hwm(struct db_context *db, const char *hwm); + +NTSTATUS idmap_autorid_db_init(const char *path, + TALLOC_CTX *mem_ctx, + struct db_context **db); + +struct autorid_global_config *idmap_autorid_loadconfig(struct db_context *db, + TALLOC_CTX *ctx); + +NTSTATUS idmap_autorid_saveconfig(struct db_context *db, + struct autorid_global_config *cfg); + +#endif /* _IDMAP_AUTORID_H_ */ -- cgit