Re: [NASL2] Auto-conversion with + and -

Michel Arboi <[email protected]>
Newsgroups gmane.comp.security.nessus.devel
Organization Compilo ergo sum
Message-ID <[email protected]>
"Pavel Kankovsky" <[email protected]> writes:

> BTW: what happens when you use + to concatenate a pure string and an
> impure string? Will the result be pure? Impure?

Pure

> Will the impure argument be auto-purified?

No. 'a'+"\n" will give 'a\\n' (a + antislash + n)
If you want to "purify" it, use the string function.
BTW, I am adding a strcat function. Maybe we'll get rid of this +
operator (we'll have to do something with - too)

> I think the whole concept of pure/impure strings creates considerably more
> problems than it solves.

So do I. That's why I implemented "pure strings". But we cannot
get rid of "impure strings" without rewriting many plugins. That's why
I used a different separator for pure strings (single quote instead of
double quote)

> Is there any script that (really) needs to work with impure strings

It's easier to declare regex patterns with "impure strings" than with
pure strings. That's the only example I can think of.
e.g. ereg_replace(string: s, pattern: "A(.*)B", replace: "\1");

> I suggest to get rid of impure strings completely and interpret escape
> sequences in string literals.

Too hard for a little gain IMHO.
And do not forget that when Nessus 1.4.x is out, there will be a time
where we'll have to maintain two brands of scripts: some for the old
1.2 parser, and others for the new one. 

I cannot see a painless way to do it. I suppose that this time will
have to be the shortest possible.
But considering the fact that Debian still ships the obsolete 1.0.x
Nessus, I am pessimistic.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.