combine 2 if-statements. While here; spacing, spacing, spacing

This commit is contained in:
Björn Ketelaars
2015-09-19 17:54:15 +02:00
parent 7e33e463bb
commit b1de821740

38
fiche.c
View File

@@ -77,25 +77,23 @@ void *thread_connection(void *args)
bzero(buffer, BUFSIZE); bzero(buffer, BUFSIZE);
int status = recv(connection_socket, buffer, BUFSIZE, MSG_DONTWAIT); int status = recv(connection_socket, buffer, BUFSIZE, MSG_DONTWAIT);
if (WHITELIST != NULL) if (WHITELIST != NULL && check_whitelist(data.ip_address) == NULL)
if (check_whitelist(data.ip_address) == NULL) {
{ display_info(data, NULL, "Rejected connection from unknown user.");
display_info(data, NULL, "Rejected connection from unknown user."); save_log(NULL, data.ip_address, data.hostname);
save_log(NULL, data.ip_address, data.hostname); write(connection_socket, "You are not whitelisted!\n", 26);
write(connection_socket, "You are not whitelisted!\n", 26); close(connection_socket);
close(connection_socket); pthread_exit(NULL);
pthread_exit(NULL); }
}
if (BANLIST != NULL) if (BANLIST != NULL && check_banlist(data.ip_address) != NULL)
if (check_banlist(data.ip_address) != NULL) {
{ display_info(data, NULL, "Rejected connection from banned user.");
display_info(data, NULL, "Rejected connection from banned user."); save_log(NULL, data.ip_address, data.hostname);
save_log(NULL, data.ip_address, data.hostname); write(connection_socket, "You are banned!\n", 17);
write(connection_socket, "You are banned!\n", 17); close(connection_socket);
close(connection_socket); pthread_exit(NULL);
pthread_exit(NULL); }
}
if (check_protocol(buffer) == 1) if (check_protocol(buffer) == 1)
status = -1; status = -1;
@@ -345,8 +343,8 @@ void save_to_file(char *slug, char *buffer, struct client_data data)
void change_owner(char *directory) void change_owner(char *directory)
{ {
if ((UID != -1)&&(GID != -1)) if (UID != -1 && GID != -1)
chown(directory, UID, GID); chown(directory, UID, GID);
} }
void set_uid_gid(char *username) void set_uid_gid(char *username)