Sanitation

Whitespace fixes etc
This commit is contained in:
Patrick Van der Veken 2015-08-18 07:46:23 +02:00
parent c927fe8f1f
commit ba260576b5
4 changed files with 50 additions and 50 deletions

View File

@ -73,20 +73,20 @@ if ($options{'help'}) {
# check file parameter
if ($options{'file'}) {
$key_file = $options{'file'};
unless (-f $key_file) {
die "ERROR: input file $key_file not found [$!]";
}
unless (-f $key_file) {
die "ERROR: input file $key_file not found [$!]";
}
} else {
die "ERROR: missing value for --file parameter";
die "ERROR: missing value for --file parameter";
}
# check label parameter
if ($options{'label'}) {
$key_label = $options{'label'};
if (not (defined ($key_label) or $key_label eq "")) {
die "ERROR: key label not defined";
}
if (not (defined ($key_label) or $key_label eq "")) {
die "ERROR: key label not defined";
}
} else {
die "ERROR: missing value for --label parameter";
die "ERROR: missing value for --label parameter";
}
# -----------------------------------------------------------------------------
@ -99,33 +99,33 @@ close (KEY_FILE);
# determine type of key
if (grep { /$key_algo/ } @key_file) {
$key_type = 1;
$key_type = 1;
} else {
$key_type = 2;
$key_type = 2;
}
# process key
SWITCH: {
$key_type == 1 && do {
# 1 line only!!
foreach (@key_file) {
chomp;
($key_algo, $key_line) = split (/ /);
};
last SWITCH;
};
$key_type == 2 && do {
foreach (@key_file) {
chomp;
# skip BEGIN/END lines
next if (/^----/);
# skip Comment field
next if (/^Comment/);
$key_line .= $_;
}
last SWITCH;
};
}
$key_type == 1 && do {
# 1 line only!!
foreach (@key_file) {
chomp;
($key_algo, $key_line) = split (/ /);
};
last SWITCH;
};
$key_type == 2 && do {
foreach (@key_file) {
chomp;
# skip BEGIN/END lines
next if (/^----/);
# skip Comment field
next if (/^Comment/);
$key_line .= $_;
}
last SWITCH;
};
}
# mangle space in label
$key_label =~ tr/ /_/s;
@ -152,7 +152,7 @@ convert_pubkey.pl - converts public keys for SSH controls format (SSH-RSA)
=head1 SYNOPSIS
update_ssh.pl -f|--file=<public_key> -l|--label=<label_name>
[-h|--help]
[-h|--help]
[-V|--version]

View File

@ -810,7 +810,7 @@ do
log "child process ${PID} exited [OK]"
fi
done
# break loop if we no child PIDs left
# break loop if we have no child PIDs left
(($# > 0)) || break
sleep 1 # required to avoid race conditions
done
@ -941,17 +941,17 @@ done
# check for configuration files (local overrides local)
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" || -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
then
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" ]]
then
. "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}"
fi
if [[ -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
then
. "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}"
fi
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" ]]
then
. "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}"
fi
if [[ -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
then
. "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}"
fi
else
print -u2 "ERROR: could not find global or local configuration file"
fi
print -u2 "ERROR: could not find global or local configuration file"
fi
# startup checks
check_params && check_config && check_setup && check_logging
@ -994,7 +994,7 @@ case ${ARG_ACTION} in
# wait until all background processes are completed
wait_for_children ${PIDS} || \
warn "$? background jobs (possibly) failed to complete correctly"
PIDS=''
PIDS=''
# reset max updates in background
COUNT=${MAX_BACKGROUND_PROCS}
fi
@ -1036,7 +1036,7 @@ case ${ARG_ACTION} in
warn "$? background jobs (possibly) failed to complete correctly"
PIDS=''
# reset max updates in background
COUNT=${MAX_BACKGROUND_PROCS}
COUNT=${MAX_BACKGROUND_PROCS}
fi
done
# final wait for background processes to be finished completely

View File

@ -20,4 +20,4 @@ blacklist_file=/etc/kudos/ssh_controls/keys.blacklisted
#******************************************************************************
# End of FILE
#******************************************************************************
#******************************************************************************

View File

@ -545,7 +545,7 @@ unless ($preview) {
last SWITCH_RELEASE;
};
}
}
}
# use fall back in case we cannot determine the version
if (not (defined ($linux_version)) or $linux_version eq "") {
$selinux_context = 'etc_t';
@ -554,10 +554,10 @@ unless ($preview) {
$selinux_context = $selinux_contexts{$linux_version};
}
if ($has_selinux) {
do_log ("INFO: runtime info: OS major version $linux_version, SELinux context $selinux_context on $hostname");
} else {
do_log ("INFO: runtime info: OS major version $linux_version on $hostname");
}
do_log ("INFO: runtime info: OS major version $linux_version, SELinux context $selinux_context on $hostname");
} else {
do_log ("INFO: runtime info: OS major version $linux_version on $hostname");
}
last SWITCH_OS;
};
}