Stumbling around 'it' in complex relevance

(imported topic written by jeremytoo)

The /etc/security/user file in AIX looks like this:

user:

setting = value

setting = value

user:

setting = value

setting = value

so, for example:

steve:

minage = 0

maxage = 7

login = true

joe:

maxage = 3

minlen = 9

I’m trying to get specific settings for specific users. Unfortunately, this file isn’t XML, and it isn’t in .ini file format, so there don’t appear to be any inspectors that can parse the file for me.

I can put the whole file together with:

concatenation " " of (lines of file “/etc/security/user”)

this gives me a nice big mishmash, and I can check simple settings this way. e.g. Are there any accounts with a minlen of 4 or less? (truth be told, the lines don’t need to be concatenated for this particular check).

I need to check 3 things, however.

I need to return a true if any accounts have a maxage of less than 13 AND do not have login=false and rlogin=false set.

Try as I might, I cannot come up with a way of determining this.

I had thought I could say:

(it as string, following texts of firsts “:” of (it as string) of (concatenation " " of lines of file “/etc/security/user”)) of (preceding texts of firsts “:” of lines of file “/etc/passwd”)

this gives me a display of (based on the file above):

A: steve, minage = 0 maxage = 7 login = true joe: maxage = 3 minlen = 9

A: joe, minage = 0 maxage = 7 login = true joe: maxage = 3 minlen = 9

what I WANT is:

A: steve, minage = 0 maxage = 7 login = true

A: joe, maxage = 3 minlen = 9

(space is irrelevant to me)

I think the second ‘it’ is getting overwritten by the concatenation of lines of file “/etc/security/user” – how do I go about bringing in the same ‘it’ that I had before the comma?

(imported comment written by jeremytoo)

I’ve also tried:

(it as string, following texts of firsts (it as string & “:”) of (concatenation " " of lines of file “/etc/security/user”)) of (preceding texts of firsts “:” of lines of file “/etc/passwd”)

when I use that relevance, I get no output at all, not even an error message.

(imported comment written by NoahSalzman)

I replied in the wrong thread

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=409133

Copying the reply here, where it belongs:

This is definitely a hard bit of Relevance to solve (only looked at it briefly). Are you interested in the academic exercise of figuring out the Relevance or do you just want the problem solved?

If it’s the latter, you should do something like this:

  1. Create an Action that writes out the AIX security information using the lsuser utility

By doing this you use the “most appropriate tool for the job”, why recreate in Relevance what can be done by a purpose-built tool native to AIX

  1. Read in the results of that output with an Analysis (with very simple Relevance)

(imported comment written by MarkA.Stevens)

Hopefully this will get you going. There’s a comment buried in there, so it won’t run exactly as written.

Q: (parenthesized parts 1 of it, "maxage = " parenthesized parts 3 of it) of matches (regex "^(.):.(maxage)\s=\s(\S).

$") of /

change maxage to whatever

/ substrings separated by “!@#$!@#$” of concatenation “!@#$” of lines whose (not (it starts with "

")) of file “/etc/security/user”

A: default, 1

A: root, 1

A: daemon, 1

A: bin, 1

A: sys, 1

A: adm, 1

A: uucp, 1

A: guest, 1

A: nobody, 1

A: lpd, 1

A: invscout, 1

A: snapp, 1

A: ipsec, 1

A: nuucp, 1

A: rcasingh, 1

A: sshd, 1

A: wellison, 1

A: bala, 1

A: iscux08, 1

A: prichman, 1

A: blawlor, 1

A: corblack, 1

A: unixteam, 1

A: mysql, 1

A: gscunix, 1

A: lp, 1

T: 6251

I: ( substring, substring )

I Hope This Helps …Mark A. Stevens