/*
* 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 <pwd.h>
#include <ctype.h>
#include "ldap_common.h"
/* publickey attributes filters */
static const char *keys_attrs[] = {
(char *)NULL
};
/*
* _nss_ldap_key2str is the data marshaling method for the publickey getXbyY
* (e.g., getpublickey() and getsecretkey()) backend processes. This method
* is called after a successful ldap search has been performed. This method
* will parse the ldap search values into "public:secret" file format.
*
* c3d91f44568fbbefada50d336d9bd67b16e7016f987bb607:
* 7675cd9b8753b5db09dabf12da759c2bd1331c927bb322861fffb54be13f55e9
*
* (All in one line)
*
* Publickey does not have a front end marshaller so db_type is set
* for special handling.
*/
static int
{
int nss_result;
int len;
goto result_key2str;
}
/* get the publickey */
if (pkey_array == NULL) {
goto result_key2str;
}
while (*pkey_array) {
break;
pkey_array++;
}
if (*pkey_array == NULL) {
goto result_key2str;
}
/* get the secretkey */
if (skey_array == NULL) {
/*
* if we got this far, it's possible that the secret
* key is actually missing or no permission to read it.
* For the current implementation, we assume that the
* clients have read permission to the secret key. So,
* the only possibility of reaching this here is due to
* missing secret key.
*/
goto result_key2str;
}
while (*skey_array) {
break;
skey_array++;
}
if (*skey_array == NULL) {
goto result_key2str;
}
/* 2 = 1 ':' + 1 '\0' */
goto result_key2str;
}
/*
* publickey does not have a frontend marshaller.
* copy the result to buf.buffer directly
*/
return ((int)nss_result);
}
/*
* getkeys gets both the public and secret keys from publickey entry by either
* uid name or host name. This function constructs an ldap search filter using
* the name invocation parameter and the getpwnam search filter defined. Once
* the filter is constructed, we search for a matching entry and marshal the
* data results into struct passwd for the frontend process. The function
* _nss_ldap_key2ent performs the data marshaling.
* The lookups will be done using the proxy credential. We don't want to use
* the user's credential for lookup at this point because we don't have any
* secure transport.
*/
static nss_status_t
{
int ret;
/*
* We need to break it down to find if this is a netname for host
* or user. We'll pass the domain as is to the LDAP call.
*/
!= 0)
return ((nss_status_t)NSS_NOTFOUND);
if (!domain)
return ((nss_status_t)NSS_NOTFOUND);
*domain++ = '\0';
return ((nss_status_t)NSS_NOTFOUND);
name = ++p;
/* user keys lookup */
return ((nss_status_t)NSS_NOTFOUND);
return ((nss_status_t)NSS_NOTFOUND);
} else {
/* host keys lookup */
return ((nss_status_t)NSS_NOTFOUND);
return ((nss_status_t)NSS_NOTFOUND);
}
return (rc);
}
0,
0,
0,
};
/*
* _nss_ldap_publickey_constr is where life begins. This function calls the
* generic ldap constructor function to define and build the abstract
* data types required to support ldap operations.
*/
/*ARGSUSED0*/
const char *dummy3)
{
}