getprojent.c revision cb5caa98562cf06753163f558cbcfe30b8f4673a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 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
};
/*
* _nss_ldap_proj2str 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 the file format.
* e.g.
*
* system:0:System:::
*
* beatles:100:The Beatles:john,paul,george,ringo::task.max-lwps=
* (privileged,100,signal=SIGTERM),(privileged,110,deny)
*
* (All in one line)
*/
static int
{
int nss_result, buflen;
unsigned long len = 0;
return (NSS_STR_PARSE_PARSE);
goto result_proj2str;
}
goto result_proj2str;
}
else
else
else
else
/* 6 = 5 ':' + 1 '\0' */
goto result_proj2str;
}
goto result_proj2str;
}
/* The front end marshaller does not need trailing nulls */
} else
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]),
}