/* $OpenBSD: ypldap.h,v 1.19 2017/05/30 09:33:31 jmatthew Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #define YPLDAP_USER "_ypldap" #define YPLDAP_CONF_FILE "/etc/ypldap.conf" #define YPLDAP_CERT_FILE "/etc/ssl/cert.pem" #define DEFAULT_INTERVAL 600 #define LINE_WIDTH 1024 #define FILTER_WIDTH 128 #define ATTR_WIDTH 32 #define MAX_SERVERS_DNS 8 enum imsg_type { IMSG_NONE, IMSG_CONF_START, IMSG_CONF_IDM, IMSG_CONF_END, IMSG_START_UPDATE, IMSG_END_UPDATE, IMSG_TRASH_UPDATE, IMSG_PW_ENTRY, IMSG_GRP_ENTRY, IMSG_HOST_DNS }; struct ypldap_addr { TAILQ_ENTRY(ypldap_addr) next; struct sockaddr_storage ss; }; TAILQ_HEAD(ypldap_addr_list, ypldap_addr); enum { PROC_MAIN, PROC_CLIENT } ypldap_process; static const char * const log_procnames[] = { "parent", "ldapclient" }; struct userent { RB_ENTRY(userent) ue_name_node; RB_ENTRY(userent) ue_uid_node; uid_t ue_uid; char *ue_line; char *ue_netid_line; gid_t ue_gid; }; struct groupent { RB_ENTRY(groupent) ge_name_node; RB_ENTRY(groupent) ge_gid_node; gid_t ge_gid; char *ge_line; }; enum client_state { STATE_NONE, STATE_DNS_INPROGRESS, STATE_DNS_TEMPFAIL, STATE_DNS_DONE, STATE_LDAP_FAIL, STATE_LDAP_DONE }; /* * beck, djm, dlg: pay attention to the struct name */ struct idm { TAILQ_ENTRY(idm) idm_entry; u_int32_t idm_id; char idm_name[HOST_NAME_MAX+1]; #define F_SSL 0x00100000 #define F_CONFIGURING 0x00200000 #define F_NEEDAUTH 0x00400000 #define F_STARTTLS 0x00800000 #define F_FIXED_ATTR(n) (1<