passwd.c revision fcef1231eea30ee9cdc75f3f39f4b9207a84ea1d
/*
* System Security Services Daemon. NSS client interface
*
* Copyright (C) Simo Sorce 2007
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* PASSWD database NSS interface */
#include <nss.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "sss_cli.h"
static struct sss_nss_getpwent_data {
static void sss_nss_getpwent_data_clean(void) {
}
sss_nss_getpwent_data.len = 0;
sss_nss_getpwent_data.ptr = 0;
}
/* GETPWNAM Request:
*
* 0-X: string with name
*
* GERTPWUID Request:
*
* 0-7: 64bit number with uid
*
* Replies:
*
* 0-3: 32bit unsigned number of results
* For each result:
* 0-7: 64bit number uid
* 8-15: 64bit number gid
* 16-X: sequence of 5, 0 terminated, strings (name, passwd, gecos, dir, shell)
*/
struct sss_nss_pw_rep {
char *buffer;
};
{
char *sbuf;
int err;
return EBADMSG;
}
} else {
}
i = 0;
while (i < slen) {
i++;
}
if (i == slen) { /* premature end of buf */
return err;
}
i++;
while (i < slen) {
i++;
}
if (i == slen) { /* premature end of buf */
return err;
}
i++;
while (i < slen) {
i++;
}
if (i == slen) { /* premature end of buf */
return err;
}
i++;
while (i < slen) {
i++;
}
if (i == slen) { /* premature end of buf */
return err;
}
i++;
while (i < slen) {
i++;
}
return err;
}
return 0;
}
{
struct sss_cli_req_data rd;
struct sss_nss_pw_rep pwrep;
enum nss_status nret;
int ret;
if (nret != NSS_STATUS_SUCCESS) {
return nret;
}
/* no results if not found */
return NSS_STATUS_NOTFOUND;
}
/* only 1 result is accepted for this function */
return NSS_STATUS_TRYAGAIN;
}
if (ret) {
return NSS_STATUS_TRYAGAIN;
}
return NSS_STATUS_SUCCESS;
}
{
struct sss_cli_req_data rd;
struct sss_nss_pw_rep pwrep;
enum nss_status nret;
int ret;
if (nret != NSS_STATUS_SUCCESS) {
return nret;
}
/* no results if not found */
return NSS_STATUS_NOTFOUND;
}
/* only 1 result is accepted for this function */
return NSS_STATUS_TRYAGAIN;
}
if (ret) {
return NSS_STATUS_TRYAGAIN;
}
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_sss_setpwent(void)
{
enum nss_status nret;
int errnop;
/* make sure we do not have leftovers, and release memory */
if (nret != NSS_STATUS_SUCCESS) {
return nret;
}
return NSS_STATUS_SUCCESS;
}
int *errnop)
{
struct sss_cli_req_data rd;
struct sss_nss_pw_rep pwrep;
enum nss_status nret;
int ret;
/* if there are leftovers return the next one */
if (ret) {
return NSS_STATUS_TRYAGAIN;
}
/* advance buffer pointer */
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;
}
/* no results if not found */
return NSS_STATUS_NOTFOUND;
}
/* call again ourselves, this will return the first result */
}
enum nss_status _nss_sss_endpwent(void)
{
enum nss_status nret;
int errnop;
/* make sure we do not have leftovers, and release memory */
if (nret != NSS_STATUS_SUCCESS) {
return nret;
}
return NSS_STATUS_SUCCESS;
}