summaryrefslogtreecommitdiff
path: root/src/authenticate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/authenticate.cc')
-rw-r--r--src/authenticate.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/authenticate.cc b/src/authenticate.cc
index 63a8b3a..7a69388 100644
--- a/src/authenticate.cc
+++ b/src/authenticate.cc
@@ -49,8 +49,8 @@ int Binc::authenticate(Depot &depot,
// check if checkpassword is present
if (access(session.unparsedArgs[0], X_OK) != 0) { // x is enough
- bincError << "unable to start authenticator " << session.unparsedArgs[0] << ": " << strerror(errno)
- << endl;
+ bincError << "unable to start authenticator " << session.unparsedArgs[0] << ": "
+ << strerror(errno) << endl;
return 1;
}
@@ -101,7 +101,8 @@ int Binc::authenticate(Depot &depot,
int result;
int childspid = fork();
if (childspid == -1) {
- bincLog << "bincimap-up: pid " << pid << " failed to start main server: " << strerror(errno) << endl;
+ bincLog << "bincimap-up: pid " << pid
+ << " failed to start main server: " << strerror(errno) << endl;
return 1;
}
@@ -133,8 +134,9 @@ int Binc::authenticate(Depot &depot,
if (session.unparsedArgs[0] != nullptr) {
execvp(session.unparsedArgs[0], &session.unparsedArgs[0]);
- bincDebug << "bincimap-up: pid " << pid << " authenticate(), [auth module] invocation of "
- << session.unparsedArgs[0] << " failed: " << strerror(errno) << endl;
+ bincDebug << "bincimap-up: pid " << pid
+ << " authenticate(), [auth module] invocation of " << session.unparsedArgs[0]
+ << " failed: " << strerror(errno) << endl;
bincDebug.flush();
exit(111);
}
@@ -152,7 +154,8 @@ int Binc::authenticate(Depot &depot,
close(authintercom[0]);
// create the string of data to be passed to the checkpassword stub
- int dataSize = username.length() + password.length() + challenge.length() + timestamp.length();
+ int dataSize = username.length() + password.length() + challenge.length()
+ + timestamp.length();
dataSize += 4;
char *checkpasswordData = new char[dataSize];
char *cpTmp = checkpasswordData;
@@ -225,8 +228,8 @@ int Binc::authenticate(Depot &depot,
}
if (n == 0) {
- bincLog << "bincimap-up: pid " << pid << " server timed out after " << IDLE_TIMEOUT << " seconds"
- << endl;
+ bincLog << "bincimap-up: pid " << pid << " server timed out after " << IDLE_TIMEOUT
+ << " seconds" << endl;
timedout = true;
break;
}
@@ -256,8 +259,8 @@ int Binc::authenticate(Depot &depot,
if (w > 0) Session::getInstance().addReadBytes(w);
if (w < 0) {
- bincDebug << "bincimap-up: pid " << pid << " error writing to server: " << strerror(errno)
- << endl;
+ bincDebug << "bincimap-up: pid " << pid
+ << " error writing to server: " << strerror(errno) << endl;
eof = true;
}
} while (bincClient.canRead());
@@ -271,8 +274,8 @@ int Binc::authenticate(Depot &depot,
eof = true;
break;
} else if (ret == -1) {
- bincDebug << "bincimap-up: pid " << pid << " error reading from server: " << strerror(errno)
- << endl;
+ bincDebug << "bincimap-up: pid " << pid
+ << " error reading from server: " << strerror(errno) << endl;
eof = true;
break;
} else {
@@ -290,8 +293,8 @@ int Binc::authenticate(Depot &depot,
// catch the dead baby
if (waitpid(childspid, &result, 0) != childspid) {
- bincLog << "bincimap-up: pid " << pid << " <" << username
- << "> authentication failed: " << (authenticated ? "server " : session.unparsedArgs[0])
+ bincLog << "bincimap-up: pid " << pid << " <" << username << "> authentication failed: "
+ << (authenticated ? "server " : session.unparsedArgs[0])
<< " waitpid returned unexpected value" << endl;
string tmp = strerror(errno);
@@ -304,9 +307,9 @@ int Binc::authenticate(Depot &depot,
if (disconnected) return 0;
if (WIFSIGNALED(result)) {
- bincLog << "bincimap-up: pid " << pid << " <" << username
- << "> authentication failed: " << (authenticated ? "server" : session.unparsedArgs[0])
- << " died by signal " << WTERMSIG(result) << endl;
+ bincLog << "bincimap-up: pid " << pid << " <" << username << "> authentication failed: "
+ << (authenticated ? "server" : session.unparsedArgs[0]) << " died by signal "
+ << WTERMSIG(result) << endl;
sleep(AUTH_PENALTY);
session.setState(Session::LOGOUT);
return -1;