Skip to content

Commit

Permalink
console: changed argument name from stdin to std_in to avoid name con…
Browse files Browse the repository at this point in the history
…flicts

- part of pullrequest #123 by peter-kutak
  • Loading branch information
franku committed Oct 30, 2018
1 parent 1bd991e commit 6f456aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions core/src/console/auth_pam.cc
Expand Up @@ -40,10 +40,10 @@ enum class PamAuthState {
};

static PamAuthState state = PamAuthState::INIT;
static bool SetEcho(FILE *stdin, bool on);
static bool SetEcho(FILE *std_in, bool on);


bool ConsolePamAuthenticate(FILE *stdin, BareosSocket *UA_sock)
bool ConsolePamAuthenticate(FILE *std_in, BareosSocket *UA_sock)
{
bool quit = false;
bool error = false;
Expand All @@ -70,7 +70,7 @@ bool ConsolePamAuthenticate(FILE *stdin, BareosSocket *UA_sock)
switch (type) {
case PAM_PROMPT_ECHO_OFF:
case PAM_PROMPT_ECHO_ON:
SetEcho (stdin, type == PAM_PROMPT_ECHO_ON);
SetEcho (std_in, type == PAM_PROMPT_ECHO_ON);
state = PamAuthState::RECEIVE_MSG;
break;
case PAM_SUCCESS:
Expand Down Expand Up @@ -123,27 +123,27 @@ bool ConsolePamAuthenticate(FILE *stdin, BareosSocket *UA_sock)
}
}; /* while (!quit) */

SetEcho (stdin, true);
SetEcho (std_in, true);
ConsoleOutput("\n");

return !error;
}

#include <termios.h>
static bool SetEcho(FILE *stdin, bool on)
static bool SetEcho(FILE *std_in, bool on)
{
struct termios termios_old, termios_new;

/* Turn echoing off and fail if we can’t. */
if (tcgetattr (fileno (stdin), &termios_old) != 0)
if (tcgetattr (fileno (std_in), &termios_old) != 0)
return false;
termios_new = termios_old;
if (on) {
termios_new.c_lflag |= ECHO;
} else {
termios_new.c_lflag &= ~ECHO;
}
if (tcsetattr (fileno (stdin), TCSAFLUSH, &termios_new) != 0)
if (tcsetattr (fileno (std_in), TCSAFLUSH, &termios_new) != 0)
return false;
return true;
}
2 changes: 1 addition & 1 deletion core/src/console/auth_pam.h
Expand Up @@ -27,7 +27,7 @@

class BareosSocket;

bool ConsolePamAuthenticate(FILE *stdin, BareosSocket *UA_sock);
bool ConsolePamAuthenticate(FILE *std_in, BareosSocket *UA_sock);


#endif /* BAREOS_CONSOLE_AUTH_PAM_H_ */

0 comments on commit 6f456aa

Please sign in to comment.