- Fixed intruder generated value displays.
This commit is contained in:
parent
dbe2042c01
commit
8d66dc48fd
@ -1740,6 +1740,9 @@ createNewTermGeneric (Termlist tl, Term t)
|
||||
memcpy (newterm, t, sizeof (struct term));
|
||||
TermRunid (newterm) = freenumber;
|
||||
|
||||
/* The type of the new term should be that of the parent! */
|
||||
newterm->stype = termlistAppend (NULL, t);
|
||||
|
||||
/* return */
|
||||
return termlistPrepend (tl, newterm);
|
||||
}
|
||||
|
129
src/dotout.c
129
src/dotout.c
@ -5,6 +5,7 @@
|
||||
#include "arachne.h"
|
||||
#include "binding.h"
|
||||
#include "depend.h"
|
||||
#include "type.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
||||
@ -63,8 +64,29 @@ static System sys = NULL;
|
||||
* code
|
||||
*/
|
||||
|
||||
//! Is this term chosen by the intruder?
|
||||
int
|
||||
isIntruderChoice (const Term t)
|
||||
{
|
||||
if (realTermLeaf (t))
|
||||
{
|
||||
if (TermRunid (t) >= sys->maxruns)
|
||||
{
|
||||
// Chosen by intruder
|
||||
// However, if it is a rolename, this is not really what we mean
|
||||
if (!(t->roleVar || isAgentType (t->stype)))
|
||||
{
|
||||
// Not a role variable, and chosen by the intruder: that's it
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Print the run identifier in some meaningful way
|
||||
void
|
||||
printVisualRun (int rid)
|
||||
printVisualRunID (int rid)
|
||||
{
|
||||
int run;
|
||||
int displayi;
|
||||
@ -99,11 +121,20 @@ printVisualRun (int rid)
|
||||
}
|
||||
else
|
||||
{
|
||||
// >= sys->maxruns means intruder choice
|
||||
eprintf ("Intruder%i", (rid - sys->maxruns + 1));
|
||||
eprintf ("%i", (rid - sys->maxruns + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printVisualRun (const Term t)
|
||||
{
|
||||
if (isIntruderChoice (t))
|
||||
{
|
||||
eprintf ("Intruder");
|
||||
}
|
||||
printVisualRunID (TermRunid (t));
|
||||
}
|
||||
|
||||
//! Remap term stuff
|
||||
void
|
||||
termPrintRemap (const Term t)
|
||||
@ -113,12 +144,16 @@ termPrintRemap (const Term t)
|
||||
|
||||
//! Remap term list
|
||||
void
|
||||
termlistPrintRemap (Termlist tl)
|
||||
termlistPrintRemap (Termlist tl, char *sep)
|
||||
{
|
||||
while (tl != NULL)
|
||||
{
|
||||
termPrintRemap(tl->term);
|
||||
termPrintRemap (tl->term);
|
||||
tl = tl->next;
|
||||
if (tl != NULL)
|
||||
{
|
||||
eprintf ("%s", sep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1263,7 +1298,7 @@ printRunExplanation (const System sys, const int run,
|
||||
int hadcontent;
|
||||
|
||||
eprintf ("Run ");
|
||||
printVisualRun (run);
|
||||
printVisualRunID (run);
|
||||
|
||||
eprintf (runrolesep);
|
||||
// Print first line
|
||||
@ -1700,57 +1735,55 @@ dotSemiState (const System mysys)
|
||||
from_intruder_count = drawAllBindings (sys);
|
||||
|
||||
// Third, the intruder node (if needed)
|
||||
{
|
||||
/*
|
||||
* Stupid brute analysis, can probably be done much more efficient, but
|
||||
* this is not a timing critical bit, so we just do it like this.
|
||||
*/
|
||||
Termlist found;
|
||||
List bl;
|
||||
{
|
||||
/*
|
||||
* Stupid brute analysis, can probably be done much more efficient, but
|
||||
* this is not a timing critical bit, so we just do it like this.
|
||||
*/
|
||||
Termlist found;
|
||||
List bl;
|
||||
|
||||
// collect the intruder-generated constants
|
||||
found = NULL;
|
||||
for (bl = sys->bindings; bl != NULL; bl = bl->next)
|
||||
{
|
||||
Binding b;
|
||||
// collect the intruder-generated constants
|
||||
found = NULL;
|
||||
for (bl = sys->bindings; bl != NULL; bl = bl->next)
|
||||
{
|
||||
Binding b;
|
||||
|
||||
b = (Binding) bl->data;
|
||||
if (!b->blocked)
|
||||
{
|
||||
int addsubterms(Term t)
|
||||
b = (Binding) bl->data;
|
||||
if (!b->blocked)
|
||||
{
|
||||
int addsubterms (Term t)
|
||||
{
|
||||
if (TermRunid(t) >= sys->maxruns)
|
||||
if (isIntruderChoice (t))
|
||||
{
|
||||
// >= sys->maxruns means intruder choice
|
||||
found = termlistAddNew(found, t);
|
||||
found = termlistAddNew (found, t);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
term_iterate_open_leaves(b->term, addsubterms);
|
||||
}
|
||||
}
|
||||
term_iterate_open_leaves (b->term, addsubterms);
|
||||
}
|
||||
}
|
||||
|
||||
// now maybe we draw the node
|
||||
if ((from_intruder_count > 0) || (found != NULL))
|
||||
{
|
||||
eprintf
|
||||
("\tintruder [\n");
|
||||
eprintf ("\t\tlabel=\"");
|
||||
eprintf ("Initial intruder knowledge");
|
||||
if (found != NULL)
|
||||
{
|
||||
eprintf ("\\n");
|
||||
eprintf ("The intruder generates: ");
|
||||
termlistPrintRemap (found);
|
||||
}
|
||||
eprintf ("\",\n");
|
||||
eprintf ("\t\tstyle=filled,fillcolor=\"");
|
||||
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
|
||||
eprintf ("\"\n\t];\n");
|
||||
}
|
||||
termlistDelete(found);
|
||||
}
|
||||
// now maybe we draw the node
|
||||
if ((from_intruder_count > 0) || (found != NULL))
|
||||
{
|
||||
eprintf ("\tintruder [\n");
|
||||
eprintf ("\t\tlabel=\"");
|
||||
eprintf ("Initial intruder knowledge");
|
||||
if (found != NULL)
|
||||
{
|
||||
eprintf ("\\n");
|
||||
eprintf ("The intruder generates: ");
|
||||
termlistPrintRemap (found, ", ");
|
||||
}
|
||||
eprintf ("\",\n");
|
||||
eprintf ("\t\tstyle=filled,fillcolor=\"");
|
||||
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
|
||||
eprintf ("\"\n\t];\n");
|
||||
}
|
||||
termlistDelete (found);
|
||||
}
|
||||
|
||||
// eprintf ("\t};\n");
|
||||
|
||||
|
1834
src/parser.c
1834
src/parser.c
File diff suppressed because it is too large
Load Diff
92
src/parser.h
92
src/parser.h
@ -1,7 +1,9 @@
|
||||
/* A Bison parser, made by GNU Bison 2.1. */
|
||||
/* A Bison parser, made by GNU Bison 2.3. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -18,37 +20,46 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ID = 258,
|
||||
PROTOCOL = 259,
|
||||
ROLE = 260,
|
||||
READT = 261,
|
||||
SENDT = 262,
|
||||
CLAIMT = 263,
|
||||
VAR = 264,
|
||||
CONST = 265,
|
||||
RUN = 266,
|
||||
SECRET = 267,
|
||||
COMPROMISED = 268,
|
||||
INVERSEKEYS = 269,
|
||||
UNTRUSTED = 270,
|
||||
USERTYPE = 271,
|
||||
SINGULAR = 272,
|
||||
FUNCTION = 273,
|
||||
HASHFUNCTION = 274,
|
||||
KNOWS = 275,
|
||||
TRUSTED = 276
|
||||
};
|
||||
enum yytokentype
|
||||
{
|
||||
ID = 258,
|
||||
PROTOCOL = 259,
|
||||
ROLE = 260,
|
||||
READT = 261,
|
||||
SENDT = 262,
|
||||
CLAIMT = 263,
|
||||
VAR = 264,
|
||||
CONST = 265,
|
||||
RUN = 266,
|
||||
SECRET = 267,
|
||||
COMPROMISED = 268,
|
||||
INVERSEKEYS = 269,
|
||||
UNTRUSTED = 270,
|
||||
USERTYPE = 271,
|
||||
SINGULAR = 272,
|
||||
FUNCTION = 273,
|
||||
HASHFUNCTION = 274,
|
||||
KNOWS = 275,
|
||||
TRUSTED = 276
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ID 258
|
||||
@ -74,22 +85,21 @@
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 13 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
char* str;
|
||||
struct tacnode* tac;
|
||||
Symbol symb;
|
||||
int value;
|
||||
} YYSTYPE;
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 87 "parser.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
{
|
||||
char *str;
|
||||
struct tacnode *tac;
|
||||
Symbol symb;
|
||||
int value;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 98 "parser.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
|
||||
|
||||
|
2365
src/scanner.c
2365
src/scanner.c
File diff suppressed because it is too large
Load Diff
@ -315,7 +315,7 @@ termInTerm (Term t, Term tsub)
|
||||
void
|
||||
termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||
char *righttup, char *leftenc, char *rightenc,
|
||||
void (*callback) (int rid))
|
||||
void (*callback) (const Term t))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (!DEBUGL (4))
|
||||
@ -345,7 +345,7 @@ termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||
}
|
||||
else
|
||||
{
|
||||
callback (TermRunid (term));
|
||||
callback (term);
|
||||
}
|
||||
}
|
||||
if (term->subst != NULL)
|
||||
@ -404,7 +404,7 @@ termPrint (Term term)
|
||||
void
|
||||
termTuplePrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||
char *righttup, char *leftenc, char *rightenc,
|
||||
void (*callback) (int rid))
|
||||
void (*callback) (const Term t))
|
||||
{
|
||||
if (term == NULL)
|
||||
{
|
||||
|
@ -174,11 +174,11 @@ int termSubTerm (Term t, Term tsub);
|
||||
int termInTerm (Term t, Term tsub);
|
||||
void termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||
char *righttup, char *leftenc, char *rightenc,
|
||||
void (*callback) (int rid));
|
||||
void (*callback) (const Term t));
|
||||
void termPrint (Term term);
|
||||
void termTuplePrintCustom (Term term, char *leftvar, char *rightvar,
|
||||
char *lefttup, char *righttup, char *leftenc,
|
||||
char *rightenc, void (*callback) (int rid));
|
||||
char *rightenc, void (*callback) (const Term t));
|
||||
void termTuplePrint (Term term);
|
||||
Term termDuplicate (const Term term);
|
||||
Term termNodeDuplicate (const Term term);
|
||||
|
Loading…
Reference in New Issue
Block a user