void NoGlobalVarDefValidator::visit(ShPtr<VarDefStmt> stmt) {
	// The left-hand side of a VarDefStmt cannot be a global variable.
	if (module->isGlobalVar(stmt->getVar())) {
		validationError("In ", func->getName(), "(), found a VarDefStmt `",
			stmt, "` that defines a global variable.");
	}
	OrderedAllVisitor::visit(stmt);
}
Exemplo n.º 2
0
bool Parser::init() {
  bool success = true;
  for (ParseRule *r : definitions_)
    success = success && r->init(*this);
  if (!success) {
    validationError() << "Invalid parser.";
  }
  return success;
}
WidgetErrorType WidgetDigSignValidation::validateDigitalSignature()
{
    WidgetValidationError validationError( ValidateOK );
    WidgetErrorType m_DigSigError = EErrorNone;
    QString commaSeparatedAKIs;
    QDir resourcePath(m_WidgetInfo[ EPropertyContentDirectory ].toString());

   // Widget which has digital signatures must have valid dig sigs.
    DigSigService* dsService = new DigSigService();
    validationError = dsService->validateWidget(resourcePath.absolutePath());

    if (validationError == ValidateOK) {
        QStringList certificateAKIs = dsService->getCertificateAKIs();
        if(!(certificateAKIs.isEmpty())) {
            m_WidgetInfo[ EPropertyCertificateAKIs ] = certificateAKIs;
        }          
    }
    else 
    {
           //Check if untrusted widget installation is allowed
            if((m_WidgetInfo[ EPropertyAllowUntrustedWidget].toBool()) == true ) 
            {
                switch(validationError)
                {
                    case CertificateRevoked:
                        //Certificate Revoked. Abort installation
                        m_DigSigError = EErrorCertificateRevoked;
                        break; 
                    default:
                       {
                        //emit and get the user response for proceeding with signature invalid widget installation
                        if (m_Mode == EModeInteractive) {
                            QMap< WidgetPropertyType, QVariant > propertyMap;
                            interactiveProperties( propertyMap );
                        }
                       }
                }
            }
            else {
             // Untrusted Widget Installation NOT ALLOWED
             return EErrorDigitalSignatureValidationFailed;
            }
    }

	if(dsService->isTestSigned())
        m_WidgetInfo[EPropertyDeveloperSigned ] = "true";
    else
        m_WidgetInfo[EPropertyDeveloperSigned ] = "false";		
    
    // Author Info from DigSigService
    AuthorInfo author;
    dsService->getAuthorInfo(author);
    
    if(author.isRecognized)
        m_WidgetInfo[EPropertyAuthor] = author.authorName;
    else
        m_WidgetInfo[EPropertyAuthor] = "unrecognized";
    
    delete dsService;
    return m_DigSigError;
}