1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29#include <errno.h> 30#include "Solaris_NFSShareSecurityModes.h" 31#include "nfs_keys.h" 32#include "nfs_providers_msgstrings.h" 33#include "nfs_provider_names.h" 34#include "messageStrings.h" 35#include "util.h" 36#include "common_functions.h" 37#include "createprop_methods.h" 38#include "libfsmgt.h" 39 40 41/* 42 * Private method declarations 43 */ 44 45static CCIMInstanceList *get_associated_nfsShare_instList( 46 CCIMObjectPath *nfsShareOP); 47static CCIMInstanceList *get_associated_nfsShareSec_instList( 48 CCIMObjectPath *nfsShareSecOP); 49static CCIMObjectPathList *get_associated_nfsShareSec_OPList( 50 CCIMObjectPath *nfsShareSecOP, int *err); 51static CCIMObjectPath *get_Solaris_NFSShare_OP(char *nameKey); 52static CCIMObjectPath *get_Solaris_NFSShareSec_OP(char *, char *); 53static CCIMInstanceList *update_list_with_secMode_inst( 54 CCIMObjectPath *nfsShareOP, 55 CCIMInstanceList *shareSecModeInstList); 56 57/* 58 * Public methods 59 */ 60/* 61 * Instance provider methods 62 */ 63 64/* 65 * Method: cp_createInstance_Solaris_NFSShareSecurityModes 66 * 67 * This method is not supported. In order for a Solaris_NFSShareSecurityModes 68 * association to exist a corresponding Solaris_NFSShare and 69 * Solaris_NFSShareSecurity must already exist. 70 */ 71/* ARGSUSED */ 72CCIMObjectPath * 73cp_createInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, 74 CCIMInstance *pInst) { 75 76 int err = 0; 77 78 util_handleError("SOLARIS_NFSSHARESECMODES::CREATE_INSTANCE", 79 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 80 81 return ((CCIMObjectPath *)NULL); 82} /* cp_createInstance_Solaris_NFSShareSecurityModes */ 83 84/* 85 * Method: cp_deleteInstance_Solaris_NFSShareSecurityModes 86 * 87 * This method is not supported. In order for a Solaris_NFSShareSecurityModes 88 * association to be deleted a corresponding Solaris_NFSShare and 89 * Solaris_NFSShareSecurity must be deleted. The Solaris_NFSShare and 90 * Solaris_NFSShareSecurity should only be deleted through those providers. 91 */ 92/* ARGSUSED */ 93CIMBool 94cp_deleteInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { 95 int err = 0; 96 97 util_handleError("SOLARIS_NFSSHARESECMODES::DELETE_INSTANCE", 98 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 99 100 return (cim_false); 101} /* cp_deleteInstance_Solaris_NFSShareSecurityModes */ 102 103/* 104 * Method: cp_enumInstances_Solaris_NFSShareSecurityModes 105 * 106 * Description: Enumerates the instances of Solaris_NFSShareSecurityModes 107 * on a host. An instance of Solaris_NFSShareSecurityModes is an 108 * association that links a share to it's share security entry. 109 * 110 * Parameters: 111 * - CCIMObjectPath *pOP - An object path containing the name of 112 * the class of which to enumerate the instances of. 113 * 114 * Return Value: 115 * - A pointer to a list of Solaris_NFSShareSecurityModes instances. 116 * - NULL if an error occurred or if there are no instances of 117 * Solaris_NFSShareSecurityModes on the host. In the case of an 118 * error, the error will be logged. 119 */ 120 121CCIMInstanceList * 122cp_enumInstances_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { 123 CCIMInstanceList *shareSecModeInstList; 124 CCIMObjectPathList *nfsShareOPList; 125 CCIMObjectPathList *tmpOPList; 126 CCIMObjectPath *nfsShareOP; 127 CCIMException *ex; 128 int err = 0; 129 130 if (pOP == NULL) { 131 util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 132 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 133 return ((CCIMInstanceList *)NULL); 134 } 135 136 nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); 137 if (nfsShareOP == NULL) { 138 ex = cim_getLastError(); 139 util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 140 CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, 141 &err); 142 return ((CCIMInstanceList *)NULL); 143 } 144 145 nfsShareOPList = cimom_enumerateInstanceNames(nfsShareOP, cim_false); 146 if (nfsShareOPList == NULL) { 147 ex = cim_getLastError(); 148 util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 149 CIM_ERR_FAILED, CIMOM_ENUM_INSTNAMES_FAILURE, ex, &err); 150 cim_freeObjectPath(nfsShareOP); 151 return ((CCIMInstanceList *)NULL); 152 } 153 154 cim_freeObjectPath(nfsShareOP); 155 156 157 if (nfsShareOPList->mDataObject == NULL) { 158 cim_freeObjectPathList(nfsShareOPList); 159 return ((CCIMInstanceList *)NULL); 160 } 161 162 shareSecModeInstList = cim_createInstanceList(); 163 if (shareSecModeInstList == NULL) { 164 ex = cim_getLastError(); 165 util_handleError("SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 166 CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); 167 cim_freeObjectPathList(nfsShareOPList); 168 return ((CCIMInstanceList *)NULL); 169 } 170 171 172 for (tmpOPList = nfsShareOPList; tmpOPList != NULL; 173 tmpOPList = tmpOPList->mNext) { 174 shareSecModeInstList = update_list_with_secMode_inst( 175 tmpOPList->mDataObject, shareSecModeInstList); 176 if (shareSecModeInstList == NULL) { 177 cim_freeObjectPathList(nfsShareOPList); 178 return ((CCIMInstanceList *)NULL); 179 } 180 } 181 cim_freeObjectPathList(nfsShareOPList); 182 return (shareSecModeInstList); 183} /* cp_enumInstances_Solaris_NFSShareSecurityModes */ 184 185/* 186 * Method: cp_enumInstanceNames_Solaris_NFSShareSecurityModes 187 * 188 * Description: Enumerates all of the instances of 189 * Solaris_NFSShareSecurityModes on the host. 190 * 191 * Parameters: 192 * - CCIMObjectPath* pOP - An object path containing the name of the 193 * class of which to enumerate instances of. 194 * 195 * Returns: 196 * - A pointer to a list of Solaris_NFSShareSecurityModes object paths. 197 * - NULL if an error occurred or if there are no NFS mounts on the host. 198 * In the case of an error, the error will be logged. 199 */ 200 201CCIMObjectPathList * 202cp_enumInstanceNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { 203 CCIMInstanceList *instList; 204 CCIMObjectPathList *OPList; 205 CCIMException *ex; 206 int err = 0; 207 208 /* 209 * First check if pOP is null. 210 */ 211 if (pOP == NULL) { 212 util_handleError( 213 "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCENAMES", 214 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 215 return ((CCIMObjectPathList *)NULL); 216 } 217 218 instList = cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); 219 if (instList == NULL) { 220 /* 221 * Either an error occurred or we don't have any 222 * Solaris_NFSShareSecurityModes instances on the host. 223 */ 224 return ((CCIMObjectPathList *)NULL); 225 } 226 227 OPList = cim_createObjectPathList(instList); 228 if (OPList == NULL) { 229 ex = cim_getLastError(); 230 util_handleError( 231 "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCENAMES", 232 CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, ex, &err); 233 } 234 235 cim_freeInstanceList(instList); 236 return (OPList); 237} /* cp_enumInstanceNames_Solaris_NFSShareSecurityModes */ 238 239/* 240 * Method: cp_execQuery_Solaris_NFSShareSecurityModes 241 * 242 * Description: Queries the Solaris_NFSShareSecurityModes instances on the 243 * host to find those that meet the search criteria. 244 * 245 * Parameters: 246 * - CCIMObjectPath *pOP - An object path containing the name of 247 * the class of which to query. 248 * - char *selectClause - Not used. 249 * - char *nonJoinExp - Not used. 250 * - char *queryExp - Not used. 251 * - char *queryLang - Not used. 252 * 253 * Returns: 254 * - A pointer to a list of Solaris_NFSShareSecurityModes instances 255 * that match the search criteria. 256 * - NULL if an error occurred or if there are no 257 * Solaris_NFSShareSecurityModes instances matching the search criteria. 258 * in case of an error, the error will be logged. 259 */ 260/* ARGSUSED */ 261CCIMInstanceList * 262cp_execQuery_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, 263 char *selectClause, char *nonJoinExp, char *queryExp, 264 char *queryLang) { 265 266 CCIMInstance *emptyInst; 267 CCIMInstanceList *shareSecModeInstList; 268 CCIMException *ex; 269 int err = 0; 270 271 if (pOP == NULL) { 272 util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", 273 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 274 return ((CCIMInstanceList *)NULL); 275 } 276 277 shareSecModeInstList = 278 cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); 279 if (shareSecModeInstList == NULL) { 280 return ((CCIMInstanceList *)NULL); 281 } 282 283 emptyInst = cim_createInstance(""); 284 if (emptyInst == NULL) { 285 ex = cim_getLastError(); 286 util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", 287 CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); 288 cim_freeInstanceList(shareSecModeInstList); 289 return ((CCIMInstanceList *)NULL); 290 } 291 292 shareSecModeInstList = cim_prependInstance(shareSecModeInstList, 293 emptyInst); 294 if (shareSecModeInstList == NULL) { 295 ex = cim_getLastError(); 296 util_handleError("SOLARIS_NFSSHARESECMODES::EXEC_QUERY", 297 CIM_ERR_FAILED, PREPEND_INSTANCE_FAILURE, ex, &err); 298 cim_freeInstance(emptyInst); 299 return ((CCIMInstanceList *)NULL); 300 } 301 302 return (shareSecModeInstList); 303} /* cp_execQuery_Solaris_NFSShareSecurityModes */ 304 305/* 306 * Method: cp_getInstance_Solaris_NFSShareSecurityModes 307 * 308 * Description: Gets the instance corresponding to the 309 * Solaris_NFSShareSecurityModes object path passed in. 310 * 311 * Parameters: 312 * - CCIMObjectPath* pOP - An object path containing all the keys of 313 * the instance that is supposed to be returned. 314 * 315 * Returns: 316 * - A pointer to the Solaris_NFSShareSecurityModes instance corresponding 317 * to the object path parameter. 318 * - NULL if an error occurred or if the instance doesn't exist. In the 319 * case of an error the error is logged. 320 */ 321CCIMInstance * 322cp_getInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP) { 323 CCIMInstanceList *instList; 324 CCIMInstance *inst; 325 CCIMObjectPath *settingOP; 326 CCIMObjectPath *elementOP; 327 CCIMPropertyList *shareSecModesPropList; 328 int err = 0; 329 330 if (pOP == NULL) { 331 util_handleError("SOLARIS_NFSSHARESECMODES::GET_INSTANCE", 332 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 333 return ((CCIMInstance *)NULL); 334 } 335 336 /* 337 * Make sure the key values passed in are populated. 338 */ 339 shareSecModesPropList = pOP->mKeyProperties; 340 settingOP = util_getKeyValue(shareSecModesPropList, 341 shareSecModeProps[SETTING].type, shareSecModeProps[SETTING].name, 342 &err); 343 elementOP = util_getKeyValue(shareSecModesPropList, 344 shareSecModeProps[ELEMENT].type, shareSecModeProps[ELEMENT].name, 345 &err); 346 347 if (settingOP == NULL || elementOP == NULL || 348 settingOP->mKeyProperties == NULL || 349 elementOP->mKeyProperties == NULL) { 350 util_handleError("SOLARIS_NFSSHARESECMODES::GET_INSTANCE", 351 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 352 return ((CCIMInstance *)NULL); 353 } 354 355 instList = cp_enumInstances_Solaris_NFSShareSecurityModes(pOP); 356 if (instList == NULL) { 357 /* 358 * Either an error occurred or we simply don't have any 359 * instances of Solaris_NFSShareSecurityModes on the system. 360 * In the case that an error occurred, it will be handled in 361 * cp_enumInstances_Solaris_NFSShareSecurityModes. 362 */ 363 return ((CCIMInstance *)NULL); 364 } 365 366 inst = cim_getInstance(instList, pOP); 367 368 cim_freeInstanceList(instList); 369 return (inst); 370} /* cp_getInstance_Solaris_NFSShareSecurityModes */ 371 372/* 373 * Method: cp_setInstance_Solaris_NFSShareSecurityModes 374 * 375 * Not Supported: Inorder to change the properties of a 376 * Solaris_NFSShareSecurityModes instance on the host the Solaris_NFSShare and 377 * Solaris_NFSShareSecurity instances would have to be changed. These changes 378 * must be done in the providers for Solaris_NFSShare and 379 * Solaris_NFSShareSecurity. 380 */ 381/* ARGSUSED */ 382CIMBool 383cp_setInstance_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, 384 CCIMInstance *pInst, char **props, int num_props) { 385 386 int err = 0; 387 388 util_handleError("SOLARIS_NFSSHAREDEFSECMODES::SET_INSTANCE", 389 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 390 391 return (cim_false); 392} /* cp_setInstance_Solaris_NFSShareDefSecurityModes */ 393 394/* 395 * Method: cp_setInstanceWithList_Solaris_NFSShareSecurityModes 396 * 397 * Not Supported: Inorder to change the properties of a 398 * Solaris_NFSShareSecurityModes instance on the host the Solaris_NFSShare and 399 * Solaris_NFSShareSecurity instances would have to be changed. These changes 400 * must be done in the providers for Solaris_NFSShare and 401 * Solaris_NFSShareSecurity. 402 */ 403/* ARGSUSED */ 404CIMBool 405cp_setInstanceWithList_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, 406 CCIMInstance *pInst, char **props, int num_props) { 407 408 int err = 0; 409 410 util_handleError("SOLARIS_NFSSHARESECMODES::SET_INSTANCE", 411 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 412 413 return (cim_false); 414} /* cp_setInstanceWithList_Solaris_NFSShareSecurityModes */ 415 416/* 417 * Association provider methods 418 */ 419/* 420 * Method: cp_associators_Solaris_NFSShareSecurityModes 421 * 422 * Description: Returns the instances associated with the pObjectName 423 * parameter via the Solaris_NFSShareSecurityModes association. 424 * 425 * Parameters: 426 * - CCIMObjectPath *pAssocName - An object path containing the name of 427 * the association that the caller is trying to reach. 428 * - CCIMObjectPath *pObjectName - The object path containing information 429 * (Class Name, Key Properties) about the object whose associated objects 430 * are to be returned. 431 * - char *pResultClass - If specified, only return instances that are of 432 * this class type. 433 * - char *pRole - If specified, this is the role of the pObjectName 434 * object path passed in. If this is not valid, NULL is returned. 435 * - char *pResultRole - If specified, only return instances that are 436 * playing this role in the association. 437 * 438 * Returns: 439 * - A pointer to a list of Solaris_NFSShareSecurity (if pRole == 440 * Element && pObjectName is a Solaris_NFSShare object path) or 441 * Solaris_NFSShare (if pRole == Setting && pObjectName is a 442 * Solaris_NFSShareSecurity object path) instances which are associated to 443 * the pObjectName parameter. 444 * - NULL if an error occurred or if there are no instances associated to 445 * the pObjectName passed in. In the case of an error, the error will be 446 * logged. 447 */ 448/* ARGSUSED */ 449CCIMInstanceList * 450cp_associators_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, 451 CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, 452 char *pResultRole) { 453 454 CCIMInstanceList *returnInstList; 455 int err = 0; 456 457 if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { 458 util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATORS", 459 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 460 return ((CCIMInstanceList *)NULL); 461 } 462 463 /* 464 * Determine whether pObjectname is the Element or the Setting of the 465 * association. Element = Solaris_NFSShare, 466 * Setting = Solaris_NFSShareSecurity. 467 */ 468 if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { 469 if (pRole != NULL && (strcasecmp(pRole, 470 shareSecModeProps[ELEMENT].name) != 0)) { 471 util_handleError( 472 "SOLARIS_NFSSHARESECMODES::ASSOCIATORS", 473 CIM_ERR_INVALID_PARAMETER, NULL, NULL, 474 &err); 475 return ((CCIMInstanceList *)NULL); 476 } 477 returnInstList = get_associated_nfsShareSec_instList( 478 pObjectName); 479 } else if (strcasecmp(pObjectName->mName, 480 SOLARIS_NFSSHARESECURITY) == 0) { 481 if (pRole != NULL && (strcasecmp(pRole, 482 shareSecModeProps[SETTING].name) != 0)) { 483 util_handleError( 484 "SOLARIS_NFSSHARESECMODES::ASSOCIATORS", 485 CIM_ERR_INVALID_PARAMETER, NULL, NULL, 486 &err); 487 return ((CCIMInstanceList *)NULL); 488 } 489 returnInstList = get_associated_nfsShare_instList(pObjectName); 490 } else { 491 util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATORS", 492 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 493 return ((CCIMInstanceList *)NULL); 494 } 495 496 return (returnInstList); 497} /* cp_associators_Solaris_NFSShareSecurityModes */ 498 499/* 500 * Method:cp_associatorNames_Solaris_NFSShareSecurityModes 501 * 502 * Description: Returns the object paths of the instances on the other side 503 * of the association. These are associated via the 504 * Solaris_NFSShareSecurityModes association and have the opposite key 505 * passed in as the parameter(pObjectName). 506 * 507 * Parameters: 508 * - CCIMObjectPath *pAssocName - An object path containing information 509 * about the association that the caller is trying to reach. 510 * - CCIMObjectPath *pObjectName - The object path which contains the 511 * information on whose associated objects are to be returned. 512 * - char *pResultClass - If specified, only return instances that are of 513 * this class type. 514 * - char *pRole - If specified, this is the role of the pObjectName 515 * object path passed in. If this is not valid, NULL is returned. 516 * - char *pResultRole - If specified, only return instances that are 517 * playing this role in the association. 518 * 519 * Returns: 520 * - A pointer to a list of Solaris_NFSShareSecurity (if Role == 521 * Element and pObjectName is a Solaris_NFSShare object path) or 522 * Solaris_NFSShare (if Role == Setting and pObjectName is a 523 * Solaris_NFSShareSecurity object path) object paths which are 524 * associated to the pObjectName parameter. 525 * - NULL if an error occurred or if there are no instances associated to 526 * the pObjectName passed in. In the case of an error, the error will be 527 * logged. 528 */ 529CCIMObjectPathList * 530cp_associatorNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, 531 CCIMObjectPath *pObjectName, char *pResultClass, char *pRole, 532 char *pResultRole) { 533 534 CCIMInstanceList *instList; 535 CCIMObjectPathList *objPathList = NULL; 536 int err = 0; 537 538 if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { 539 util_handleError("SOLARIS_NFSSHARESECMODES::ASSOCIATOR_NAMES", 540 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 541 } else { 542 instList = 543 cp_associators_Solaris_NFSShareSecurityModes(pAssocName, 544 pObjectName, pResultClass, pRole, pResultRole); 545 if (instList != NULL) { 546 objPathList = cim_createObjectPathList(instList); 547 cim_freeInstanceList(instList); 548 } 549 } 550 return (objPathList); 551} /* cp_associatorNames_Solaris_NFSShareSecurityModes */ 552 553/* 554 * Method: cp_references_Solaris_NFSShareSecurityModes 555 * 556 * Description: Returns the Solaris_NFSShareSecurityModes instances that have 557 * the passed in parameter, pObjectName, as one of it's keys. 558 * 559 * Parameters: 560 * - CCIMObjectPath *pAssocName - An object path containing information 561 * about the association that the caller is trying to reach. 562 * - CCIMObjectPath *pObjectName - The object path which contains the 563 * information on whose associated objects are to be returned. 564 * - char *pRole - If specified, this is the role of the pObjectName 565 * object path passed in. If this is not valid, NULL is returned. 566 * 567 * Returns: 568 * - A pointer to a list of Solaris_NFSShareSecurityModes instances. 569 * - NULL if an error occurred or if there are no 570 * Solaris_NFSShareSecurityModes instances having pObjectName as one of 571 * it's keys. 572 */ 573CCIMInstanceList * 574cp_references_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, 575 CCIMObjectPath *pObjectName, char *pRole) { 576 577 CCIMInstanceList *instList; 578 CCIMObjectPathList *objPathList; 579 int err = 0; 580 581 if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { 582 util_handleError("SOLARIS_NFSSHARESECMODES::REFERENCES", 583 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 584 return ((CCIMInstanceList *)NULL); 585 } 586 587 588 /* 589 * Get everything that is related to the pObjectName passed in. 590 */ 591 objPathList = cp_associatorNames_Solaris_NFSShareSecurityModes( 592 pAssocName, pObjectName, NULL, pRole, NULL); 593 if (objPathList == NULL) { 594 return ((CCIMInstanceList *)NULL); 595 } 596 597 /* 598 * Determine whether pObjectname is the Element or the Setting of the 599 * association. Element = Solaris_NFSShare, 600 * Setting = Solaris_NFSShareSecurity. 601 */ 602 if ((strcasecmp(pObjectName->mName, SOLARIS_NFSSHARE) == 0)) { 603 instList = create_association_instList( 604 SOLARIS_NFSSHARESECMODES, pObjectName, 605 shareSecModeProps[ELEMENT].name, objPathList, 606 shareSecModeProps[SETTING].name, &err); 607 } else { 608 instList = 609 create_association_instList(SOLARIS_NFSSHARESECMODES, 610 pObjectName, shareSecModeProps[SETTING].name, 611 objPathList, shareSecModeProps[ELEMENT].name, &err); 612 } 613 cim_freeObjectPathList(objPathList); 614 615 return (instList); 616} /* cp_references_Solaris_NFSShareSecurityModes */ 617 618/* 619 * Method: cp_referenceNames_Solaris_NFSShareSecurityModes 620 * 621 * Description: Returns the Solaris_NFSShareSecurityModes object paths for 622 * the instances that have the passed in parameter (pObjectName, as one of 623 * it's keys. 624 * 625 * Parameters: 626 * - CCIMObjectPath *pAssocName - An object path containing information 627 * about the association that the caller is trying to reach. 628 * - CCIMObjectPath *pObjectName - The object path which contains the 629 * information on whose associated objects are to be returned. 630 * - char *pRole - If specified, this is the role of the pObjectName 631 * object path passed in. If this is not valid, NULL is returned. 632 * 633 * Returns: 634 * - A pointer to a list of Solaris_NFSShareSecurityModes object paths. 635 * - NULL if there was an error or if there are no 636 * Solaris_NFSShareSecurityModes instances having pObjectName as one of 637 * it's keys. 638 */ 639CCIMObjectPathList * 640cp_referenceNames_Solaris_NFSShareSecurityModes(CCIMObjectPath *pAssocName, 641 CCIMObjectPath *pObjectName, char *pRole) { 642 643 CCIMInstanceList *shareSecModeInstList; 644 CCIMObjectPathList *shareSecModeOPList; 645 int err = 0; 646 647 if (pObjectName == NULL || pObjectName->mKeyProperties == NULL) { 648 util_handleError("SOLARIS_NFSSHARESECMODES::REFERENCE_NAMES", 649 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 650 return ((CCIMInstanceList *)NULL); 651 } 652 653 shareSecModeInstList = 654 cp_references_Solaris_NFSShareSecurityModes(pAssocName, 655 pObjectName, pRole); 656 657 if (shareSecModeInstList == NULL) { 658 return ((CCIMObjectPathList *)NULL); 659 } 660 661 shareSecModeOPList = cim_createObjectPathList(shareSecModeInstList); 662 663 cim_freeInstanceList(shareSecModeInstList); 664 665 return (shareSecModeOPList); 666} /* cp_referenceNames_Solaris_NFSShareSecurityModes */ 667 668/* 669 * Property provider methods 670 */ 671 672/* 673 * Method: cp_getProperty_Solaris_NFSShareSecurityModes 674 * 675 * Description: Retrieves the property, described by the parameter pOP, from 676 * the instance of Solaris_NFSShareSecurityModes on the host. 677 * 678 * Parameters: 679 * - CCIMObjectPath *pOP - The object path containing all the 680 * information needed to find the instance in which the property is to 681 * be returned. 682 * - cimchar *pPropName - The name of the property to be found. 683 * 684 * Returns: 685 * - A pointer to the property corresponding to the name passed in with 686 * pPropName. 687 * - NULL if an error occurred or if the property doesn't exist. In the 688 * case of an error, the error will be logged. 689 */ 690CCIMProperty * 691cp_getProperty_Solaris_NFSShareSecurityModes(CCIMObjectPath *pOP, 692 cimchar *pPropName) { 693 694 CCIMInstance *shareSecModeInst; 695 CCIMProperty *shareSecModeProp; 696 int err = 0; 697 698 if (pOP == NULL) { 699 util_handleError("SOLARIS_NFSSHARESECMODES::GET_PROPERTY", 700 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 701 return ((CCIMProperty *)NULL); 702 } 703 704 shareSecModeInst = cp_getInstance_Solaris_NFSShareSecurityModes(pOP); 705 if (shareSecModeInst == NULL) { 706 return ((CCIMProperty *)NULL); 707 } 708 709 shareSecModeProp = cim_getProperty(shareSecModeInst, pPropName); 710 cim_freeInstance(shareSecModeInst); 711 712 return (shareSecModeProp); 713} /* cp_getProperty_Solaris_NFSShareSecurityModes */ 714 715/* 716 * Method: cp_setProperty_Solaris_NFSShareSecurityModes 717 * 718 * This method is not supported. This is not allowed because in 719 * order to change the properties a Solaris_NFSShareSecurityModes on 720 * the host, the Solaris_NFSShare and Solaris_NFSShareSecurity must 721 * be changed. Any changes to Solaris_NFSShare and Solaris_NFSShareSecurity 722 * need to be done in those providers. 723 */ 724/* ARGSUSED */ 725CIMBool 726cp_setProperty_Solaris_NFSShareSecurityModes( 727 CCIMObjectPath *pOP, 728 CCIMProperty *pProp) { 729 730 int err = 0; 731 732 util_handleError("SOLARIS_NFSSHARESECMODES::SET_PROPERTY", 733 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 734 735 return (cim_false); 736} /* cp_setProperty_Solaris_NFSShareSecurityModes */ 737 738/* 739 * Method provider methods 740 */ 741 742/* 743 * Method: cp_invokeMethod_Solaris_NFSShareSecurityModes 744 * 745 * Description: This method is not supported because the provider doesn't have 746 * any methods. 747 * 748 */ 749/* ARGSUSED */ 750CCIMProperty * 751cp_invokeMethod_Solaris_NFSShareSecurityModes( 752 CCIMObjectPath *pOP, 753 cimchar *functionName, 754 CCIMPropertyList *inParams, 755 CCIMPropertyList *outParams) { 756 int err = 0; 757 758 util_handleError("SOLARIS_NFSSHARESECMODES::INVOKE_METHOD", 759 CIM_ERR_NOT_SUPPORTED, NULL, NULL, &err); 760 return ((CCIMProperty *)NULL); 761} /* cp_invokeMethod_Solaris_NFSShareSecurityModes */ 762 763 764/* 765 * Private methods 766 */ 767 768/* 769 * Method: get_associated_nfsShare_instList 770 * 771 * Finds the Solaris_NFSShare instances that are associated to the 772 * Solaris_NFSShareSecurity object path that was passed in. 773 */ 774static CCIMInstanceList * 775get_associated_nfsShare_instList(CCIMObjectPath *nfsShareSecOP) { 776 CCIMInstanceList *nfsShareInstList; 777 CCIMInstance *nfsShareInst; 778 CCIMObjectPath *nfsShareOP; 779 CCIMException *ex; 780 char *settingID; 781 int err = 0; 782 783 settingID = util_getKeyValue(nfsShareSecOP->mKeyProperties, string, 784 SETTING_ID, &err); 785 if (settingID == NULL || err != 0) { 786 util_handleError( 787 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", 788 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 789 return ((CCIMInstanceList *)NULL); 790 } 791 792 nfsShareInstList = cim_createInstanceList(); 793 if (nfsShareInstList == NULL) { 794 ex = cim_getLastError(); 795 util_handleError( 796 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", 797 CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); 798 return ((CCIMInstanceList *)NULL); 799 } 800 801 nfsShareOP = get_Solaris_NFSShare_OP(settingID); 802 if (nfsShareOP == NULL) { 803 /* 804 * An error occurred in get_Solaris_NFSShare_OP and was 805 * handled there. 806 */ 807 return ((CCIMInstanceList *)NULL); 808 } 809 810 nfsShareInst = cimom_getInstance(nfsShareOP, cim_false, cim_false, 811 cim_false, cim_false, NULL, 0); 812 813 cim_freeObjectPath(nfsShareOP); 814 815 if (nfsShareInst == NULL) { 816 /* 817 * No instances exist which are associated with the passed in 818 * Solaris_NFSShareSecurity object. 819 */ 820 cim_freeInstanceList(nfsShareInstList); 821 return ((CCIMInstanceList *)NULL); 822 } 823 824 /* 825 * Work around for cimom bug 4649100. 826 */ 827 if (!set_share_keyProperties_to_true(nfsShareInst)) { 828 /* 829 * Key values not found 830 */ 831 cim_logDebug( 832 "get_associated_nfsShareSec_instList", 833 "No keyProprties found, should return error here"); 834 cim_freeInstance(nfsShareInst); 835 cim_freeInstanceList(nfsShareInstList); 836 return ((CCIMInstanceList *)NULL); 837 } 838 839 if (nfsShareInst->mProperties == NULL) { 840 cim_freeInstanceList(nfsShareInstList); 841 cim_freeInstance(nfsShareInst); 842 return ((CCIMInstanceList *)NULL); 843 } 844 845 nfsShareInstList = cim_addInstance(nfsShareInstList, nfsShareInst); 846 if (nfsShareInstList == NULL) { 847 ex = cim_getLastError(); 848 util_handleError( 849 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SHARE_INSTLIST", 850 CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); 851 cim_freeInstance(nfsShareInst); 852 return ((CCIMInstanceList *)NULL); 853 } 854 855 return (nfsShareInstList); 856} /* get_associated_nfsShare_instList */ 857 858/* 859 * Method: get_associated_nfsShareSec_instList 860 * 861 * Finds the Solaris_NFSShareSecurity instances that are associated to the 862 * Solaris_NFSShare object path that was passed in. 863 */ 864static CCIMInstanceList * 865get_associated_nfsShareSec_instList(CCIMObjectPath *nfsShareOP) { 866 CCIMObjectPath *nfsShareSecOP; 867 CCIMInstanceList *nfsShareSecInstList = NULL; 868 CCIMException *ex; 869 char *name; 870 int err = 0; 871 fs_sharelist_t *nfs_sharesec_list, *tmp_sharesec_list; 872 873 874 name = util_getKeyValue(nfsShareOP->mKeyProperties, string, 875 NAME, &err); 876 if (name == NULL || err != 0) { 877 util_handleError( 878 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_INSTLIST", 879 CIM_ERR_INVALID_PARAMETER, NULL, NULL, &err); 880 return ((CCIMInstanceList *)NULL); 881 } 882 883 nfsShareSecInstList = cim_createInstanceList(); 884 if (nfsShareSecInstList == NULL) { 885 ex = cim_getLastError(); 886 util_handleError( 887 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_INSTLIST", 888 CIM_ERR_FAILED, CREATE_INSTANCE_LIST_FAILURE, ex, &err); 889 return ((CCIMInstanceList *)NULL); 890 } 891 892 nfs_sharesec_list = fs_get_share_list(&err); 893 if (nfs_sharesec_list == NULL) { 894 /* 895 * Check whether an error was returned or if we simply don't 896 * have any nfs shares on the system. If err is not 897 * equal to 0, an error was encountered. 898 */ 899 900 if (err != 0) { 901 /* 902 * Determine the error and log it. 903 */ 904 if (err == ENOMEM || err == EAGAIN) { 905 util_handleError( 906 "SOLARIS_NFSSHARESECMODES:" \ 907 ":GET_ASSOC_SEC_INSTLIST", 908 CIM_ERR_LOW_ON_MEMORY, LOW_MEMORY, 909 NULL, &err); 910 cim_freeInstanceList(nfsShareSecInstList); 911 return ((CCIMInstanceList *)NULL); 912 } else { 913 914 /* 915 * If any other errors were encountered it 916 * can be handled as a general error. We may 917 * not know exactly what the error is. 918 */ 919 util_handleError( 920 "SOLARIS_NFSSHARESECMODES:" \ 921 ":GET_ASSOC_SEC_INSTLIST", 922 CIM_ERR_FAILED, strerror(err), 923 NULL, &err); 924 cim_freeInstanceList(nfsShareSecInstList); 925 return ((CCIMInstanceList *)NULL); 926 } 927 } 928 } 929 930 931 for (tmp_sharesec_list = nfs_sharesec_list; tmp_sharesec_list != NULL; 932 tmp_sharesec_list = tmp_sharesec_list->next) { 933 char **sec_modes; 934 char *optionValue = NULL; 935 int count = 0; 936 937 err = 0; 938 939 940 sec_modes = fs_parse_opts_for_sec_modes( 941 tmp_sharesec_list->options, &count, &err); 942 943 944 if (sec_modes == NULL || count == 0) { 945 util_handleError( 946 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SEC_INSTLIST", 947 CIM_ERR_FAILED, 948 FS_PARSE_OPTS_FOR_SEC_MODES_FAILURE, ex, &err); 949 fs_free_share_list(nfs_sharesec_list); 950 cim_freeInstanceList(nfsShareSecInstList); 951 return ((CCIMInstanceList *)NULL); 952 } 953 954 955 if ((strcasecmp(tmp_sharesec_list->fstype, "nfs") == 0) && 956 (strcmp(tmp_sharesec_list->path, name) == 0)) { 957 958 CCIMInstance *nfsShareSecInst; 959 int i; 960 961 for (i = 0; i < count; i++) { 962 char tmpString[MAXSIZE]; 963 (void) strcpy(tmpString, sec_modes[i]); 964 optionValue = get_property_from_opt_string( 965 sec_modes[i], "sec=", B_TRUE, B_FALSE); 966 967 if (strcmp(optionValue, "0") == 0) { 968 free(optionValue); 969 optionValue = strdup("sys"); 970 } 971 972 nfsShareSecOP = 973 get_Solaris_NFSShareSec_OP(name, 974 optionValue); 975 976 free(optionValue); 977 if (nfsShareSecOP == NULL) { 978 /* 979 * An error occurred and it was 980 * handled in get_NFSShareSec_OP. 981 */ 982 fs_free_share_list(nfs_sharesec_list); 983 fileutil_free_string_array(sec_modes, 984 count); 985 cim_freeInstanceList( 986 nfsShareSecInstList); 987 return ((CCIMInstanceList *)NULL); 988 } 989 990 nfsShareSecInst = 991 cimom_getInstance(nfsShareSecOP, cim_false, 992 cim_false, cim_false, cim_false, NULL, 0); 993 if (nfsShareSecInst == NULL) { 994 /* 995 * An error occurred and it was 996 * handled in cimom_getInstance. 997 */ 998 fs_free_share_list(nfs_sharesec_list); 999 fileutil_free_string_array(sec_modes, 1000 count); 1001 cim_freeInstanceList( 1002 nfsShareSecInstList); 1003 return ((CCIMInstanceList *)NULL); 1004 } 1005 1006 /* 1007 * Work around for cimom bug 4649100. 1008 */ 1009 if (!set_shareSec_keyProperties_to_true( 1010 nfsShareSecInst)) { 1011 /* 1012 * Key values not found 1013 */ 1014 cim_logDebug( 1015 "get_associated_nfsShareSec_" \ 1016 "instList", "No keyProprties " \ 1017 "found, should return error here"); 1018 cim_freeInstance(nfsShareSecInst); 1019 cim_freeInstanceList( 1020 nfsShareSecInstList); 1021 return ((CCIMInstanceList *)NULL); 1022 } 1023 1024 /* 1025 * Add the instance to the instance list. 1026 */ 1027 nfsShareSecInstList = cim_addInstance( 1028 nfsShareSecInstList, nfsShareSecInst); 1029 if (nfsShareSecInstList == NULL) { 1030 ex = cim_getLastError(); 1031 util_handleError( 1032 "SOLARIS_NFSSHARESECMODES:" \ 1033 ":GET_ASSOC_SEC_INSTLIST", 1034 CIM_ERR_FAILED, 1035 ADD_INSTANCE_FAILURE, ex, &err); 1036 cim_freeInstance(nfsShareSecInst); 1037 fs_free_share_list(nfs_sharesec_list); 1038 fileutil_free_string_array(sec_modes, 1039 count); 1040 return ((CCIMInstanceList *)NULL); 1041 } 1042 } 1043 } 1044 fileutil_free_string_array(sec_modes, count); 1045 } 1046 fs_free_share_list(nfs_sharesec_list); 1047 return (nfsShareSecInstList); 1048} /* get_associated_nfsShareSec_instList */ 1049 1050/* 1051 * Method: get_associated_nfsShareSec_OPList 1052 * 1053 * Finds the Solaris_NFSShareSecurity object paths that are associated 1054 * to the Solaris_NFSShare object path that was passed in. 1055 */ 1056static CCIMObjectPathList * 1057get_associated_nfsShareSec_OPList(CCIMObjectPath *nfsShareOP, int *errp) { 1058 CCIMInstanceList *nfsShareSecInstList; 1059 CCIMObjectPathList *nfsShareSecOPList; 1060 CCIMException *ex; 1061 int err = 0; 1062 1063 1064 nfsShareSecInstList = 1065 get_associated_nfsShareSec_instList(nfsShareOP); 1066 if (nfsShareSecInstList == NULL) { 1067 /* 1068 * An error occurred in get_associated_nfsShareSec_InstList 1069 * and was handled in that function. 1070 */ 1071 *errp = -1; 1072 return ((CCIMObjectPathList *)NULL); 1073 } 1074 1075 nfsShareSecOPList = cim_createObjectPathList(nfsShareSecInstList); 1076 if (nfsShareSecOPList == NULL) { 1077 ex = cim_getLastError(); 1078 util_handleError( 1079 "SOLARIS_NFSSHARESECMODES::GET_ASSOC_SP_OPLIST", 1080 CIM_ERR_FAILED, CREATE_OBJECT_LIST_FAILURE, 1081 ex, &err); 1082 *errp = -1; 1083 } 1084 1085 cim_freeInstanceList(nfsShareSecInstList); 1086 return (nfsShareSecOPList); 1087} /* get_associated_nfsShareSec_OPList */ 1088 1089/* 1090 * Method: get_Solaris_NFSShare_OP 1091 * 1092 * Gets the Solaris_NFSShare object path based on the passed in name key. 1093 */ 1094static CCIMObjectPath * 1095get_Solaris_NFSShare_OP(char *nameKey) { 1096 CCIMObjectPath *nfsShareOP; 1097 CCIMPropertyList *nfsShareKeyPropList; 1098 CCIMException *ex; 1099 char *sysName; 1100 int err = 0; 1101 1102 nfsShareOP = cim_createEmptyObjectPath(SOLARIS_NFSSHARE); 1103 if (nfsShareOP == NULL) { 1104 ex = cim_getLastError(); 1105 util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", 1106 CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, 1107 &err); 1108 return ((CCIMObjectPath *)NULL); 1109 } 1110 1111 sysName = (cimchar *)sys_get_hostname(&err); 1112 if (sysName == NULL) { 1113 util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", 1114 CIM_ERR_FAILED, GET_HOSTNAME_FAILURE, NULL, &err); 1115 cim_freeObjectPath(nfsShareOP); 1116 return ((CCIMObjectPath *)NULL); 1117 } 1118 1119 /* 1120 * Create the property list which to add all the key properties to and 1121 * which will be added to the object path. 1122 */ 1123 nfsShareKeyPropList = cim_createPropertyList(); 1124 if (nfsShareKeyPropList == NULL) { 1125 ex = cim_getLastError(); 1126 util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", 1127 CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); 1128 cim_freeObjectPath(nfsShareOP); 1129 free(sysName); 1130 return ((CCIMObjectPath *)NULL); 1131 } 1132 1133 /* 1134 * add_property_to_list parameters are as follows: 1135 * 1.) property name (cimchar *), 1136 * 2.) property type (CIMType), 1137 * 3.) property value (cimchar *), 1138 * 4.) property object path for reference properties (CCIMObjectPath *), 1139 * 5.) is property a key? (CIMBool), 1140 * 6.) property list to add the property to (CCIMPropertyList *). 1141 */ 1142 1143 nfsShareKeyPropList = add_property_to_list(CREATION_CLASS, string, 1144 SOLARIS_NFSSHARE, NULL, cim_true, nfsShareKeyPropList); 1145 if (nfsShareKeyPropList == NULL) { 1146 cim_freeObjectPath(nfsShareOP); 1147 free(sysName); 1148 return ((CCIMObjectPath *)NULL); 1149 } 1150 1151 nfsShareKeyPropList = add_property_to_list(NAME, string, nameKey, 1152 NULL, cim_true, nfsShareKeyPropList); 1153 if (nfsShareKeyPropList == NULL) { 1154 cim_freeObjectPath(nfsShareOP); 1155 free(sysName); 1156 return ((CCIMObjectPath *)NULL); 1157 } 1158 1159 nfsShareKeyPropList = add_property_to_list(SYS_CREATION_CLASS, string, 1160 SOLARIS_CS, NULL, cim_true, nfsShareKeyPropList); 1161 if (nfsShareKeyPropList == NULL) { 1162 cim_freeObjectPath(nfsShareOP); 1163 free(sysName); 1164 return ((CCIMObjectPath *)NULL); 1165 } 1166 1167 nfsShareKeyPropList = add_property_to_list(SYSTEM, string, sysName, 1168 NULL, cim_true, nfsShareKeyPropList); 1169 if (nfsShareKeyPropList == NULL) { 1170 cim_freeObjectPath(nfsShareOP); 1171 free(sysName); 1172 return ((CCIMObjectPath *)NULL); 1173 } 1174 1175 nfsShareOP = cim_addPropertyListToObjectPath(nfsShareOP, 1176 nfsShareKeyPropList); 1177 if (nfsShareOP == NULL) { 1178 ex = cim_getLastError(); 1179 util_handleError("SOLARIS_NFSSHARESECMODES::GET_NFSSHARE_OP", 1180 CIM_ERR_FAILED, ADD_PROP_TO_OBJPATH_FAILURE, ex, &err); 1181 cim_freePropertyList(nfsShareKeyPropList); 1182 free(sysName); 1183 return ((CCIMObjectPath *)NULL); 1184 } 1185 1186 free(sysName); 1187 return (nfsShareOP); 1188} /* get_Solaris_NFSShare_OP */ 1189 1190/* 1191 * Method: get_Solaris_NFSShareSec_OP 1192 * 1193 * Gets the Solaris_NFSShareSecurity object path based on the passed in 1194 * path and mode keys. 1195 */ 1196static CCIMObjectPath * 1197get_Solaris_NFSShareSec_OP(char *path, char *mode) { 1198 CCIMObjectPath *nfsShareSecOP; 1199 CCIMPropertyList *nfsShareSecKeyPropList; 1200 CCIMException *ex; 1201 int err = 0; 1202 1203 cim_logDebug("get_Solaris_NFSShareSec_OP", 1204 "Just entering"); 1205 1206 nfsShareSecOP = 1207 cim_createEmptyObjectPath(SOLARIS_NFSSHARESEC); 1208 if (nfsShareSecOP == NULL) { 1209 ex = cim_getLastError(); 1210 util_handleError( 1211 "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", 1212 CIM_ERR_FAILED, CREATE_EMPTY_OBJPATH_FAILURE, ex, &err); 1213 return ((CCIMObjectPath *)NULL); 1214 } 1215 1216 nfsShareSecKeyPropList = 1217 cim_createPropertyList(); 1218 if (nfsShareSecKeyPropList == NULL) { 1219 ex = cim_getLastError(); 1220 util_handleError( 1221 "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", 1222 CIM_ERR_FAILED, CREATE_PROPLIST_FAILURE, ex, &err); 1223 cim_freeObjectPath(nfsShareSecOP); 1224 return ((CCIMObjectPath *)NULL); 1225 } 1226 1227 /* 1228 * add_property_to_list parameters are as follows: 1229 * 1.) property settingID (cimchar *), 1230 * 2.) property mode (cimchar *) 1231 */ 1232 nfsShareSecKeyPropList = add_property_to_list(SETTING_ID, string, 1233 path, NULL, cim_true, nfsShareSecKeyPropList); 1234 if (nfsShareSecKeyPropList == NULL) { 1235 cim_freeObjectPath(nfsShareSecOP); 1236 return ((CCIMObjectPath *)NULL); 1237 } 1238 1239 nfsShareSecKeyPropList = add_property_to_list(MODE, string, mode, 1240 NULL, cim_true, nfsShareSecKeyPropList); 1241 if (nfsShareSecKeyPropList == NULL) { 1242 cim_freeObjectPath(nfsShareSecOP); 1243 return ((CCIMObjectPath *)NULL); 1244 } 1245 1246 nfsShareSecOP = cim_addPropertyListToObjectPath( 1247 nfsShareSecOP, nfsShareSecKeyPropList); 1248 if (nfsShareSecOP == NULL) { 1249 ex = cim_getLastError(); 1250 util_handleError( 1251 "SOLARIS_NFSSHAREDEFSECMODES::GET_NFSSHARESEC_OP", 1252 CIM_ERR_FAILED, ADD_PROPERTY_FAILURE, ex, &err); 1253 cim_freePropertyList(nfsShareSecKeyPropList); 1254 return ((CCIMObjectPath *)NULL); 1255 } 1256 1257 return (nfsShareSecOP); 1258} /* get_Solaris_NFSShareSec_OP */ 1259 1260/* 1261 * Method: update_list_with_secMode_inst 1262 * 1263 * Adds the Solaris_NFSShareSecurityModes instance described by the passed 1264 * in object path to the shareSecModeInstList instance list. 1265 */ 1266static CCIMInstanceList * 1267update_list_with_secMode_inst(CCIMObjectPath *nfsShareOP, 1268 CCIMInstanceList *shareSecModeInstList) { 1269 1270 CCIMObjectPathList *nfsShareSecOPList; 1271 CCIMObjectPathList *tmpOPList; 1272 CCIMInstance *shareSecModeInst; 1273 CCIMException *ex; 1274 int err = 0; 1275 1276 /* 1277 * Retrieve all of the Solaris_NFSShareSecurity instances 1278 * associated with the current Solaris_NFSShare object path. 1279 * The get_associate_nfsShareSec_propList function will return 1280 * the appropriate reference properties to be used in creating 1281 * a Solaris_NFSShareSecurityModes instance. 1282 */ 1283 nfsShareSecOPList = get_associated_nfsShareSec_OPList( 1284 nfsShareOP, &err); 1285 if (nfsShareSecOPList == NULL) { 1286 if (err != 0) { 1287 return ((CCIMInstanceList *)NULL); 1288 } 1289 return (shareSecModeInstList); 1290 } 1291 1292 for (tmpOPList = nfsShareSecOPList; tmpOPList != NULL; 1293 tmpOPList = tmpOPList->mNext) { 1294 shareSecModeInst = cim_createInstance(SOLARIS_NFSSHARESECMODES); 1295 if (shareSecModeInst == NULL) { 1296 ex = cim_getLastError(); 1297 util_handleError( 1298 "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 1299 CIM_ERR_FAILED, CREATE_INSTANCE_FAILURE, ex, &err); 1300 return ((CCIMInstanceList *)NULL); 1301 } 1302 /* 1303 * Add the properties to the 1304 * Solaris_NFSSHareSecurityModes instance. 1305 */ 1306 1307 if (add_property_to_instance(shareSecModeProps[SETTING].name, 1308 shareSecModeProps[SETTING].type, NULL, 1309 tmpOPList->mDataObject, shareSecModeProps[SETTING].isKey, 1310 shareSecModeInst) == cim_false) { 1311 cim_freeObjectPathList(nfsShareSecOPList); 1312 return ((CCIMInstanceList *)NULL); 1313 } 1314 1315 if (add_property_to_instance(shareSecModeProps[ELEMENT].name, 1316 shareSecModeProps[ELEMENT].type, NULL, 1317 nfsShareOP, shareSecModeProps[ELEMENT].isKey, 1318 shareSecModeInst) == cim_false) { 1319 cim_freeObjectPathList(nfsShareSecOPList); 1320 return ((CCIMInstanceList *)NULL); 1321 } 1322 1323 shareSecModeInstList = 1324 cim_addInstance(shareSecModeInstList, 1325 shareSecModeInst); 1326 if (shareSecModeInstList == NULL) { 1327 ex = cim_getLastError(); 1328 util_handleError( 1329 "SOLARIS_NFSSHARESECMODES::ENUM_INSTANCES", 1330 CIM_ERR_FAILED, ADD_INSTANCE_FAILURE, 1331 ex, &err); 1332 cim_freeInstance(shareSecModeInst); 1333 cim_freeObjectPathList(nfsShareSecOPList); 1334 return ((CCIMInstanceList *)NULL); 1335 } 1336 } 1337 1338 return (shareSecModeInstList); 1339} /* update_list_with_secMode_inst */ 1340