summaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd-staticids.bbclass
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2017-04-27 14:41:04 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-29 11:17:22 +0100
commitd4dafce19bd198bde11c567bf3fc4786e5eadf3f (patch)
treee75007454ce67d86582f2a21dba2c1abca8902f5 /meta/classes/useradd-staticids.bbclass
parent7a0e795373653886452a7a2992ced10080711c26 (diff)
downloadpoky-d4dafce19bd198bde11c567bf3fc4786e5eadf3f.tar.gz
useradd-statids.bbclass: Add support for -P / --clear-password option
The commit 31dee7946340bf0f1e94e4e714191d3d6ca3bf6a added a new useradd and groupadd option to specify a clear text password. The parsing logic in the useradd-staticid class did not understand this new option. If the meta-skeleton examples were run with the class enabled an error would be generated, as an example uses the -P option. Note, the code has a check that we do not attempt to set both a crypt and clear text password. It is not allowed that these two options are set at the same time, so we prefer the crypt option if they happen to be. (From OE-Core rev: a1715970d5c454dd24d04972ffb9cf735b5d1338) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/useradd-staticids.bbclass')
-rw-r--r--meta/classes/useradd-staticids.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index c156a12ee5..2d282c0d71 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -77,6 +77,7 @@ def update_useradd_static_config(d):
77 parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False) 77 parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False)
78 parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true") 78 parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true")
79 parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account") 79 parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account")
80 parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new account")
80 parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into") 81 parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into")
81 parser.add_argument("-r", "--system", help="create a system account", action="store_true") 82 parser.add_argument("-r", "--system", help="create a system account", action="store_true")
82 parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account") 83 parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account")
@@ -195,7 +196,10 @@ def update_useradd_static_config(d):
195 newparam += ['', ' --no-create-home'][uaargs.create_home is False] 196 newparam += ['', ' --no-create-home'][uaargs.create_home is False]
196 newparam += ['', ' --no-user-group'][uaargs.user_group is False] 197 newparam += ['', ' --no-user-group'][uaargs.user_group is False]
197 newparam += ['', ' --non-unique'][uaargs.non_unique] 198 newparam += ['', ' --non-unique'][uaargs.non_unique]
198 newparam += ['', ' --password %s' % uaargs.password][uaargs.password != None] 199 if uaargs.password != None:
200 newparam += ['', ' --password %s' % uaargs.password][uaargs.password != None]
201 elif uaargs.clear_password:
202 newparam += ['', ' --clear-password %s' % uaargs.clear_password][uaargs.clear_password != None]
199 newparam += ['', ' --root %s' % uaargs.root][uaargs.root != None] 203 newparam += ['', ' --root %s' % uaargs.root][uaargs.root != None]
200 newparam += ['', ' --system'][uaargs.system] 204 newparam += ['', ' --system'][uaargs.system]
201 newparam += ['', ' --shell %s' % uaargs.shell][uaargs.shell != None] 205 newparam += ['', ' --shell %s' % uaargs.shell][uaargs.shell != None]
@@ -216,6 +220,7 @@ def update_useradd_static_config(d):
216 parser.add_argument("-K", "--key", metavar="KEY=VALUE", help="override /etc/login.defs defaults") 220 parser.add_argument("-K", "--key", metavar="KEY=VALUE", help="override /etc/login.defs defaults")
217 parser.add_argument("-o", "--non-unique", help="allow to create groups with duplicate (non-unique) GID", action="store_true") 221 parser.add_argument("-o", "--non-unique", help="allow to create groups with duplicate (non-unique) GID", action="store_true")
218 parser.add_argument("-p", "--password", metavar="PASSWORD", help="use this encrypted password for the new group") 222 parser.add_argument("-p", "--password", metavar="PASSWORD", help="use this encrypted password for the new group")
223 parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new group")
219 parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into") 224 parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into")
220 parser.add_argument("-r", "--system", help="create a system account", action="store_true") 225 parser.add_argument("-r", "--system", help="create a system account", action="store_true")
221 parser.add_argument("GROUP", help="Group name of the new group") 226 parser.add_argument("GROUP", help="Group name of the new group")
@@ -277,7 +282,10 @@ def update_useradd_static_config(d):
277 newparam += ['', ' --gid %s' % gaargs.gid][gaargs.gid != None] 282 newparam += ['', ' --gid %s' % gaargs.gid][gaargs.gid != None]
278 newparam += ['', ' --key %s' % gaargs.key][gaargs.key != None] 283 newparam += ['', ' --key %s' % gaargs.key][gaargs.key != None]
279 newparam += ['', ' --non-unique'][gaargs.non_unique] 284 newparam += ['', ' --non-unique'][gaargs.non_unique]
280 newparam += ['', ' --password %s' % gaargs.password][gaargs.password != None] 285 if gaargs.password != None:
286 newparam += ['', ' --password %s' % gaargs.password][gaargs.password != None]
287 elif gaargs.clear_password:
288 newparam += ['', ' --clear-password %s' % gaargs.clear_password][gaargs.clear_password != None]
281 newparam += ['', ' --root %s' % gaargs.root][gaargs.root != None] 289 newparam += ['', ' --root %s' % gaargs.root][gaargs.root != None]
282 newparam += ['', ' --system'][gaargs.system] 290 newparam += ['', ' --system'][gaargs.system]
283 newparam += ' %s' % gaargs.GROUP 291 newparam += ' %s' % gaargs.GROUP