/*
SSSD
IPA Backend Module -- Access control
Authors:
Sumit Bose <sbose@redhat.com>
Stephen Gallagher <sgallagh@redhat.com>
Copyright (C) 2011 Red Hat
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/>.
*/
#include "config.h" /* for HAVE_FUNCTION_ATTRIBUTE_FORMAT in "ipa_hbac.h" */
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "ipa_hbac.h"
#include "sss_utf8.h"
#ifndef HAVE_ERRNO_T
#define HAVE_ERRNO_T
typedef int errno_t;
#endif
#ifndef EOK
#define EOK 0
#endif
/* HBAC logging system */
/* debug macro */
if (hbac_debug_fn != NULL) { \
} \
} while (0)
/* static pointer to external logging function */
/* setup function for external logging function */
{
}
/* auxiliary function for hbac_request_element logging */
const char *label);
/* auxiliary function for hbac_eval_req logging */
/* auxiliary function for hbac_rule_element logging */
const char *label);
/* auxiliary function for hbac_rule logging */
/* Placeholder structure for future HBAC time-based
* evaluation rules
*/
struct hbac_time_rules {
int not_yet_implemented;
};
enum hbac_eval_result_int {
};
{
return true;
/* If other categories are added, handle them here */
return false;
}
{
bool complete = true;
*missing_attrs = 0;
/* No rule passed in? */
return false;
}
/* Make sure we have all elements */
complete = false;
}
complete = false;
}
complete = false;
}
complete = false;
}
return complete;
}
struct hbac_eval_req *hbac_req,
enum hbac_error_code *error);
struct hbac_eval_req *hbac_req,
{
uint32_t i;
if (info) {
if (!*info) {
return HBAC_EVAL_OOM;
}
}
for (i = 0; rules[i]; i++) {
if (intermediate_result == HBAC_EVAL_UNMATCHED) {
/* This rule did not match at all. Skip it */
continue;
} else if (intermediate_result == HBAC_EVAL_MATCHED) {
if (info) {
}
}
break;
} else {
/* An error occurred processing this rule */
"Error %d occurred during evaluating of rule [%s].\n",
if (info) {
}
/* Explicitly not checking the result of strdup(), since if
* it's NULL, we can't do anything anyway.
*/
goto done;
}
}
/* If we've reached the end of the loop, we have either set the
* result to ALLOW explicitly or we'll stick with the default DENY.
*/
done:
return result;
}
struct hbac_request_element *req_el,
bool *matched);
struct hbac_eval_req *hbac_req,
enum hbac_error_code *error)
{
bool matched;
return HBAC_EVAL_UNMATCHED;
}
/* Make sure we have all elements */
|| !rule->targethosts
"Rule [%s] cannot be parsed, some elements are empty\n",
return HBAC_EVAL_MATCH_ERROR;
}
/* Check users */
&matched);
return HBAC_EVAL_MATCH_ERROR;
} else if (!matched) {
return HBAC_EVAL_UNMATCHED;
}
/* Check services */
&matched);
return HBAC_EVAL_MATCH_ERROR;
} else if (!matched) {
return HBAC_EVAL_UNMATCHED;
}
/* Check target hosts */
&matched);
"Cannot parse targethost elements of rule [%s]\n",
return HBAC_EVAL_MATCH_ERROR;
} else if (!matched) {
return HBAC_EVAL_UNMATCHED;
}
/* Check source hosts */
&matched);
"Cannot parse srchost elements of rule [%s]\n",
return HBAC_EVAL_MATCH_ERROR;
} else if (!matched) {
return HBAC_EVAL_UNMATCHED;
}
return HBAC_EVAL_MATCHED;
}
struct hbac_request_element *req_el,
bool *matched)
{
size_t i, j;
int ret;
*matched = true;
return EOK;
}
/* First check the name list */
/* Do a case-insensitive comparison. */
return ret;
*matched = true;
return EOK;
}
}
}
}
/* Not found in the name list
* Check for group membership
*/
/* Do a case-insensitive comparison. */
return ret;
*matched = true;
return EOK;
}
}
}
}
/* Not found in groups either */
*matched = false;
return EOK;
}
{
switch (result) {
case HBAC_EVAL_ALLOW:
return "HBAC_EVAL_ALLOW";
case HBAC_EVAL_DENY:
return "HBAC_EVAL_DENY";
case HBAC_EVAL_ERROR:
return "HBAC_EVAL_ERROR";
case HBAC_EVAL_OOM:
return "Could not allocate memory for hbac_info object";
}
return "HBAC_EVAL_ERROR";
}
{
}
{
switch (code) {
case HBAC_SUCCESS:
return "Success";
return "Function is not yet implemented";
case HBAC_ERROR_OUT_OF_MEMORY:
return "Out of memory";
return "Rule could not be evaluated";
case HBAC_ERROR_UNKNOWN:
default:
return "Unknown error code";
}
}
const char *label)
{
int i;
if (el) {
}
}
} else {
}
}
} else {
}
}
{
if (req) {
if (local_time == NULL) {
return;
}
if (ret <= 0) {
return;
}
} else {
}
}
const char *label)
{
int i;
if (el) {
}
} else {
}
}
}
} else {
}
}
}
}
{
if (rule) {
} else {
}
} else {
}
if (rule->targethosts) {
} else {
}
} else {
}
}
}