Program: 15131
Project: 15131
Buggy source:
public DescribeSecurityGroupsResponseType describe(final DescribeSecurityGroupsType request) throws EucalyptusCloudException {
  final Context ctx=Contexts.lookup();
  NetworkGroupUtil.makeDefault(ctx.getUserFullName());
  final List<String> groupNames=request.getSecurityGroupSet();
  DescribeSecurityGroupsResponseType reply=(DescribeSecurityGroupsResponseType)request.getReply();
  final List<SecurityGroupItemType> replyList=reply.getSecurityGroupInfo();
  if (Contexts.lookup().hasAdministrativePrivileges()) {
    try {
      for (      SecurityGroupItemType group : Iterables.filter(NetworkGroupUtil.getUserNetworksAdmin(ctx.getUserFullName(),request.getSecurityGroupSet()),new Predicate<SecurityGroupItemType>(){
        @Override public boolean apply(        SecurityGroupItemType arg0){
          return groupNames.isEmpty() || groupNames.contains(arg0.getGroupName());
        }
      }
)) {
        replyList.add(group);
      }
    }
 catch (    Exception e) {
      LOG.debug(e,e);
    }
  }
 else {
    try {
      for (      SecurityGroupItemType group : Iterables.filter(NetworkGroupUtil.getUserNetworks(ctx.getUserFullName(),request.getSecurityGroupSet()),new Predicate<SecurityGroupItemType>(){
        @Override public boolean apply(        SecurityGroupItemType arg0){
          if (Permissions.isAuthorized(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_SECURITYGROUP,arg0.getGroupName(),ctx.getAccount(),PolicySpec.requestToAction(request),ctx.getUser())) {
            return false;
          }
          return groupNames.isEmpty() || groupNames.contains(arg0.getGroupName());
        }
      }
)) {
        replyList.add(group);
      }
    }
 catch (    Exception e) {
      LOG.debug(e,e);
    }
  }
  return reply;
}

Fixed version (ground truth):
public DescribeSecurityGroupsResponseType describe(final DescribeSecurityGroupsType request) throws EucalyptusCloudException {
  final Context ctx=Contexts.lookup();
  NetworkGroupUtil.makeDefault(ctx.getUserFullName());
  final List<String> groupNames=request.getSecurityGroupSet();
  DescribeSecurityGroupsResponseType reply=(DescribeSecurityGroupsResponseType)request.getReply();
  final List<SecurityGroupItemType> replyList=reply.getSecurityGroupInfo();
  if (Contexts.lookup().hasAdministrativePrivileges()) {
    try {
      for (      SecurityGroupItemType group : Iterables.filter(NetworkGroupUtil.getUserNetworksAdmin(ctx.getUserFullName(),request.getSecurityGroupSet()),new Predicate<SecurityGroupItemType>(){
        @Override public boolean apply(        SecurityGroupItemType arg0){
          return groupNames.isEmpty() || groupNames.contains(arg0.getGroupName());
        }
      }
)) {
        replyList.add(group);
      }
    }
 catch (    Exception e) {
      LOG.debug(e,e);
    }
  }
 else {
    try {
      for (      SecurityGroupItemType group : Iterables.filter(NetworkGroupUtil.getUserNetworks(ctx.getUserFullName(),request.getSecurityGroupSet()),new Predicate<SecurityGroupItemType>(){
        @Override public boolean apply(        SecurityGroupItemType arg0){
          if (!Permissions.isAuthorized(PolicySpec.VENDOR_EC2,PolicySpec.EC2_RESOURCE_SECURITYGROUP,arg0.getGroupName(),ctx.getAccount(),PolicySpec.requestToAction(request),ctx.getUser())) {
            return false;
          }
          return groupNames.isEmpty() || groupNames.contains(arg0.getGroupName());
        }
      }
)) {
        replyList.add(group);
      }
    }
 catch (    Exception e) {
      LOG.debug(e,e);
    }
  }
  return reply;
}