/*
* 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 "ldap_common.h"
/* printer attributes filters */
#define _F_GETPRINTERBYNAME \
"(&(objectClass=sunPrinter)(|(printer-name=%s)(printer-aliases=%s)))"
/*
* Attributes from the following classes:
* printerService
* printerAbstact
* sunPrinter
*/
/*
* Get all attributes.
*/
/*
* _nss_ldap_printers2str is the data marshaling method for the printers
* getXbyY backend processes. This method is called after a successful
* ldap search has been performed. This method will parse the ldap search
* values into argp->buf.buffer. Three error conditions are expected and
* returned to nsswitch.
* In order to be compatible with old data output, the code is commented out
* with NSS_LDAP_PRINTERS. The NSS_LDAP_PRINTERS section is for future
* refrences if it's decided to fix the output format.
*/
static int
{
int i, j;
int nss_result;
#ifdef NSS_LDAP_PRINTERS
#endif
return (NSS_STR_PARSE_PARSE);
return (NSS_STR_PARSE_PARSE);
} else {
}
#ifdef NSS_LDAP_PRINTERS
#endif
/*
* Pick out the printer name and aliases
*/
goto result_printers2str;
}
#ifdef NSS_LDAP_PRINTERS
for (i = 0; i < attr->value_count; i++) {
}
}
#endif
/*
* Add the rest of the attributes
*/
goto result_printers2str;
}
/*
* The attribute contains key=value
*/
for (j = 0; j < attr->value_count; j++) {
if (len < 1 ||
*buffer = 0;
nss_result = (int)NSS_STR_PARSE_PARSE;
goto result_printers2str;
}
}
} else {
/*
* Skip some attr names
*/
#ifdef NSS_LDAP_PRINTERS
"objectclass") == 0 ||
"printer-uri") == 0 ||
"printer-aliases") == 0)
#else
#endif
continue;
}
/*
* Translate attr name ->key name
*/
== 0)
attrname = "bsdaddr";
#ifdef NSS_LDAP_PRINTERS
== 0)
attrname = "description";
== 0)
attrname = "itopssupported";
== 0)
== 0)
#endif
else
/*
* The attrname is the key. The attribute
* data is the value.
*/
for (j = 0; j < attr->value_count; j++) {
int k;
char *kp;
*buffer = 0;
goto result_printers2str;
}
if (len < 1) {
*buffer = 0;
goto result_printers2str;
}
/*
* Add extra for any colons which need to
* be backslashed plus ending ':' or ','.
*/
k = 0;
if (*kp == ':')
/* count ':' in value */
k++;
if (j == 0)
/* first time */
len += k;
else
/* add ',' */
len += k + 1;
goto result_printers2str;
}
if (j > 0)
*buffer++ = ',';
(void) append_attr(buffer,
}
}
return ((int)nss_result);
}
/*
* Attributes which contain colons must be backslashed.
*/
static void
{
return;
}
if (*cp == ':') {
*bp++ = '\\';
}
}
}
/*
* getbyname gets printer attributes by printer name. This function
* constructs an ldap search filter using the printer name invocation
* parameter and the getprinterbyname search filter defined. Once the
* filter is constructed, we search for matching entries and marshal
* the data results into argp->buf.buffer for the frontend process.
* The function _nss_ldap_printers2str performs the data marshaling.
*/
static nss_status_t
{
return ((nss_status_t)NSS_NOTFOUND);
}
};
/*
* _nss_ldap_printers_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)
{
}