/*
SSSD
Authors:
Stephen Gallagher <sgallagh@redhat.com>
Copyright (C) 2010 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 <nss.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "sss_cli.h"
#include "nss_compat.h"
} while (0);
/*
* Replies:
*
* 0-3: 32bit unsigned number of results N
* For each result:
* 8-11: 32bit unsigned type of result
* 12-X: \0 terminated string representing a tuple
* (host, user, domain)
* or a netgroup, depending on the type indicator
* ... repeated N times
*/
struct sss_nss_netgr_rep {
char *buffer;
};
{
char *sbuf;
char *temp;
if (*len < 6) {
/* Not enough space for data, bad packet */
return EBADMSG;
}
i = 0;
switch (type) {
case SSS_NETGR_REP_TRIPLE:
/* Host value */
&temp,
&size);
/* libc expects NULL instead of empty string */
if (size == 0) {
} else {
}
/* User value */
&temp,
&size);
/* libc expects NULL instead of empty string */
if (size == 0) {
} else {
}
/* Domain value */
&temp,
&size);
/* libc expects NULL instead of empty string */
if (size == 0) {
} else {
}
break;
case SSS_NETGR_REP_GROUP:
&temp,
NULL);
break;
default:
return EBADMSG;
}
return 0;
}
struct __netgrent *result)
{
int errnop;
char *name;
if (!netgroup) return NSS_STATUS_NOTFOUND;
sss_nss_lock();
/* make sure we do not have leftovers, and release memory */
if (ret != 0) {
goto out;
}
goto out;
}
if (nret != NSS_STATUS_SUCCESS) {
goto out;
}
/* Get number of results from repbuf */
/* no results if not found */
goto out;
}
out:
return nret;
}
int *errnop)
{
int ret;
/* Caught once glibc passing in buffer == 0x0 */
return NSS_STATUS_TRYAGAIN;
}
/* If we're already processing result data, continue to
* return it.
*/
if (ret != 0) {
return NSS_STATUS_TRYAGAIN;
}
return NSS_STATUS_SUCCESS;
}
/* Release memory, if any */
/* retrieve no more than SSS_NSS_MAX_ENTRIES at a time */
if (nret != NSS_STATUS_SUCCESS) {
return nret;
}
/* Get number of results from repbuf. */
/* no results if not found */
return NSS_STATUS_RETURN;
}
/* skip metadata fields */
/* call again ourselves, this will return the first result */
}
int *errnop)
{
sss_nss_lock();
return nret;
}
{
int errnop;
sss_nss_lock();
/* make sure we do not have leftovers, and release memory */
if (nret != NSS_STATUS_SUCCESS) {
}
return nret;
}