Ejemplo n.º 1
0
int 
freeRuleExecInfoInternals(ruleExecInfo_t *rs, int freeSpeialStructFlag)
{
  if (rs->msParamArray != NULL && (freeSpeialStructFlag & FREE_MS_PARAM) > 0) {
    clearMsParamArray (rs->msParamArray, 1);
    free (rs->msParamArray);
  }

  if (rs->doinp != NULL && (freeSpeialStructFlag & FREE_DOINP) > 0) {
     clearDataObjInp (rs->doinp);
     free (rs->doinp);
  }
 
  if (rs->doi != NULL) 
    freeAllDataObjInfo(rs->doi);
  if (rs->rgi != NULL)
    freeRescGrpInfo(rs->rgi);
  if (rs->uoic != NULL)
    freeUserInfo(rs->uoic);
  if (rs->uoip != NULL)
    freeUserInfo(rs->uoip);
  if (rs->coi != NULL)
    freeCollInfo(rs->coi);
#if 0	/* XXXXX deplicate rgio */
  if (rs->rgio != NULL)
    freeRescGrpInfo(rs->rgio);
#endif
  if (rs->uoio != NULL)
    freeUserInfo(rs->uoio);
  if (rs->condInputData != NULL) 
    freeKeyValPairStruct(rs->condInputData);
  if (rs->next != NULL) 
    freeRuleExecInfoStruct(rs->next, freeSpeialStructFlag);
  return(0);
}
Ejemplo n.º 2
0
int
freeL1desc( int l1descInx ) {
    if ( l1descInx < 3 || l1descInx >= NUM_L1_DESC ) {
        rodsLog( LOG_NOTICE,
                 "freeL1desc: l1descInx %d out of range", l1descInx );
        return SYS_FILE_DESC_OUT_OF_RANGE;
    }

    if ( L1desc[l1descInx].dataObjInfo != NULL ) {
        freeDataObjInfo( L1desc[l1descInx].dataObjInfo );
    }

    if ( L1desc[l1descInx].otherDataObjInfo != NULL ) {
        freeAllDataObjInfo( L1desc[l1descInx].otherDataObjInfo );
    }

    if ( L1desc[l1descInx].replDataObjInfo != NULL ) {
        freeDataObjInfo( L1desc[l1descInx].replDataObjInfo );
    }

    if ( L1desc[l1descInx].dataObjInpReplFlag == 1 &&
            L1desc[l1descInx].dataObjInp != NULL ) {
        clearDataObjInp( L1desc[l1descInx].dataObjInp );
        free( L1desc[l1descInx].dataObjInp );
    }
    memset( &L1desc[l1descInx], 0, sizeof( l1desc_t ) );

    return 0;
}
Ejemplo n.º 3
0
int
rsRsyncFileToData( rsComm_t *rsComm, dataObjInp_t *dataObjInp ) {

    char * fileChksumStr = getValByKey( &dataObjInp->condInput, RSYNC_CHKSUM_KW );

    if ( fileChksumStr == NULL ) {
        rodsLog( LOG_ERROR,
                 "rsRsyncFileToData: RSYNC_CHKSUM_KW input is missing" );
        return CHKSUM_EMPTY_IN_STRUCT_ERR;
    }

    addKeyVal( &dataObjInp->condInput, ORIG_CHKSUM_KW, fileChksumStr );

    // =-=-=-=-=-=-=-
    // determine the resource hierarchy if one is not provided
    if ( getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW ) == NULL ) {
        std::string       hier;
        irods::error ret = irods::resolve_resource_hierarchy( irods::OPEN_OPERATION,
                           rsComm, dataObjInp, hier );
        if ( !ret.ok() ) {
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " :: failed in irods::resolve_resource_hierarchy for [";
            msg << dataObjInp->objPath << "]";
            irods::log( PASSMSG( msg.str(), ret ) );
            return ret.code();
        }

        // =-=-=-=-=-=-=-
        // we resolved the redirect and have a host, set the hier str for subsequent
        // api calls, etc.
        addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, hier.c_str() );

    } // if keyword

    char *dataObjChksumStr = NULL;
    dataObjInfo_t *dataObjInfoHead = NULL;
    int status = _rsDataObjChksum( rsComm, dataObjInp, &dataObjChksumStr,
                                   &dataObjInfoHead );

    if ( status < 0 && status != CAT_NO_ACCESS_PERMISSION &&
            status != CAT_NO_ROWS_FOUND ) {
        /* XXXXX CAT_NO_ACCESS_PERMISSION mean the chksum was calculated but
         * cannot be registered. But the chksum value is OK.
         */
        rodsLog( LOG_ERROR,
                 "rsRsyncFileToData: _rsDataObjChksum of %s error. status = %d",
                 dataObjInp->objPath, status );
    }

    freeAllDataObjInfo( dataObjInfoHead );
    if ( dataObjChksumStr != NULL &&
            strcmp( dataObjChksumStr, fileChksumStr ) == 0 ) {
        free( dataObjChksumStr );
        return 0;
    }
    free( dataObjChksumStr );
    return SYS_SVR_TO_CLI_PUT_ACTION;
}
Ejemplo n.º 4
0
/* resolveDataObjReplStatus - a dirty copy may be deleted leaving no
 * dirty copy. In that case, pick the newest copy and mark it dirty
 */
