sdap.h revision 6f91c61426c8cfbfec52d5e77ae4650007694e69
/*
SSSD
LDAP Helper routines
Copyright (C) Simo Sorce <ssorce@redhat.com>
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 <http://www.gnu.org/licenses/>.
*/
#ifndef _SDAP_H_
#define _SDAP_H_
#include "providers/dp_backend.h"
#include <ldap.h>
#include "util/sss_ldap.h"
struct sdap_msg {
};
struct sdap_op;
struct sdap_msg *, int, void *);
struct sdap_handle;
struct sdap_op {
struct sdap_handle *sh;
int msgid;
bool done;
void *data;
struct tevent_context *ev;
};
struct fd_event_item {
struct fd_event_item *prev;
struct fd_event_item *next;
int fd;
};
struct ldap_cb_data {
struct sdap_handle *sh;
struct tevent_context *ev;
struct fd_event_item *fd_list;
};
struct sup_list {
int num_vals;
char **vals;
};
struct sdap_handle {
bool connected;
/* Authentication ticket expiration time (if any) */
bool disable_deref;
struct sdap_fd_events *sdap_fd_events;
struct sup_list supported_saslmechs;
struct sup_list supported_controls;
struct sup_list supported_extensions;
/* during release we need to lock access to the handler
* from the destructor to avoid recursion */
bool destructor_lock;
/* mark when it is safe to finally release the handler memory */
bool release_memory;
};
struct sdap_service {
char *name;
char *uri;
char *kinit_service_name;
struct sockaddr_storage *sockaddr;
};
struct sdap_ppolicy_data {
int grace;
int expire;
};
#define SYSDB_SHADOWPW_LASTCHANGE "shadowLastChange"
#define SYSDB_SHADOWPW_MIN "shadowMin"
#define SYSDB_SHADOWPW_MAX "shadowMax"
#define SYSDB_SHADOWPW_WARNING "shadowWarning"
#define SYSDB_SHADOWPW_INACTIVE "shadowInactive"
#define SYSDB_SHADOWPW_EXPIRE "shadowExpire"
#define SYSDB_SHADOWPW_FLAG "shadowFlag"
#define SYSDB_NS_ACCOUNT_LOCK "nsAccountLock"
#define SYSDB_KRBPW_LASTCHANGE "krbLastPwdChange"
#define SYSDB_KRBPW_EXPIRATION "krbPasswordExpiration"
#define SYSDB_PWD_ATTRIBUTE "pwdAttribute"
#define SYSDB_AD_ACCOUNT_EXPIRES "adAccountExpires"
#define SYSDB_AD_USER_ACCOUNT_CONTROL "adUserAccountControl"
#define SYSDB_NDS_LOGIN_DISABLED "ndsLoginDisabled"
#define SYSDB_NDS_LOGIN_EXPIRATION_TIME "ndsLoginExpirationTime"
#define SYSDB_NDS_LOGIN_ALLOWED_TIME_MAP "ndsLoginAllowedTimeMap"
#define SDAP_ROOTDSE_ATTR_NAMING_CONTEXTS "namingContexts"
#define SDAP_ROOTDSE_ATTR_DEFAULT_NAMING_CONTEXT "defaultNamingContext"
#define SDAP_ROOTDSE_ATTR_AD_VERSION "domainControllerFunctionality"
#define SDAP_IPA_USN "entryUSN"
#define SDAP_IPA_LAST_USN "lastUSN"
#define SDAP_AD_USN "uSNChanged"
#define SDAP_AD_LAST_USN "highestCommittedUSN"
#define SDAP_AD_GROUP_TYPE_BUILTIN 0x00000001
#define SDAP_AD_GROUP_TYPE_GLOBAL 0x00000002
#define SDAP_AD_GROUP_TYPE_DOMAIN_LOCAL 0x00000004
#define SDAP_AD_GROUP_TYPE_UNIVERSAL 0x00000008
#define SDAP_AD_GROUP_TYPE_APP_BASIC 0x00000010
#define SDAP_AD_GROUP_TYPE_APP_QUERY 0x00000020
#define SDAP_AD_GROUP_TYPE_SECURITY 0x80000000
enum sdap_basic_opt {
SDAP_URI = 0,
SDAP_OPTS_BASIC /* opts counter */
};
enum sdap_gen_attrs {
SDAP_AT_ENTRY_USN = 0,
SDAP_AT_GENERAL /* attrs counter */
};
/* the objectclass must be the first attribute.
* Functions depend on this */
enum sdap_user_attrs {
SDAP_OC_USER = 0,
SDAP_OPTS_USER /* attrs counter */
};
/* the objectclass must be the first attribute.
* Functions depend on this */
enum sdap_group_attrs {
SDAP_OC_GROUP = 0,
SDAP_OPTS_GROUP /* attrs counter */
};
enum sdap_netgroup_attrs {
SDAP_OC_NETGROUP = 0,
SDAP_OPTS_NETGROUP /* attrs counter */
};
enum sdap_sudorule_attrs {
SDAP_OC_SUDORULE = 0,
SDAP_OPTS_SUDO /* attrs counter */
};
enum sdap_service_attrs {
SDAP_OC_SERVICE = 0,
SDAP_OPTS_SERVICES /* attrs counter */
};
enum sdap_autofs_map_attrs {
SDAP_OPTS_AUTOFS_MAP /* attrs counter */
};
enum sdap_autofs_entry_attrs {
SDAP_OPTS_AUTOFS_ENTRY /* attrs counter */
};
struct sdap_attr_map {
const char *opt_name;
const char *def_name;
const char *sys_name;
char *name;
};
struct sdap_search_base {
const char *basedn;
int scope;
const char *filter;
};
/* Values from
*/
enum dc_functional_level {
DS_BEHAVIOR_WIN2000 = 0,
DS_BEHAVIOR_WIN2003 = 2,
DS_BEHAVIOR_WIN2008 = 3,
DS_BEHAVIOR_WIN2012 = 5,
};
struct sdap_domain {
struct sss_domain_info *dom;
char *basedn;
struct sdap_search_base **search_bases;
struct sdap_search_base **user_search_bases;
struct sdap_search_base **group_search_bases;
struct sdap_search_base **netgroup_search_bases;
struct sdap_search_base **sudo_search_bases;
struct sdap_search_base **service_search_bases;
struct sdap_search_base **autofs_search_bases;
/* Need to modify the list from a talloc destructor */
struct sdap_domain **head;
/* Enumeration and cleanup periodic task */
struct be_ptask *cleanup_task;
/* enumeration loop timer */
/* cleanup loop timer */
struct timeval last_purge;
void *pvt;
};
struct sdap_options {
struct sdap_attr_map *gen_map;
struct sdap_attr_map *user_map;
struct sdap_attr_map *group_map;
struct sdap_attr_map *netgroup_map;
struct sdap_attr_map *service_map;
/* ID-mapping support */
struct sdap_idmap_ctx *idmap_ctx;
/* FIXME - should this go to a special struct to avoid mixing with name-service-switch maps? */
struct sdap_attr_map *sudorule_map;
struct sdap_attr_map *autofs_mobject_map;
struct sdap_attr_map *autofs_entry_map;
/* supported schema types */
enum schema_type {
} schema_type;
/* The search bases for the domain or its subdomain */
struct sdap_domain *sdom;
bool support_matching_rule;
};
struct sdap_server_opts {
char *server_id;
bool supports_usn;
unsigned long last_usn;
char *max_user_value;
char *max_group_value;
char *max_service_value;
char *max_sudo_value;
bool posix_checked;
};
struct sdap_id_ctx;
struct sdap_attr_map_info {
struct sdap_attr_map *map;
int num_attrs;
};
struct sdap_deref_attrs {
struct sdap_attr_map *map;
struct sysdb_attrs *attrs;
};
struct sdap_attr_map *src_map,
int num_entries,
struct sdap_attr_map **_map);
struct sdap_attr_map *src_map,
char **extra_attrs,
struct sdap_attr_map **_map,
struct sdap_options *opts,
int extra_attr_index,
struct sdap_attr_map *src_map,
struct sdap_attr_map **_map,
struct confdb_ctx *cdb,
const char *conf_path,
struct sdap_attr_map *def_map,
int num_entries,
struct sdap_attr_map **_map);
struct sysdb_attrs **_attrs,
bool disable_range_retrieval);
struct sdap_attr_map_info *minfo,
struct sdap_deref_attrs ***_res);
struct sdap_handle *sh);
struct sdap_attr_map *map,
const char **filter,
const char ***_attrs,
size_t *attr_count);
struct sdap_options *opts,
struct sysdb_attrs *attrs,
struct sss_domain_info *dom,
const char **_group_name);
struct sdap_options *opts,
struct sysdb_attrs *attrs,
struct sss_domain_info *dom,
const char **_user_name);
struct sdap_options *opts,
struct sysdb_attrs *attrs,
struct sss_domain_info *dom,
const char **_netgroup_name);
struct sdap_options *opts,
struct sdap_domain *sdom);
const char *server,
struct sysdb_attrs *rootdse,
struct sdap_options *opts,
struct sdap_server_opts **srv_opts);
struct sdap_server_opts **srv_opts);
#endif /* _SDAP_H_ */