summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2013-06-30 22:55:34 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2013-06-30 22:55:34 +0200
commitada2248de61130b216b0a332f9b19227541befea (patch)
tree3c59e94f3897a1f3cc3a06a6d0f7f6f428d9824e
parentb037a49dd3bd8874c91c437b8acc59b4423f0dcc (diff)
downloadMAC-Telnet-ada2248de61130b216b0a332f9b19227541befea.tar.gz
MAC-Telnet-ada2248de61130b216b0a332f9b19227541befea.zip
Fix some erroneous ifdefs
-rw-r--r--mactelnet.c10
-rw-r--r--mactelnetd.c6
2 files changed, 8 insertions, 8 deletions
diff --git a/mactelnet.c b/mactelnet.c
index 0f86250..4eebc5f 100644
--- a/mactelnet.c
+++ b/mactelnet.c
@@ -35,7 +35,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
-#ifdef __LINUX__
+#ifdef __linux__
#include <linux/if_ether.h>
#include <sys/mman.h>
#endif
@@ -202,7 +202,7 @@ static void send_auth(char *username, char *password) {
int plen;
md5_state_t state;
-#if defined(__LINUX__) && defined(_POSIX_MEMLOCK_RANGE)
+#if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE)
mlock(md5data, sizeof(md5data));
mlock(md5sum, sizeof(md5data));
#endif
@@ -473,7 +473,7 @@ int main (int argc, char **argv) {
case 'p':
/* Save password */
-#if defined(__LINUX__) && defined(_POSIX_MEMLOCK_RANGE)
+#if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE)
mlock(password, sizeof(password));
#endif
strncpy(password, optarg, sizeof(password) - 1);
@@ -637,14 +637,14 @@ int main (int argc, char **argv) {
if (!have_password) {
char *tmp;
tmp = getpass(quiet_mode ? "" : _("Password: "));
-#if defined(__LINUX__) && defined(_POSIX_MEMLOCK_RANGE)
+#if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE)
mlock(password, sizeof(password));
#endif
strncpy(password, tmp, sizeof(password) - 1);
password[sizeof(password) - 1] = '\0';
/* security */
memset(tmp, 0, strlen(tmp));
-#ifdef __LINUX__
+#ifdef __linux__
free(tmp);
#endif
}
diff --git a/mactelnetd.c b/mactelnetd.c
index b90ce2f..c338678 100644
--- a/mactelnetd.c
+++ b/mactelnetd.c
@@ -39,13 +39,13 @@
#include <string.h>
#ifdef __linux__
#include <linux/if_ether.h>
+#include <sys/mman.h>
#else
#include <sys/time.h>
#endif
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/sysinfo.h>
-#include <sys/mman.h>
#include <pwd.h>
#include <utmp.h>
#include <syslog.h>
@@ -386,7 +386,7 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
if ((user = find_user(curconn->username)) != NULL) {
md5_state_t state;
-#ifdef _POSIX_MEMLOCK_RANGE
+#if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE)
mlock(md5data, sizeof(md5data));
mlock(md5sum, sizeof(md5sum));
if (user->password != NULL) {
@@ -598,7 +598,7 @@ static void handle_data_packet(struct mt_connection *curconn, struct mt_mactelne
} else if (cpkt.cptype == MT_CPTYPE_PASSWORD) {
-#ifdef _POSIX_MEMLOCK_RANGE
+#if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE)
mlock(curconn->trypassword, 17);
#endif
memcpy(curconn->trypassword, cpkt.data, 17);