summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/device-functions.c b/device-functions.c
index a9fc638..8e59686 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4546,9 +4546,9 @@ void Main_update_shift_registers()
// reset update sensors
globals.Changes.update_os = 0;
- globals.Changes.update_amp = 0;
- globals.Changes.update_zout = 0;
- globals.Changes.update_load = 0;
+ globals.Changes.update_amp = 0;
+ globals.Changes.update_zout = 0;
+ globals.Changes.update_load = 0;
}
@@ -4577,7 +4577,8 @@ int IO_Setup_RS232(int baud, char hardhand, gboolean update_flash)
// this is a conversation handler for pam, it basically sends the password when pam asks for it
-static int conversation(int num_msg, const struct pam_message **msgs, struct pam_response **resp, void *appdata_ptr) {
+static int conversation(int num_msg, const struct pam_message **msgs, struct pam_response **resp, void *appdata_ptr)
+{
struct pam_response* responses = calloc(num_msg, sizeof(struct pam_response));
if (!responses) {
@@ -4589,14 +4590,15 @@ static int conversation(int num_msg, const struct pam_message **msgs, struct pam
const struct pam_message *msg = msgs[i];
struct pam_response* response = &(responses[i]);
switch (msg->msg_style) {
- case PAM_PROMPT_ECHO_OFF:
- response->resp = strdup((char*) appdata_ptr);
- if (!response->resp)
- return PAM_CONV_ERR;
- break;
-
- default:
+ case PAM_PROMPT_ECHO_OFF:
+ response->resp = strdup((char*) appdata_ptr);
+ if (!response->resp) {
return PAM_CONV_ERR;
+ }
+ break;
+
+ default:
+ return PAM_CONV_ERR;
}
response->resp_retcode = 0;
}
@@ -4606,15 +4608,18 @@ static int conversation(int num_msg, const struct pam_message **msgs, struct pam
return PAM_SUCCESS;
}
-static gboolean checkpassword(const char* username, char* password) {
+static gboolean checkpassword(const char* username, char* password)
+{
struct pam_conv pam_conversation = { conversation, password };
pam_handle_t* pamh;
- if (pam_start("passwd", username, &pam_conversation, &pamh) != PAM_SUCCESS)
+ if (pam_start("passwd", username, &pam_conversation, &pamh) != PAM_SUCCESS) {
return FALSE;
+ }
- if (pam_authenticate(pamh, 0) != PAM_SUCCESS)
+ if (pam_authenticate(pamh, 0) != PAM_SUCCESS) {
return FALSE;
+ }
// we only want to check the password and not actually start a session, so get out of here
@@ -4623,7 +4628,8 @@ static gboolean checkpassword(const char* username, char* password) {
return TRUE;
}
-int change_password(gchar *old_password, gchar *new_password) {
+int change_password(gchar *old_password, gchar *new_password)
+{
gboolean old_valid = TRUE;
@@ -4659,8 +4665,7 @@ int change_password(gchar *old_password, gchar *new_password) {
lu_end(ctx);
return OK;
- }
- else {
+ } else {
return password_change_error;
}
}