nss_mc_group.c revision 287e76479d68db4134274d4a4fca5fe0fbc9a605
/*
* System Security Services Daemon. NSS client interface
*
* Copyright (C) Simo Sorce 2011
*
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* GROUP database NSS interface using mmap cache */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "nss_mc.h"
{
struct sss_mc_grp_data *data;
void *cookie;
char *membuf;
int ret;
int i;
/* additional checks before filling result*/
/* entry is now invalid */
return EINVAL;
}
return ERANGE;
}
/* fill in glibc provided structs */
/* copy in buffer */
/* fill in group */
if (ret) {
return ret;
}
if (ret) {
return ret;
}
if (ret) {
return ret;
}
}
return EINVAL;
}
return 0;
}
{
struct sss_mc_grp_data *data;
char *rec_name;
int ret;
if (ret) {
return ret;
}
/* hashes are calculated including the NULL terminator */
return ENOENT;
}
while (slot != MC_INVALID_VAL) {
if (ret) {
goto done;
}
/* check record matches what we are searching for */
/* if name hash does not match we can skip this immediately */
continue;
}
break;
}
}
if (slot == MC_INVALID_VAL) {
goto done;
}
done:
return ret;
}
{
struct sss_mc_grp_data *data;
char gidstr[11];
int len;
int ret;
if (ret) {
return ret;
}
if (len > 10) {
return EINVAL;
}
/* hashes are calculated including the NULL terminator */
return ENOENT;
}
while (slot != MC_INVALID_VAL) {
if (ret) {
goto done;
}
/* check record matches what we are searching for */
/* if uid hash does not match we can skip this immediately */
continue;
}
break;
}
}
if (slot == MC_INVALID_VAL) {
goto done;
}
done:
return ret;
}