63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose/*
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose SSSD
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose Authors:
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose Sumit Bose <sbose@redhat.com>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose Copyright (C) 2016 Red Hat
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose This program is free software; you can redistribute it and/or modify
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose it under the terms of the GNU General Public License as published by
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose the Free Software Foundation; either version 3 of the License, or
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose (at your option) any later version.
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose This program is distributed in the hope that it will be useful,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose GNU General Public License for more details.
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose You should have received a copy of the GNU General Public License
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose*/
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#ifndef AD_PAC_H_
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#define AD_PAC_H_
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include <stdbool.h>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include <stdint.h>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose/* ldb_val is defined as datablob in the Samba header files data_blob.h which
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose * is included via ndr.h -> samba_util.h -> data_blob.h.
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose * To allow proper type checking we have to make sure to keep the original
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose * definition from ldb.h */
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#ifdef ldb_val
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#error Please make sure to include ad_pac.h before ldb.h
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#endif
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include <ndr.h>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include <gen_ndr/krb5pac.h>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include <gen_ndr/ndr_krb5pac.h>
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#undef ldb_val
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include "util/util.h"
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#include "providers/ldap/ldap_common.h"
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Boseerrno_t check_if_pac_is_available(TALLOC_CTX *mem_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sss_domain_info *dom,
3d29430867cf92b2d71afa95abb679711231117cPavel Březina struct dp_id_data *ar,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct ldb_message **_msg);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Boseerrno_t ad_get_data_from_pac(TALLOC_CTX *mem_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose uint8_t *pac_blob, size_t pac_len,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct PAC_LOGON_INFO **_logon_info);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Boseerrno_t ad_get_sids_from_pac(TALLOC_CTX *mem_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sss_idmap_ctx *idmap_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct PAC_LOGON_INFO *logon_info,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char **_user_sid_str,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char **_primary_group_sid_str,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose size_t *_num_sids,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char *** _sid_list);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Boseerrno_t ad_get_pac_data_from_user_entry(TALLOC_CTX *mem_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct ldb_message *msg,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sss_idmap_ctx *idmap_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char **username,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char **user_sid,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char **primary_group_sid,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose size_t *num_sids,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose char ***group_sids);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bosestruct tevent_req *ad_handle_pac_initgr_send(TALLOC_CTX *mem_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct be_ctx *be_ctx,
3d29430867cf92b2d71afa95abb679711231117cPavel Březina struct dp_id_data *ar,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sdap_id_ctx *id_ctx,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sdap_domain *sdom,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct sdap_id_conn_ctx *conn,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose bool noexist_delete,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose struct ldb_message *msg);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Boseerrno_t ad_handle_pac_initgr_recv(struct tevent_req *req,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose int *_dp_error, const char **_err,
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose int *sdap_ret);
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose
63b8e826f62d2e8930c872de7d4cc8b5bc15d4a4Sumit Bose#endif /* AD_PAC_H_ */