help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RegEx help


From: Atom Powers
Subject: RegEx help
Date: Wed, 23 Nov 2005 10:52:35 -0800

I'm trying to check a user account and send an allert if it's changed.
But I'm having trouble with my RegEx; it's not matching the way it
should.

####
control:
user_httpd = ( ExecResult(/usr/sbin/pw show user httpd) )
classes:
user_httpd_ok = ( RegCmp("httpd:\*:80:80::0:0:World Wide Web
Owner:/nonexistent:/usr/sbin/nologin",${user_httpd}) )
alerts:
!user_httpd_ok::
"httpd user NOT OK: ${user_httpd}"
####

But I can't get it to match unless I pair it all the way down to
####
user_httpd_ok = ( RegCmp("httpd",${user_httpd}) )
####

If I add even one more character (the colon) it won't match anymore.
None of these will match:
"httpd:"
"httpd."
"httpd\:"
"httpd[:]"
"httpd[\:]"
"httpd\W"


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]