コード例 #1
0
int
showUser(const char *name) {
    char user_name[NAME_LEN]{};
    char zone_name[NAME_LEN]{};
    int status = parseUserName(name, user_name, zone_name);
    if (status < 0) {
        printf("Failed parsing input:[%s]\n", name);
        return status;
    }
    if (std::string(zone_name).empty()) {
        snprintf(zone_name, sizeof(zone_name), "%s", myEnv.rodsZone);
    }
    const userinfo_t info{user_name, zone_name};

    if (!print_general_info(info)) {
        printf("User %s#%s does not exist.\n", info.user_name, info.zone_name);
        return 0;
    }
    print_auth_info(info);
    print_group_info(info);

    return 0;
}
コード例 #2
0
ファイル: rsAuthResponse.c プロジェクト: UPPMAX/irods
int
rsAuthResponse (rsComm_t *rsComm, authResponseInp_t *authResponseInp)
{
   int status;
   char *bufp;
   authCheckInp_t authCheckInp;
   authCheckOut_t *authCheckOut = NULL;
   rodsServerHost_t *rodsServerHost;

   char digest[RESPONSE_LEN+2];
   char md5Buf[CHALLENGE_LEN+MAX_PASSWORD_LEN+2];
   char serverId[MAX_PASSWORD_LEN+2];
   MD5_CTX context;

   bufp = _rsAuthRequestGetChallenge();

   /* need to do NoLogin because it could get into inf loop for cross 
    * zone auth */

   status = getAndConnRcatHostNoLogin (rsComm, SLAVE_RCAT, 
    rsComm->proxyUser.rodsZone, &rodsServerHost);
   if (status < 0) {
      return(status);
   }

   memset (&authCheckInp, 0, sizeof (authCheckInp)); 
   authCheckInp.challenge = bufp;
   authCheckInp.response = authResponseInp->response;
   authCheckInp.username = authResponseInp->username;

   if (rodsServerHost->localFlag == LOCAL_HOST) {
      status = rsAuthCheck (rsComm, &authCheckInp, &authCheckOut);
   } else {
      status = rcAuthCheck (rodsServerHost->conn, &authCheckInp, &authCheckOut);
      /* not likely we need this connection again */
      rcDisconnect(rodsServerHost->conn);
      rodsServerHost->conn = NULL;
   }
   if (status < 0) {
      rodsLog (LOG_NOTICE,
            "rsAuthResponse: rxAuthCheck failed, status = %d", status);
      return (status);
   }

   if (rodsServerHost->localFlag != LOCAL_HOST) {
      if (authCheckOut->serverResponse == NULL) {
	 rodsLog(LOG_NOTICE, "Warning, cannot authenticate remote server, no serverResponse field");
	 if (requireServerAuth) {
	    rodsLog(LOG_NOTICE, "Authentication disallowed, no serverResponse field");
	    return(REMOTE_SERVER_AUTH_NOT_PROVIDED);
	 }
      }
      else {
	 char *cp;
	 int OK, len, i;
	 if (*authCheckOut->serverResponse == '\0') {
	    rodsLog(LOG_NOTICE, "Warning, cannot authenticate remote server, serverResponse field is empty");
	    if (requireServerAuth) { 
	       rodsLog(LOG_NOTICE, "Authentication disallowed, empty serverResponse");
	       return(REMOTE_SERVER_AUTH_EMPTY);  
	    }
	 }
	 else {
	    char username2[NAME_LEN+2];
	    char userZone[NAME_LEN+2];
	    memset(md5Buf, 0, sizeof(md5Buf));
	    strncpy(md5Buf, authCheckInp.challenge, CHALLENGE_LEN);
	    parseUserName(authResponseInp->username, username2, userZone);
	    getZoneServerId(userZone, serverId);
	    len = strlen(serverId);
	    if (len <= 0) {
	       rodsLog (LOG_NOTICE, "rsAuthResponse: Warning, cannot authenticate the remote server, no RemoteZoneSID defined in server.config", status);
	       if (requireServerAuth) {
		  rodsLog(LOG_NOTICE, "Authentication disallowed, no RemoteZoneSID defined");
		  return(REMOTE_SERVER_SID_NOT_DEFINED);  
	       }
	    }
	    else { 
	       strncpy(md5Buf+CHALLENGE_LEN, serverId, len);
	       MD5Init (&context);
	       MD5Update (&context, (unsigned char*)md5Buf, 
			  CHALLENGE_LEN+MAX_PASSWORD_LEN);
	       MD5Final ((unsigned char*)digest, &context);
	       for (i=0;i<RESPONSE_LEN;i++) {
		  if (digest[i]=='\0') digest[i]++;  /* make sure 'string' doesn't
							end early*/
	       }
	       cp = authCheckOut->serverResponse;
	       OK=1;
	       for (i=0;i<RESPONSE_LEN;i++) {
		  if (*cp++ != digest[i]) OK=0;
	       }
	       rodsLog(LOG_DEBUG, "serverResponse is OK/Not: %d", OK);
	       if (OK==0) {
		  rodsLog(LOG_NOTICE, "Server response incorrect, authentication disallowed");
		  return(REMOTE_SERVER_AUTHENTICATION_FAILURE);
	       }
	    }
	 }
      }
   }

   /* Set the clientUser zone if it is null. */
   if (strlen(rsComm->clientUser.rodsZone)==0) {
      zoneInfo_t *tmpZoneInfo;
      status = getLocalZoneInfo (&tmpZoneInfo);
      if (status < 0) {
	 free (authCheckOut);
	 return status;
      }
      strncpy(rsComm->clientUser.rodsZone,
	      tmpZoneInfo->zoneName, NAME_LEN);
   }


   /* have to modify privLevel if the icat is a foreign icat because
    * a local user in a foreign zone is not a local user in this zone
    * and vice vera for a remote user
    */
   if (rodsServerHost->rcatEnabled == REMOTE_ICAT) {
      /* proxy is easy because rodsServerHost is based on proxy user */
        if (authCheckOut->privLevel == LOCAL_PRIV_USER_AUTH)
            authCheckOut->privLevel = REMOTE_PRIV_USER_AUTH;
        else if (authCheckOut->privLevel == LOCAL_PRIV_USER_AUTH)
            authCheckOut->privLevel = REMOTE_PRIV_USER_AUTH;

	/* adjust client user */
	if (strcmp (rsComm->proxyUser.userName, rsComm->clientUser.userName) 
	  == 0) {
            authCheckOut->clientPrivLevel = authCheckOut->privLevel;
	} else {
	    zoneInfo_t *tmpZoneInfo;
	    status = getLocalZoneInfo (&tmpZoneInfo);
            if (status < 0) {
                free (authCheckOut);
                return status;
            }

	    if (strcmp (tmpZoneInfo->zoneName, rsComm->clientUser.rodsZone)
	      == 0) {
		/* client is from local zone */
        	if (authCheckOut->clientPrivLevel == REMOTE_PRIV_USER_AUTH) {
                    authCheckOut->clientPrivLevel = LOCAL_PRIV_USER_AUTH;
		} else if (authCheckOut->clientPrivLevel == REMOTE_USER_AUTH) {
                    authCheckOut->clientPrivLevel = LOCAL_USER_AUTH;
		}
	    } else {
		/* client is from remote zone */
                if (authCheckOut->clientPrivLevel == LOCAL_PRIV_USER_AUTH) {
                    authCheckOut->clientPrivLevel = REMOTE_USER_AUTH;
                } else if (authCheckOut->clientPrivLevel == LOCAL_USER_AUTH) {
                    authCheckOut->clientPrivLevel = REMOTE_USER_AUTH;
                }
	    }
	}
   } else if (strcmp (rsComm->proxyUser.userName, rsComm->clientUser.userName)
    == 0) {
        authCheckOut->clientPrivLevel = authCheckOut->privLevel;
   }

   status = chkProxyUserPriv (rsComm, authCheckOut->privLevel);

   if (status < 0) {
      free (authCheckOut);
      return status;
   } 

   rodsLog(LOG_NOTICE,
    "rsAuthResponse set proxy authFlag to %d, client authFlag to %d, user:%s proxy:%s client:%s",
          authCheckOut->privLevel,
          authCheckOut->clientPrivLevel,
          authCheckInp.username,
          rsComm->proxyUser.userName,
          rsComm->clientUser.userName);

   if (strcmp (rsComm->proxyUser.userName, rsComm->clientUser.userName) != 0) {
      rsComm->proxyUser.authInfo.authFlag = authCheckOut->privLevel;
      rsComm->clientUser.authInfo.authFlag = authCheckOut->clientPrivLevel;
   } else {	/* proxyUser and clientUser are the same */
      rsComm->proxyUser.authInfo.authFlag =
      rsComm->clientUser.authInfo.authFlag = authCheckOut->privLevel;
   } 

   /*** Added by RAJA Nov 16 2010 **/
   if (authCheckOut->serverResponse != NULL) free(authCheckOut->serverResponse);
   /*** Added by RAJA Nov 16 2010 **/
   free (authCheckOut);

   return (status);
} 
コード例 #3
0
ファイル: libosauth.cpp プロジェクト: pombreda/irods
    // =-=-=-=-=-=-=-
    // handle an agent-side auth request call
    irods::error osauth_auth_agent_response(
        irods::auth_plugin_context& _ctx,
        authResponseInp_t*           _resp ) {
        // =-=-=-=-=-=-=-
        // validate incoming parameters
        if ( !_ctx.valid().ok() ) {
            return ERROR(
                       SYS_INVALID_INPUT_PARAM,
                       "invalid plugin context" );
        }
        else if ( !_resp ) {
            return ERROR(
                       SYS_INVALID_INPUT_PARAM,
                       "null authResponseInp_t ptr" );
        }

        int status;
        char *bufp;
        authCheckInp_t authCheckInp;
        rodsServerHost_t *rodsServerHost;

        char digest[RESPONSE_LEN + 2];
        char md5Buf[CHALLENGE_LEN + MAX_PASSWORD_LEN + 2];
        char serverId[MAX_PASSWORD_LEN + 2];
        MD5_CTX context;

        bufp = _rsAuthRequestGetChallenge();

        // =-=-=-=-=-=-=-
        // need to do NoLogin because it could get into inf loop for cross
        // zone auth
        status = getAndConnRcatHostNoLogin(
                     _ctx.comm(),
                     MASTER_RCAT,
                     _ctx.comm()->proxyUser.rodsZone,
                     &rodsServerHost );
        if ( status < 0 ) {
            return ERROR(
                       status,
                       "getAndConnRcatHostNoLogin failed" );
        }

        memset( &authCheckInp, 0, sizeof( authCheckInp ) );
        authCheckInp.challenge = bufp;
        authCheckInp.username = _resp->username;

        std::string resp_str = irods::AUTH_SCHEME_KEY    +
                               irods::kvp_association()  +
                               irods::AUTH_OSAUTH_SCHEME +
                               irods::kvp_delimiter()    +
                               irods::AUTH_RESPONSE_KEY  +
                               irods::kvp_association()  +
                               _resp->response;
        authCheckInp.response = const_cast<char*>( resp_str.c_str() );

        authCheckOut_t *authCheckOut = NULL;
        if ( rodsServerHost->localFlag == LOCAL_HOST ) {
            status = rsAuthCheck( _ctx.comm(), &authCheckInp, &authCheckOut );
        }
        else {
            status = rcAuthCheck( rodsServerHost->conn, &authCheckInp, &authCheckOut );
            /* not likely we need this connection again */
            rcDisconnect( rodsServerHost->conn );
            rodsServerHost->conn = NULL;
        }
        if ( status < 0 || authCheckOut == NULL ) { // JMC cppcheck
            if ( authCheckOut != NULL ) {
                free( authCheckOut->serverResponse );
            }
            free( authCheckOut );
            return ERROR(
                       status,
                       "rxAuthCheck failed" );
        }

        if ( rodsServerHost->localFlag != LOCAL_HOST ) {
            if ( authCheckOut->serverResponse == NULL ) {
                rodsLog( LOG_NOTICE, "Warning, cannot authenticate remote server, no serverResponse field" );
                if ( requireServerAuth ) {
                    free( authCheckOut );
                    return ERROR(
                               REMOTE_SERVER_AUTH_NOT_PROVIDED,
                               "Authentication disallowed, no serverResponse field" );
                }
            }
            else {
                char *cp;
                int OK, len, i;
                if ( *authCheckOut->serverResponse == '\0' ) {
                    rodsLog( LOG_NOTICE, "Warning, cannot authenticate remote server, serverResponse field is empty" );
                    if ( requireServerAuth ) {
                        free( authCheckOut->serverResponse );
                        free( authCheckOut );
                        return ERROR(
                                   REMOTE_SERVER_AUTH_EMPTY,
                                   "Authentication disallowed, empty serverResponse" );
                    }
                }
                else {
                    char username2[NAME_LEN + 2];
                    char userZone[NAME_LEN + 2];
                    memset( md5Buf, 0, sizeof( md5Buf ) );
                    strncpy( md5Buf, authCheckInp.challenge, CHALLENGE_LEN );
                    parseUserName( _resp->username, username2, userZone );
                    getZoneServerId( userZone, serverId );
                    len = strlen( serverId );
                    if ( len <= 0 ) {
                        rodsLog( LOG_NOTICE, "rsAuthResponse: Warning, cannot authenticate the remote server, no RemoteZoneSID defined in server_config.json", status );
                        if ( requireServerAuth ) {
                            free( authCheckOut->serverResponse );
                            free( authCheckOut );
                            return ERROR(
                                       REMOTE_SERVER_SID_NOT_DEFINED,
                                       "Authentication disallowed, no RemoteZoneSID defined" );
                        }
                    }
                    else {
                        strncpy( md5Buf + CHALLENGE_LEN, serverId, len );
                        MD5_Init( &context );
                        MD5_Update( &context, ( unsigned char* )md5Buf,
                                   CHALLENGE_LEN + MAX_PASSWORD_LEN );
                        MD5_Final( ( unsigned char* )digest, &context );
                        for ( i = 0; i < RESPONSE_LEN; i++ ) {
                            if ( digest[i] == '\0' ) {
                                digest[i]++;
                            }  /* make sure 'string' doesn't
                                                                  end early*/
                        }
                        cp = authCheckOut->serverResponse;
                        OK = 1;
                        for ( i = 0; i < RESPONSE_LEN; i++ ) {
                            if ( *cp++ != digest[i] ) {
                                OK = 0;
                            }
                        }
                        rodsLog( LOG_DEBUG, "serverResponse is OK/Not: %d", OK );
                        if ( OK == 0 ) {
                            free( authCheckOut->serverResponse );
                            free( authCheckOut );
                            return ERROR(
                                       REMOTE_SERVER_AUTHENTICATION_FAILURE,
                                       "Server response incorrect, authentication disallowed" );
                        }
                    }
                }
            }
        }

        /* Set the clientUser zone if it is null. */
        if ( strlen( _ctx.comm()->clientUser.rodsZone ) == 0 ) {
            zoneInfo_t *tmpZoneInfo;
            status = getLocalZoneInfo( &tmpZoneInfo );
            if ( status < 0 ) {
                free( authCheckOut->serverResponse );
                free( authCheckOut );
                return ERROR(
                           status,
                           "getLocalZoneInfo failed" );
            }
            strncpy( _ctx.comm()->clientUser.rodsZone,
                     tmpZoneInfo->zoneName, NAME_LEN );
        }


        /* have to modify privLevel if the icat is a foreign icat because
         * a local user in a foreign zone is not a local user in this zone
         * and vice versa for a remote user
         */
        if ( rodsServerHost->rcatEnabled == REMOTE_ICAT ) {
            /* proxy is easy because rodsServerHost is based on proxy user */
            if ( authCheckOut->privLevel == LOCAL_PRIV_USER_AUTH ) {
                authCheckOut->privLevel = REMOTE_PRIV_USER_AUTH;
            }
            else if ( authCheckOut->privLevel == LOCAL_USER_AUTH ) {
                authCheckOut->privLevel = REMOTE_USER_AUTH;
            }

            /* adjust client user */
            if ( strcmp( _ctx.comm()->proxyUser.userName,  _ctx.comm()->clientUser.userName )
                    == 0 ) {
                authCheckOut->clientPrivLevel = authCheckOut->privLevel;
            }
            else {
                zoneInfo_t *tmpZoneInfo;
                status = getLocalZoneInfo( &tmpZoneInfo );
                if ( status < 0 ) {
                    free( authCheckOut->serverResponse );
                    free( authCheckOut );
                    return ERROR(
                               status,
                               "getLocalZoneInfo failed" );
                }

                if ( strcmp( tmpZoneInfo->zoneName,  _ctx.comm()->clientUser.rodsZone )
                        == 0 ) {
                    /* client is from local zone */
                    if ( authCheckOut->clientPrivLevel == REMOTE_PRIV_USER_AUTH ) {
                        authCheckOut->clientPrivLevel = LOCAL_PRIV_USER_AUTH;
                    }
                    else if ( authCheckOut->clientPrivLevel == REMOTE_USER_AUTH ) {
                        authCheckOut->clientPrivLevel = LOCAL_USER_AUTH;
                    }
                }
                else {
                    /* client is from remote zone */
                    if ( authCheckOut->clientPrivLevel == LOCAL_PRIV_USER_AUTH ) {
                        authCheckOut->clientPrivLevel = REMOTE_USER_AUTH;
                    }
                    else if ( authCheckOut->clientPrivLevel == LOCAL_USER_AUTH ) {
                        authCheckOut->clientPrivLevel = REMOTE_USER_AUTH;
                    }
                }
            }
        }
        else if ( strcmp( _ctx.comm()->proxyUser.userName,  _ctx.comm()->clientUser.userName )
                  == 0 ) {
            authCheckOut->clientPrivLevel = authCheckOut->privLevel;
        }

        status = check_proxy_user_privileges( _ctx.comm(), authCheckOut->privLevel );

        if ( status < 0 ) {
            free( authCheckOut->serverResponse );
            free( authCheckOut );
            return ERROR(
                       status,
                       "check_proxy_user_privileges failed" );
        }

        rodsLog( LOG_DEBUG,
                 "rsAuthResponse set proxy authFlag to %d, client authFlag to %d, user:%s proxy:%s client:%s",
                 authCheckOut->privLevel,
                 authCheckOut->clientPrivLevel,
                 authCheckInp.username,
                 _ctx.comm()->proxyUser.userName,
                 _ctx.comm()->clientUser.userName );

        if ( strcmp( _ctx.comm()->proxyUser.userName,  _ctx.comm()->clientUser.userName ) != 0 ) {
            _ctx.comm()->proxyUser.authInfo.authFlag = authCheckOut->privLevel;
            _ctx.comm()->clientUser.authInfo.authFlag = authCheckOut->clientPrivLevel;
        }
        else {	/* proxyUser and clientUser are the same */
            _ctx.comm()->proxyUser.authInfo.authFlag =
                _ctx.comm()->clientUser.authInfo.authFlag = authCheckOut->privLevel;
        }

        free( authCheckOut->serverResponse );
        free( authCheckOut );
        return SUCCESS();

    } // osauth_auth_agent_response