int
resolveDataObjReplStatus( rsComm_t *rsComm, dataObjInp_t *dataObjUnlinkInp ) {
    int status;
    dataObjInfo_t *dataObjInfoHead = NULL;
    dataObjInfo_t *newestDataObjInfo = NULL;
    dataObjInfo_t *tmpDataObjInfo;

    if ( getValByKey( &dataObjUnlinkInp->condInput, RESC_NAME_KW ) == NULL &&
            getValByKey( &dataObjUnlinkInp->condInput, REPL_NUM_KW ) == NULL ) {
        return 0;
    }
    status = getDataObjInfo( rsComm, dataObjUnlinkInp,
                             &dataObjInfoHead, ACCESS_DELETE_OBJECT, 1 );

    if ( status < 0 ) {
        return status;
    }

    tmpDataObjInfo = dataObjInfoHead;
    while ( tmpDataObjInfo != NULL ) {
        if ( tmpDataObjInfo->replStatus == 0 ) {
            if ( newestDataObjInfo == NULL ) {
                newestDataObjInfo = tmpDataObjInfo;
            }
            else if ( atoi( tmpDataObjInfo->dataModify ) >
                      atoi( newestDataObjInfo->dataModify ) ) {
                newestDataObjInfo = tmpDataObjInfo;
            }
        }
        else {
            newestDataObjInfo = NULL;
            break;
        }
        tmpDataObjInfo = tmpDataObjInfo->next;
    }

    /* modify the repl status */
    if ( newestDataObjInfo != NULL ) {
        keyValPair_t regParam;
        char tmpStr[MAX_NAME_LEN];
        modDataObjMeta_t modDataObjMetaInp;

        memset( &regParam, 0, sizeof( regParam ) );
        memset( &modDataObjMetaInp, 0, sizeof( modDataObjMetaInp ) );
        snprintf( tmpStr, MAX_NAME_LEN, "%d", NEWLY_CREATED_COPY );
        addKeyVal( &regParam, REPL_STATUS_KW, tmpStr );
        modDataObjMetaInp.dataObjInfo = newestDataObjInfo;
        modDataObjMetaInp.regParam = &regParam;

        status = rsModDataObjMeta( rsComm, &modDataObjMetaInp );

        clearKeyVal( &regParam );
    }
    freeAllDataObjInfo( dataObjInfoHead );
    return status;
}
Ejemplo n.º 5
0
int
computeHostAddress(rsComm_t *rsComm, char *inStr, rodsHostAddr_t *addr)
{
  int status;
  dataObjInp_t dataObjInp;
  dataObjInfo_t *dataObjInfoHead = NULL;
  char *path;
  rescGrpInfo_t *rescGrpInfo = NULL;

  if (inStr[0] == '@')
    path = inStr + 1;
  else
    path = inStr;
  if (path[0] == '/') { /* objpath */
    memset (&dataObjInp, 0, sizeof (dataObjInp));
    rstrcpy (dataObjInp.objPath, path, MAX_NAME_LEN);
    status = getDataObjInfo (rsComm, &dataObjInp, &dataObjInfoHead,
			     ACCESS_READ_OBJECT, 0);
    if (status < 0) {
      rodsLog (LOG_ERROR,
	       "computeHostAddress: getDataObjInfo error for Path %s", path); 
      return (status);
    }

    status = sortObjInfoForOpen (rsComm, &dataObjInfoHead, NULL, 0);
    if (status < 0) {
      rodsLog (LOG_ERROR,
               "computeHostAddress: sortObjInfoForOpen error for Path %s", path);
      return status;
    }
    rstrcpy (addr->zoneName, dataObjInfoHead->rescInfo->zoneName, NAME_LEN);
    rstrcpy (addr->hostAddr, dataObjInfoHead->rescInfo->rescLoc, LONG_NAME_LEN);
    freeAllDataObjInfo (dataObjInfoHead);
  }
  else { /* it is a logical resource (or group) name */
    status = getRescInfo (rsComm, path, NULL, &rescGrpInfo);
    if (status < 0) {
      rodsLog (LOG_ERROR,
               "computeHostAddress: getRescInfo error for Path %s", path);
      return (status);
    }

    status = sortResc(rsComm, &rescGrpInfo, "random");
    if (status < 0) {
      rodsLog (LOG_ERROR,
               "computeHostAddress: sortResc error for Path %s", path);
      return status;
    }
    rstrcpy (addr->zoneName, rescGrpInfo->rescInfo->zoneName, NAME_LEN);
    rstrcpy (addr->hostAddr, rescGrpInfo->rescInfo->rescLoc, LONG_NAME_LEN);
    freeAllRescGrpInfo (rescGrpInfo);
  }
    return(0);
}
Ejemplo n.º 6
0
int
getRescForGetInDataObj( rsComm_t *rsComm, dataObjInp_t *dataObjInp,
                        hostSearchStat_t *hostSearchStat ) {
    int status, i;
    dataObjInfo_t *dataObjInfoHead = NULL;

    if ( dataObjInp == NULL || hostSearchStat == NULL ) {
        return USER__NULL_INPUT_ERR;
    }

    status = getDataObjInfoIncSpecColl( rsComm, dataObjInp, &dataObjInfoHead );
    if ( status < 0 ) {
        return status;
    }

    sortObjInfoForOpen( &dataObjInfoHead, &dataObjInp->condInput, 0 );
    if ( dataObjInfoHead ) {
        if ( hostSearchStat->numHost >= MAX_HOST_TO_SEARCH ||
                hostSearchStat->totalCount >= MAX_HOST_TO_SEARCH ) {
            freeAllDataObjInfo( dataObjInfoHead );
            return 0;
        }
        for ( i = 0; i < hostSearchStat->numHost; i++ ) {
            if ( dataObjInfoHead->rescInfo == hostSearchStat->rescInfo[i] ) {
                hostSearchStat->count[i]++;
                hostSearchStat->totalCount++;
                freeAllDataObjInfo( dataObjInfoHead );
                return 0;
            }
        }
        /* no match. add one */
        hostSearchStat->rescInfo[hostSearchStat->numHost] =
            dataObjInfoHead->rescInfo;
        hostSearchStat->count[hostSearchStat->numHost] = 1;
        hostSearchStat->numHost++;
        hostSearchStat->totalCount++;
    }
    freeAllDataObjInfo( dataObjInfoHead );
    return 0;
}
Ejemplo n.º 7
0
int
filePathRegRepl (rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
rescInfo_t *rescInfo)
{
    dataObjInfo_t destDataObjInfo, *dataObjInfoHead = NULL;
    regReplica_t regReplicaInp;
    char *rescGroupName = NULL;
    int status;

    status = getDataObjInfo (rsComm, phyPathRegInp, &dataObjInfoHead,
      ACCESS_READ_OBJECT, 0);

    if (status < 0) {
        rodsLog (LOG_ERROR,
          "filePathRegRepl: getDataObjInfo for %s", phyPathRegInp->objPath);
        return (status);
    }
    status = sortObjInfoForOpen (rsComm, &dataObjInfoHead, NULL, 0);
    if (status < 0) return status;

    destDataObjInfo = *dataObjInfoHead;
    rstrcpy (destDataObjInfo.filePath, filePath, MAX_NAME_LEN);
    destDataObjInfo.rescInfo = rescInfo;
    rstrcpy (destDataObjInfo.rescName, rescInfo->rescName, NAME_LEN);
    if ((rescGroupName = getValByKey (&phyPathRegInp->condInput,
      RESC_GROUP_NAME_KW)) != NULL) {
        rstrcpy (destDataObjInfo.rescGroupName, rescGroupName, NAME_LEN);
    }
    memset (&regReplicaInp, 0, sizeof (regReplicaInp));
    regReplicaInp.srcDataObjInfo = dataObjInfoHead;
    regReplicaInp.destDataObjInfo = &destDataObjInfo;
    if (getValByKey (&phyPathRegInp->condInput, SU_CLIENT_USER_KW) != NULL) {
        addKeyVal (&regReplicaInp.condInput, SU_CLIENT_USER_KW, "");
        addKeyVal (&regReplicaInp.condInput, IRODS_ADMIN_KW, "");
    } else if (getValByKey (&phyPathRegInp->condInput,
      IRODS_ADMIN_KW) != NULL) {
        addKeyVal (&regReplicaInp.condInput, IRODS_ADMIN_KW, "");
    }
    status = rsRegReplica (rsComm, &regReplicaInp);
    clearKeyVal (&regReplicaInp.condInput);
    freeAllDataObjInfo (dataObjInfoHead);

    return status;
}
Ejemplo n.º 8
0
int
freeL1desc (int l1descInx)
{
    if (l1descInx < 3 || l1descInx >= NUM_L1_DESC) {
        rodsLog (LOG_NOTICE,
                 "freeL1desc: l1descInx %d out of range", l1descInx);
        return (SYS_FILE_DESC_OUT_OF_RANGE);
    }

    if (L1desc[l1descInx].dataObjInfo != NULL) {
        /* for remote zone type L1desc, rescInfo is not from local cache
         * but malloc'ed */
        if (L1desc[l1descInx].remoteZoneHost != NULL &&
                L1desc[l1descInx].dataObjInfo->rescInfo != NULL)
            free (L1desc[l1descInx].dataObjInfo->rescInfo);
#if 0	/* no longer need this with irsDataObjClose */
        /* will be freed in _rsDataObjReplS since it needs the new
         * replNum and dataID */
        if (L1desc[l1descInx].oprType != REPLICATE_DEST)
            freeDataObjInfo (L1desc[l1descInx].dataObjInfo);
#endif
        if (L1desc[l1descInx].dataObjInfo != NULL)
            freeDataObjInfo (L1desc[l1descInx].dataObjInfo);
    }

    if (L1desc[l1descInx].otherDataObjInfo != NULL) {
        freeAllDataObjInfo (L1desc[l1descInx].otherDataObjInfo);
    }

    if (L1desc[l1descInx].replDataObjInfo != NULL) {
        freeDataObjInfo (L1desc[l1descInx].replDataObjInfo);
    }

    if (L1desc[l1descInx].dataObjInpReplFlag == 1 &&
            L1desc[l1descInx].dataObjInp != NULL) {
        clearDataObjInp (L1desc[l1descInx].dataObjInp);
        free (L1desc[l1descInx].dataObjInp);
    }
    memset (&L1desc[l1descInx], 0, sizeof (l1desc_t));

    return (0);
}
Ejemplo n.º 9
0
int
rsRsyncDataToFile( rsComm_t *rsComm, dataObjInp_t *dataObjInp ) {
    int status;
    char *fileChksumStr = NULL;
    char *dataObjChksumStr = NULL;
    dataObjInfo_t *dataObjInfoHead = NULL;

    fileChksumStr = getValByKey( &dataObjInp->condInput, RSYNC_CHKSUM_KW );

    if ( fileChksumStr == NULL ) {
        rodsLog( LOG_ERROR,
                 "rsRsyncDataToFile: RSYNC_CHKSUM_KW input is missing for %s",
                 dataObjInp->objPath );
        return CHKSUM_EMPTY_IN_STRUCT_ERR;
    }

    addKeyVal( &dataObjInp->condInput, ORIG_CHKSUM_KW, fileChksumStr );

    status = _rsDataObjChksum( rsComm, dataObjInp, &dataObjChksumStr,
                               &dataObjInfoHead );

    if ( status < 0 && status != CAT_NO_ACCESS_PERMISSION &&
            status != CAT_NO_ROWS_FOUND ) {
        /* XXXXX CAT_NO_ACCESS_PERMISSION mean the chksum was calculated but
         * cannot be registered. But the chksum value is OK.
         */
        rodsLog( LOG_ERROR,
                 "rsRsyncDataToFile: _rsDataObjChksum of %s error. status = %d",
                 dataObjInp->objPath, status );
        return status;
    }

    freeAllDataObjInfo( dataObjInfoHead );
    status = dataObjChksumStr && strcmp( dataObjChksumStr, fileChksumStr ) == 0 ?
             0 : SYS_SVR_TO_CLI_GET_ACTION;

    free( dataObjChksumStr );

    return status;
}
Ejemplo n.º 10
0
int
specCollSubStat( rsComm_t *rsComm, specColl_t *specColl,
                 char *subPath, specCollPerm_t specCollPerm, dataObjInfo_t **dataObjInfo ) {
    int status;
    int objType;
    rodsStat_t *rodsStat = NULL;
    dataObjInfo_t *myDataObjInfo = NULL;;

    if ( dataObjInfo == NULL ) {
        return USER__NULL_INPUT_ERR;
    }
    *dataObjInfo = NULL;

    if ( specColl->collClass == MOUNTED_COLL ) {
        /* a mount point */
        myDataObjInfo = *dataObjInfo = ( dataObjInfo_t * ) malloc( sizeof( dataObjInfo_t ) );

        memset( myDataObjInfo, 0, sizeof( dataObjInfo_t ) );

        /*status = resolveResc (specColl->resource, &myDataObjInfo->rescInfo);
        if (status < 0) {
            rodsLog( LOG_ERROR,"specCollSubStat: resolveResc error for %s, status = %d",
                     specColl->resource, status);
            freeDataObjInfo (myDataObjInfo);
            *dataObjInfo = NULL;
            return status;
        }*/

        rstrcpy( myDataObjInfo->objPath, subPath, MAX_NAME_LEN );
        rstrcpy( myDataObjInfo->subPath, subPath, MAX_NAME_LEN );
        rstrcpy( myDataObjInfo->rescName, specColl->resource, NAME_LEN );
        rstrcpy( myDataObjInfo->rescHier, specColl->rescHier, MAX_NAME_LEN );
        rstrcpy( myDataObjInfo->dataType, "generic", NAME_LEN );

        status = getMountedSubPhyPath( specColl->collection,
                                       specColl->phyPath, subPath, myDataObjInfo->filePath );
        if ( status < 0 ) {
            freeDataObjInfo( myDataObjInfo );
            *dataObjInfo = NULL;
            return status;
        }
        replSpecColl( specColl, &myDataObjInfo->specColl );
    }
    else if ( specColl->collClass == LINKED_COLL ) {

        /* a link point */
        specCollCache_t *specCollCache = NULL;
        char newPath[MAX_NAME_LEN];
        specColl_t *curSpecColl;
        char *accessStr;
        dataObjInp_t myDataObjInp;
        rodsObjStat_t *rodsObjStatOut = NULL;

        *dataObjInfo = NULL;
        curSpecColl = specColl;

        status = getMountedSubPhyPath( curSpecColl->collection,
                                       curSpecColl->phyPath, subPath, newPath );
        if ( status < 0 ) {
            return status;
        }

        status = resolveLinkedPath( rsComm, newPath, &specCollCache, NULL );
        if ( status < 0 ) {
            return status;
        }
        if ( specCollCache != NULL &&
                specCollCache->specColl.collClass != LINKED_COLL ) {

            status = specCollSubStat( rsComm, &specCollCache->specColl,
                                      newPath, specCollPerm, dataObjInfo );
            return status;
        }
        bzero( &myDataObjInp, sizeof( myDataObjInp ) );
        rstrcpy( myDataObjInp.objPath, newPath, MAX_NAME_LEN );

        status = collStat( rsComm, &myDataObjInp, &rodsObjStatOut );
        if ( status >= 0 && NULL != rodsObjStatOut ) {      /* a collection */ // JMC cppcheck - nullptr
            myDataObjInfo = *dataObjInfo =
                                ( dataObjInfo_t * ) malloc( sizeof( dataObjInfo_t ) );
            memset( myDataObjInfo, 0, sizeof( dataObjInfo_t ) );
            replSpecColl( curSpecColl, &myDataObjInfo->specColl );
            rstrcpy( myDataObjInfo->objPath, newPath, MAX_NAME_LEN );
            myDataObjInfo->dataId = strtoll( rodsObjStatOut->dataId, 0, 0 );
            rstrcpy( myDataObjInfo->dataOwnerName, rodsObjStatOut->ownerName, NAME_LEN );
            rstrcpy( myDataObjInfo->dataOwnerZone, rodsObjStatOut->ownerZone, NAME_LEN );
            rstrcpy( myDataObjInfo->dataCreate,    rodsObjStatOut->createTime, TIME_LEN );
            rstrcpy( myDataObjInfo->dataModify,    rodsObjStatOut->modifyTime, TIME_LEN );
            freeRodsObjStat( rodsObjStatOut );
            return COLL_OBJ_T;
        }
        freeRodsObjStat( rodsObjStatOut );

        /* data object */
        if ( specCollPerm == READ_COLL_PERM ) {
            accessStr = ACCESS_READ_OBJECT;
        }
        else if ( specCollPerm == WRITE_COLL_PERM ) {
            accessStr = ACCESS_DELETE_OBJECT;
        }
        else {
            accessStr = NULL;
        }

        status = getDataObjInfo( rsComm, &myDataObjInp, dataObjInfo,
                                 accessStr, 0 );
        if ( status < 0 ) {
            myDataObjInfo = *dataObjInfo =
                                ( dataObjInfo_t * ) malloc( sizeof( dataObjInfo_t ) );
            memset( myDataObjInfo, 0, sizeof( dataObjInfo_t ) );
            replSpecColl( curSpecColl, &myDataObjInfo->specColl );
            rstrcpy( myDataObjInfo->objPath, newPath, MAX_NAME_LEN );
            rodsLog( LOG_DEBUG,
                     "specCollSubStat: getDataObjInfo error for %s, status = %d",
                     newPath, status );
            return status;
        }
        else {
            replSpecColl( curSpecColl, &( *dataObjInfo )->specColl );
            return DATA_OBJ_T;
        }
    }
    else if ( getStructFileType( specColl ) >= 0 ) {

        /* bundle */
        dataObjInp_t myDataObjInp;
        dataObjInfo_t *tmpDataObjInfo;

        bzero( &myDataObjInp, sizeof( myDataObjInp ) );
        rstrcpy( myDataObjInp.objPath, specColl->objPath, MAX_NAME_LEN );
        // add the resource hierarchy to the condInput of the inp
        addKeyVal( &myDataObjInp.condInput, RESC_HIER_STR_KW, specColl->rescHier );
        status = getDataObjInfo( rsComm, &myDataObjInp, dataObjInfo, NULL, 1 );
        if ( status < 0 ) {
            rodsLog( LOG_ERROR,
                     "specCollSubStat: getDataObjInfo error for %s, status = %d",
                     myDataObjInp.objPath, status );
            *dataObjInfo = NULL;
            return status;
        }

        /* screen out any stale copies */
        status = sortObjInfoForOpen( dataObjInfo, &myDataObjInp.condInput, 0 );
        if ( status < 0 ) {
            rodsLog( LOG_ERROR,
                     "specCollSubStat: sortObjInfoForOpen error for %s. status = %d",
                     myDataObjInp.objPath, status );
            return status;
        }

        if ( strlen( specColl->resource ) > 0 ) {
            if ( requeDataObjInfoByResc( dataObjInfo, specColl->resource,
                                         0, 1 ) >= 0 ) {
                if ( strcmp( specColl->resource,
                             ( *dataObjInfo )->rescName ) != 0 ) {
                    rodsLog( LOG_ERROR,
                             "specCollSubStat: %s in %s does not match cache resc %s",
                             myDataObjInp.objPath, ( *dataObjInfo )->rescName,
                             specColl->resource );
                    freeAllDataObjInfo( *dataObjInfo );
                    *dataObjInfo = NULL;
                    return SYS_CACHE_STRUCT_FILE_RESC_ERR;
                }
            }
            else {
                rodsLog( LOG_ERROR,
                         "specCollSubStat: requeDataObjInfoByResc %s, resc %s error",
                         myDataObjInp.objPath, specColl->resource );
                freeAllDataObjInfo( *dataObjInfo );
                *dataObjInfo = NULL;
                return SYS_CACHE_STRUCT_FILE_RESC_ERR;
            }
        }

        /* free all the other dataObjInfo */
        if ( ( *dataObjInfo )->next != NULL ) {
            freeAllDataObjInfo( ( *dataObjInfo )->next );
            ( *dataObjInfo )->next = NULL;
        }

        /* fill in DataObjInfo */
        tmpDataObjInfo = *dataObjInfo;
        replSpecColl( specColl, &tmpDataObjInfo->specColl );
        rstrcpy( specColl->resource, tmpDataObjInfo->rescName, NAME_LEN );
        rstrcpy( specColl->rescHier, tmpDataObjInfo->rescHier, MAX_NAME_LEN );
        rstrcpy( specColl->phyPath, tmpDataObjInfo->filePath, MAX_NAME_LEN );
        rstrcpy( tmpDataObjInfo->subPath, subPath, MAX_NAME_LEN );
        specColl->replNum = tmpDataObjInfo->replNum;

        if ( strcmp( ( *dataObjInfo )->subPath, specColl->collection ) == 0 ) {
            /* no need to go down */
            return COLL_OBJ_T;
        }
    }
    else {
        rodsLog( LOG_ERROR,
                 "specCollSubStat: Unknown specColl collClass = %d",
                 specColl->collClass );
        return SYS_UNKNOWN_SPEC_COLL_CLASS;
    }
    status = l3Stat( rsComm, *dataObjInfo, &rodsStat );

    if ( status < 0 ) {
        return status;
    }

    if ( rodsStat->st_ctim != 0 ) {
        snprintf( ( *dataObjInfo )->dataCreate, TIME_LEN, "%d", rodsStat->st_ctim );
        snprintf( ( *dataObjInfo )->dataModify, TIME_LEN, "%d", rodsStat->st_mtim );
    }

    if ( rodsStat->st_mode & S_IFDIR ) {
        objType = COLL_OBJ_T;
    }
    else {
        objType = DATA_OBJ_T;
        ( *dataObjInfo )->dataSize = rodsStat->st_size;
    }
    free( rodsStat );

    return objType;
}
Ejemplo n.º 11
0
int
statPathInSpecColl( rsComm_t *rsComm, char *objPath,
                    int inCachOnly, rodsObjStat_t **rodsObjStatOut ) {
    int status;
    dataObjInfo_t *dataObjInfo = NULL;
    specColl_t *specColl;
    specCollCache_t *specCollCache;

    if ( ( status = getSpecCollCache( rsComm, objPath, inCachOnly,
                                      &specCollCache ) ) < 0 ) {
        if ( status != SYS_SPEC_COLL_NOT_IN_CACHE &&
                status != CAT_NO_ROWS_FOUND ) {
            rodsLog( LOG_ERROR,
                     "statPathInSpecColl: getSpecCollCache for %s, status = %d",
                     objPath, status );
        }
        return status;
    }

    if ( *rodsObjStatOut == NULL ) {
        *rodsObjStatOut = ( rodsObjStat_t * ) malloc( sizeof( rodsObjStat_t ) );
    }
    memset( *rodsObjStatOut, 0, sizeof( rodsObjStat_t ) );
    specColl = &specCollCache->specColl;
    rstrcpy( ( *rodsObjStatOut )->dataId, specCollCache->collId, NAME_LEN );
    rstrcpy( ( *rodsObjStatOut )->ownerName, specCollCache->ownerName, NAME_LEN );
    rstrcpy( ( *rodsObjStatOut )->ownerZone, specCollCache->ownerZone, NAME_LEN );

    status = specCollSubStat( rsComm, specColl, objPath, UNKNOWN_COLL_PERM, &dataObjInfo );

    if ( status < 0 ) {
        if ( dataObjInfo != NULL ) {
            if ( dataObjInfo->specColl != NULL ) {
                ( *rodsObjStatOut )->specColl = dataObjInfo->specColl;
            }
            else {
                replSpecColl( &specCollCache->specColl,
                              &( *rodsObjStatOut )->specColl );
            }
            if ( specColl->collClass == LINKED_COLL ) {
                rstrcpy( ( *rodsObjStatOut )->specColl->objPath,
                         dataObjInfo->objPath, MAX_NAME_LEN );
            }
            else {
                ( *rodsObjStatOut )->specColl->objPath[0] = '\0';
            }
            dataObjInfo->specColl = NULL;
        }
        ( *rodsObjStatOut )->objType = UNKNOWN_OBJ_T;
        rstrcpy( ( *rodsObjStatOut )->createTime, specCollCache->createTime,
                 TIME_LEN );
        rstrcpy( ( *rodsObjStatOut )->modifyTime, specCollCache->modifyTime,
                 TIME_LEN );
        freeAllDataObjInfo( dataObjInfo );
        /* XXXXX 0 return is creating a problem for fuse */
        return 0;
    }
    else {
        ( *rodsObjStatOut )->specColl = dataObjInfo->specColl;
        dataObjInfo->specColl = NULL;

        if ( specColl->collClass == LINKED_COLL ) {
            rstrcpy( ( *rodsObjStatOut )->ownerName, dataObjInfo->dataOwnerName,
                     NAME_LEN );
            rstrcpy( ( *rodsObjStatOut )->ownerZone, dataObjInfo->dataOwnerZone,
                     NAME_LEN );
            snprintf( ( *rodsObjStatOut )->dataId, NAME_LEN, "%lld",
                      dataObjInfo->dataId );
            /* save the linked path here */
            rstrcpy( ( *rodsObjStatOut )->specColl->objPath,
                     dataObjInfo->objPath, MAX_NAME_LEN );
        }
        ( *rodsObjStatOut )->objType = ( objType_t )status;
        ( *rodsObjStatOut )->objSize = dataObjInfo->dataSize;
        rstrcpy( ( *rodsObjStatOut )->createTime, dataObjInfo->dataCreate,
                 TIME_LEN );
        rstrcpy( ( *rodsObjStatOut )->modifyTime, dataObjInfo->dataModify,
                 TIME_LEN );
        freeAllDataObjInfo( dataObjInfo );
    }

    return status;
}
Ejemplo n.º 12
0
int
rsDataObjPhymv( rsComm_t *rsComm, dataObjInp_t *dataObjInp,
                transferStat_t **transStat ) {
    int status = 0;
    dataObjInfo_t *dataObjInfoHead = NULL;
    dataObjInfo_t *oldDataObjInfoHead = NULL;
    rescGrpInfo_t *myRescGrpInfo = NULL;
    ruleExecInfo_t rei;
    int multiCopyFlag = 0;
    char *accessPerm = NULL;
    int remoteFlag = 0;
    rodsServerHost_t *rodsServerHost = NULL;
    specCollCache_t *specCollCache = NULL;

    resolveLinkedPath( rsComm, dataObjInp->objPath, &specCollCache,
                       &dataObjInp->condInput );
    remoteFlag = getAndConnRemoteZone( rsComm, dataObjInp, &rodsServerHost,
                                       REMOTE_OPEN );

    if ( remoteFlag < 0 ) {
        return remoteFlag;
    }
    else if ( remoteFlag == REMOTE_HOST ) {
        status = _rcDataObjPhymv( rodsServerHost->conn, dataObjInp,
                                  transStat );
        return status;
    }

    // =-=-=-=-=-=-=-
    // determine hierarchy string
    if ( getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW ) == NULL ) {
        std::string       hier;
        irods::error ret = irods::resolve_resource_hierarchy( irods::OPEN_OPERATION, rsComm,
                           dataObjInp, hier );
        if ( !ret.ok() ) {
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " :: failed in irods::resolve_resource_hierarchy for [";
            msg << dataObjInp->objPath << "]";
            irods::log( PASSMSG( msg.str(), ret ) );
            return ret.code();
        }

        // =-=-=-=-=-=-=-
        // we resolved the redirect and have a host, set the hier str for subsequent
        // api calls, etc.
        addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, hier.c_str() );

    } // if keyword

    *transStat = ( transferStat_t* )malloc( sizeof( transferStat_t ) );
    memset( *transStat, 0, sizeof( transferStat_t ) );

    if ( getValByKey( &dataObjInp->condInput, ADMIN_KW ) != NULL ) {
        if ( rsComm->clientUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH ) {
            return CAT_INSUFFICIENT_PRIVILEGE_LEVEL;
        }
        accessPerm = NULL;
    }
    else {
        accessPerm = ACCESS_DELETE_OBJECT;
    }

    /* query rcat for resource info and sort it */
    status = getRescGrpForCreate( rsComm, dataObjInp, &myRescGrpInfo );
    if ( status < 0 ) {
        delete myRescGrpInfo->rescInfo;
        delete myRescGrpInfo;
        return status;
    }

    initReiWithDataObjInp( &rei, rsComm, dataObjInp );
    status = applyRule( "acSetMultiReplPerResc", NULL, &rei, NO_SAVE_REI );
    if ( strcmp( rei.statusStr, MULTI_COPIES_PER_RESC ) == 0 ) {
        multiCopyFlag = 1;
    }
    else {
        multiCopyFlag = 0;
    }

    /* query rcat for dataObjInfo and sort it */
    status = getDataObjInfo( rsComm, dataObjInp, &dataObjInfoHead,
                             accessPerm, 1 );

    if ( status < 0 ) {
        rodsLog( LOG_NOTICE,
                 "rsDataObjPhymv: getDataObjInfo for %s", dataObjInp->objPath );
        delete myRescGrpInfo->rescInfo;
        delete myRescGrpInfo;
        return status;
    }

    status = resolveInfoForPhymv( &dataObjInfoHead, &oldDataObjInfoHead, &myRescGrpInfo, &dataObjInp->condInput, multiCopyFlag );

    if ( status < 0 ) {
        freeAllDataObjInfo( dataObjInfoHead );
        freeAllDataObjInfo( oldDataObjInfoHead );
        if ( myRescGrpInfo ) {
            delete myRescGrpInfo->rescInfo;
            delete myRescGrpInfo;
        }
        if ( status == CAT_NO_ROWS_FOUND ) {
            return 0;
        }
        else {
            return status;
        }
    }

    status = _rsDataObjPhymv( rsComm, dataObjInp, dataObjInfoHead,
                              myRescGrpInfo, *transStat, multiCopyFlag );

    freeAllDataObjInfo( dataObjInfoHead );
    freeAllDataObjInfo( oldDataObjInfoHead );
    if ( myRescGrpInfo ) {
        delete myRescGrpInfo->rescInfo;
        delete myRescGrpInfo;
    }

    return status;
}
Ejemplo n.º 13
0
int
_rsDataObjOpen( rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t *dataObjInfoHead ) {
    int status = 0;
    int phyOpenFlag = DO_PHYOPEN;
    if ( getValByKey( &dataObjInp->condInput, NO_OPEN_FLAG_KW ) != NULL ) {
        phyOpenFlag = DO_NOT_PHYOPEN;
    }
    else if ( getValByKey( &dataObjInp->condInput, PHYOPEN_BY_SIZE_KW )
              != NULL ) {
        phyOpenFlag = PHYOPEN_BY_SIZE;
    }
    // =-=-=-=-=-=-=-
    // JMC - backport 4604
    char * lockType = getValByKey( &dataObjInp->condInput, LOCK_TYPE_KW );
    int lockFd = -1; // JMC - backport 4604
    if ( lockType != NULL ) {
        lockFd = irods::server_api_call(
                     DATA_OBJ_LOCK_AN,
                     rsComm,
                     dataObjInp,
                     NULL,
                     ( void** ) NULL,
                     NULL );
        if ( lockFd > 0 ) {
            /* rm it so it won't be done again causing deadlock */
            rmKeyVal( &dataObjInp->condInput, LOCK_TYPE_KW );
        }
        else {
            rodsLogError( LOG_ERROR, lockFd,
                          "_rsDataObjOpen: lock error for %s. lockType = %s",
                          dataObjInp->objPath, lockType );
            return lockFd;
        }
    }

    int writeFlag = getWriteFlag( dataObjInp->openFlags );

    // check earlier attempt at resolving resource hierarchy
    if (!getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW)) {
        int l1descInx = 0;
        if ( dataObjInp->openFlags & O_CREAT && writeFlag > 0 ) {
            l1descInx = rsDataObjCreate( rsComm, dataObjInp );
            status = l1descInx; // JMC - backport 4604
        }
        // =-=-=-=-=-=-=-
        // JMC - backport 4604
        if ( lockFd >= 0 ) {
            if ( status > 0 ) {
                L1desc[l1descInx].lockFd = lockFd;
            }
            else {
                char fd_string[NAME_LEN];
                snprintf( fd_string, sizeof( fd_string ), "%-d", lockFd );
                addKeyVal( &dataObjInp->condInput, LOCK_FD_KW, fd_string );
                irods::server_api_call(
                    DATA_OBJ_UNLOCK_AN,
                    rsComm,
                    dataObjInp,
                    NULL,
                    ( void** ) NULL,
                    NULL );

            }
        }
        return status;
    }
    else {
//////
        /* screen out any stale copies */
        status = sortObjInfoForOpen( &dataObjInfoHead, &dataObjInp->condInput, writeFlag );
        if ( status < 0 ) { // JMC - backport 4604
            if ( lockFd > 0 ) {
                char fd_string[NAME_LEN];
                snprintf( fd_string, sizeof( fd_string ), "%-d", lockFd );
                addKeyVal( &dataObjInp->condInput, LOCK_FD_KW, fd_string );
                irods::server_api_call(
                    DATA_OBJ_UNLOCK_AN,
                    rsComm,
                    dataObjInp,
                    NULL,
                    ( void** ) NULL,
                    NULL );


            }
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " - Unable to select a data obj info matching the resource hierarchy from the keywords.";
            irods::log( ERROR( status, msg.str() ) );
            return status;
        }
//////
        status = applyPreprocRuleForOpen( rsComm, dataObjInp, &dataObjInfoHead );
        if ( status < 0 ) { // JMC - backport 4604
            if ( lockFd > 0 ) {
                char fd_string[NAME_LEN];
                snprintf( fd_string, sizeof( fd_string ), "%-d", lockFd );
                addKeyVal( &dataObjInp->condInput, LOCK_FD_KW, fd_string );
                irods::server_api_call(
                    DATA_OBJ_UNLOCK_AN,
                    rsComm,
                    dataObjInp,
                    NULL,
                    ( void** ) NULL,
                    NULL );

            }
            return status;
        }
    }

    dataObjInfo_t * compDataObjInfo = NULL;
    if ( getStructFileType( dataObjInfoHead->specColl ) >= 0 ) {
        /* special coll. Nothing to do */
    }
    else if ( writeFlag > 0 ) {
        // JMC :: had to reformat this code to find a missing {
        //     :: i seriously hope its in the right place...
        status = procDataObjOpenForWrite( rsComm, dataObjInp, &dataObjInfoHead, &compDataObjInfo );
    }

    if ( status < 0 ) {
        if ( lockFd > 0 ) {
            char fd_string[NAME_LEN];
            snprintf( fd_string, sizeof( fd_string ), "%-d", lockFd );
            addKeyVal( &dataObjInp->condInput, LOCK_FD_KW, fd_string );
            irods::server_api_call(
                DATA_OBJ_UNLOCK_AN,
                rsComm,
                dataObjInp,
                NULL,
                ( void** ) NULL,
                NULL );
        }
        freeAllDataObjInfo( dataObjInfoHead );
        return status;
    }

    std::string resc_class;
    irods::error prop_err = irods::get_resource_property<std::string>(
                                dataObjInfoHead->rescId, "class", resc_class );
    if ( prop_err.ok() ) {
        if ( resc_class == "bundle" ) {
            status = stageBundledData( rsComm, &dataObjInfoHead );
            if ( status < 0 ) {
                rodsLog( LOG_ERROR,
                         "_rsDataObjOpen: stageBundledData of %s failed stat=%d",
                         dataObjInfoHead->objPath, status );
                freeAllDataObjInfo( dataObjInfoHead );
                if ( lockFd >= 0 ) {
                    char fd_string[NAME_LEN];
                    snprintf( fd_string, sizeof( fd_string ), "%-d", lockFd );
                    addKeyVal( &dataObjInp->condInput, LOCK_FD_KW, fd_string );
                    irods::server_api_call(
                        DATA_OBJ_UNLOCK_AN,
                        rsComm,
                        dataObjInp,
                        NULL,
                        ( void** ) NULL,
                        NULL );
                }
                return status;
            }
        }
    }

    /* If compDataObjInfo != NULL, an existing COMPOUND_CL DataObjInfo exist.
     * Need to replicate to * this DataObjInfo in rsdataObjClose.
     * For read, compDataObjInfo should be NULL. */
    dataObjInfo_t * tmpDataObjInfo = dataObjInfoHead;

    while ( tmpDataObjInfo != NULL ) {
        dataObjInfo_t * nextDataObjInfo = tmpDataObjInfo->next;
        tmpDataObjInfo->next = NULL;

        int l1descInx = status = _rsDataObjOpenWithObjInfo( rsComm, dataObjInp, phyOpenFlag, tmpDataObjInfo );

        if ( l1descInx >= 0 ) {
            if ( compDataObjInfo != NULL ) {
                L1desc[l1descInx].replDataObjInfo = compDataObjInfo;
            }

            dataObjInfo_t *otherDataObjInfo = NULL;
            queDataObjInfo( &otherDataObjInfo, nextDataObjInfo, 0, 1 ); // JMC - backport 4542
            L1desc[l1descInx].otherDataObjInfo = otherDataObjInfo; // JMC - backport 4542

            if ( writeFlag > 0 ) {
                L1desc[l1descInx].openType = OPEN_FOR_WRITE_TYPE;
            }
            else {
                L1desc[l1descInx].openType = OPEN_FOR_READ_TYPE;
            }
            if ( lockFd >= 0 ) {
                L1desc[l1descInx].lockFd = lockFd;
            }
            return l1descInx;

        } // if l1descInx >= 0

        tmpDataObjInfo = nextDataObjInfo;
    } // while

    return status;
} // BAD
Ejemplo n.º 14
0
int
rsDataObjPut (rsComm_t *rsComm, dataObjInp_t *dataObjInp,
bytesBuf_t *dataObjInpBBuf, portalOprOut_t **portalOprOut)
{
    int status;
    int status2;
    int remoteFlag;
    rodsServerHost_t *rodsServerHost;
    specCollCache_t *specCollCache = NULL;

    resolveLinkedPath (rsComm, dataObjInp->objPath, &specCollCache,
      &dataObjInp->condInput);
#if 0
    status = resolvePathInSpecColl (rsComm, dataObjInp->objPath,
          READ_COLL_PERM, 0, &dataObjInfo);

    if (dataObjInfo != NULL) {
        if (dataObjInfo->specColl != NULL && 
	  dataObjInfo->specColl->collClass == LINKED_COLL) {
            rstrcpy (dataObjInp->objPath, dataObjInfo->objPath,
              MAX_NAME_LEN);
	}
        freeAllDataObjInfo (dataObjInfo);
    }
#endif

    remoteFlag = getAndConnRemoteZone (rsComm, dataObjInp, &rodsServerHost,
      REMOTE_CREATE);

    if (remoteFlag < 0) {
        return (remoteFlag);
    } else if (remoteFlag == LOCAL_HOST) {
	/** since the object is written here, we apply pre procesing RAJA 
         * Dec 2 2010 **/
      status2 = applyRuleForPostProcForWrite(rsComm, dataObjInpBBuf, 
       dataObjInp->objPath);
	 if (status2 < 0) 
	   return(status2); /* need to dealloc anything??? */
	/** since the object is written here, we apply pre procesing RAJA 
         * Dec 2 2010 **/

	dataObjInp->openFlags = O_RDWR;
        status = _rsDataObjPut (rsComm, dataObjInp, dataObjInpBBuf,
          portalOprOut, BRANCH_MSG);
    } else {
	int l1descInx;
        status = _rcDataObjPut (rodsServerHost->conn, dataObjInp, 
	  dataObjInpBBuf, portalOprOut);
        if (status < 0 || 
          getValByKey (&dataObjInp->condInput, DATA_INCLUDED_KW) != NULL) {
            return (status);
        } else {
            /* have to allocate a local l1descInx to keep track of things
             * since the file is in remote zone. It sets remoteL1descInx,
             * oprType = REMOTE_ZONE_OPR and remoteZoneHost so that  
             * rsComplete knows what to do */
            l1descInx = allocAndSetL1descForZoneOpr (
              (*portalOprOut)->l1descInx, dataObjInp, rodsServerHost, NULL);
            if (l1descInx < 0) return l1descInx;
            (*portalOprOut)->l1descInx = l1descInx;
            return status;
        }
    }

    return (status);
}
Ejemplo n.º 15
0
int
_rsModDataObjMeta( rsComm_t *rsComm, modDataObjMeta_t *modDataObjMetaInp ) {
#ifdef RODS_CAT
    int status = 0;
    dataObjInfo_t *dataObjInfo;
    keyValPair_t *regParam;
    int i;
    ruleExecInfo_t rei2;

    memset( ( char* )&rei2, 0, sizeof( ruleExecInfo_t ) );
    rei2.rsComm = rsComm;
    if ( rsComm != NULL ) {
        rei2.uoic = &rsComm->clientUser;
        rei2.uoip = &rsComm->proxyUser;
    }
    rei2.doi = modDataObjMetaInp->dataObjInfo;
    rei2.condInputData = modDataObjMetaInp->regParam;
    regParam = modDataObjMetaInp->regParam;
    dataObjInfo = modDataObjMetaInp->dataObjInfo;

    if ( regParam->len == 0 ) {
        return ( 0 );
    }

    /* In dataObjInfo, need just dataId. But it will accept objPath too,
     * but less efficient
     */

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    rei2.doi = dataObjInfo;
    i =  applyRule( "acPreProcForModifyDataObjMeta", NULL, &rei2, NO_SAVE_REI );
    if ( i < 0 ) {
        if ( rei2.status < 0 ) {
            i = rei2.status;
        }
        rodsLog( LOG_ERROR, "_rsModDataObjMeta:acPreProcForModifyDataObjMeta error stat=%d", i );

        return i;
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    if ( getValByKey( regParam, ALL_KW ) != NULL ) {
        /* all copies */
        dataObjInfo_t *dataObjInfoHead = NULL;
        dataObjInfo_t *tmpDataObjInfo;
        dataObjInp_t dataObjInp;

        bzero( &dataObjInp, sizeof( dataObjInp ) );
        rstrcpy( dataObjInp.objPath, dataObjInfo->objPath, MAX_NAME_LEN );
        status = getDataObjInfoIncSpecColl( rsComm, &dataObjInp, &dataObjInfoHead );

        if ( status < 0 )  {
            rodsLog( LOG_NOTICE, "%s - Failed to get data objects.", __FUNCTION__ );
            return status;
        }
        tmpDataObjInfo = dataObjInfoHead;
        while ( tmpDataObjInfo != NULL ) {
            if ( tmpDataObjInfo->specColl != NULL ) {
                break;
            }
            status = chlModDataObjMeta( rsComm, tmpDataObjInfo, regParam );
            if ( status < 0 ) {
                rodsLog( LOG_ERROR,
                         "_rsModDataObjMeta:chlModDataObjMeta %s error stat=%d",
                         tmpDataObjInfo->objPath, status );
            }
            tmpDataObjInfo = tmpDataObjInfo->next;
        }
        freeAllDataObjInfo( dataObjInfoHead );
    }
    else {
        status = chlModDataObjMeta( rsComm, dataObjInfo, regParam );
        if ( status < 0 ) {
            char* sys_error;
            char* rods_error = rodsErrorName( status, &sys_error );
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " - Failed to modify the database for object \"";
            msg << dataObjInfo->objPath;
            msg << "\" - " << rods_error << " " << sys_error;
            irods::error ret = ERROR( status, msg.str() );
            irods::log( ret );
        }
    }

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    if ( status >= 0 ) {
        i =  applyRule( "acPostProcForModifyDataObjMeta", NULL, &rei2, NO_SAVE_REI );
        if ( i < 0 ) {
            if ( rei2.status < 0 ) {
                i = rei2.status;
            }
            rodsLog( LOG_ERROR,
                     "_rsModDataObjMeta:acPostProcForModifyDataObjMeta error stat=%d", i );
            return i;
        }
    }
    else {
        rodsLog( LOG_NOTICE, "%s - Failed updating the database with object info.", __FUNCTION__ );
        return status;
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    return ( status );
#else
    return ( SYS_NO_RCAT_SERVER_ERR );
#endif

}
Ejemplo n.º 16
0
int _call_file_modified_for_modification(
    rsComm_t*         rsComm,
    modDataObjMeta_t* modDataObjMetaInp ) {
    int status = 0;
    dataObjInfo_t *dataObjInfo;
    keyValPair_t *regParam;
    ruleExecInfo_t rei2;

    memset( ( char* )&rei2, 0, sizeof( ruleExecInfo_t ) );
    rei2.rsComm = rsComm;
    if ( rsComm != NULL ) {
        rei2.uoic = &rsComm->clientUser;
        rei2.uoip = &rsComm->proxyUser;
    }
    rei2.doi = modDataObjMetaInp->dataObjInfo;
    rei2.condInputData = modDataObjMetaInp->regParam;
    regParam = modDataObjMetaInp->regParam;
    dataObjInfo = modDataObjMetaInp->dataObjInfo;

    if ( regParam->len == 0 ) {
        return ( 0 );
    }

    if ( getValByKey( regParam, ALL_KW ) != NULL ) {
        /* all copies */
        dataObjInfo_t *dataObjInfoHead = NULL;
        dataObjInfo_t *tmpDataObjInfo;
        dataObjInp_t dataObjInp;

        bzero( &dataObjInp, sizeof( dataObjInp ) );
        rstrcpy( dataObjInp.objPath, dataObjInfo->objPath, MAX_NAME_LEN );
        status = getDataObjInfoIncSpecColl( rsComm, &dataObjInp, &dataObjInfoHead );

        if ( status < 0 )  {
            rodsLog( LOG_NOTICE, "%s - Failed to get data objects.", __FUNCTION__ );
            return status;
        }
        tmpDataObjInfo = dataObjInfoHead;
        while ( tmpDataObjInfo != NULL ) {
            if ( tmpDataObjInfo->specColl != NULL ) {
                break;
            }

            irods::file_object_ptr file_obj(
                new irods::file_object(
                    rsComm,
                    tmpDataObjInfo ) );

            char* pdmo_kw = getValByKey( regParam, IN_PDMO_KW );
            if ( pdmo_kw != NULL ) {
                file_obj->in_pdmo( pdmo_kw );

            }

            irods::error ret = fileModified( rsComm, file_obj );
            if ( !ret.ok() ) {
                std::stringstream msg;
                msg << __FUNCTION__;
                msg << " - Failed to signal resource that the data object \"";
                msg << tmpDataObjInfo->objPath;
                msg << " was modified.";
                ret = PASSMSG( msg.str(), ret );
                irods::log( ret );
                status = ret.code();
            }

            tmpDataObjInfo = tmpDataObjInfo->next;
        }
        freeAllDataObjInfo( dataObjInfoHead );
    }
    else {
        irods::file_object_ptr file_obj(
            new irods::file_object(
                rsComm,
                dataObjInfo ) );

        char* pdmo_kw = getValByKey( regParam, IN_PDMO_KW );
        if ( pdmo_kw != NULL ) {
            file_obj->in_pdmo( pdmo_kw );
        }
        irods::error ret = fileModified( rsComm, file_obj );
        if ( !ret.ok() ) {
            std::stringstream msg;
            msg << __FUNCTION__;
            msg << " - Failed to signal the resource that the data object \"";
            msg << dataObjInfo->objPath;
            msg << "\" was modified.";
            ret = PASSMSG( msg.str(), ret );
            irods::log( ret );
            status = ret.code();
        }

    }

    return status;

}
Ejemplo n.º 17
0
int
rsDataObjUnlink (rsComm_t *rsComm, dataObjInp_t *dataObjUnlinkInp)
{
    int status;
    ruleExecInfo_t rei;
    int trashPolicy;
    dataObjInfo_t *dataObjInfoHead = NULL;
    rodsServerHost_t *rodsServerHost = NULL;
    int rmTrashFlag = 0;
    specCollCache_t *specCollCache = NULL;

    resolveLinkedPath (rsComm, dataObjUnlinkInp->objPath, &specCollCache,
      &dataObjUnlinkInp->condInput);
    status = getAndConnRcatHost (rsComm, MASTER_RCAT,
     dataObjUnlinkInp->objPath, &rodsServerHost);

    if (status < 0) {
        return (status);
    } else if (rodsServerHost->rcatEnabled == REMOTE_ICAT) {
        int retval;
        retval = rcDataObjUnlink (rodsServerHost->conn, dataObjUnlinkInp);
        return status;
    }

    if (getValByKey (
      &dataObjUnlinkInp->condInput, IRODS_ADMIN_RMTRASH_KW) != NULL ||
      getValByKey (
      &dataObjUnlinkInp->condInput, IRODS_RMTRASH_KW) != NULL) {
        if (isTrashPath (dataObjUnlinkInp->objPath) == False) {
            return (SYS_INVALID_FILE_PATH);
        }
	rmTrashFlag = 1;
    }

    dataObjUnlinkInp->openFlags = O_WRONLY;  /* set the permission checking */
    status = getDataObjInfoIncSpecColl (rsComm, dataObjUnlinkInp, 
      &dataObjInfoHead);

    if (status < 0) return (status);

    if (rmTrashFlag == 1) {
        char *tmpAge;
        int ageLimit;
        if ((tmpAge = getValByKey (&dataObjUnlinkInp->condInput, AGE_KW))
          != NULL) {
	    ageLimit = atoi (tmpAge) * 60;
	    if ((time (0) - atoi (dataObjInfoHead->dataModify)) < ageLimit) {
		/* younger than ageLimit. Nothing to do */
    		freeAllDataObjInfo (dataObjInfoHead);
		return 0;
	    }
	}
    }
    if (dataObjUnlinkInp->oprType == UNREG_OPR ||
      getValByKey (&dataObjUnlinkInp->condInput, FORCE_FLAG_KW) != NULL ||
      getValByKey (&dataObjUnlinkInp->condInput, REPL_NUM_KW) != NULL ||
      dataObjInfoHead->specColl != NULL || rmTrashFlag == 1) {
        status = _rsDataObjUnlink (rsComm, dataObjUnlinkInp, &dataObjInfoHead);
    } else {
        initReiWithDataObjInp (&rei, rsComm, dataObjUnlinkInp);
        status = applyRule ("acTrashPolicy", NULL, &rei, NO_SAVE_REI);
        trashPolicy = rei.status;

        if (trashPolicy != NO_TRASH_CAN) {
            status = rsMvDataObjToTrash (rsComm, dataObjUnlinkInp, 
	      &dataObjInfoHead);
    	    freeAllDataObjInfo (dataObjInfoHead);
            return status;
        } else {
            status = _rsDataObjUnlink (rsComm, dataObjUnlinkInp, 
	      &dataObjInfoHead);
        }
    }

    initReiWithDataObjInp (&rei, rsComm, dataObjUnlinkInp);
    rei.doi = dataObjInfoHead;
    rei.status = status;
    rei.status = applyRule ("acPostProcForDelete", NULL, &rei, NO_SAVE_REI);

    if (rei.status < 0) {
        rodsLog (LOG_NOTICE,
          "rsDataObjUnlink: acPostProcForDelete error for %s. status = %d",
          dataObjUnlinkInp->objPath, rei.status);
    }

    /* dataObjInfoHead may be outdated */
    freeAllDataObjInfo (dataObjInfoHead);

    return (status);
}
Ejemplo n.º 18
0
int
rsExecCmd (rsComm_t *rsComm, execCmd_t *execCmdInp, execCmdOut_t **execCmdOut)
{
    int status;
    dataObjInfo_t *dataObjInfoHead = NULL;
    rodsServerHost_t *rodsServerHost;
    int remoteFlag;
    rodsHostAddr_t addr;

    /* some sanity check on the cmd path */
    if (strchr (execCmdInp->cmd, '/') != NULL) {
	rodsLog (LOG_ERROR,
	  "rsExecCmd: bad cmd path %s", execCmdInp->cmd);
	return (BAD_EXEC_CMD_PATH);
    }

    memset (&addr, 0, sizeof (addr));
    if (*execCmdInp->hintPath != '\0') {
	dataObjInp_t dataObjInp;
	memset (&dataObjInp, 0, sizeof (dataObjInp));
	rstrcpy (dataObjInp.objPath, execCmdInp->hintPath, MAX_NAME_LEN);
        status = getDataObjInfo (rsComm, &dataObjInp, &dataObjInfoHead,
          ACCESS_READ_OBJECT, 0);

        if (status < 0) {
	    rodsLog (LOG_ERROR,
              "rsExecCmd: getDataObjInfo error for hintPath %s", 
	      execCmdInp->hintPath);  
            return (status);
	}
        status = sortObjInfoForOpen (rsComm, &dataObjInfoHead, 
	  &execCmdInp->condInput, 0);
	if (status < 0) return status;

	if (execCmdInp->addPathToArgv > 0) {
	    char tmpArgv[LONG_NAME_LEN];
	    rstrcpy (tmpArgv, execCmdInp->cmdArgv, HUGE_NAME_LEN);
	    snprintf (execCmdInp->cmdArgv, HUGE_NAME_LEN, "%s %s",
	      dataObjInfoHead->filePath, tmpArgv);
	}
	rstrcpy (addr.zoneName, dataObjInfoHead->rescInfo->zoneName, 
	  NAME_LEN);
	rstrcpy (addr.hostAddr, dataObjInfoHead->rescInfo->rescLoc, 
	  LONG_NAME_LEN);
	/* just in case we have to do it remote */
	*execCmdInp->hintPath = '\0';	/* no need for hint */
        rstrcpy (execCmdInp->execAddr, dataObjInfoHead->rescInfo->rescLoc,
          LONG_NAME_LEN);
	freeAllDataObjInfo (dataObjInfoHead);
        remoteFlag = resolveHost (&addr, &rodsServerHost);
    } else if (*execCmdInp->execAddr  != '\0') {
	rstrcpy (addr.hostAddr, execCmdInp->execAddr, LONG_NAME_LEN);
        remoteFlag = resolveHost (&addr, &rodsServerHost);
    } else {
	rodsServerHost = LocalServerHost;
	remoteFlag = LOCAL_HOST;
    }
    
    if (remoteFlag == LOCAL_HOST) {
	status = _rsExecCmd (rsComm, execCmdInp, execCmdOut);
    } else if (remoteFlag == REMOTE_HOST) {
	status = remoteExecCmd (rsComm, execCmdInp, execCmdOut, 
	  rodsServerHost);
    } else {
       rodsLog (LOG_NOTICE,
         "rsFileOpenByHost: resolveHost of %s error, status = %d",
          addr.hostAddr, remoteFlag);
        status = SYS_UNRECOGNIZED_REMOTE_FLAG;
    }
     
    return (status);
}
Ejemplo n.º 19
0
int
rsDataObjUnlink( rsComm_t *rsComm, dataObjInp_t *dataObjUnlinkInp ) {
    int status;
    ruleExecInfo_t rei;
    int trashPolicy;
    dataObjInfo_t *dataObjInfoHead = NULL;
    rodsServerHost_t *rodsServerHost = NULL;
    int rmTrashFlag = 0;
    specCollCache_t *specCollCache = NULL;

    resolveLinkedPath( rsComm, dataObjUnlinkInp->objPath, &specCollCache,
                       &dataObjUnlinkInp->condInput );
    status = getAndConnRcatHost( rsComm, MASTER_RCAT,
                                 ( const char* )dataObjUnlinkInp->objPath, &rodsServerHost );

    if ( status < 0 || NULL == rodsServerHost ) { // JMC cppcheck - nullptr
        return status;
    }
    else if ( rodsServerHost->rcatEnabled == REMOTE_ICAT ) {
        rcDataObjUnlink( rodsServerHost->conn, dataObjUnlinkInp );
        return status;
    }

    // =-=-=-=-=-=-=-
    // working on the "home zone", determine if we need to redirect to a different
    // server in this zone for this operation.  if there is a RESC_HIER_STR_KW then
    // we know that the redirection decision has already been made

    // =-=-=-=-=-=-=-
    // determine the resource hierarchy if one is not provided
    addKeyVal(
        &dataObjUnlinkInp->condInput,
        irods::UNLINK_OPERATION.c_str(),
        "true" );
    if ( getValByKey( &dataObjUnlinkInp->condInput, RESC_HIER_STR_KW ) == NULL ) {
        std::string       hier;
        irods::error ret = irods::resolve_resource_hierarchy( irods::OPEN_OPERATION,
                           rsComm, dataObjUnlinkInp, hier );
        if ( !ret.ok() ) {
            std::stringstream msg;
            msg << "failed in irods::resolve_resource_hierarchy for [";
            msg << dataObjUnlinkInp->objPath << "]";
            irods::log( PASSMSG( msg.str(), ret ) );
            return ret.code();
        }

        // =-=-=-=-=-=-=-
        // we resolved the redirect and have a host, set the hier str for subsequent
        // api calls, etc.
        addKeyVal( &dataObjUnlinkInp->condInput, RESC_HIER_STR_KW, hier.c_str() );

    } // if keyword

    if ( getValByKey(
                &dataObjUnlinkInp->condInput, ADMIN_RMTRASH_KW ) != NULL ||
            getValByKey(
                &dataObjUnlinkInp->condInput, RMTRASH_KW ) != NULL ) {
        if ( isTrashPath( dataObjUnlinkInp->objPath ) == False ) {
            return SYS_INVALID_FILE_PATH;
        }
        rmTrashFlag = 1;
    }

    dataObjUnlinkInp->openFlags = O_WRONLY;  /* set the permission checking */
    status = getDataObjInfoIncSpecColl( rsComm, dataObjUnlinkInp,
                                        &dataObjInfoHead );

    if ( status < 0 ) {
        char* sys_error = NULL;
        const char* rods_error = rodsErrorName( status, &sys_error );
        std::stringstream msg;
        msg << __FUNCTION__;
        msg << " - Failed to get data objects.";
        msg << " - " << rods_error << " " << sys_error;
        irods::error result = ERROR( status, msg.str() );
        irods::log( result );
        free( sys_error );
        return status;
    }

    if ( rmTrashFlag == 1 ) {
        char *tmpAge;
        int ageLimit;
        if ( ( tmpAge = getValByKey( &dataObjUnlinkInp->condInput, AGE_KW ) )
                != NULL ) {
            ageLimit = atoi( tmpAge ) * 60;
            if ( ( time( 0 ) - atoi( dataObjInfoHead->dataModify ) ) < ageLimit ) {
                /* younger than ageLimit. Nothing to do */
                freeAllDataObjInfo( dataObjInfoHead );
                return 0;
            }
        }
    }

    if ( dataObjUnlinkInp->oprType == UNREG_OPR ||
            getValByKey( &dataObjUnlinkInp->condInput, FORCE_FLAG_KW ) != NULL ||
            getValByKey( &dataObjUnlinkInp->condInput, REPL_NUM_KW ) != NULL ||
            getValByKey( &dataObjUnlinkInp->condInput, EMPTY_BUNDLE_ONLY_KW ) != NULL ||
            dataObjInfoHead->specColl != NULL || rmTrashFlag == 1 ) {
        status = _rsDataObjUnlink( rsComm, dataObjUnlinkInp, &dataObjInfoHead );
    }
    else {
        initReiWithDataObjInp( &rei, rsComm, dataObjUnlinkInp );
        status = applyRule( "acTrashPolicy", NULL, &rei, NO_SAVE_REI );
        trashPolicy = rei.status;

        if ( trashPolicy != NO_TRASH_CAN ) {
            status = rsMvDataObjToTrash( rsComm, dataObjUnlinkInp,
                                         &dataObjInfoHead );
            freeAllDataObjInfo( dataObjInfoHead );
            return status;
        }
        else {
            status = _rsDataObjUnlink( rsComm, dataObjUnlinkInp,
                                       &dataObjInfoHead );
        }
    }

    initReiWithDataObjInp( &rei, rsComm, dataObjUnlinkInp );
    rei.doi = dataObjInfoHead;
    rei.status = status;

    // make resource properties available as rule session variables
    rei.condInputData = (keyValPair_t *)malloc(sizeof(keyValPair_t));
    memset(rei.condInputData, 0, sizeof(keyValPair_t));
    irods::get_resc_properties_as_kvp(rei.doi->rescHier, rei.condInputData);

    rei.status = applyRule( "acPostProcForDelete", NULL, &rei, NO_SAVE_REI );

    if ( rei.status < 0 ) {
        rodsLog( LOG_NOTICE,
                 "rsDataObjUnlink: acPostProcForDelete error for %s. status = %d",
                 dataObjUnlinkInp->objPath, rei.status );
    }

    /* dataObjInfoHead may be outdated */
    freeAllDataObjInfo( dataObjInfoHead );

    return status;
}
Ejemplo n.º 20
0
int
rsDataObjPhymv (rsComm_t *rsComm, dataObjInp_t *dataObjInp,
transferStat_t **transStat)
{
    int status;
    dataObjInfo_t *dataObjInfoHead = NULL;
    dataObjInfo_t *oldDataObjInfoHead = NULL;
    rescGrpInfo_t *myRescGrpInfo = NULL;
    ruleExecInfo_t rei;
    int multiCopyFlag;
    char *accessPerm;
    int remoteFlag;
    rodsServerHost_t *rodsServerHost;
    specCollCache_t *specCollCache = NULL;

    resolveLinkedPath (rsComm, dataObjInp->objPath, &specCollCache,
      &dataObjInp->condInput);
    remoteFlag = getAndConnRemoteZone (rsComm, dataObjInp, &rodsServerHost,
      REMOTE_OPEN);

    if (remoteFlag < 0) {
        return (remoteFlag);
    } else if (remoteFlag == REMOTE_HOST) {
        status = _rcDataObjPhymv (rodsServerHost->conn, dataObjInp,
          transStat);
        return status;
    }

    *transStat = (transferStat_t*)malloc (sizeof (transferStat_t));
    memset (*transStat, 0, sizeof (transferStat_t));

    if (getValByKey (&dataObjInp->condInput, IRODS_ADMIN_KW) != NULL) {
	if (rsComm->clientUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH) {
	    return (CAT_INSUFFICIENT_PRIVILEGE_LEVEL);
	}
	accessPerm = NULL;
    } else {
	accessPerm = ACCESS_DELETE_OBJECT;
    }

    /* query rcat for resource info and sort it */
    status = getRescGrpForCreate (rsComm, dataObjInp, &myRescGrpInfo);
    if (status < 0) return status;

    initReiWithDataObjInp (&rei, rsComm, dataObjInp);
    status = applyRule ("acSetMultiReplPerResc", NULL, &rei, NO_SAVE_REI);
    if (strcmp (rei.statusStr, MULTI_COPIES_PER_RESC) == 0) {
        multiCopyFlag = 1;
    } else {
        multiCopyFlag = 0;
    }

    /* query rcat for dataObjInfo and sort it */
    status = getDataObjInfo (rsComm, dataObjInp, &dataObjInfoHead,
      accessPerm, 1);

    if (status < 0) {
      rodsLog (LOG_NOTICE,
          "rsDataObjPhymv: getDataObjInfo for %s", dataObjInp->objPath);
        return (status);
    }

	
    status = resolveInfoForPhymv (&dataObjInfoHead, &oldDataObjInfoHead,
      &myRescGrpInfo, &dataObjInp->condInput, multiCopyFlag);
    if (status < 0) {
        freeAllDataObjInfo (dataObjInfoHead);
        freeAllDataObjInfo (oldDataObjInfoHead);
        freeAllRescGrpInfo (myRescGrpInfo);
        if (status == CAT_NO_ROWS_FOUND) {
	    return (0);
	} else {
            return (status);
	}
    }

    status = _rsDataObjPhymv (rsComm, dataObjInp, dataObjInfoHead, 
      myRescGrpInfo, *transStat, multiCopyFlag);

    freeAllDataObjInfo (dataObjInfoHead);
    freeAllDataObjInfo (oldDataObjInfoHead);
    freeAllRescGrpInfo (myRescGrpInfo);

    return (status);
}
Ejemplo n.º 21
0
int
rsRsyncFileToData (rsComm_t *rsComm, dataObjInp_t *dataObjInp)
{
    int status;
    char *fileChksumStr = NULL;
     char *dataObjChksumStr = NULL;
    dataObjInfo_t *dataObjInfoHead = NULL;

    fileChksumStr = getValByKey (&dataObjInp->condInput, RSYNC_CHKSUM_KW);

    if (fileChksumStr == NULL) {
        rodsLog (LOG_ERROR,
          "rsRsyncFileToData: RSYNC_CHKSUM_KW input is missing");
        return (CHKSUM_EMPTY_IN_STRUCT_ERR);
    }

    status = _rsDataObjChksum (rsComm, dataObjInp, &dataObjChksumStr,
      &dataObjInfoHead);

    if (status < 0 && status != CAT_NO_ACCESS_PERMISSION && 
      status != CAT_NO_ROWS_FOUND) {
        /* XXXXX CAT_NO_ACCESS_PERMISSION mean the chksum was calculated but
         * cannot be registered. But the chksum value is OK.
         */
        rodsLog (LOG_ERROR,
          "rsRsyncFileToData: _rsDataObjChksum of %s error. status = %d",
          dataObjInp->objPath, status);
    }

    freeAllDataObjInfo (dataObjInfoHead);

    if (dataObjChksumStr != NULL &&
      strcmp (dataObjChksumStr, fileChksumStr) == 0) {
	free (dataObjChksumStr);
	return (0);
    }
    return SYS_SVR_TO_CLI_PUT_ACTION;
#if 0
    msParamArray_t *myMsParamArray;
    dataObjInp_t *myDataObjInp;

    myMsParamArray = malloc (sizeof (msParamArray_t));
    memset (myMsParamArray, 0, sizeof (msParamArray_t));
    /* have to get its own dataObjInp_t */
    myDataObjInp = malloc (sizeof (dataObjInp_t));
    replDataObjInp (dataObjInp, myDataObjInp);
    addKeyVal (&myDataObjInp->condInput, REG_CHKSUM_KW, fileChksumStr);

    status = addMsParam (myMsParamArray, CL_PUT_ACTION, DataObjInp_MS_T,
      (void *) myDataObjInp, NULL);

    if (status < 0) {
        rodsLogAndErrorMsg (LOG_ERROR, &rsComm->rError, status,
          "rsRsyncDataToFile: addMsParam error. status = %d", status);
        return (status);
    }

    /* tell the client to do the put */
    status = sendAndRecvBranchMsg (rsComm, rsComm->apiInx,
     SYS_SVR_TO_CLI_MSI_REQUEST, (void *) myMsParamArray, NULL);

    return (status);
#endif
}
Ejemplo n.º 22
0
int
_rsModDataObjMeta (rsComm_t *rsComm, modDataObjMeta_t *modDataObjMetaInp)
{
#ifdef RODS_CAT
    int status;
    dataObjInfo_t *dataObjInfo;
    keyValPair_t *regParam;
    int i;
    ruleExecInfo_t rei2;

    memset ((char*)&rei2, 0, sizeof (ruleExecInfo_t));
    rei2.rsComm = rsComm;
    if (rsComm != NULL) {
      rei2.uoic = &rsComm->clientUser;
      rei2.uoip = &rsComm->proxyUser;
    }
    rei2.doi = modDataObjMetaInp->dataObjInfo;
    rei2.condInputData = modDataObjMetaInp->regParam;
    regParam = modDataObjMetaInp->regParam;
    dataObjInfo = modDataObjMetaInp->dataObjInfo;

    if (regParam->len == 0) {
        rodsLog(LOG_NOTICE, "Warning, _rsModDataObjMeta called with empty regParam, returning success");
        return (0);
    }

    /* In dataObjInfo, need just dataId. But it will accept objPath too,
     * but less efficient 
     */

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    rei2.doi = dataObjInfo;
    i =  applyRule("acPreProcForModifyDataObjMeta",NULL, &rei2, NO_SAVE_REI);
    if (i < 0) {
      if (rei2.status < 0) {
        i = rei2.status;
      }
      rodsLog (LOG_ERROR,
               "_rsModDataObjMeta:acPreProcForModifyDataObjMeta error stat=%d", i);
      return i;
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    if (getValByKey (regParam, ALL_KW) != NULL) {
	/* all copies */
	dataObjInfo_t *dataObjInfoHead = NULL;
	dataObjInfo_t *tmpDataObjInfo;
	dataObjInp_t dataObjInp;

	bzero (&dataObjInp, sizeof (dataObjInp));
	rstrcpy (dataObjInp.objPath, dataObjInfo->objPath, MAX_NAME_LEN);
        status = getDataObjInfoIncSpecColl (rsComm, &dataObjInp,
          &dataObjInfoHead);
	if (status < 0) return status;
	tmpDataObjInfo = dataObjInfoHead;
        while (tmpDataObjInfo != NULL) {
	    if (tmpDataObjInfo->specColl != NULL) break;
            status = chlModDataObjMeta (rsComm, tmpDataObjInfo, regParam);
	    if (status < 0) {
                rodsLog (LOG_ERROR,
                  "_rsModDataObjMeta:chlModDataObjMeta %s error stat=%d",
	          tmpDataObjInfo->objPath, status);
	    }
	    tmpDataObjInfo = tmpDataObjInfo->next;
	}
	freeAllDataObjInfo (dataObjInfoHead);
    } else {
        status = chlModDataObjMeta (rsComm, dataObjInfo, regParam);
    }

    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/
    if (status >= 0) {
      i =  applyRule("acPostProcForModifyDataObjMeta",NULL, &rei2, NO_SAVE_REI);
      if (i < 0) {
        if (rei2.status < 0) {
          i = rei2.status;
        }
        rodsLog (LOG_ERROR,
           "_rsModDataObjMeta:acPostProcForModifyDataObjMeta error stat=%d",i);
        return i;
      }
    }
    /** RAJA ADDED June 1 2009 for pre-post processing rule hooks **/

    return (status);
#else
    return (SYS_NO_RCAT_SERVER_ERR);
#endif

}