/*
* System Security Services Daemon. NSS client interface
*
* Authors:
* Lukas Slebodnik <lslebodn@redhat.com>
*
* Copyright (C) 2015 Red Hat
*
* 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/>.
*/
/* INITGROUPs database NSS interface using mmap cache */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <time.h>
#include "nss_mc.h"
#include "shared/safealign.h"
NULL, 0, 0 };
{
long int i;
long int max_ret;
/* additional checks before filling result*/
/* entry is now invalid */
return EINVAL;
}
/* check we have enough space in the buffer */
long int newsize;
}
if (!newgroups) {
return ENOMEM;
}
}
for (i = 0; i < max_ret; i++) {
*start += 1;
}
return 0;
}
{
char *rec_name;
int ret;
if (ret) {
return ret;
}
/* Get max size of data table. */
/* hashes are calculated including the NULL terminator */
/* If slot is not within the bounds of mmapped region and
* it's value is not MC_INVALID_VAL, then the cache is
* probably corrupted. */
/* free record from previous iteration */
if (ret) {
goto done;
}
/* check record matches what we are searching for */
/* if name hash does not match we can skip this immediately */
continue;
}
/* Integrity check
* - data->name cannot point outside all strings or data
* - all data must be within copy of record
* - size of record must be lower that data table size
* - data->strs cannot point outside strings
* - rec_name is a zero-terminated string */
goto done;
}
break;
}
}
goto done;
}
done:
return ret;
}