コード例 #4
0
ファイル: imeta.c プロジェクト: UPPMAX/irods
/*
Via a general query, show the AVUs for a user
*/
int
showUser(char *name, char *attrName, int wild)
{
   genQueryInp_t genQueryInp;
   genQueryOut_t *genQueryOut;
   int i1a[10];
   int i1b[10];
   int i2a[10];
   char *condVal[10];
   char v1[BIG_STR];
   char v2[BIG_STR];
   char v3[BIG_STR];
   int status;
   char *columnNames[]={"attribute", "value", "units"};

   char userName[NAME_LEN];
   char userZone[NAME_LEN];

   status = parseUserName(name, userName, userZone);
   if (status) {
      printf("Invalid username format\n");
      return(0);
   }
   if (userZone[0]=='\0') {
      strncpy(userZone, myEnv.rodsZone, NAME_LEN);
   }

   memset (&genQueryInp, 0, sizeof (genQueryInp_t));

   printf("AVUs defined for user %s#%s:\n",userName, userZone);
   printCount=0;
   i1a[0]=COL_META_USER_ATTR_NAME;
   i1b[0]=0; /* currently unused */
   i1a[1]=COL_META_USER_ATTR_VALUE;
   i1b[1]=0;
   i1a[2]=COL_META_USER_ATTR_UNITS;
   i1b[2]=0;
   genQueryInp.selectInp.inx = i1a;
   genQueryInp.selectInp.value = i1b;
   genQueryInp.selectInp.len = 3;

   i2a[0]=COL_USER_NAME;
   sprintf(v1,"='%s'",userName);
   condVal[0]=v1;

   i2a[1]=COL_USER_ZONE;
   sprintf(v2,"='%s'",userZone);
   condVal[1]=v2;

   genQueryInp.sqlCondInp.inx = i2a;
   genQueryInp.sqlCondInp.value = condVal;
   genQueryInp.sqlCondInp.len=2;

   if (attrName != NULL && *attrName!='\0') {
      i2a[2]=COL_META_USER_ATTR_NAME;
      if (wild) {
	 sprintf(v3,"like '%s'",attrName);
      }
      else {
	 sprintf(v3,"= '%s'",attrName);
      }
      condVal[2]=v3;
      genQueryInp.sqlCondInp.len++;
   }

   genQueryInp.maxRows=10;
   genQueryInp.continueInx=0;
   genQueryInp.condInput.len=0;

   if (zoneArgument[0]!='\0') {
      addKeyVal (&genQueryInp.condInput, ZONE_KW, zoneArgument);
   }

   status = rcGenQuery(Conn, &genQueryInp, &genQueryOut);
   if (status == CAT_NO_ROWS_FOUND) {
      i1a[0]=COL_USER_COMMENT;
      genQueryInp.selectInp.len = 1;
      status = rcGenQuery(Conn, &genQueryInp, &genQueryOut);
      if (status==0) {
	 printf("None\n");
	 return(0);
      }
      if (status == CAT_NO_ROWS_FOUND) {
	 printf("User %s does not exist.\n", name);
	 return(0);
      }
   }

   printGenQueryResults(Conn, status, genQueryOut, columnNames);

   while (status==0 && genQueryOut->continueInx > 0) {
      genQueryInp.continueInx=genQueryOut->continueInx;
      status = rcGenQuery(Conn, &genQueryInp, &genQueryOut);
      if (genQueryOut->rowCnt>0) printf("----\n");
      printGenQueryResults(Conn, status, genQueryOut, 
					columnNames);
   }

   return (0);
}
コード例 #5
0
ファイル: iquota.cpp プロジェクト: pombreda/irods
/*
  Via a general query, show user group membership
*/
int
showUserGroupMembership( char *userNameIn, char *usersZone ) {
    genQueryInp_t genQueryInp;
    genQueryOut_t *genQueryOut;
    int i1a[20];
    int i1b[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    int i2a[20];
    char *condVal[10];
    char v1[BIG_STR];
    char v2[BIG_STR];
    int i, j, status;
    int printCount;
    char userName[NAME_LEN];
    char zoneName[NAME_LEN];
    int showUserZone = 1;

    status = parseUserName( userNameIn, userName, zoneName );
    if ( status ) {
        return status;
    }
    if ( zoneName[0] == '\0' ) {
        snprintf( zoneName, sizeof( zoneName ), "%s", usersZone );
        showUserZone = 0;
    }

    memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );

    i1a[0] = COL_USER_GROUP_NAME;
    genQueryInp.selectInp.inx = i1a;
    genQueryInp.selectInp.value = i1b;
    genQueryInp.selectInp.len = 1;

    i2a[0] = COL_USER_NAME;
    snprintf( v1, sizeof v1, "='%s'", userName );
    condVal[0] = v1;

    i2a[1] = COL_USER_ZONE;
    snprintf( v2, sizeof v2, "='%s'", zoneName );
    condVal[1] = v2;

    genQueryInp.sqlCondInp.inx = i2a;
    genQueryInp.sqlCondInp.value = condVal;
    genQueryInp.sqlCondInp.len = 2;

    genQueryInp.condInput.len = 0;

    genQueryInp.maxRows = MAX_SQL_ROWS;
    genQueryInp.continueInx = 0;
    status = rcGenQuery( Conn, &genQueryInp, &genQueryOut );
    if ( status == CAT_NO_ROWS_FOUND ) {
        printf( "Not a member of any group\n" );
        return 0;
    }
    if ( status != 0 ) {
        printError( Conn, status, "rcGenQuery" );
        return status;
    }

    printCount = 0;
    if ( showUserZone ) {
        printf( "User %s#%s is a member of groups: ", userName, zoneName );
    }
    else {
        printf( "User %s is a member of groups: ", userName );
    }
    for ( i = 0; i < genQueryOut->rowCnt; i++ ) {
        for ( j = 0; j < genQueryOut->attriCnt; j++ ) {
            char *tResult;
            tResult = genQueryOut->sqlResult[j].value;
            tResult += i * genQueryOut->sqlResult[j].len;
            if ( printCount > 0 ) {
                printf( ", %s", tResult );
            }
            else {
                printf( "%s", tResult );
            }
            printCount++;
        }
    }
    printf( "\n" );
    return 0;
}
コード例 #6
0
ファイル: iquota.cpp プロジェクト: pombreda/irods
/*
  Show user quota information
*/
int
showQuotas( char *userName, int userOrGroup, int rescOrGlobal ) {
    genQueryInp_t genQueryInp;
    genQueryOut_t *genQueryOut;
    int inputInx[20];
    int inputVal[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    int inputCond[20];
    char *condVal[10];
    char v1[BIG_STR];
    char v1b[BIG_STR];
    char v2[BIG_STR];
    char v3[BIG_STR];
    int i, j, status;
    int  localiTime = 0;
    int printCount;
    static int printedTime = 0;
    char *colName[10];

    memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
    printCount = 0;
    i = 0;
    if ( rescOrGlobal == 0 ) {
        colName[i] = "Resource: ";
        inputInx[i++] = COL_QUOTA_RESC_NAME;
    }
    else {
        colName[i] = "Resource: ";
        inputInx[i++] = COL_QUOTA_RESC_ID;
    }
    if ( userOrGroup == 0 ) {
        colName[i] = "User:  "******"Group:  ";
    }
    inputInx[i++] = COL_QUOTA_USER_NAME;
    colName[i] = "Zone:  ";
    inputInx[i++] = COL_QUOTA_USER_ZONE;
    colName[i] = "Quota: ";
    inputInx[i++] = COL_QUOTA_LIMIT;
    colName[i] = "Over:  ";
    inputInx[i++] = COL_QUOTA_OVER;
    colName[i] = "Time";
    inputInx[i++] = COL_QUOTA_MODIFY_TIME;

    genQueryInp.selectInp.inx = inputInx;
    genQueryInp.selectInp.value = inputVal;
    genQueryInp.selectInp.len = i;

    char userName2[NAME_LEN];
    char userZone[NAME_LEN];
    genQueryInp.sqlCondInp.len = 0;
    if ( userName[0] != '\0' ) {
        status = parseUserName( userName, userName2, userZone );
        if ( status < 0 ) {
            rodsLog( LOG_ERROR, "parseUserName error in showQuotas with status %d", status );
            return status;
        }
        if ( userZone[0] == '\0' ) {
            inputCond[0] = COL_QUOTA_USER_NAME;
            sprintf( v1, "='%s'", userName );
            condVal[0] = v1;
            genQueryInp.sqlCondInp.len++;
        }
        else {
            inputCond[0] = COL_QUOTA_USER_NAME;
            sprintf( v1, "='%s'", userName2 );
            condVal[0] = v1;
            genQueryInp.sqlCondInp.len++;
            inputCond[1] = COL_QUOTA_USER_ZONE;
            sprintf( v1b, "='%s'", userZone );
            condVal[1] = v1b;
            genQueryInp.sqlCondInp.len++;
        }
    }
    inputCond[genQueryInp.sqlCondInp.len] = COL_QUOTA_USER_TYPE;
    if ( userOrGroup == 0 ) {
        sprintf( v2, "!='%s'", "rodsgroup" );
    }
    else {
        sprintf( v2, "='%s'", "rodsgroup" );
    }
    condVal[genQueryInp.sqlCondInp.len] = v2;
    genQueryInp.sqlCondInp.len++;

    if ( rescOrGlobal == 1 ) {
        inputCond[genQueryInp.sqlCondInp.len] = COL_QUOTA_RESC_ID;
        sprintf( v3, "='%s'", "0" );
        condVal[genQueryInp.sqlCondInp.len] = v3;
        genQueryInp.sqlCondInp.len++;
    }


    genQueryInp.sqlCondInp.inx = inputCond;
    genQueryInp.sqlCondInp.value = condVal;

    genQueryInp.condInput.len = 0;

    genQueryInp.maxRows = MAX_SQL_ROWS;

    genQueryInp.continueInx = 0;
    status = rcGenQuery( Conn, &genQueryInp, &genQueryOut );
    if ( status == CAT_NO_ROWS_FOUND ) {
        printf( "None\n\n" );
        return 0;
    }
    if ( status != 0 ) {
        printError( Conn, status, "rcGenQuery" );
        return status;
    }

    if ( genQueryOut->rowCnt > 0 && printedTime == 0 ) {
        for ( i = 0; i < 1; i++ ) {
            for ( j = 0; j < genQueryOut->attriCnt; j++ ) {
                char *tResult;
                long itime;

                tResult = genQueryOut->sqlResult[j].value;
                tResult += i * genQueryOut->sqlResult[j].len;
                if ( j == 5 ) {
                    itime = atoll( tResult );
                    if ( itime > localiTime ) {
                        localiTime = itime;
                        getLocalTimeFromRodsTime( tResult, quotaTime );
                    }
                }
            }
        }
    }
    printCount = 0;
    for ( i = 0; i < genQueryOut->rowCnt; i++ ) {
        for ( j = 0; j < genQueryOut->attriCnt; j++ ) {
            char *tResult;
            long itime;
            tResult = genQueryOut->sqlResult[j].value;
            tResult += i * genQueryOut->sqlResult[j].len;
            if ( j == 5 ) {
                itime = atoll( tResult );
                if ( itime > localiTime ) {
                    localiTime = itime;
                    getLocalTimeFromRodsTime( tResult, quotaTime );
                }
            }
            else {
                printf( "  %s", colName[j] );
                if ( rescOrGlobal == 1 && j == 0 ) {
                    tResult = "All";
                }
                if ( j == 4 || j == 3 ) {
                    printNice( tResult, 0, "bytes" );
                    if ( strncmp( colName[j], "Over:", 5 ) == 0 ) {
                        rodsLong_t ival;
                        ival = atoll( tResult );
                        if ( ival > 0 ) {
                            printf( " OVER QUOTA" );
                        }
                        else {
                            if ( ival > QUOTA_APPROACH_WARNING_SIZE ) {
                                printf( " (Nearing quota)" );
                            }
                            else {
                                printf( " (under quota)" );
                            }
                        }

                    }
                    printf( "\n" );
                }
                else {
                    printf( "%s\n", tResult );
                }
                printCount++;
            }
        }
        printf( "\n" );
    }
    return 0;
}
コード例 #7
0
ファイル: ichmod.cpp プロジェクト: bpow/irods
int
main( int argc, char **argv ) {

    signal( SIGPIPE, SIG_IGN );

    int status;
    rodsEnv myEnv;
    rErrMsg_t errMsg;
    rcComm_t *conn;
    rodsArguments_t myRodsArgs;
    char *optStr;
    rodsPathInp_t rodsPathInp;
    int i, nArgs;
    modAccessControlInp_t modAccessControl;
    char userName[NAME_LEN];
    char zoneName[NAME_LEN];
    int doingInherit;
    char rescAccessLevel[LONG_NAME_LEN];
    char adminModeAccessLevel[LONG_NAME_LEN];

    optStr = "RrhvVM";

    status = parseCmdLineOpt( argc, argv, optStr, 0, &myRodsArgs );
    if ( status ) {
        printf( "Use -h for help\n" );
        exit( 1 );
    }
    if ( myRodsArgs.help == True ) {
        usage();
        exit( 0 );
    }

    if ( status < 0 ) {
        rodsLogError( LOG_ERROR, status, "main: parseCmdLineOpt error. " );
        printf( "Use -h for help\n" );
        exit( 2 );
    }

    nArgs = argc - myRodsArgs.optind;

    if ( nArgs < 2 ) {
        usage();
        exit( 3 );
    }

    status = getRodsEnv( &myEnv );

    if ( status < 0 ) {
        rodsLogError( LOG_ERROR, status, "main: getRodsEnv error. " );
        exit( 3 );
    }

    optind = myRodsArgs.optind + 2;
    doingInherit = 0;
    if ( strcmp( argv[myRodsArgs.optind], ACCESS_INHERIT ) == 0 ||
            strcmp( argv[myRodsArgs.optind], ACCESS_NO_INHERIT ) == 0 ) {
        doingInherit = 1;
        optind = myRodsArgs.optind + 1;
    }

    status = parseCmdLinePath( argc, argv, optind, &myEnv,
                               UNKNOWN_OBJ_T, NO_INPUT_T, 0, &rodsPathInp );

    if ( status < 0 ) {
        rodsLogError( LOG_ERROR, status, "main: parseCmdLinePath error. " );
        usage();
        exit( 4 );
    }

    // =-=-=-=-=-=-=-
    // initialize pluggable api table
    irods::api_entry_table& api_tbl = irods::get_client_api_table();
    irods::pack_entry_table& pk_tbl  = irods::get_pack_table();
    init_api_table( api_tbl, pk_tbl );

    conn = rcConnect( myEnv.rodsHost, myEnv.rodsPort, myEnv.rodsUserName,
                      myEnv.rodsZone, 0, &errMsg );

    if ( conn == NULL ) {
        exit( 5 );
    }

    status = clientLogin( conn );
    if ( status != 0 ) {
        rcDisconnect( conn );
        exit( 6 );
    }

    modAccessControl.recursiveFlag = myRodsArgs.recursive;
    modAccessControl.accessLevel = argv[myRodsArgs.optind];

    if ( doingInherit ) {
        modAccessControl.userName = "";
        modAccessControl.zone = "";
    }
    else {
        status = parseUserName( argv[myRodsArgs.optind + 1], userName, zoneName );
        if ( status != 0 ) {
            printf( "Invalid iRODS user name format: %s\n",
                    argv[myRodsArgs.optind + 1] );
            exit( 7 );
        }
    }
    modAccessControl.userName = userName;
    modAccessControl.zone = zoneName;
    for ( i = 0; i < rodsPathInp.numSrc && status == 0; i++ ) {
        if ( rodsPathInp.numSrc > 1 && myRodsArgs.verbose != 0 ) {
            printf( "path %s\n", rodsPathInp.srcPath[i].outPath );
        }
        modAccessControl.path = rodsPathInp.srcPath[i].outPath;

        if ( myRodsArgs.resource ) {
            strncpy( rescAccessLevel, MOD_RESC_PREFIX, LONG_NAME_LEN );
            strncat( rescAccessLevel, argv[myRodsArgs.optind], LONG_NAME_LEN - strlen( rescAccessLevel ) );
            modAccessControl.accessLevel = rescAccessLevel; /* indicate resource*/
            modAccessControl.path = argv[optind]; /* just use the plain name */
        }
        if ( myRodsArgs.admin && i == 0 ) {  /* admin mode, add indicator */
            strncpy( adminModeAccessLevel, MOD_ADMIN_MODE_PREFIX, LONG_NAME_LEN );
            strncat( adminModeAccessLevel, modAccessControl.accessLevel,
                     LONG_NAME_LEN - strlen( adminModeAccessLevel ) );
            modAccessControl.accessLevel = adminModeAccessLevel;
        }
        status = rcModAccessControl( conn, &modAccessControl );
        if ( status < 0 ) {
            rodsLogError( LOG_ERROR, status, "rcModAccessControl failure %s",
                          errMsg.msg );
            if ( conn->rError ) {
                rError_t *Err;
                rErrMsg_t *ErrMsg;
                int i, len;
                Err = conn->rError;
                len = Err->len;
                for ( i = 0; i < len; i++ ) {
                    ErrMsg = Err->errMsg[i];
                    rodsLog( LOG_ERROR, "Level %d: %s", i, ErrMsg->msg );
                }
            }
        }
    }

    printErrorStack( conn->rError );
    rcDisconnect( conn );

    if ( status < 0 ) {
        exit( 8 );
    }
    else {
        exit( 0 );
    }

}
コード例 #8
0
/**
 * \fn msiDataObjAutoMove(msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
 *                      msParam_t *inpParam4, msParam_t *inpParam5, ruleExecInfo_t *rei)
 *
 * \brief This microservice is used to automatically move the newly created file into a destination collection.
 *
 * \module core
 *
 * \since 2.2
 *
 * \author  Bing Zhu
 * \date    2009-07
 *
 * \note This microservice changes the ownership for the dataset(s) being moved.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] inpParam1 - a STR_MS_T containing the object name with path. It usually comes from query as "$objPat
 *                          like /zone/../%" in the deployed microservice
 * \param[in] inpParam2 - a STR_MS_T containing the leading collection name to be truncated
 * \param[in] inpParam3 - a STR_MS_T containing the destination collection
 * \param[in] inpParam4 - a STR_MS_T containing the new owner
 * \param[in] inpParam5 - a STR_MS_T containing a flag for whether the checksum should be computed
                        \li true - default - will compute the checksum
                        \li false - will not compute the checksum
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 upon success
 * \pre none
 * \post none
 * \sa none
**/
int msiDataObjAutoMove( msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
                        msParam_t *inpParam4, msParam_t *inpParam5, ruleExecInfo_t *rei ) {
    char *obj_path, *truct_path, *dest_coll, *new_owner;
    char *new_truct_path;
    char *new_obj_path;
    int  t;
    int  new_truct_path_len;
    rsComm_t *rsconn;
    char  mdest_coll[MAX_NAME_LEN];

    char  query_str[2048];
    genQueryInp_t genQueryInp;
    genQueryOut_t *genQueryOut = NULL;

    char new_obj_parent[MAX_NAME_LEN];
    char obj_name[MAX_NAME_LEN];

    collInp_t collCreateInp;
    dataObjCopyInp_t dataObjRenameInp;
    modAccessControlInp_t myModAccessCntlInp;

    dataObjInp_t myDataObjInp;
    char own_perm[20], null_perm[20];
    char user_name[NAME_LEN], zone_name[NAME_LEN];

    char *sTmpstr;
    int compute_checksum = 0;
    char *chksum_str = NULL;
    char tmpstr[1024];

    strcpy( own_perm, "own" );
    strcpy( null_perm, "null" );

    if ( rei == NULL || rei->rsComm == NULL ) {
        rodsLog( LOG_ERROR,
                 "msiDataObjAutoMove: input rei or rei->rsComm is NULL" );
        return ( SYS_INTERNAL_NULL_INPUT_ERR );
    }

    rsconn = rei->rsComm;

    if ( inpParam1 == NULL ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input objpath (inpParam1) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    obj_path = ( char * )inpParam1->inOutStruct;
    if ( ( obj_path == NULL ) || ( strlen( obj_path ) == 0 ) ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input objpath (inpParam1->inOutStruct) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    if ( inpParam2 == NULL ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input truct_path (inpParam2) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    truct_path = ( char * )inpParam2->inOutStruct;
    if ( ( truct_path == NULL ) || ( strlen( truct_path ) == 0 ) ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input truct_path (inpParam2->inOutStruct) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    if ( inpParam3 == NULL ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input dest_coll (inpParam3) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    dest_coll = ( char * )inpParam3->inOutStruct;
    if ( ( dest_coll == NULL ) || ( strlen( dest_coll ) == 0 ) ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input dest_coll (inpParam3->inOutStruct) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    if ( inpParam4 == NULL ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input new_owner (inpParam4) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    new_owner = ( char * )inpParam4->inOutStruct;
    if ( new_owner != NULL ) {
        if ( strlen( new_owner ) == 0 ) {
            new_owner = NULL;
        }
        else if ( strcmp( new_owner, "null" ) == 0 ) {
            new_owner = NULL;
        }
    }
    if ( new_owner != NULL ) {
        user_name[0] = '\0';
        zone_name[0] = '\0';
        t = parseUserName( new_owner, user_name, zone_name );
        if ( t < 0 ) {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: parseUserName() failed. errStatus=%d.", t );
            return t;
        }
        if ( strlen( zone_name ) == 0 ) {
            strcpy( zone_name, rei->uoip->rodsZone );
        }
    }

    if ( inpParam5 == NULL ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: input compute_checksum (inpParam5) is NULL." );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }
    sTmpstr = ( char * )inpParam5->inOutStruct;
    compute_checksum = 1;   /* default to true */
    if ( ( sTmpstr != NULL ) && ( strlen( sTmpstr ) >= 0 ) ) {
        if ( strcmp( sTmpstr, "false" ) == 0 ) {
            compute_checksum = 0;
        }
    }

    if ( compute_checksum == 1 ) {
        chksum_str =  NULL;
        memset( &myDataObjInp, 0, sizeof( dataObjInp_t ) );
        strncpy( myDataObjInp.objPath, obj_path, MAX_NAME_LEN );
        addKeyVal( &myDataObjInp.condInput, VERIFY_CHKSUM_KW, "" );
        sprintf( tmpstr, "%d", 0 );
        addKeyVal( &myDataObjInp.condInput, REPL_NUM_KW, tmpstr );
        t = rsDataObjChksum( rsconn, &myDataObjInp, &chksum_str );
        if ( t < 0 ) {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsDataObjChksum() for '%s' failed. errStatus=%d.", obj_path, t );
            return t;
        }
    }

    if ( new_owner != NULL ) {
        /* add ownership */
        memset( &myModAccessCntlInp, 0, sizeof( modAccessControlInp_t ) );
        myModAccessCntlInp.recursiveFlag = False;
        myModAccessCntlInp.accessLevel = own_perm;
        myModAccessCntlInp.userName = user_name;
        myModAccessCntlInp.zone = zone_name;
        myModAccessCntlInp.path = obj_path;
        t = rsModAccessControl( rsconn, &myModAccessCntlInp );
        if ( t < 0 ) {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsModAccessControl() add new owner for '%s' failed. errStatus=%d.", obj_path, t );
            return t;
        }

    }

    t = strlen( truct_path );
    new_truct_path = ( char * )calloc( t + 2, sizeof( char ) );
    if ( truct_path[t - 1] != '/' ) {
        strcpy( new_truct_path, truct_path );
        new_truct_path_len = t;
    }
    else {
        strcpy( new_truct_path, truct_path );
        new_truct_path[t] = '/';
        new_truct_path[t + 1] = '\0';
        new_truct_path_len = t + 1;
    }
    if ( strncmp( new_truct_path, obj_path, t ) != 0 ) {
        /* when the object is not match, we don't move */
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: The object path, %s, is not in the specified collection, %s.", obj_path, new_truct_path );
        return SYS_INTERNAL_NULL_INPUT_ERR;
    }

    t = strlen( dest_coll );
    new_obj_path = ( char * )calloc( t + strlen( obj_path ), sizeof( char ) );
    strcpy( mdest_coll, dest_coll );
    if ( dest_coll[t - 1] == '/' ) {
        mdest_coll[t - 1] = '\0';
    }
    sprintf( new_obj_path, "%s/%s", mdest_coll, &( obj_path[new_truct_path_len + 1] ) );
    sprintf( query_str, "SELECT COLL_NAME WHERE COLL_NAME like '%s%%'", mdest_coll );

    /* check if the dest_coll exists */
    memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
    t = fillGenQueryInpFromStrCond( query_str, &genQueryInp );
    if ( t < 0 ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: fillGenQueryInpFromStrCond() failed. errStatus=%d", t );
        free( new_obj_path ); // JMC cppcheck - leak
        free( new_truct_path ); // JMC cppcheck - leak
        return t;
    }
    genQueryInp.maxRows = MAX_SQL_ROWS;
    genQueryInp.continueInx = 0;
    t = rsGenQuery( rsconn, &genQueryInp, &genQueryOut );
    if ( t < 0 ) {
        if ( t == CAT_NO_ROWS_FOUND ) {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: The destination collection '%s' does not exist.", dest_coll );
        }
        else {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsGenQuery() failed. errStatus=%d", t );
        }
        free( new_obj_path ); // JMC cppcheck - leak
        free( new_truct_path ); // JMC cppcheck - leak
        return t;
    }

    /* separate new_obj_path with path and name */
    t = splitPathByKey( new_obj_path, new_obj_parent, obj_name, '/' );
    if ( t < 0 ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: splitPathByKey() failed for splitting '%s'. errStatus=%d.", new_obj_path, t );
        free( new_obj_path ); // JMC cppcheck - leak
        free( new_truct_path ); // JMC cppcheck - leak
        return t;
    }

    /* fprintf(stderr,"msiDataObjAutoMove: newpar=%s, obj_name=%s, from=%s\n", new_obj_parent, obj_name, obj_path); */

    /* create the dires in new_obj_path 'imkidr -p'*/
    if ( strlen( new_obj_parent ) > strlen( mdest_coll ) ) {
        memset( &collCreateInp, 0, sizeof( collCreateInp ) );
        rstrcpy( collCreateInp.collName, new_obj_parent, MAX_NAME_LEN );
        addKeyVal( &collCreateInp.condInput, RECURSIVE_OPR__KW, "" );   /* always have '-p' option. */
        t = rsCollCreate( rsconn, &collCreateInp );
        if ( t < 0 ) {
            rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsCollCreate() failed for %s. errStatus=%d.", new_obj_parent, t );
            free( new_obj_path ); // JMC cppcheck - leak
            free( new_truct_path ); // JMC cppcheck - leak
            return t;
        }
    }

    fprintf( stderr, "new_obj_path=%s, obj_path=%s\n", new_obj_path, obj_path );
    /* renamed the obj_path to new_obj_path */
    memset( &dataObjRenameInp, 0, sizeof( dataObjCopyInp_t ) );
    rstrcpy( dataObjRenameInp.destDataObjInp.objPath, new_obj_path, MAX_NAME_LEN );
    rstrcpy( dataObjRenameInp.srcDataObjInp.objPath, obj_path, MAX_NAME_LEN );
    t = rsDataObjRename( rsconn, &dataObjRenameInp );
    if ( t < 0 ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsDataObjRename() failed. errStatus=%d.", t );
        free( new_obj_path ); // JMC cppcheck - leak
        free( new_truct_path ); // JMC cppcheck - leak
        return t;
    }

    memset( &myModAccessCntlInp, 0, sizeof( modAccessControlInp_t ) );
    myModAccessCntlInp.recursiveFlag = False;
    myModAccessCntlInp.accessLevel = null_perm;
    myModAccessCntlInp.userName = rei->uoic->userName;
    myModAccessCntlInp.zone = zone_name;
    myModAccessCntlInp.path = new_obj_path;
    t = rsModAccessControl( rsconn, &myModAccessCntlInp );
    if ( t < 0 ) {
        rodsLog( LOG_ERROR, "msiDataObjAutoMove: rsModAccessControl() remove user for '%s' failed. errStatus=%d.", obj_path, t );
    }

    free( new_truct_path ); // JMC cppcheck - leak
    return 0;
}