nis_db.cc revision 8d0852b7f8176b2c281cc944010af2b0fecf9fb2
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * CDDL HEADER START
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * The contents of this file are subject to the terms of the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Common Development and Distribution License (the "License").
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * You may not use this file except in compliance with the License.
16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347agiri * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * See the License for the specific language governing permissions
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * and limitations under the License.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * When distributing Covered Code, include this CDDL HEADER in each
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * If applicable, add the following below this CDDL HEADER, with the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * fields enclosed by brackets "[]" replaced with your own identifying
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * information: Portions Copyright [yyyy] [name of copyright owner]
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * CDDL HEADER END
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Use is subject to license terms.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaextern "C" {
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastatic db_result *db_add_entry_x(char *tab, int numattrs,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * (Imported from rpc.nisd/nis_xx_proc.c)
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * 'tbl_prototype' is used to create a table that holds a directory.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otatable_obj tbl_prototype = { (char *)"DIRECTORY", 2, ' ', {2, &cols[0]}, NULL };
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Free resources associated with a db_result structure
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota /* Can't have valid objects */
return (res);
static db_result*
return (res);
db *
char *intName;
if (intName == 0)
return (dbase);
switch (dbstat) {
case DB_SUCCESS:
case DB_NOTFOUND:
case DB_BADTABLE:
case DB_BADQUERY:
case DB_BADOBJECT:
case DB_MEMORY_LIMIT:
case DB_STORAGE_LIMIT:
case DB_INTERNAL_ERROR:
case DB_SYNC_FAILED:
return (str);
return (FALSE);
return (dbstat);
return (DB_INTERNAL_ERROR);
return (dbstat);
return (dbstat);
return (dbstat);
return (dbstat);
return (dbstat);
return (dbstat);
if (numattrs != 0) {
DB_BADQUERY));
return (res);
if (numattrs != 0) {
DB_BADQUERY));
delete query;
return (res);
if (msg == 0)
if (name == 0)
if (dir == 0) {
if (tableP == 0)
return (name);
if (table == 0) {
return (name);
if (statP != 0) \
return (obj); \
nis_object *o;
int lstat;
if (objName == 0)
if (table == 0)
o = get_root_object();
if (dbase != 0)
if (lstat != 0) {
if (query == 0) {
delete query;
if (lstat != 0) {
if (res == 0)
nis_object *o;
int stat;
if (objName == 0) {
if (statP != 0)
if (table == 0) {
if (statP != 0)
&ldapMappingList, 0, 0);
if (statP != 0)
nis_object *o;
if (statP != 0)
if (lstatP != 0)
nis_object *o;
int xid;
if (objName == 0)
return (DB_SUCCESS);
if (tsd == 0)
return (DB_INTERNAL_ERROR);
return (DB_SUCCESS);
return (stat);
if (nod == 0) {
return (DB_MEMORY_LIMIT);
return (DB_MEMORY_LIMIT);
return (DB_SUCCESS);
return (DB_SUCCESS);
if (table == 0)
return (DB_BADQUERY);
if (touchRootDir() == 0)
return (DB_SUCCESS);
return (DB_INTERNAL_ERROR);
table = 0;
return (DB_MEMORY_LIMIT);
if (dbase != 0)
return (DB_BADTABLE);
if (query == 0) {
return (DB_BADQUERY);
delete query;
return (DB_SUCCESS);
return (DB_BADTABLE);
return (DB_BADTABLE);
tobj = *t;
char *objName;
__nis_buffer_t b = {0, 0};
return (DB_BADOBJECT);
if (name != 0)
return (stat);
if (curObj != 0) {
return (DB_BADOBJECT);
return (DB_BADOBJECT);
TA_SEARCHABLE) !=
TA_SEARCHABLE)) {
return (DB_BADOBJECT);
if (objTable == 0) {
if (curObj != 0)
return (DB_BADQUERY);
int lstat;
if (curObj != 0)
return (DB_MEMORY_LIMIT);
if (dbase != 0)
if (curObj != 0)
return (DB_BADTABLE);
if (curObj != 0)
return (DB_INTERNAL_ERROR);
if (lstat != 0) {
if (curObj != 0)
return (DB_LOCK_ERROR);
if (lstat != 0) {
if (curObj != 0)
return (DB_LOCK_ERROR);
if (dbres == 0)
if (dirObj == 0) {
if (curObj != 0)
return (ds);
if (xid == 0) {
if (curObj != 0)
return (DB_INTERNAL_ERROR);
if (st != 0) {
if (curObj != 0)
return (DB_INTERNAL_ERROR);
if (st != 0)
if (curObj != 0)
if (isDir) {
return (stat);
int assigned = 0;
if (old == 0) {
if (x->obj != 0)
x->obj = n;
assigned++;
return (assigned > 0);
for (i = 0; i < x->numColumns; i++)
x->column = 0;
x->numColumns = 0;
return (ret);
if (!useLDAPrespository) {
if (ldapStat != 0)
return (DB_SUCCESS);
if (ldapStat != 0)
return (DB_NOTFOUND);
if (ldapStat != 0)
return (DB_NOTFOUND);
if (obj == 0)
return (DB_SUCCESS);
if (doDestroy)
return (dstat);
if (cookie != 0) {
if (start == 0)
int nm;
if (fromLDAP) {
if (cookie != 0)
*((__nis_table_mapping_t **)
cookie) = t;
if (dstatP != 0)
return (stat);
if (dbase != 0)
if (cookie != 0)
if (dstatP != 0)
return ((dstatP != 0) ?
if (cookie != 0)
if (dstatP != 0)
return (stat);
int freeObjPath = 0;
if (obj == 0) {
ent = 0;
objPath = 0;
&objPath);
obj = 0;
if (dbase != 0)
if (freeObjPath)
obj = 0;
db_query *q;
if (freeObjPath)
obj = 0;
if (freeObjPath)
obj = 0;
if (cookie != 0)
*((__nis_table_mapping_t **)
cookie) = t;
if (dstatP != 0)
return (stat);
obj = 0;
tbl = 0;
if (dbase != 0)
obj = 0;
obj = 0;
if (cookie != 0)
*((__nis_table_mapping_t **)
cookie) = t;
if (dstatP != 0)
return (stat);
obj = 0;
if (dstatP != 0)
return (stat);
} else if (skiplog) {
return (res);
db_query *
if (nosync)
delete query;
return (res);
int nosync)
if (num_attrs != 0) {
DB_BADQUERY));
if (nosync)
delete query;
if (nosync)
return (res);
vers *
return (NULL);
if (v == NULL)
return (NULL);
return (DB_BADTABLE);
return (DB_BADTABLE);
delete answer;
return (DB_BADTABLE);
return (DB_SUCCESS);
return (DB_BADTABLE);
return (DB_SUCCESS);
return (DB_BADTABLE);
return (DB_SUCCESS);
return (DB_BADTABLE);
return (DB_SUCCESS);
return (DB_BADTABLE);
return (DB_SUCCESS);
return (stat);
return (stat);
return (stat);
return (DB_BADTABLE);
return (DB_BADQUERY);
return (DB_STORAGE_LIMIT);
return (stat);
__db_disallowLDAP(void) {
useLDAPrespository = 0;
__db_allowLDAP(void) {