1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #include "ldap_util.h" 30*0Sstevel@tonic-gate #include "ldap_print.h" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate void 34*0Sstevel@tonic-gate printMappingFormat(__nis_mapping_format_t *f) { 35*0Sstevel@tonic-gate __nis_value_t *val = getMappingFormat(f, 0, fa_any, 0, 0); 36*0Sstevel@tonic-gate int i; 37*0Sstevel@tonic-gate char *myself = "printMappingFormat"; 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate if (val == 0) 40*0Sstevel@tonic-gate return; 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate for (i = 0; i < val->numVals; i++) { 43*0Sstevel@tonic-gate c2buf(myself, val->val[i].value, val->val[i].length); 44*0Sstevel@tonic-gate } 45*0Sstevel@tonic-gate freeValue(val, 1); 46*0Sstevel@tonic-gate } 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate void 49*0Sstevel@tonic-gate printMappingFormatArray(__nis_mapping_format_t *a) { 50*0Sstevel@tonic-gate __nis_value_t *val = getMappingFormatArray(a, 0, fa_any, 0, 0); 51*0Sstevel@tonic-gate char *myself = "printMappingFormatArray"; 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate if (val != 0) { 54*0Sstevel@tonic-gate if (val->type == vt_string) { 55*0Sstevel@tonic-gate int i; 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate if (a[0].type != mmt_begin) 58*0Sstevel@tonic-gate p2buf(myself, "\""); 59*0Sstevel@tonic-gate for (i = 0; i < val->numVals; i++) { 60*0Sstevel@tonic-gate sc2buf(myself, val->val[i].value, 61*0Sstevel@tonic-gate val->val[i].length); 62*0Sstevel@tonic-gate } 63*0Sstevel@tonic-gate } else { 64*0Sstevel@tonic-gate p2buf(myself, "<illegal>"); 65*0Sstevel@tonic-gate } 66*0Sstevel@tonic-gate freeValue(val, 1); 67*0Sstevel@tonic-gate } else { 68*0Sstevel@tonic-gate p2buf(myself, "<novals>"); 69*0Sstevel@tonic-gate } 70*0Sstevel@tonic-gate } 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate void 73*0Sstevel@tonic-gate printIndex(__nis_index_t *i) { 74*0Sstevel@tonic-gate int len = 0; 75*0Sstevel@tonic-gate char *str = getIndex(i, &len); 76*0Sstevel@tonic-gate char *myself = "printIndex"; 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate sc2buf(myself, str, len); 79*0Sstevel@tonic-gate sfree(str); 80*0Sstevel@tonic-gate } 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate void 83*0Sstevel@tonic-gate printObjSpec(__nis_obj_spec_t *o) { 84*0Sstevel@tonic-gate int len = 0; 85*0Sstevel@tonic-gate char *str = getObjSpec(o, &len); 86*0Sstevel@tonic-gate char *myself = "printObjSpec"; 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate sc2buf(myself, str, len); 89*0Sstevel@tonic-gate sfree(str); 90*0Sstevel@tonic-gate } 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate void 93*0Sstevel@tonic-gate printSearchTriple(__nis_search_triple_t *s) { 94*0Sstevel@tonic-gate int len = 0; 95*0Sstevel@tonic-gate char *str = getSearchTriple(s, &len); 96*0Sstevel@tonic-gate char *myself = "printSearchTriple"; 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate sc2buf(myself, str, len); 99*0Sstevel@tonic-gate sfree(str); 100*0Sstevel@tonic-gate } 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate void 103*0Sstevel@tonic-gate printMappingItem(__nis_mapping_item_t *i, __nis_mapping_item_type_t native) { 104*0Sstevel@tonic-gate __nis_value_t *val = getMappingItem(i, native, 0, 0, NULL); 105*0Sstevel@tonic-gate int j; 106*0Sstevel@tonic-gate char *myself = "printMappingItem"; 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate if (val == 0) 109*0Sstevel@tonic-gate return; 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate if (i->repeat) 112*0Sstevel@tonic-gate p2buf(myself, "("); 113*0Sstevel@tonic-gate for (j = 0; j < val->numVals; j++) { 114*0Sstevel@tonic-gate c2buf(myself, val->val[j].value, val->val[j].length); 115*0Sstevel@tonic-gate } 116*0Sstevel@tonic-gate if (i->repeat) 117*0Sstevel@tonic-gate p2buf(myself, ")"); 118*0Sstevel@tonic-gate freeValue(val, 1); 119*0Sstevel@tonic-gate } 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate void 122*0Sstevel@tonic-gate printMappingSubElement(__nis_mapping_sub_element_t *e, 123*0Sstevel@tonic-gate __nis_mapping_item_type_t native) { 124*0Sstevel@tonic-gate int i; 125*0Sstevel@tonic-gate char *myself = "printMappingSubElement"; 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate switch (e->type) { 128*0Sstevel@tonic-gate case me_item: 129*0Sstevel@tonic-gate printMappingItem(&e->element.item, native); 130*0Sstevel@tonic-gate break; 131*0Sstevel@tonic-gate case me_print: 132*0Sstevel@tonic-gate p2buf(myself, "("); 133*0Sstevel@tonic-gate printMappingFormatArray(e->element.print.fmt); 134*0Sstevel@tonic-gate for (i = 0; i < e->element.print.numItems; i++) { 135*0Sstevel@tonic-gate p2buf(myself, ", "); 136*0Sstevel@tonic-gate printMappingItem(&e->element.print.item[i], native); 137*0Sstevel@tonic-gate } 138*0Sstevel@tonic-gate if (e->element.print.doElide) { 139*0Sstevel@tonic-gate p2buf(myself, ", \"%c\"", e->element.print.elide); 140*0Sstevel@tonic-gate } 141*0Sstevel@tonic-gate p2buf(myself, ")"); 142*0Sstevel@tonic-gate break; 143*0Sstevel@tonic-gate case me_split: 144*0Sstevel@tonic-gate p2buf(myself, "("); 145*0Sstevel@tonic-gate printMappingItem(&e->element.split.item, native); 146*0Sstevel@tonic-gate p2buf(myself, ", \"%c\")", e->element.split.delim); 147*0Sstevel@tonic-gate break; 148*0Sstevel@tonic-gate case me_match: 149*0Sstevel@tonic-gate p2buf(myself, "<me_match>"); 150*0Sstevel@tonic-gate break; 151*0Sstevel@tonic-gate case me_extract: 152*0Sstevel@tonic-gate p2buf(myself, "("); 153*0Sstevel@tonic-gate printMappingItem(&e->element.extract.item, native); 154*0Sstevel@tonic-gate p2buf(myself, ", "); 155*0Sstevel@tonic-gate printMappingFormatArray(e->element.extract.fmt); 156*0Sstevel@tonic-gate p2buf(myself, ")"); 157*0Sstevel@tonic-gate break; 158*0Sstevel@tonic-gate default: 159*0Sstevel@tonic-gate p2buf(myself, "(<unknown>)"); 160*0Sstevel@tonic-gate break; 161*0Sstevel@tonic-gate } 162*0Sstevel@tonic-gate } 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate void 165*0Sstevel@tonic-gate printMappingElement(__nis_mapping_element_t *e, 166*0Sstevel@tonic-gate __nis_mapping_item_type_t native) { 167*0Sstevel@tonic-gate int i; 168*0Sstevel@tonic-gate char *myself = "printMappingElement"; 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate switch (e->type) { 171*0Sstevel@tonic-gate case me_item: 172*0Sstevel@tonic-gate printMappingItem(&e->element.item, native); 173*0Sstevel@tonic-gate break; 174*0Sstevel@tonic-gate case me_print: 175*0Sstevel@tonic-gate p2buf(myself, "("); 176*0Sstevel@tonic-gate printMappingFormatArray(e->element.print.fmt); 177*0Sstevel@tonic-gate for (i = 0; i < e->element.print.numSubElements; i++) { 178*0Sstevel@tonic-gate p2buf(myself, ", "); 179*0Sstevel@tonic-gate printMappingSubElement( 180*0Sstevel@tonic-gate &e->element.print.subElement[i], native); 181*0Sstevel@tonic-gate } 182*0Sstevel@tonic-gate if (e->element.print.doElide) { 183*0Sstevel@tonic-gate p2buf(myself, ", \"%c\"", e->element.print.elide); 184*0Sstevel@tonic-gate } 185*0Sstevel@tonic-gate p2buf(myself, ")"); 186*0Sstevel@tonic-gate break; 187*0Sstevel@tonic-gate case me_split: 188*0Sstevel@tonic-gate p2buf(myself, "("); 189*0Sstevel@tonic-gate printMappingItem(&e->element.split.item, native); 190*0Sstevel@tonic-gate p2buf(myself, ", \"%c\")", e->element.split.delim); 191*0Sstevel@tonic-gate break; 192*0Sstevel@tonic-gate case me_match: 193*0Sstevel@tonic-gate p2buf(myself, "("); 194*0Sstevel@tonic-gate printMappingFormatArray(e->element.match.fmt); 195*0Sstevel@tonic-gate for (i = 0; i < e->element.match.numItems; i++) { 196*0Sstevel@tonic-gate p2buf(myself, ", "); 197*0Sstevel@tonic-gate printMappingItem(&e->element.match.item[i], native); 198*0Sstevel@tonic-gate } 199*0Sstevel@tonic-gate p2buf(myself, ")"); 200*0Sstevel@tonic-gate break; 201*0Sstevel@tonic-gate case me_extract: 202*0Sstevel@tonic-gate p2buf(myself, "("); 203*0Sstevel@tonic-gate printMappingItem(&e->element.extract.item, native); 204*0Sstevel@tonic-gate p2buf(myself, ", "); 205*0Sstevel@tonic-gate printMappingFormatArray(e->element.extract.fmt); 206*0Sstevel@tonic-gate p2buf(myself, ")"); 207*0Sstevel@tonic-gate break; 208*0Sstevel@tonic-gate default: 209*0Sstevel@tonic-gate p2buf(myself, "(<unknown>)"); 210*0Sstevel@tonic-gate break; 211*0Sstevel@tonic-gate } 212*0Sstevel@tonic-gate } 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate void 215*0Sstevel@tonic-gate printMappingRLHS(__nis_mapping_rlhs_t *m, __nis_mapping_item_type_t native) { 216*0Sstevel@tonic-gate int i; 217*0Sstevel@tonic-gate char *myself = "printMappingRLHS"; 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate if (m->numElements > 1) 220*0Sstevel@tonic-gate p2buf(myself, "("); 221*0Sstevel@tonic-gate for (i = 0; i < m->numElements; i++) { 222*0Sstevel@tonic-gate printMappingElement(&m->element[i], native); 223*0Sstevel@tonic-gate } 224*0Sstevel@tonic-gate if (m->numElements > 1) 225*0Sstevel@tonic-gate p2buf(myself, ")"); 226*0Sstevel@tonic-gate } 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate void 229*0Sstevel@tonic-gate printMappingRule(__nis_mapping_rule_t *r, 230*0Sstevel@tonic-gate __nis_mapping_item_type_t nativeLhs, 231*0Sstevel@tonic-gate __nis_mapping_item_type_t nativeRhs) { 232*0Sstevel@tonic-gate char *myself = "printMappingRule"; 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate printMappingRLHS(&r->lhs, nativeLhs); 235*0Sstevel@tonic-gate p2buf(myself, "="); 236*0Sstevel@tonic-gate printMappingRLHS(&r->rhs, nativeRhs); 237*0Sstevel@tonic-gate } 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gate void 240*0Sstevel@tonic-gate printObjName(__nis_index_t *index, char *name) { 241*0Sstevel@tonic-gate char *myself = "printObjName"; 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate printIndex(index); 244*0Sstevel@tonic-gate p2buf(myself, "%s", NIL(name)); 245*0Sstevel@tonic-gate } 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate void 248*0Sstevel@tonic-gate printobjectDN(__nis_object_dn_t *o) { 249*0Sstevel@tonic-gate char *myself = "printobjectDN"; 250*0Sstevel@tonic-gate int i; 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate p2buf(myself, "\t"); 253*0Sstevel@tonic-gate printSearchTriple(&o->read); 254*0Sstevel@tonic-gate p2buf(myself, ":\n\t"); 255*0Sstevel@tonic-gate printSearchTriple(&o->write); 256*0Sstevel@tonic-gate switch (o->delDisp) { 257*0Sstevel@tonic-gate case dd_always: 258*0Sstevel@tonic-gate p2buf(myself, ":\n\t\talways"); 259*0Sstevel@tonic-gate break; 260*0Sstevel@tonic-gate case dd_perDbId: 261*0Sstevel@tonic-gate p2buf(myself, ":\n\t\tdbid=%s\n", NIL(o->dbIdName)); 262*0Sstevel@tonic-gate for (i = 0; i < o->numDbIds; i++) { 263*0Sstevel@tonic-gate p2buf(myself, "\t\t\t"); 264*0Sstevel@tonic-gate printMappingRule(o->dbId[i], mit_ldap, mit_nisplus); 265*0Sstevel@tonic-gate } 266*0Sstevel@tonic-gate break; 267*0Sstevel@tonic-gate case dd_never: 268*0Sstevel@tonic-gate p2buf(myself, ":\n\t\tnever"); 269*0Sstevel@tonic-gate break; 270*0Sstevel@tonic-gate default: 271*0Sstevel@tonic-gate p2buf(myself, ":\n\t\t<unknown>"); 272*0Sstevel@tonic-gate } 273*0Sstevel@tonic-gate } 274*0Sstevel@tonic-gate 275*0Sstevel@tonic-gate void 276*0Sstevel@tonic-gate printTableMapping(__nis_table_mapping_t *t) { 277*0Sstevel@tonic-gate __nis_object_dn_t *o; 278*0Sstevel@tonic-gate int i; 279*0Sstevel@tonic-gate char *myself = "printTableMapping"; 280*0Sstevel@tonic-gate 281*0Sstevel@tonic-gate p2buf(myself, "\n%s:", NIL(t->dbId)); 282*0Sstevel@tonic-gate printObjName(&t->index, t->objName); 283*0Sstevel@tonic-gate p2buf(myself, "\n\t%s \t%s", NIL(t->objName), NIL(t->objPath)); 284*0Sstevel@tonic-gate p2buf(myself, "\n\tTTL = (%d - %d) -> %d\n", 285*0Sstevel@tonic-gate t->initTtlLo, t->initTtlHi, t->ttl); 286*0Sstevel@tonic-gate 287*0Sstevel@tonic-gate for (o = t->objectDN; o != 0; o = o->next) { 288*0Sstevel@tonic-gate printobjectDN(o); 289*0Sstevel@tonic-gate p2buf(myself, "\n"); 290*0Sstevel@tonic-gate } 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate p2buf(myself, "\tLDAP -> NIS+\n"); 293*0Sstevel@tonic-gate p2buf(myself, "\tRules:\n"); 294*0Sstevel@tonic-gate for (i = 0; i < t->numRulesFromLDAP; i++) { 295*0Sstevel@tonic-gate p2buf(myself, "\t\t"); 296*0Sstevel@tonic-gate printMappingRule(t->ruleFromLDAP[i], mit_nisplus, mit_ldap); 297*0Sstevel@tonic-gate p2buf(myself, "\n"); 298*0Sstevel@tonic-gate } 299*0Sstevel@tonic-gate 300*0Sstevel@tonic-gate p2buf(myself, "\tNIS+ -> LDAP\n"); 301*0Sstevel@tonic-gate p2buf(myself, "\tRules:\n"); 302*0Sstevel@tonic-gate for (i = 0; i < t->numRulesToLDAP; i++) { 303*0Sstevel@tonic-gate p2buf(myself, "\t\t"); 304*0Sstevel@tonic-gate printMappingRule(t->ruleToLDAP[i], mit_ldap, mit_nisplus); 305*0Sstevel@tonic-gate p2buf(myself, "\n"); 306*0Sstevel@tonic-gate } 307*0Sstevel@tonic-gate } 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate void 310*0Sstevel@tonic-gate printRuleValue(__nis_rule_value_t *rv) { 311*0Sstevel@tonic-gate int i, j; 312*0Sstevel@tonic-gate __nis_buffer_t b = {0, 0}; 313*0Sstevel@tonic-gate char *myself = "printRuleValue"; 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate if (rv == 0) 316*0Sstevel@tonic-gate return; 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate if (rv->colName != 0) { 319*0Sstevel@tonic-gate bp2buf(myself, &b, "Columns:\n"); 320*0Sstevel@tonic-gate for (i = 0; i < rv->numColumns; i++) { 321*0Sstevel@tonic-gate bp2buf(myself, &b, "\t%s", NIL(rv->colName[i])); 322*0Sstevel@tonic-gate if (rv->colVal[i].numVals == 1) { 323*0Sstevel@tonic-gate bp2buf(myself, &b, "="); 324*0Sstevel@tonic-gate if (rv->colVal[i].type == vt_string) 325*0Sstevel@tonic-gate sbc2buf(myself, 326*0Sstevel@tonic-gate rv->colVal[i].val[0].value, 327*0Sstevel@tonic-gate rv->colVal[i].val[0].length, &b); 328*0Sstevel@tonic-gate else 329*0Sstevel@tonic-gate bc2buf(myself, 330*0Sstevel@tonic-gate rv->colVal[i].val[0].value, 331*0Sstevel@tonic-gate rv->colVal[i].val[0].length, &b); 332*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 333*0Sstevel@tonic-gate } else { 334*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 335*0Sstevel@tonic-gate for (j = 0; j < rv->colVal[i].numVals; j++) { 336*0Sstevel@tonic-gate bp2buf(myself, &b, "\t\t"); 337*0Sstevel@tonic-gate if (rv->colVal[i].type == vt_string) 338*0Sstevel@tonic-gate sbc2buf(myself, 339*0Sstevel@tonic-gate rv->colVal[i].val[j].value, 340*0Sstevel@tonic-gate rv->colVal[i].val[j].length, 341*0Sstevel@tonic-gate &b); 342*0Sstevel@tonic-gate else 343*0Sstevel@tonic-gate bc2buf(myself, 344*0Sstevel@tonic-gate rv->colVal[i].val[j].value, 345*0Sstevel@tonic-gate rv->colVal[i].val[j].length, 346*0Sstevel@tonic-gate &b); 347*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 348*0Sstevel@tonic-gate } 349*0Sstevel@tonic-gate } 350*0Sstevel@tonic-gate } 351*0Sstevel@tonic-gate } 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate if (rv->attrName != 0) { 354*0Sstevel@tonic-gate bp2buf(myself, &b, "Attributes:\n"); 355*0Sstevel@tonic-gate for (i = 0; i < rv->numAttrs; i++) { 356*0Sstevel@tonic-gate bp2buf(myself, &b, "\t%s", NIL(rv->attrName[i])); 357*0Sstevel@tonic-gate if (rv->attrVal[i].numVals == 1) { 358*0Sstevel@tonic-gate bp2buf(myself, &b, "="); 359*0Sstevel@tonic-gate if (rv->attrVal[i].type == vt_string) 360*0Sstevel@tonic-gate sbc2buf(myself, 361*0Sstevel@tonic-gate rv->attrVal[i].val[0].value, 362*0Sstevel@tonic-gate rv->attrVal[i].val[0].length, 363*0Sstevel@tonic-gate &b); 364*0Sstevel@tonic-gate else 365*0Sstevel@tonic-gate bc2buf(myself, 366*0Sstevel@tonic-gate rv->attrVal[i].val[0].value, 367*0Sstevel@tonic-gate rv->attrVal[i].val[0].length, 368*0Sstevel@tonic-gate &b); 369*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 370*0Sstevel@tonic-gate } else { 371*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 372*0Sstevel@tonic-gate for (j = 0; j < rv->attrVal[i].numVals; j++) { 373*0Sstevel@tonic-gate bp2buf(myself, &b, "\t\t"); 374*0Sstevel@tonic-gate if (rv->attrVal[i].type == vt_string) 375*0Sstevel@tonic-gate sbc2buf(myself, 376*0Sstevel@tonic-gate rv->attrVal[i].val[j].value, 377*0Sstevel@tonic-gate rv->attrVal[i].val[j].length, 378*0Sstevel@tonic-gate &b); 379*0Sstevel@tonic-gate else 380*0Sstevel@tonic-gate bc2buf(myself, 381*0Sstevel@tonic-gate rv->attrVal[i].val[j].value, 382*0Sstevel@tonic-gate rv->attrVal[i].val[j].length, 383*0Sstevel@tonic-gate &b); 384*0Sstevel@tonic-gate bp2buf(myself, &b, "\n"); 385*0Sstevel@tonic-gate } 386*0Sstevel@tonic-gate } 387*0Sstevel@tonic-gate } 388*0Sstevel@tonic-gate } 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate c2buf(myself, b.buf, b.len); 391*0Sstevel@tonic-gate sfree(b.buf); 392*0Sstevel@tonic-gate printbuf(); 393*0Sstevel@tonic-gate } 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate void 396*0Sstevel@tonic-gate printLdapMod(LDAPMod **mods, __nis_buffer_t *b) { 397*0Sstevel@tonic-gate LDAPMod *m; 398*0Sstevel@tonic-gate char *s; 399*0Sstevel@tonic-gate char *myself = "printLdapMod"; 400*0Sstevel@tonic-gate 401*0Sstevel@tonic-gate if (mods == 0) 402*0Sstevel@tonic-gate return; 403*0Sstevel@tonic-gate 404*0Sstevel@tonic-gate if (b == 0) 405*0Sstevel@tonic-gate b = &pb; 406*0Sstevel@tonic-gate 407*0Sstevel@tonic-gate while ((m = *mods) != 0) { 408*0Sstevel@tonic-gate if ((m->mod_op & LDAP_MOD_ADD) != 0 || 409*0Sstevel@tonic-gate (m->mod_op & ~LDAP_MOD_BVALUES) == 0) { 410*0Sstevel@tonic-gate s = "ADD "; 411*0Sstevel@tonic-gate } else if ((m->mod_op & LDAP_MOD_DELETE) != 0) { 412*0Sstevel@tonic-gate s = "DELETE "; 413*0Sstevel@tonic-gate } else if ((m->mod_op & LDAP_MOD_REPLACE) != 0) { 414*0Sstevel@tonic-gate s = "REPLACE"; 415*0Sstevel@tonic-gate } else { 416*0Sstevel@tonic-gate s = "UNKNOWN"; 417*0Sstevel@tonic-gate } 418*0Sstevel@tonic-gate bp2buf(myself, b, "%s: %s\n", s, m->mod_type); 419*0Sstevel@tonic-gate if ((m->mod_op & LDAP_MOD_BVALUES) == 0) { 420*0Sstevel@tonic-gate char **v = m->mod_values; 421*0Sstevel@tonic-gate 422*0Sstevel@tonic-gate if (v != 0) { 423*0Sstevel@tonic-gate while (*v != 0) { 424*0Sstevel@tonic-gate bp2buf(myself, b, "\t%s\n", *v); 425*0Sstevel@tonic-gate v++; 426*0Sstevel@tonic-gate } 427*0Sstevel@tonic-gate } 428*0Sstevel@tonic-gate } else { 429*0Sstevel@tonic-gate struct berval **bv = m->mod_bvalues; 430*0Sstevel@tonic-gate 431*0Sstevel@tonic-gate if (bv != 0) { 432*0Sstevel@tonic-gate while (*bv != 0) { 433*0Sstevel@tonic-gate bp2buf(myself, b, "\t<ber> %d bytes\n", 434*0Sstevel@tonic-gate (*bv)->bv_len); 435*0Sstevel@tonic-gate bv++; 436*0Sstevel@tonic-gate } 437*0Sstevel@tonic-gate } 438*0Sstevel@tonic-gate } 439*0Sstevel@tonic-gate mods++; 440*0Sstevel@tonic-gate } 441*0Sstevel@tonic-gate } 442*0Sstevel@tonic-gate 443*0Sstevel@tonic-gate static void 444*0Sstevel@tonic-gate printObjRights(char *msg, void *access) { 445*0Sstevel@tonic-gate uchar_t *a = access; 446*0Sstevel@tonic-gate int i; 447*0Sstevel@tonic-gate 448*0Sstevel@tonic-gate if (a == 0) 449*0Sstevel@tonic-gate return; 450*0Sstevel@tonic-gate 451*0Sstevel@tonic-gate for (i = 0; i < 4; i++) { 452*0Sstevel@tonic-gate p2buf(msg, "%s", (a[i] & NIS_READ_ACC) ? "r" : "-"); 453*0Sstevel@tonic-gate p2buf(msg, "%s", (a[i] & NIS_MODIFY_ACC) ? "m" : "-"); 454*0Sstevel@tonic-gate p2buf(msg, "%s", (a[i] & NIS_CREATE_ACC) ? "c" : "-"); 455*0Sstevel@tonic-gate p2buf(msg, "%s", (a[i] & NIS_DESTROY_ACC) ? "d" : "-"); 456*0Sstevel@tonic-gate } 457*0Sstevel@tonic-gate } 458*0Sstevel@tonic-gate 459*0Sstevel@tonic-gate void 460*0Sstevel@tonic-gate printObjAttr(__nis_obj_attr_t *attr) { 461*0Sstevel@tonic-gate char *myself = "printObjAttr"; 462*0Sstevel@tonic-gate 463*0Sstevel@tonic-gate if (attr == 0) 464*0Sstevel@tonic-gate return; 465*0Sstevel@tonic-gate 466*0Sstevel@tonic-gate p2buf(myself, "\tzo_owner = %s\n", NIL(attr->zo_owner)); 467*0Sstevel@tonic-gate p2buf(myself, "\tzo_group = %s\n", NIL(attr->zo_group)); 468*0Sstevel@tonic-gate p2buf(myself, "\tzo_domain = %s\n", NIL(attr->zo_domain)); 469*0Sstevel@tonic-gate p2buf(myself, "\tzo_access = "); 470*0Sstevel@tonic-gate printObjRights(myself, &attr->zo_access); 471*0Sstevel@tonic-gate p2buf(myself, " (0x%08x)\n", attr->zo_access); 472*0Sstevel@tonic-gate p2buf(myself, "\tzo_ttl = %d\n", attr->zo_ttl); 473*0Sstevel@tonic-gate } 474