Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #5942: allow comma in GECOS field #602

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions techniques/system/common/1.0/rudder_stdlib.st
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,16 @@ bundle agent rudder_common_reports_generic(technique_name, class_prefix, identif
ifvarclass => "${class_prefix}_error";
}

# Define the content of a specific field
# Text to set must not contain the separator, otherwise it will always define a "repair" state
# see https://dev.cfengine.com/issues/6467
body edit_field rudder_field_set(split,col,newval,separator)
{
field_separator => "${split}";
select_field => "${col}";
value_separator => "${separator}";
field_value => "${newval}";
field_operation => "set";
extend_fields => "true";
allow_blank_fields => "true";
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ bundle edit_line set_user_fullname(user,user_index,fullname)
field_edits:
"${user}:.*"
# Edit GECOS on /etc/passwd
edit_field => col(":", "5", "${fullname}", "set"),
edit_field => rudder_field_set(":", "5", "${fullname}", "#"),
classes => kept_if_else("usermanagement_fullname_edit_${user_index}_kept","usermanagement_fullname_edit_${user_index}_repaired","usermanagement_fullname_edit_${user_index}_error");

}
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bundle edit_line set_user_fullname(user,user_index,fullname)
field_edits:
"${user}:.*"
# Edit GECOS on /etc/passwd
edit_field => col(":", "5", "${fullname}", "set"),
edit_field => rudder_field_set(":", "5", "${fullname}", "#"),
classes => kept_if_else("usermanagement_fullname_edit_${user_index}_kept","usermanagement_fullname_edit_${user_index}_repaired","usermanagement_fullname_edit_${user_index}_error");

}
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ bundle edit_line set_user_fullname(user,user_index,fullname)
field_edits:
"${user}:.*"
# Edit GECOS on /etc/passwd
edit_field => col(":", "5", "${fullname}", "set"),
edit_field => rudder_field_set(":", "5", "${fullname}", "#"),
classes => kept_if_else("usermanagement_fullname_edit_${user_index}_kept","usermanagement_fullname_edit_${user_index}_repaired","usermanagement_fullname_edit_${user_index}_error");

}
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ bundle edit_line set_user_fullname(user,user_index,fullname)
field_edits:
"${user}:.*"
# Edit GECOS on /etc/passwd
edit_field => col(":", "5", "${fullname}", "set"),
edit_field => rudder_field_set(":", "5", "${fullname}", "#"),
classes => kept_if_else("usermanagement_fullname_edit_${user_index}_kept","usermanagement_fullname_edit_${user_index}_repaired","usermanagement_fullname_edit_${user_index}_error");

}
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ bundle edit_line set_user_fullname(user,user_index,fullname)
field_edits:
"${user}:.*"
# Edit GECOS on /etc/passwd
edit_field => col(":", "5", "${fullname}", "set"),
edit_field => rudder_field_set(":", "5", "${fullname}", "#"),
classes => kept_if_else("usermanagement_fullname_edit_${user_index}_kept","usermanagement_fullname_edit_${user_index}_repaired","usermanagement_fullname_edit_${user_index}_error");

}