sudosrv_cmd.c revision 278284224aa10805d58c978977e43b1d1126f9b1
/*
Authors:
Pavel Březina <pbrezina@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 <stdint.h>
#include <errno.h>
#include <talloc.h>
#include "responder/common/responder.h"
#include "responder/common/responder_packet.h"
#include "responder/sudo/sudosrv_private.h"
#include "db/sysdb_sudo.h"
{
size_t packet_len = 0;
("Unable to create a new packet [%d]; %s\n",
goto done;
}
goto done;
}
done:
return ret;
}
struct sudo_cmd_ctx *cmd_ctx,
{
size_t response_len = 0;
return ret;
}
}
{
size_t response_len = 0;
switch (ret) {
case EOK:
/*
* Parent of dctx->res is in-memory cache, we must not talloc_free it!
*/
} else {
/* filter rules by time */
return EFAULT;
}
}
/* send result */
return EFAULT;
}
break;
case EAGAIN:
/* async processing, just return here */
return EOK;
case EFAULT:
/* very bad error */
return EFAULT;
/* case ENOENT:
* - means user not found
* - send error ENOENT
*/
default:
/* send error */
break;
}
return EFAULT;
}
return EOK;
}
{
if (!cmd_ctx) {
goto done;
}
/* get responder ctx */
goto done;
}
/* create domain ctx */
if (!dctx) {
goto done;
}
/* get query */
goto done;
}
/* If the body isn't valid UTF-8, fail */
goto done;
}
/* parse query */
(const char*)query_body,
goto done;
}
goto done;
}
if (domname) {
goto done;
}
} else {
/* this is a multidomain search */
cmd_ctx->check_next = true;
}
/* try to find rules in in-memory cache */
/* cache hit */
/* cache expired or missed */
} /* else error */
done:
}
{
if (!cmd_ctx) {
goto done;
}
cmd_ctx->check_next = false;
/* get responder ctx */
goto done;
}
/* create domain ctx */
if (!dctx) {
goto done;
}
/* sudo currently does not support domain selection
* so find first available domain
* TODO - support domain selection */
}
goto done;
}
/* try to find rules in in-memory cache */
/* cache hit */
/* cache expired or missed */
} /* else error */
done:
}
struct cli_protocol_version *register_cli_protocol_version(void)
{
static struct cli_protocol_version sudo_cli_protocol_version[] = {
};
return sudo_cli_protocol_version;
}
struct sss_cmd_table *get_sudo_cmds(void) {
static struct sss_cmd_table sudo_cmds[] = {
{SSS_CLI_NULL, NULL}
};
return sudo_cmds;
}