ad_gpo.c revision 03e5f1528184a558fd990e66f083157b404dce08
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder Yassir Elley <yelley@redhat.com>
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder Copyright (C) 2013 Red Hat
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder This program is free software; you can redistribute it and/or modify
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder it under the terms of the GNU General Public License as published by
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder the Free Software Foundation; either version 3 of the License, or
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder (at your option) any later version.
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder This program is distributed in the hope that it will be useful,
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder but WITHOUT ANY WARRANTY; without even the implied warranty of
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder GNU General Public License for more details.
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder You should have received a copy of the GNU General Public License
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder * This file implements the following pair of *public* functions (see header):
d27b1887e61f1dc53d77c37f59dbf5019242a686Christian Maeder * ad_gpo_access_send/recv: provides client-side GPO processing
473f5af6e4803fbeecc814065952396f2501039bChristian Maeder * This file also implements the following pairs of *private* functions (which
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder * are used by the public functions):
945e82ed7877917f3ab1657f555e71991372546aChristian Maeder * ad_gpo_process_som_send/recv: populate list of gp_som objects
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder * ad_gpo_process_gpo_send/recv: populate list of gp_gpo objects
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder * ad_gpo_process_cse_send/recv: retrieve policy file data
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder/* == gpo-ldap constants =================================================== */
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder#define AD_AT_CONFIG_NC "configurationNamingContext"
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder#define AD_AT_NT_SEC_DESC "nTSecurityDescriptor"
8dfcec5538467723b1cf9d1651de7c9c89fe4aabChristian Maeder#define AD_AT_FILE_SYS_PATH "gPCFileSysPath"
7710f7c3425e45af11af124ff37bec27229d24f7Christian Maeder#define AD_AT_MACHINE_EXT_NAMES "gPCMachineExtensionNames"
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder#define AD_AT_FUNC_VERSION "gPCFunctionalityVersion"
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder#define UAC_WORKSTATION_TRUST_ACCOUNT 0x00001000
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder#define AD_AGP_GUID "edacfd8f-ffb3-11d1-b41d-00a0c968f939"
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder#define AD_AUTHENTICATED_USERS_SID "S-1-5-11"
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maeder/* == gpo-smb constants ==================================================== */
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder#define ALLOW_LOGON_INTERACTIVE "SeInteractiveLogonRight"
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder#define DENY_LOGON_INTERACTIVE "SeDenyInteractiveLogonRight"
6a6689ad6d4c70af2ce3389f39a50982f20fd939Christian Maeder#define ALLOW_LOGON_REMOTE_INTERACTIVE "SeRemoteInteractiveLogonRight"
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder#define DENY_LOGON_REMOTE_INTERACTIVE "SeDenyRemoteInteractiveLogonRight"
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder#define ALLOW_LOGON_NETWORK "SeNetworkLogonRight"
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder#define DENY_LOGON_NETWORK "SeDenyNetworkLogonRight"
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder#define ALLOW_LOGON_BATCH "SeBatchLogonRight"
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder#define DENY_LOGON_BATCH "SeDenyBatchLogonRight"
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder#define ALLOW_LOGON_SERVICE "SeServiceLogonRight"
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder#define DENY_LOGON_SERVICE "SeDenyServiceLogonRight"
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder#define GP_EXT_GUID_SECURITY "{827D319E-6EAC-11D2-A4EA-00C04F79F83A}"
6a6689ad6d4c70af2ce3389f39a50982f20fd939Christian Maeder#define GP_EXT_GUID_SECURITY_SUFFIX "/Machine/Microsoft/Windows NT/SecEdit/GptTmpl.inf"
31a81edf1285dc338211bfe86ba50a1f4128d9d2Christian Maeder#define GPO_CHILD SSSD_LIBEXEC_PATH"/gpo_child"
31a81edf1285dc338211bfe86ba50a1f4128d9d2Christian Maeder/* fd used by the gpo_child process for logging */
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder/* == common data structures and declarations ============================= */
0bbc28585c7d42913167ff78a862ef25ea59e85eChristian Maederstruct tevent_req *ad_gpo_process_som_send(TALLOC_CTX *mem_ctx,
0bbc28585c7d42913167ff78a862ef25ea59e85eChristian Maederint ad_gpo_process_som_recv(struct tevent_req *req,
4ed68712ee368cbebfeaa327968583cb022e3c72Christian Maederstruct tevent_req *ad_gpo_process_gpo_send(TALLOC_CTX *mem_ctx,
4ed68712ee368cbebfeaa327968583cb022e3c72Christian Maederint ad_gpo_process_gpo_recv(struct tevent_req *req,
526e7f36639cb58e3c99a54bea082499a6b04a25Christian Maederstruct tevent_req *ad_gpo_process_cse_send(TALLOC_CTX *mem_ctx,
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maederint ad_gpo_process_cse_recv(struct tevent_req *req);
5896f38ba2934056542cb7cb3e6359e88a622547Christian Maeder/* == ad_gpo_parse_map_options and helpers ==================================*/
fd94a6f66ccb5cef99aa42069b61e4b8734dbd3fChristian Maeder#define GPO_GDM_FINGERPRINT "gdm-fingerprint"
d97700a22b2585ece83b05f3fff945fdfd0c44b4Christian Maederconst char *gpo_map_interactive_defaults[] =
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder GPO_GDM_FINGERPRINT, GPO_GDM_PASSWORD, GPO_GDM_SMARTCARD, GPO_KDM, NULL};
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maederconst char *gpo_map_remote_interactive_defaults[] = {GPO_SSHD, NULL};
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maederconst char *gpo_map_network_defaults[] = {GPO_FTP, GPO_SAMBA, NULL};
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maederconst char *gpo_map_batch_defaults[] = {GPO_CROND, NULL};
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maederconst char *gpo_map_service_defaults[] = {NULL};
275698320a734a6fd647ea6a461d6ce38862da1dChristian Maederconst char *gpo_map_permit_defaults[] = {GPO_SUDO, GPO_SUDO_I,
526e7f36639cb58e3c99a54bea082499a6b04a25Christian Maederconst char *gpo_map_deny_defaults[] = {NULL};
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maederstruct gpo_map_option_entry gpo_map_option_entries[] = {
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder {GPO_MAP_INTERACTIVE, AD_GPO_MAP_INTERACTIVE, gpo_map_interactive_defaults,
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder ALLOW_LOGON_INTERACTIVE, DENY_LOGON_INTERACTIVE},
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder {GPO_MAP_REMOTE_INTERACTIVE, AD_GPO_MAP_REMOTE_INTERACTIVE,
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder ALLOW_LOGON_REMOTE_INTERACTIVE, DENY_LOGON_REMOTE_INTERACTIVE},
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder {GPO_MAP_NETWORK, AD_GPO_MAP_NETWORK, gpo_map_network_defaults,
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder {GPO_MAP_BATCH, AD_GPO_MAP_BATCH, gpo_map_batch_defaults,
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder {GPO_MAP_SERVICE, AD_GPO_MAP_SERVICE, gpo_map_service_defaults,
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder {GPO_MAP_PERMIT, AD_GPO_MAP_PERMIT, gpo_map_permit_defaults, NULL, NULL},
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder {GPO_MAP_DENY, AD_GPO_MAP_DENY, gpo_map_deny_defaults, NULL, NULL},
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maederconst char* gpo_map_type_string(int gpo_map_type)
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder case GPO_MAP_INTERACTIVE: return "Interactive";
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder case GPO_MAP_REMOTE_INTERACTIVE: return "Remote Interactive";
a43c1a7fa08c12524415386aa13a566cc9e53a4fChristian Maederstatic inline bool
990cfa5c6abdd4d093cea540c34bb5522bf540d2Christian Maederad_gpo_service_in_list(char **list, size_t nlist, const char *str)
18548c6cc2dff13bf9f5f08b3f6cde6ca914df1dChristian Maeder for (i = 0; i < nlist; i++) {
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maeder return (i < nlist) ? true : false;
5bedf8c26d27eac08962c78379bcb2e5cb529036Christian Maederad_gpo_parse_map_option_helper(enum gpo_map_type gpo_map_type,
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder hret = hash_lookup(options_table, &key, &val);
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder if (hret != HASH_SUCCESS && hret != HASH_ERROR_KEY_NOT_FOUND) {
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Error checking hash table: [%s]\n",
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder /* handle unexpected case where mapping for key already exists */
43d8d7472d3a0a78d9a2c85122815a81deb8689aChristian Maeder /* mapping for key exists for same map type; no error */
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder "PAM service %s maps to %s multiple times\n", key.str,
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder /* mapping for key exists for different map type; error! */
cdae1f4c0c6e32f5463a7ce9986600e27f8ac253Christian Maeder "PAM service %s maps to both %s and %s\n", key.str,
aed438ce70de05d86d51932a078d829a3f6be5c2Christian Maeder gpo_map_type_string(val.i), gpo_map_type_string(gpo_map_type));
aed438ce70de05d86d51932a078d829a3f6be5c2Christian Maeder /* handle expected case where mapping for key doesn't already exist */
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder hret = hash_enter(options_table, &key, &val);
5727dbcb926ede2e7b05f43685476ce656ce01e4Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Error checking hash table: [%s]\n",
8dfcec5538467723b1cf9d1651de7c9c89fe4aabChristian Maederad_gpo_parse_map_option(TALLOC_CTX *mem_ctx,
473f5af6e4803fbeecc814065952396f2501039bChristian Maeder DEBUG(SSSDBG_TRACE_ALL, "gpo_map_type: %s\n",
473f5af6e4803fbeecc814065952396f2501039bChristian Maeder ret = split_on_separator(tmp_ctx, conf_str, ',', true, true,
569b102de9c99536086f4c2ec60a5599604d9e8aChristian Maeder "Cannot parse list of service names %s: %d\n", conf_str, ret);
569b102de9c99536086f4c2ec60a5599604d9e8aChristian Maeder add_list = talloc_zero_array(tmp_ctx, char *, conf_list_size);
8dfcec5538467723b1cf9d1651de7c9c89fe4aabChristian Maeder remove_list = talloc_zero_array(tmp_ctx, char *, conf_list_size);
473f5af6e4803fbeecc814065952396f2501039bChristian Maeder if (add_list == NULL || remove_list == NULL) {
8dfcec5538467723b1cf9d1651de7c9c89fe4aabChristian Maeder for (i = 0; i < conf_list_size; i++) {
473f5af6e4803fbeecc814065952396f2501039bChristian Maeder switch (conf_list[i][0]) {
65c8e8b1cf766534fa0c9aec33e538dc3894ea13Christian Maeder DEBUG(SSSDBG_CRIT_FAILURE, "ad_gpo_map values must start with"
65c8e8b1cf766534fa0c9aec33e538dc3894ea13Christian Maeder "either '+' (for adding service) or '-' (for removing service), "
65c8e8b1cf766534fa0c9aec33e538dc3894ea13Christian Maeder "got '%s'\n",
aed438ce70de05d86d51932a078d829a3f6be5c2Christian Maeder /* Start by adding explicitly added services ('+') to hashtable */
aed438ce70de05d86d51932a078d829a3f6be5c2Christian Maeder for (i = 0; i < ai; i++) {
8dfcec5538467723b1cf9d1651de7c9c89fe4aabChristian Maeder /* if the service is explicitly configured to be removed, skip it */
a07a6a1143844a6f061a49aefc550e3bdd28f331Christian Maeder if (ad_gpo_service_in_list(remove_list, ri, add_list[i])) {
a07a6a1143844a6f061a49aefc550e3bdd28f331Christian Maeder ret = ad_gpo_parse_map_option_helper(gpo_map_type, key, options_table);
a07a6a1143844a6f061a49aefc550e3bdd28f331Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Invalid configuration: %d\n", ret);
584a14bf82bb60d8ffca9b45967c512d80369606Christian Maeder DEBUG(SSSDBG_TRACE_ALL, "Explicitly added service: %s\n", key.str);
a07a6a1143844a6f061a49aefc550e3bdd28f331Christian Maeder /* Add defaults to hashtable */
a07a6a1143844a6f061a49aefc550e3bdd28f331Christian Maeder for (i = 0; defaults[i]; i++) {
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder /* if the service is explicitly configured to be removed, skip it */
74ce8ed78c62ad2b1ec30fa9292c6589e2b4d171Christian Maeder if (ad_gpo_service_in_list(remove_list, ri, defaults[i])) {
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder key.str = talloc_strdup(mem_ctx, defaults[i]);
74ce8ed78c62ad2b1ec30fa9292c6589e2b4d171Christian Maeder ret = ad_gpo_parse_map_option_helper(gpo_map_type, key, options_table);
74ce8ed78c62ad2b1ec30fa9292c6589e2b4d171Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Invalid configuration: %d\n", ret);
d2111c9d2eb254b2a5ab71b27a6a07f1e353aec7Christian Maeder DEBUG(SSSDBG_TRACE_ALL, "Default service (not explicitly removed): %s\n",
d746dda8407e83621a309fe67b1378d6f1cc3312Christian Maederad_gpo_parse_map_options(struct ad_access_ctx *access_ctx)
584a14bf82bb60d8ffca9b45967c512d80369606Christian Maeder for (i = 0; i < GPO_MAP_NUM_OPTS; i++) {
584a14bf82bb60d8ffca9b45967c512d80369606Christian Maeder struct gpo_map_option_entry entry = gpo_map_option_entries[i];
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder char *entry_config = dp_opt_get_string(access_ctx->ad_options,
5fb6343a5a2b4bbc67bc83479c84a92d23d30edfChristian Maeder ret = ad_gpo_parse_map_option(access_ctx, entry.gpo_map_type,
fd94a6f66ccb5cef99aa42069b61e4b8734dbd3fChristian Maeder DEBUG(SSSDBG_OP_FAILURE, "Invalid configuration: %d\n", ret);
df67ddf64192bfcae6ece65255ad796a17cbe532Christian Maeder /* default right (applicable for services without any mapping) */
b579e1a98aa30fb6093cbbdfeae51edbd5ba26adChristian Maeder dp_opt_get_string(access_ctx->ad_options, AD_GPO_DEFAULT_RIGHT);
b579e1a98aa30fb6093cbbdfeae51edbd5ba26adChristian Maeder DEBUG(SSSDBG_TRACE_ALL, "gpo_default_right_config: %s\n",
7710f7c3425e45af11af124ff37bec27229d24f7Christian Maeder /* if default right not set in config, set them to DENY */
7710f7c3425e45af11af124ff37bec27229d24f7Christian Maeder } else if (strncasecmp(gpo_default_right_config, "interactive",
7710f7c3425e45af11af124ff37bec27229d24f7Christian Maeder } else if (strncasecmp(gpo_default_right_config, "remote_interactive",
b579e1a98aa30fb6093cbbdfeae51edbd5ba26adChristian Maeder gpo_default_right = GPO_MAP_REMOTE_INTERACTIVE;
b579e1a98aa30fb6093cbbdfeae51edbd5ba26adChristian Maeder } else if (strncasecmp(gpo_default_right_config, "network",
b579e1a98aa30fb6093cbbdfeae51edbd5ba26adChristian Maeder } else if (strncasecmp(gpo_default_right_config, "batch",
d97700a22b2585ece83b05f3fff945fdfd0c44b4Christian Maeder } else if (strncasecmp(gpo_default_right_config, "service",
0bbc28585c7d42913167ff78a862ef25ea59e85eChristian Maeder } else if (strncasecmp(gpo_default_right_config, "permit",
d97700a22b2585ece83b05f3fff945fdfd0c44b4Christian Maeder } else if (strncasecmp(gpo_default_right_config, "deny",
31a81edf1285dc338211bfe86ba50a1f4128d9d2Christian Maeder DEBUG(SSSDBG_TRACE_ALL, "gpo_default_right: %d\n", gpo_default_right);
31a81edf1285dc338211bfe86ba50a1f4128d9d2Christian Maeder access_ctx->gpo_default_right = gpo_default_right;
31a81edf1285dc338211bfe86ba50a1f4128d9d2Christian Maeder/* == ad_gpo_access_send/recv helpers =======================================*/
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maederad_gpo_dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2)
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder return false;
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder if (sid1->sid_rev_num != sid2->sid_rev_num) {
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder return false;
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder for (i = 0; i < 6; i++) {
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder if (sid1->id_auth[i] != sid2->id_auth[i]) {
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder return false;
a150c2c1cf35ba98a6dda2163c96bca7c6453025Christian Maeder return false;
static errno_t
const char *user,
const char **_user_sid,
const char ***_group_sids,
int *_group_size)
int ret = 0;
int num_group_sids = 0;
goto done;
return ret;
return ret;
goto done;
for (i = 0; i < num_group_sids; i++) {
goto done;
goto done;
return EOK;
done:
return ret;
static errno_t
const char **group_sids,
int group_size,
bool *_included)
bool included = false;
return EFAULT;
if (included) {
*_included = true;
return EOK;
for (i = 0; i < group_size; i++) {
return EFAULT;
if (included) {
*_included = true;
return EOK;
*_included = false;
return EOK;
const char *user_sid,
const char **group_sids,
int group_size)
bool agp_included = false;
bool included = false;
int ret = 0;
return AD_GPO_ACE_NEUTRAL;
return AD_GPO_ACE_DENIED;
if (!included) {
return AD_GPO_ACE_NEUTRAL;
agp_included = true;
agp_included = false;
if (agp_included) {
return AD_GPO_ACE_ALLOWED;
return AD_GPO_ACE_DENIED;
return AD_GPO_ACE_DENIED;
const char *user_sid,
const char **group_sids,
int group_size,
bool *_dacl_access_allowed)
if (num_aces == 0) {
*_dacl_access_allowed = false;
return EOK;
switch (ace_status) {
case AD_GPO_ACE_NEUTRAL:
case AD_GPO_ACE_ALLOWED:
*_dacl_access_allowed = true;
return EOK;
case AD_GPO_ACE_DENIED:
*_dacl_access_allowed = false;
return EOK;
*_dacl_access_allowed = false;
return EOK;
static errno_t
const char *user,
int num_candidate_gpos,
int *_num_dacl_filtered_gpos)
int ret = 0;
int group_size = 0;
int gpo_dn_idx = 0;
bool access_allowed = false;
goto done;
goto done;
struct gp_gpo *,
goto done;
for (i = 0; i < num_candidate_gpos; i++) {
access_allowed = false;
access_allowed = true;
if (access_allowed) {
gpo_dn_idx++;
done:
return ret;
const char **gpo_cse_guids,
int num_gpo_cse_guids)
for (i = 0; i < num_gpo_cse_guids; i++) {
static errno_t
const char *cse_guid,
int *_num_cse_filtered_gpos)
int ret = 0;
int gpo_dn_idx = 0;
bool included;
goto done;
struct gp_gpo *,
goto done;
for (i = 0; i < num_dacl_filtered_gpos; i++) {
if (included) {
gpo_dn_idx++;
done:
return ret;
int privilege_size,
const char *user_sid,
const char **group_sids,
int group_size)
for (i = 0; i < privilege_size; i++) {
for (j = 0; j < group_size; j++) {
static errno_t
const char *policy_setting_key,
char **_policy_setting_value)
int ret;
const char *policy_setting_value;
if (ret != 0) {
goto done;
goto done;
if (ret != 0) {
goto done;
if (policy_setting_value[0]) {
if (!*_policy_setting_value) {
goto done;
done:
return ret;
static errno_t
const char *filename)
int ret;
goto done;
if (ret != 0) {
goto done;
if (ret != 0) {
goto done;
if (ret != 0) {
goto done;
for (i = 0; i < GPO_MAP_NUM_OPTS; i++) {
&allow_value);
goto done;
goto done;
&deny_value);
goto done;
goto done;
done:
return ret;
static errno_t
const char *user,
char **allowed_sids,
int allowed_size,
char **denied_sids,
int denied_size)
const char *user_sid;
const char **group_sids;
int group_size = 0;
bool access_granted = false;
bool access_denied = false;
int ret;
for (j= 0; j < allowed_size; j++) {
for (j= 0; j < denied_size; j++) {
goto done;
for (j= 0; j < group_size; j++) {
group_sids[j]);
if (allowed_size == 0) {
access_granted = true;
return EOK;
switch (gpo_mode) {
return ERR_ACCESS_DENIED;
return EOK;
return EINVAL;
done:
if (ret) {
return ret;
const char *key,
char ***_sids_list,
int *_sids_list_size)
int ret;
const char *value;
int sids_list_size;
goto done;
sids_list_size = 0;
goto done;
for (i = 0; i < sids_list_size; i++) {
sids_list[i]++;
done:
return ret;
static errno_t
const char *user,
int ret;
char **allow_sids;
int allow_size ;
char **deny_sids;
int deny_size;
goto done;
goto done;
goto done;
done:
return ret;
/* == ad_gpo_access_send/recv implementation ================================*/
struct ad_gpo_access_state {
char *server_hostname;
int timeout;
const char *user;
int gpo_timeout_option;
const char *ad_hostname;
const char *target_dn;
int cse_gpo_index;
struct tevent_req *
const char *user,
const char *service)
int hret;
return NULL;
goto immediately;
goto immediately;
goto immediately;
goto immediately;
goto immediately;
goto immediately;
goto immediately;
return req;
return req;
static errno_t
const char *user,
user,
goto done;
done:
return ret;
char *filter;
char *sam_account_name;
char *domain_dn;
int dp_error;
char *server_uri;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
int ret;
int dp_error;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
int ret;
goto done;
som_list);
goto done;
done:
int ret;
int dp_error;
int num_candidate_gpos = 0;
const char **cse_filtered_gpo_guids;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
switch (ret) {
case ENOENT:
goto done;
done:
static errno_t
bool send_to_child = true;
int cached_gpt_version = 0;
return ENOMEM;
&res);
send_to_child = false;
return ret;
return EAGAIN;
* with the user_sid/group_sids of interest.
int ret;
goto done;
goto done;
goto done;
done:
return EOK;
/* == ad_gpo_process_som_send/recv helpers ================================= */
static errno_t
const char *dn,
const char **_parent_dn)
int ret;
goto done;
done:
return ret;
static errno_t
const char *target_dn,
int *_num_soms,
int ret;
int rdn_count = 0;
int som_idx = 0;
goto done;
goto done;
goto done;
if (rdn_count == 0) {
goto done;
goto done;
goto done;
goto done;
som_idx++;
done:
return ret;
static errno_t
const char *som_dn,
char *raw_gplink_value,
bool allow_enforced_only)
char *ptr;
char *first;
char *last;
char *dn;
char *gplink_options;
int ret;
int gplink_count = 0;
int num_enabled = 0;
return EINVAL;
goto done;
ptr++;
gplink_count++;
if (gplink_count == 0) {
goto done;
goto done;
num_enabled = 0;
for (i = 0; i < gplink_count; i++) {
goto done;
last++;
goto done;
if (errno != 0) {
goto done;
goto done;
goto done;
if (gplink_number == 0) {
num_enabled++;
num_enabled++;
goto done;
done:
return ret;
/* == ad_gpo_process_som_send/recv implementation ========================== */
struct ad_gpo_process_som_state {
int timeout;
bool allow_enforced_only;
char *site_name;
char *site_dn;
int som_index;
int num_soms;
struct tevent_req *
int timeout,
const char *target_dn,
const char *domain_name)
return NULL;
goto immediately;
goto immediately;
goto immediately;
return req;
int ret;
char *site;
* retrieved at that point (see https://fedorahosted.org/sssd/ticket/2276)
int ret;
int dp_error;
const char *configNC;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
static errno_t
return ENOMEM;
return EAGAIN;
int ret;
int dp_error;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
allow_enforced_only = 0;
if (errno != 0) {
goto done;
(char *)raw_gplink_value,
goto done;
if (allow_enforced_only) {
done:
return EOK;
/* == ad_gpo_process_gpo_send/recv helpers ================================= */
static errno_t
int *_num_candidate_gpos)
int num_candidate_gpos = 0;
int gpo_dn_idx = 0;
int num_enforced = 0;
int enforced_idx = 0;
int num_unenforced = 0;
int unenforced_idx = 0;
int ret;
goto done;
while (som_list[i]) {
goto done;
num_enforced++;
if (num_candidate_gpos == 0) {
*_num_candidate_gpos = 0;
goto done;
goto done;
goto done;
while (som_list[i]) {
goto done;
goto done;
enforced_idx++;
goto done;
struct gp_gpo *,
goto done;
gpo_dn_idx = 0;
goto done;
goto done;
gpo_dn_idx++;
for (i = 0; i < num_enforced; i++) {
goto done;
goto done;
gpo_dn_idx++;
done:
return ret;
* server_hostname = "adserver.foo.com", then
* _smb_server = "smb://adserver.foo.com"
* _smb_path = "/foo.com/..."
* For example, input_path = "\\foo.com\SysVol" is not a valid input_path,
static errno_t
char *server_hostname,
char *input_path,
const char **_smb_server,
const char **_smb_share,
const char **_smb_path)
char *ptr;
int ret;
int num_seps = 0;
goto done;
num_seps++;
ptr++;
ptr++;
ptr++;
if (num_seps == 0) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
static errno_t
char *raw_machine_ext_names_value,
const char ***_gpo_cse_guids,
int *_num_gpo_cse_guids)
char *ptr;
char *first;
char *last;
char *cse_guid;
char *tool_guid;
const char **gpo_cse_guids;
int ret;
int num_gpo_cse_guids = 0;
return EINVAL;
goto done;
ptr++;
if (num_gpo_cse_guids == 0) {
goto done;
goto done;
for (i = 0; i < num_gpo_cse_guids; i++) {
last++;
first ++;
for (i = 0; i < num_gpo_cse_guids; i++) {
done:
return ret;
enum ndr_err_code
struct security_descriptor *r);
return EINVAL;
&sd);
return EINVAL;
return EOK;
/* == ad_gpo_process_gpo_send/recv implementation ========================== */
struct ad_gpo_process_gpo_state {
char *server_hostname;
int timeout;
int num_candidate_gpos;
int gpo_index;
struct tevent_req *
char *server_hostname,
int timeout,
return NULL;
goto immediately;
goto immediately;
return req;
static errno_t
return ENOMEM;
return EAGAIN;
int ret;
int dp_error;
goto done;
gpo_dn);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
(char *)raw_machine_ext_names,
goto done;
done:
int *num_candidate_gpos)
return EOK;
/* == ad_gpo_process_cse_send/recv helpers ================================= */
static errno_t
const char *smb_server,
const char *smb_share,
const char *smb_path,
const char *smb_cse_suffix,
int cached_gpt_version,
int smb_server_length;
int smb_share_length;
int smb_path_length;
return ENOMEM;
return ENOMEM;
rp = 0;
return EOK;
static errno_t
int ret;
size_t p = 0;
return ret;
/* == ad_gpo_process_cse_send/recv implementation ========================== */
struct ad_gpo_process_cse_state {
int gpo_timeout_option;
const char *gpo_guid;
const char *smb_path;
const char *smb_cse_suffix;
struct tevent_req *
bool send_to_child,
const char *gpo_guid,
const char *smb_server,
const char *smb_share,
const char *smb_path,
const char *smb_cse_suffix,
int cached_gpt_version,
int gpo_timeout_option)
return NULL;
if (!send_to_child) {
goto immediately;
goto immediately;
goto immediately;
goto immediately;
goto immediately;
return req;
return req;
int ret;
int ret;
} else if (child_result != 0){
return EOK;
static errno_t
int ret;
return err;
return err;
return err;
return ret;
return err;
return EOK;