sss_nfs_client.c revision 2a256e4e4b64891fe846e933589506daa68aa13e
/*
SSSD
NFS Client
Copyright (C) Noam Meltzer <noam@primarydata.com> 2013-2014
Copyright (C) Noam Meltzer <tsnoam@gmail.com> 2014-
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/>.
*/
#define _GNU_SOURCE
#include <stddef.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <nfsidmap.h>
#include "nfsidmap_internal.h"
#include "sss_client/sss_cli.h"
#include "sss_client/nss_mc.h"
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
#define PLUGIN_NAME "sss_nfs"
#define CONF_SECTION "sss_nfs"
#define CONF_USE_MC "memcache"
#define REPLY_ID_OFFSET (8)
#define BUF_LEN (4096)
#define USE_MC_DEFAULT true
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
static char sss_nfs_plugin_name[] = PLUGIN_NAME;
static char nfs_conf_sect[] = CONF_SECTION;
static char nfs_conf_use_mc[] = CONF_USE_MC;
static bool nfs_use_mc = USE_MC_DEFAULT;
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/* Forward declarations */
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/* get from memcache functions */
{
int rc = 0;
char *p = NULL;
if (!nfs_use_mc) {
return -1;
}
do {
goto done;
}
buf = p;
if (rc == 0) {
} else {
}
done:
return rc;
}
{
int rc = 0;
char *p = NULL;
if (!nfs_use_mc) {
return -1;
}
do {
goto done;
}
buf = p;
if (rc == 0) {
} else {
}
done:
return rc;
}
{
int rc;
char *p = NULL;
if (!nfs_use_mc) {
return -1;
}
do {
goto done;
}
buf = p;
if (rc == 0) {
if (pw_name_len > len) {
IDMAP_LOG(0, ("%s: reply too long; pw_name_len=%lu, len=%lu",
}
} else {
}
done:
return rc;
}
{
int rc;
char *p = NULL;
if (!nfs_use_mc) {
return -1;
}
do {
goto done;
}
buf = p;
if (rc == 0) {
if (gr_name_len > len) {
IDMAP_LOG(0, ("%s: reply too long; gr_name_len=%lu, len=%lu",
}
} else {
}
done:
return rc;
}
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
{
int rc;
if (rc == 0) {
}
return rc;
}
enum sss_cli_command cmd)
{
int rc;
if (rc == 0) {
}
return rc;
}
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
{
int err = 0;
enum nss_status req_rc;
struct sss_cli_req_data rd;
sss_nss_lock();
if (req_rc == NSS_STATUS_NOTFOUND) {
return ENOENT;
}
if (req_rc != NSS_STATUS_SUCCESS) {
return EPIPE;
}
return 0;
}
{
int rc = 0;
uint32_t num_results = 0;
goto done;
}
if (num_results > 1) {
goto done;
}
if (num_results == 0) {
goto done;
}
rep_len));
goto done;
}
done:
return rc;
}
{
int rc = 0;
uint32_t num_results = 0;
const char *buf;
goto done;
}
if (num_results > 1) {
goto done;
}
if (num_results == 0) {
goto done;
}
rep_len));
goto done;
}
offset = 0;
if (rc != 0) {
}
done:
return rc;
}
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/* configuration parsing aids */
{
bool res = false;
}
return res;
}
{
int res;
char *val;
if (val) {
}
return res;
}
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/* libnfsidmap return-code aids */
/*
* we only want to return 0 or ENOENT; otherwise libnfsidmap will stop
* translation instead of proceeding to the next translation plugin
*/
int normalise_rc(int rc) {
int res;
}
return res;
}
/* log the actual rc from our code (to be used before normalising the rc) */
char tmp[80];
}
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/* The external interface */
static int sss_nfs_init(void)
{
return 0;
}
{
return -ENOENT;
}
{
int rc;
return -EINVAL;
}
return -EINVAL;
}
if (rc != 0) {
return -rc;
}
if (rc != 0) {
}
return -rc;
}
{
int rc;
return -EINVAL;
}
return -EINVAL;
}
if (rc != 0) {
return -rc;
}
if (rc != 0) {
}
return -rc;
}
{
int rc;
return -EINVAL;
}
if (rc != 0) {
}
return -rc;
}
{
int rc;
return -EINVAL;
}
if (rc != 0) {
}
return -rc;
}
static int sss_nfs_gss_princ_to_grouplist(
{
return -ENOENT;
}
static struct trans_func s_sss_nfs_trans = {
.init = sss_nfs_init,
};
struct trans_func *libnfsidmap_plugin_init(void)
{
return (&s_sss_nfs_trans);
}