1 /* 2 Copyright 2021 Northern.tech AS 3 4 This file is part of CFEngine 3 - written and maintained by Northern.tech AS. 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by the 8 Free Software Foundation; version 3. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18 19 To the extent this program is licensed as part of the Enterprise 20 versions of CFEngine, the applicable Commercial Open Source License 21 (COSL) may apply to this file if you as a licensee so wish it. See 22 included file COSL.txt. 23 */ 24 25 #include <mod_users.h> 26 27 #include <syntax.h> 28 29 static const ConstraintSyntax password_constraints[] = 30 { 31 CONSTRAINT_SYNTAX_GLOBAL, 32 ConstraintSyntaxNewOption("format", "plaintext,hash", "The format of the given password, either plaintext or hash", SYNTAX_STATUS_NORMAL), 33 ConstraintSyntaxNewString("data", "", "Password", SYNTAX_STATUS_NORMAL), 34 ConstraintSyntaxNewNull() 35 }; 36 37 static const BodySyntax password_body = BodySyntaxNew("password", password_constraints, NULL, SYNTAX_STATUS_NORMAL); 38 39 static const ConstraintSyntax users_constraints[] = 40 { 41 ConstraintSyntaxNewOption("policy", "present,absent,locked", "The promised state of a given user", SYNTAX_STATUS_NORMAL), 42 ConstraintSyntaxNewInt("uid", CF_INTRANGE, "User id", SYNTAX_STATUS_NORMAL), 43 ConstraintSyntaxNewBody("password", &password_body, "User password", SYNTAX_STATUS_NORMAL), 44 ConstraintSyntaxNewString("description", "", "User comment", SYNTAX_STATUS_NORMAL), 45 ConstraintSyntaxNewString("group_primary", "", "User primary group", SYNTAX_STATUS_NORMAL), 46 ConstraintSyntaxNewStringList("groups_secondary", ".*", "User additional groups", SYNTAX_STATUS_NORMAL), 47 ConstraintSyntaxNewString("home_dir", CF_ABSPATHRANGE, "User home directory", SYNTAX_STATUS_NORMAL), 48 ConstraintSyntaxNewBundle("home_bundle", "Specify the name of a bundle to run when creating a user", SYNTAX_STATUS_NORMAL), 49 ConstraintSyntaxNewBool("home_bundle_inherit", "If true this causes the home_bundle to inherit the private classes of its parent", SYNTAX_STATUS_NORMAL), 50 ConstraintSyntaxNewString("shell", CF_ABSPATHRANGE, "User shell", SYNTAX_STATUS_NORMAL), 51 ConstraintSyntaxNewNull() 52 }; 53 54 const PromiseTypeSyntax CF_USERS_PROMISE_TYPES[] = 55 { 56 PromiseTypeSyntaxNew("agent", "users", users_constraints, NULL, SYNTAX_STATUS_NORMAL), 57 PromiseTypeSyntaxNewNull() 58 }; 59