fixed memory leaks and boolean
This commit is contained in:
parent
5124ff12e9
commit
ad9ce0d2d0
@ -160,7 +160,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case SEND:
|
||||
if (!isLoggedIn) {
|
||||
printf("Please login first.\n");
|
||||
printf("Please login first.\n\n");
|
||||
continue;;
|
||||
}
|
||||
char receiver[BUF], subject[81], message[BUF * 10];
|
||||
@ -180,14 +180,14 @@ int main(int argc, char **argv)
|
||||
snprintf(buffer, sizeof(buffer), "SEND\n%s\n%s\n%s\n%s.\n", loggedInUsername.c_str(), receiver, subject, message);
|
||||
break;
|
||||
case LIST:
|
||||
if (isLoggedIn) {
|
||||
if (!isLoggedIn) {
|
||||
printf("Please login first.\n");
|
||||
continue;
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "LIST\n%s", loggedInUsername.c_str());
|
||||
break;
|
||||
case READ:
|
||||
if (isLoggedIn) {
|
||||
if (!isLoggedIn) {
|
||||
printf("Please login first.\n");
|
||||
continue;
|
||||
}
|
||||
@ -196,7 +196,7 @@ int main(int argc, char **argv)
|
||||
snprintf(buffer, sizeof(buffer), "READ\n%s\n%s", loggedInUsername.c_str(), msgNum);
|
||||
break;
|
||||
case DEL:
|
||||
if (isLoggedIn) {
|
||||
if (!isLoggedIn) {
|
||||
printf("Please login first.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -426,8 +426,7 @@ std::string cmdLOGIN(std::vector<std::string>& received, std::string& loggedInUs
|
||||
BerValue bindCredentials;
|
||||
bindCredentials.bv_val = (char*) ldapBindPassword.c_str();
|
||||
bindCredentials.bv_len = ldapBindPassword.length();
|
||||
BerValue *servercredp;
|
||||
rc = ldap_sasl_bind_s(ldapHandle, ldapBindUser.c_str(), LDAP_SASL_SIMPLE, &bindCredentials, NULL, NULL, &servercredp);
|
||||
rc = ldap_sasl_bind_s(ldapHandle, ldapBindUser.c_str(), LDAP_SASL_SIMPLE, &bindCredentials, NULL, NULL, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
ldap_unbind_ext_s(ldapHandle, NULL, NULL);
|
||||
return "ERR\n";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user