getprojent.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <project.h>
#include "ldap_common.h"
/* Project attributes filters */
#define _PROJ_NAME "SolarisProjectName"
#define _PROJ_PROJID "SolarisProjectID"
#define _PROJ_DESCR "description"
#define _PROJ_USERS "memberUid"
#define _PROJ_GROUPS "memberGid"
#define _PROJ_ATTR "SolarisProjectAttr"
#define _F_GETPROJNAME "(&(objectClass=SolarisProject)(SolarisProjectName=%s))"
#define _F_GETPROJID "(&(objectClass=SolarisProject)(SolarisProjectID=%ld))"
static const char *project_attrs[] = {
(char *)NULL
};
static char *
{
char *p = *nextpp;
char *q = p;
char c;
if (p == NULL)
return (NULL);
while ((c = *q) != '\0' && c != sep)
q++;
if (c == '\0')
*nextpp = 0;
else {
*q++ = '\0';
*nextpp = q;
}
return (p);
}
/*
* _nss_ldap_proj2ent is the data marshalling method for the project getXbyY
* (getprojbyname, getprojbyid, getprojent) backend processes. This method
* is called after a successful ldap search has been performed. This method
* will parse the ldap search values into struct project = argp->buf.buffer
* which the frontend routine expects. Three error conditions are expected
* and returned to nsswitch.
*/
static int
{
int i, nss_result;
unsigned long len = 0;
char **uglist;
goto result_proj2ent;
}
goto result_proj2ent;
}
sizeof (char *));
goto result_proj2ent;
}
if (len == 0) {
goto result_proj2ent;
}
goto result_proj2ent;
}
continue;
}
if (len == 0) {
goto result_proj2ent;
}
errno = 0;
NULL, 10);
if (errno != 0) {
goto result_proj2ent;
}
continue;
}
goto result_proj2ent;
}
continue;
}
goto result_proj2ent;
}
continue;
}
goto result_proj2ent;
}
goto result_proj2ent;
}
if (p == NULL || *p == '\0') {
*uglist++ = 0;
break;
}
*uglist++ = p;
}
return (NSS_STR_PARSE_ERANGE);
continue;
}
goto result_proj2ent;
}
goto result_proj2ent;
}
if (p == NULL || *p == '\0') {
*uglist++ = 0;
break;
}
*uglist++ = p;
}
return (NSS_STR_PARSE_ERANGE);
continue;
}
}
goto result_proj2ent;
}
*buffer = '\0';
buffer++;
}
goto result_proj2ent;
}
*buffer = '\0';
buffer++;
}
goto result_proj2ent;
}
*buffer = '\0';
buffer++;
}
goto result_proj2ent;
}
*buffer = '\0';
buffer++;
}
return ((int)nss_result);
}
/*
* getbyname gets a project entry by name. This function constructs an ldap
* search filter using the name invocation parameter and the getprojname search
* filter defined. Once the filter is constructed, we search for a matching
* entry and marshal the data results into struct project for the frontend
* process. The function _nss_ldap_proj2ent performs the data marshaling.
*/
static nss_status_t
{
char searchfilter[SEARCHFILTERLEN];
return (NSS_NOTFOUND);
}
/*
* getbyprojid gets a project entry by number. This function constructs an ldap
* search filter using the name invocation parameter and the getprojid search
* filter defined. Once the filter is constructed, we search for a matching
* entry and marshal the data results into struct project for the frontend
* process. The function _nss_ldap_proj2ent performs the data marshaling.
*/
static nss_status_t
{
char searchfilter[SEARCHFILTERLEN];
return (NSS_NOTFOUND);
}
static ldap_backend_op_t project_ops[] = {
};
/*ARGSUSED0*/
const char *dummy3)
{
return (_nss_ldap_constr(project_ops,
sizeof (project_ops) / sizeof (project_ops[0]),
}