Cannot create user with whitespace in description, bug in account_manager/posix.rb

2 views
Skip to first unread message

Claus Divossen

unread,
Jan 31, 2010, 1:03:59 PM1/31/10
to AutomateIt
Hello!

I'm playing around with AutomateIT to evaluate its potential, and I
stumbled accross a bug in the part that's responsible for creating a
user with the useradd system command. The description option is not
enclosed in quotes, so any whitespace in it will cause the command to
fail, e.g.:

# ai
=> AutomateIt Shell v0.91104 /usr/bin/ai
=> <CTRL-D> to quit, <Tab> to auto-complete
ai> account_manager.add_user("sample", :description=>"sample user")
** groupadd sample
** useradd -c sample user -m -s /bin/bash -u 1235 -g 1235 sample < /
dev/null
Usage: useradd [options] LOGIN
...

To fix this, line 18 (v0.91104) of lib/automateit/account_manager/
posix.rb has to be modified from
cmd << " -c #{opts[:description] || username}"
to
cmd << " -c '#{opts[:description] || username}'"

Best Regards,
Claus

Reply all
Reply to author
Forward
0 new messages